1use super::output::OutputFormat;
6use clap::{Args, Parser, Subcommand};
7
8#[derive(Debug, Clone, Copy, PartialEq, Eq, clap::ValueEnum)]
9pub enum RuntimeRoleArg {
10 Worker,
11 Validator,
12}
13
14#[derive(Debug, Clone, Copy, PartialEq, Eq, clap::ValueEnum)]
15pub enum RunModeArg {
16 Manual,
17 Auto,
18}
19
20#[derive(Debug, Clone, Copy, PartialEq, Eq, clap::ValueEnum)]
21pub enum MergeExecuteModeArg {
22 Local,
23 Pr,
24}
25
26#[derive(Parser)]
28#[command(name = "hivemind")]
29#[command(
30 version,
31 about,
32 long_about = "CLI-first orchestration for agentic coding workflows.\n\nStart with: docs/overview/quickstart.md"
33)]
34#[command(propagate_version = true)]
35pub struct Cli {
36 #[arg(long, short = 'f', global = true, default_value = "table")]
38 pub format: OutputFormat,
39
40 #[arg(long, short = 'v', global = true)]
42 pub verbose: bool,
43
44 #[command(subcommand)]
45 pub command: Option<Commands>,
46}
47
48#[derive(Subcommand)]
50pub enum Commands {
51 Version,
53
54 Serve(ServeArgs),
56
57 #[command(subcommand)]
59 Project(ProjectCommands),
60
61 #[command(subcommand)]
63 Global(GlobalCommands),
64
65 #[command(subcommand)]
67 Constitution(ConstitutionCommands),
68
69 #[command(subcommand)]
71 Task(TaskCommands),
72
73 #[command(subcommand)]
75 Graph(GraphCommands),
76
77 #[command(subcommand)]
79 Flow(FlowCommands),
80
81 #[command(subcommand)]
83 Events(EventCommands),
84
85 #[command(subcommand)]
87 Runtime(RuntimeCommands),
88
89 #[command(subcommand)]
91 Verify(VerifyCommands),
92
93 #[command(subcommand)]
95 Merge(MergeCommands),
96
97 #[command(subcommand)]
99 Attempt(AttemptCommands),
100
101 #[command(subcommand)]
103 Checkpoint(CheckpointCommands),
104
105 #[command(subcommand)]
107 Worktree(WorktreeCommands),
108}
109
110#[derive(Subcommand)]
112pub enum ConstitutionCommands {
113 Init(ConstitutionInitArgs),
115 Show(ConstitutionShowArgs),
117 Validate(ConstitutionValidateArgs),
119 Update(ConstitutionUpdateArgs),
121}
122
123#[derive(Args)]
124pub struct ConstitutionInitArgs {
125 pub project: String,
127
128 #[arg(long, conflicts_with = "from_file")]
130 pub content: Option<String>,
131
132 #[arg(long = "from-file", conflicts_with = "content")]
134 pub from_file: Option<String>,
135
136 #[arg(long, default_value_t = false)]
138 pub confirm: bool,
139
140 #[arg(long)]
142 pub actor: Option<String>,
143
144 #[arg(long)]
146 pub intent: Option<String>,
147}
148
149#[derive(Args)]
150pub struct ConstitutionShowArgs {
151 pub project: String,
153}
154
155#[derive(Args)]
156pub struct ConstitutionValidateArgs {
157 pub project: String,
159}
160
161#[derive(Args)]
162pub struct ConstitutionUpdateArgs {
163 pub project: String,
165
166 #[arg(long, conflicts_with = "from_file")]
168 pub content: Option<String>,
169
170 #[arg(long = "from-file", conflicts_with = "content")]
172 pub from_file: Option<String>,
173
174 #[arg(long, default_value_t = false)]
176 pub confirm: bool,
177
178 #[arg(long)]
180 pub actor: Option<String>,
181
182 #[arg(long)]
184 pub intent: Option<String>,
185}
186
187#[derive(Subcommand)]
189pub enum CheckpointCommands {
190 List(CheckpointListArgs),
192 Complete(CheckpointCompleteArgs),
194}
195
196#[derive(Args)]
198pub struct CheckpointListArgs {
199 pub attempt_id: String,
201}
202
203#[derive(Args)]
205pub struct CheckpointCompleteArgs {
206 #[arg(long)]
208 pub attempt_id: Option<String>,
209
210 #[arg(long = "id")]
212 pub checkpoint_id: String,
213
214 #[arg(long)]
216 pub summary: Option<String>,
217}
218
219#[derive(Args)]
220pub struct ServeArgs {
221 #[arg(long, default_value = "127.0.0.1")]
222 pub host: String,
223
224 #[arg(long, default_value_t = 8787)]
225 pub port: u16,
226
227 #[arg(long, default_value_t = 200)]
228 pub events_limit: usize,
229}
230
231#[derive(Subcommand)]
232pub enum WorktreeCommands {
233 List(WorktreeListArgs),
235 Inspect(WorktreeInspectArgs),
237 Cleanup(WorktreeCleanupArgs),
239}
240
241#[derive(Args)]
242pub struct WorktreeListArgs {
243 pub flow_id: String,
245}
246
247#[derive(Args)]
248pub struct WorktreeInspectArgs {
249 pub task_id: String,
251}
252
253#[derive(Args)]
254pub struct WorktreeCleanupArgs {
255 pub flow_id: String,
257 #[arg(long, default_value_t = false)]
259 pub force: bool,
260 #[arg(long, default_value_t = false)]
262 pub dry_run: bool,
263}
264
265#[derive(Subcommand)]
266pub enum GraphCommands {
267 Create(GraphCreateArgs),
269 AddDependency(GraphAddDependencyArgs),
271 AddCheck(GraphAddCheckArgs),
273 Validate(GraphValidateArgs),
275 List(GraphListArgs),
277}
278
279#[derive(Args)]
280pub struct GraphCreateArgs {
281 pub project: String,
283 pub name: String,
285
286 #[arg(long, num_args = 1..)]
288 pub from_tasks: Vec<String>,
289}
290
291#[derive(Args)]
292pub struct GraphAddDependencyArgs {
293 pub graph_id: String,
295 pub from_task: String,
297 pub to_task: String,
299}
300
301#[derive(Args)]
302pub struct GraphAddCheckArgs {
303 pub graph_id: String,
305 pub task_id: String,
307
308 #[arg(long)]
310 pub name: String,
311
312 #[arg(long)]
314 pub command: String,
315
316 #[arg(long, default_value_t = true)]
318 pub required: bool,
319
320 #[arg(long)]
322 pub timeout_ms: Option<u64>,
323}
324
325#[derive(Args)]
326pub struct GraphValidateArgs {
327 pub graph_id: String,
329}
330
331#[derive(Args)]
332pub struct GraphListArgs {
333 #[arg(long)]
335 pub project: Option<String>,
336}
337
338#[derive(Subcommand)]
339pub enum FlowCommands {
340 Create(FlowCreateArgs),
342 List(FlowListArgs),
344 Start(FlowStartArgs),
346 Tick(FlowTickArgs),
348 Pause(FlowPauseArgs),
350 Resume(FlowResumeArgs),
352 Abort(FlowAbortArgs),
354 Restart(FlowRestartArgs),
356 Status(FlowStatusArgs),
358 SetRunMode(FlowSetRunModeArgs),
360 AddDependency(FlowAddDependencyArgs),
362 RuntimeSet(FlowRuntimeSetArgs),
364}
365
366#[derive(Args)]
367pub struct FlowCreateArgs {
368 pub graph_id: String,
370 #[arg(long)]
372 pub name: Option<String>,
373}
374
375#[derive(Args)]
376pub struct FlowListArgs {
377 #[arg(long)]
379 pub project: Option<String>,
380}
381
382#[derive(Args)]
383pub struct FlowStartArgs {
384 pub flow_id: String,
386}
387
388#[derive(Args)]
389pub struct FlowTickArgs {
390 pub flow_id: String,
392
393 #[arg(long)]
395 pub interactive: bool,
396
397 #[arg(long)]
399 pub max_parallel: Option<u16>,
400}
401
402#[derive(Args)]
403pub struct FlowPauseArgs {
404 pub flow_id: String,
406 #[arg(long)]
408 pub wait: bool,
409}
410
411#[derive(Args)]
412pub struct FlowResumeArgs {
413 pub flow_id: String,
415}
416
417#[derive(Args)]
418pub struct FlowAbortArgs {
419 pub flow_id: String,
421 #[arg(long)]
422 pub force: bool,
423 #[arg(long)]
424 pub reason: Option<String>,
425}
426
427#[derive(Args)]
428pub struct FlowRestartArgs {
429 pub flow_id: String,
431 #[arg(long)]
433 pub name: Option<String>,
434 #[arg(long, default_value_t = false)]
436 pub start: bool,
437}
438
439#[derive(Args)]
440pub struct FlowSetRunModeArgs {
441 pub flow_id: String,
443 #[arg(value_enum)]
445 pub mode: RunModeArg,
446}
447
448#[derive(Args)]
449pub struct FlowAddDependencyArgs {
450 pub flow_id: String,
452 pub depends_on_flow_id: String,
454}
455
456#[derive(Args)]
457pub struct FlowRuntimeSetArgs {
458 pub flow_id: String,
460
461 #[arg(long)]
463 pub clear: bool,
464
465 #[arg(long, value_enum, default_value = "worker")]
467 pub role: RuntimeRoleArg,
468
469 #[arg(long, default_value = "opencode")]
471 pub adapter: String,
472
473 #[arg(long, default_value = "opencode")]
475 pub binary_path: String,
476
477 #[arg(long)]
479 pub model: Option<String>,
480
481 #[arg(long = "arg", allow_hyphen_values = true)]
483 pub args: Vec<String>,
484
485 #[arg(long = "env")]
487 pub env: Vec<String>,
488
489 #[arg(long, default_value = "600000")]
491 pub timeout_ms: u64,
492
493 #[arg(long, default_value_t = 1)]
495 pub max_parallel_tasks: u16,
496}
497
498#[derive(Debug, Clone, Copy, PartialEq, Eq, clap::ValueEnum)]
499pub enum TaskRetryMode {
500 Clean,
501 Continue,
502}
503
504#[derive(Args)]
505pub struct TaskRetryArgs {
506 pub task_id: String,
507 #[arg(long)]
508 pub reset_count: bool,
509 #[arg(long, value_enum, default_value_t = TaskRetryMode::Clean)]
510 pub mode: TaskRetryMode,
511}
512
513#[derive(Args)]
514pub struct TaskAbortArgs {
515 pub task_id: String,
517 #[arg(long)]
519 pub reason: Option<String>,
520}
521
522#[derive(Args)]
523pub struct FlowStatusArgs {
524 pub flow_id: String,
526}
527
528#[derive(Subcommand)]
530pub enum ProjectCommands {
531 Create(ProjectCreateArgs),
533
534 List,
536
537 Inspect(ProjectInspectArgs),
539
540 Update(ProjectUpdateArgs),
542
543 RuntimeSet(ProjectRuntimeSetArgs),
545
546 AttachRepo(AttachRepoArgs),
548
549 DetachRepo(DetachRepoArgs),
551
552 #[command(subcommand)]
554 Governance(ProjectGovernanceCommands),
555}
556
557#[derive(Subcommand)]
559pub enum ProjectGovernanceCommands {
560 Init(ProjectGovernanceInitArgs),
562 Migrate(ProjectGovernanceMigrateArgs),
564 Inspect(ProjectGovernanceInspectArgs),
566 #[command(subcommand)]
568 Document(ProjectGovernanceDocumentCommands),
569 #[command(subcommand)]
571 Attachment(ProjectGovernanceAttachmentCommands),
572 #[command(subcommand)]
574 Notepad(ProjectGovernanceNotepadCommands),
575}
576
577#[derive(Subcommand)]
579pub enum GlobalCommands {
580 #[command(subcommand)]
582 Skill(GlobalSkillCommands),
583 #[command(subcommand)]
585 SystemPrompt(GlobalSystemPromptCommands),
586 #[command(subcommand)]
588 Template(GlobalTemplateCommands),
589 #[command(subcommand)]
591 Notepad(GlobalNotepadCommands),
592}
593
594#[derive(Subcommand)]
595pub enum ProjectGovernanceDocumentCommands {
596 Create(ProjectGovernanceDocumentCreateArgs),
598 List(ProjectGovernanceDocumentListArgs),
600 Inspect(ProjectGovernanceDocumentInspectArgs),
602 Update(ProjectGovernanceDocumentUpdateArgs),
604 Delete(ProjectGovernanceDocumentDeleteArgs),
606}
607
608#[derive(Args)]
609pub struct ProjectGovernanceDocumentCreateArgs {
610 pub project: String,
612 pub document_id: String,
614 #[arg(long)]
616 pub title: String,
617 #[arg(long)]
619 pub owner: String,
620 #[arg(long = "tag")]
622 pub tags: Vec<String>,
623 #[arg(long)]
625 pub content: String,
626}
627
628#[derive(Args)]
629pub struct ProjectGovernanceDocumentListArgs {
630 pub project: String,
632}
633
634#[derive(Args)]
635pub struct ProjectGovernanceDocumentInspectArgs {
636 pub project: String,
638 pub document_id: String,
640}
641
642#[derive(Args)]
643pub struct ProjectGovernanceDocumentUpdateArgs {
644 pub project: String,
646 pub document_id: String,
648 #[arg(long)]
650 pub title: Option<String>,
651 #[arg(long)]
653 pub owner: Option<String>,
654 #[arg(long = "tag")]
656 pub tags: Option<Vec<String>>,
657 #[arg(long)]
659 pub content: Option<String>,
660}
661
662#[derive(Args)]
663pub struct ProjectGovernanceDocumentDeleteArgs {
664 pub project: String,
666 pub document_id: String,
668}
669
670#[derive(Subcommand)]
671pub enum ProjectGovernanceAttachmentCommands {
672 Include(ProjectGovernanceAttachmentSetArgs),
674 Exclude(ProjectGovernanceAttachmentSetArgs),
676}
677
678#[derive(Args)]
679pub struct ProjectGovernanceAttachmentSetArgs {
680 pub project: String,
682 pub task_id: String,
684 pub document_id: String,
686}
687
688#[derive(Subcommand)]
689pub enum ProjectGovernanceNotepadCommands {
690 Create(ProjectGovernanceNotepadCreateArgs),
692 Show(ProjectGovernanceNotepadShowArgs),
694 Update(ProjectGovernanceNotepadUpdateArgs),
696 Delete(ProjectGovernanceNotepadDeleteArgs),
698}
699
700#[derive(Args)]
701pub struct ProjectGovernanceNotepadCreateArgs {
702 pub project: String,
704 #[arg(long)]
706 pub content: String,
707}
708
709#[derive(Args)]
710pub struct ProjectGovernanceNotepadShowArgs {
711 pub project: String,
713}
714
715#[derive(Args)]
716pub struct ProjectGovernanceNotepadUpdateArgs {
717 pub project: String,
719 #[arg(long)]
721 pub content: String,
722}
723
724#[derive(Args)]
725pub struct ProjectGovernanceNotepadDeleteArgs {
726 pub project: String,
728}
729
730#[derive(Subcommand)]
731pub enum GlobalSkillCommands {
732 Create(GlobalSkillCreateArgs),
734 List,
736 Inspect(GlobalSkillInspectArgs),
738 Update(GlobalSkillUpdateArgs),
740 Delete(GlobalSkillDeleteArgs),
742}
743
744#[derive(Args)]
745pub struct GlobalSkillCreateArgs {
746 pub skill_id: String,
748 #[arg(long)]
750 pub name: String,
751 #[arg(long)]
753 pub content: String,
754 #[arg(long = "tag")]
756 pub tags: Vec<String>,
757}
758
759#[derive(Args)]
760pub struct GlobalSkillInspectArgs {
761 pub skill_id: String,
763}
764
765#[derive(Args)]
766pub struct GlobalSkillUpdateArgs {
767 pub skill_id: String,
769 #[arg(long)]
771 pub name: Option<String>,
772 #[arg(long)]
774 pub content: Option<String>,
775 #[arg(long = "tag")]
777 pub tags: Option<Vec<String>>,
778}
779
780#[derive(Args)]
781pub struct GlobalSkillDeleteArgs {
782 pub skill_id: String,
784}
785
786#[derive(Subcommand)]
787pub enum GlobalSystemPromptCommands {
788 Create(GlobalSystemPromptCreateArgs),
790 List,
792 Inspect(GlobalSystemPromptInspectArgs),
794 Update(GlobalSystemPromptUpdateArgs),
796 Delete(GlobalSystemPromptDeleteArgs),
798}
799
800#[derive(Args)]
801pub struct GlobalSystemPromptCreateArgs {
802 pub prompt_id: String,
804 #[arg(long)]
806 pub content: String,
807}
808
809#[derive(Args)]
810pub struct GlobalSystemPromptInspectArgs {
811 pub prompt_id: String,
813}
814
815#[derive(Args)]
816pub struct GlobalSystemPromptUpdateArgs {
817 pub prompt_id: String,
819 #[arg(long)]
821 pub content: String,
822}
823
824#[derive(Args)]
825pub struct GlobalSystemPromptDeleteArgs {
826 pub prompt_id: String,
828}
829
830#[derive(Subcommand)]
831pub enum GlobalTemplateCommands {
832 Create(GlobalTemplateCreateArgs),
834 List,
836 Inspect(GlobalTemplateInspectArgs),
838 Update(GlobalTemplateUpdateArgs),
840 Delete(GlobalTemplateDeleteArgs),
842 Instantiate(GlobalTemplateInstantiateArgs),
844}
845
846#[derive(Args)]
847pub struct GlobalTemplateCreateArgs {
848 pub template_id: String,
850 #[arg(long)]
852 pub system_prompt_id: String,
853 #[arg(long = "skill-id")]
855 pub skill_ids: Vec<String>,
856 #[arg(long = "document-id")]
858 pub document_ids: Vec<String>,
859 #[arg(long)]
861 pub description: Option<String>,
862}
863
864#[derive(Args)]
865pub struct GlobalTemplateInspectArgs {
866 pub template_id: String,
868}
869
870#[derive(Args)]
871pub struct GlobalTemplateUpdateArgs {
872 pub template_id: String,
874 #[arg(long)]
876 pub system_prompt_id: Option<String>,
877 #[arg(long = "skill-id")]
879 pub skill_ids: Option<Vec<String>>,
880 #[arg(long = "document-id")]
882 pub document_ids: Option<Vec<String>>,
883 #[arg(long)]
885 pub description: Option<String>,
886}
887
888#[derive(Args)]
889pub struct GlobalTemplateDeleteArgs {
890 pub template_id: String,
892}
893
894#[derive(Args)]
895pub struct GlobalTemplateInstantiateArgs {
896 pub project: String,
898 pub template_id: String,
900}
901
902#[derive(Subcommand)]
903pub enum GlobalNotepadCommands {
904 Create(GlobalNotepadCreateArgs),
906 Show,
908 Update(GlobalNotepadUpdateArgs),
910 Delete,
912}
913
914#[derive(Args)]
915pub struct GlobalNotepadCreateArgs {
916 #[arg(long)]
918 pub content: String,
919}
920
921#[derive(Args)]
922pub struct GlobalNotepadUpdateArgs {
923 #[arg(long)]
925 pub content: String,
926}
927
928#[derive(Args)]
929pub struct ProjectGovernanceInitArgs {
930 pub project: String,
932}
933
934#[derive(Args)]
935pub struct ProjectGovernanceMigrateArgs {
936 pub project: String,
938}
939
940#[derive(Args)]
941pub struct ProjectGovernanceInspectArgs {
942 pub project: String,
944}
945
946#[derive(Args)]
948pub struct ProjectCreateArgs {
949 pub name: String,
951
952 #[arg(long, short = 'd')]
954 pub description: Option<String>,
955}
956
957#[derive(Args)]
958pub struct ProjectRuntimeSetArgs {
959 pub project: String,
961
962 #[arg(long, default_value = "opencode")]
964 pub adapter: String,
965
966 #[arg(long, default_value = "opencode")]
968 pub binary_path: String,
969
970 #[arg(long)]
972 pub model: Option<String>,
973
974 #[arg(long = "arg", allow_hyphen_values = true)]
976 pub args: Vec<String>,
977
978 #[arg(long = "env")]
981 pub env: Vec<String>,
982
983 #[arg(long, default_value = "600000")]
985 pub timeout_ms: u64,
986
987 #[arg(long, default_value_t = 1)]
989 pub max_parallel_tasks: u16,
990
991 #[arg(long, value_enum, default_value = "worker")]
993 pub role: RuntimeRoleArg,
994}
995
996#[derive(Args)]
998pub struct ProjectInspectArgs {
999 pub project: String,
1001}
1002
1003#[derive(Args)]
1005pub struct ProjectUpdateArgs {
1006 pub project: String,
1008
1009 #[arg(long)]
1011 pub name: Option<String>,
1012
1013 #[arg(long, short = 'd')]
1015 pub description: Option<String>,
1016}
1017
1018#[derive(Args)]
1020pub struct AttachRepoArgs {
1021 pub project: String,
1023
1024 pub path: String,
1026
1027 #[arg(long)]
1029 pub name: Option<String>,
1030
1031 #[arg(long, default_value = "rw")]
1033 pub access: String,
1034}
1035
1036#[derive(Args)]
1038pub struct DetachRepoArgs {
1039 pub project: String,
1041
1042 pub repo_name: String,
1044}
1045
1046#[derive(Subcommand)]
1048pub enum TaskCommands {
1049 Create(TaskCreateArgs),
1051
1052 List(TaskListArgs),
1054
1055 Inspect(TaskInspectArgs),
1057
1058 Update(TaskUpdateArgs),
1060
1061 RuntimeSet(TaskRuntimeSetArgs),
1063
1064 Close(TaskCloseArgs),
1066
1067 Start(TaskStartArgs),
1069 Complete(TaskCompleteArgs),
1071
1072 Retry(TaskRetryArgs),
1074 Abort(TaskAbortArgs),
1076 SetRunMode(TaskSetRunModeArgs),
1078}
1079
1080#[derive(Args)]
1081pub struct TaskStartArgs {
1082 pub task_id: String,
1084}
1085
1086#[derive(Args)]
1087pub struct TaskCompleteArgs {
1088 pub task_id: String,
1090}
1091
1092#[derive(Args)]
1094pub struct TaskCreateArgs {
1095 pub project: String,
1097
1098 pub title: String,
1100
1101 #[arg(long, short = 'd')]
1103 pub description: Option<String>,
1104
1105 #[arg(long)]
1108 pub scope: Option<String>,
1109}
1110
1111#[derive(Args)]
1113pub struct TaskListArgs {
1114 pub project: String,
1116
1117 #[arg(long)]
1119 pub state: Option<String>,
1120}
1121
1122#[derive(Args)]
1124pub struct TaskInspectArgs {
1125 pub task_id: String,
1127}
1128
1129#[derive(Args)]
1131pub struct TaskUpdateArgs {
1132 pub task_id: String,
1134
1135 #[arg(long)]
1137 pub title: Option<String>,
1138
1139 #[arg(long, short = 'd')]
1141 pub description: Option<String>,
1142}
1143
1144#[derive(Args)]
1146pub struct TaskRuntimeSetArgs {
1147 pub task_id: String,
1149
1150 #[arg(long)]
1152 pub clear: bool,
1153
1154 #[arg(long, default_value = "opencode")]
1156 pub adapter: String,
1157
1158 #[arg(long, default_value = "opencode")]
1160 pub binary_path: String,
1161
1162 #[arg(long)]
1164 pub model: Option<String>,
1165
1166 #[arg(long = "arg", allow_hyphen_values = true)]
1168 pub args: Vec<String>,
1169
1170 #[arg(long = "env")]
1172 pub env: Vec<String>,
1173
1174 #[arg(long, default_value = "600000")]
1176 pub timeout_ms: u64,
1177
1178 #[arg(long, value_enum, default_value = "worker")]
1180 pub role: RuntimeRoleArg,
1181}
1182
1183#[derive(Args)]
1184pub struct TaskSetRunModeArgs {
1185 pub task_id: String,
1187 #[arg(value_enum)]
1189 pub mode: RunModeArg,
1190}
1191
1192#[derive(Subcommand)]
1194pub enum RuntimeCommands {
1195 List,
1197 Health(RuntimeHealthArgs),
1199 DefaultsSet(RuntimeDefaultsSetArgs),
1201}
1202
1203#[derive(Args)]
1205pub struct RuntimeHealthArgs {
1206 #[arg(long)]
1208 pub project: Option<String>,
1209
1210 #[arg(long)]
1212 pub task: Option<String>,
1213
1214 #[arg(long)]
1216 pub flow: Option<String>,
1217
1218 #[arg(long, value_enum, default_value = "worker")]
1220 pub role: RuntimeRoleArg,
1221}
1222
1223#[derive(Args)]
1224pub struct RuntimeDefaultsSetArgs {
1225 #[arg(long, value_enum, default_value = "worker")]
1227 pub role: RuntimeRoleArg,
1228
1229 #[arg(long, default_value = "opencode")]
1231 pub adapter: String,
1232
1233 #[arg(long, default_value = "opencode")]
1235 pub binary_path: String,
1236
1237 #[arg(long)]
1239 pub model: Option<String>,
1240
1241 #[arg(long = "arg", allow_hyphen_values = true)]
1243 pub args: Vec<String>,
1244
1245 #[arg(long = "env")]
1247 pub env: Vec<String>,
1248
1249 #[arg(long, default_value = "600000")]
1251 pub timeout_ms: u64,
1252
1253 #[arg(long, default_value_t = 1)]
1255 pub max_parallel_tasks: u16,
1256}
1257
1258#[derive(Args)]
1260pub struct TaskCloseArgs {
1261 pub task_id: String,
1263
1264 #[arg(long)]
1266 pub reason: Option<String>,
1267}
1268
1269#[derive(Subcommand)]
1271pub enum EventCommands {
1272 List(EventListArgs),
1274
1275 Inspect(EventInspectArgs),
1277
1278 Stream(EventStreamArgs),
1280
1281 Replay(EventReplayArgs),
1283}
1284
1285#[derive(Args)]
1287pub struct EventListArgs {
1288 #[arg(long)]
1290 pub project: Option<String>,
1291
1292 #[arg(long)]
1294 pub graph: Option<String>,
1295
1296 #[arg(long)]
1298 pub flow: Option<String>,
1299
1300 #[arg(long)]
1302 pub task: Option<String>,
1303
1304 #[arg(long)]
1306 pub attempt: Option<String>,
1307
1308 #[arg(long)]
1310 pub since: Option<String>,
1311
1312 #[arg(long)]
1314 pub until: Option<String>,
1315
1316 #[arg(long, default_value = "50")]
1318 pub limit: usize,
1319}
1320
1321#[derive(Args)]
1323pub struct EventInspectArgs {
1324 pub event_id: String,
1326}
1327
1328#[derive(Args)]
1330pub struct EventStreamArgs {
1331 #[arg(long)]
1333 pub flow: Option<String>,
1334
1335 #[arg(long)]
1337 pub task: Option<String>,
1338
1339 #[arg(long)]
1341 pub project: Option<String>,
1342
1343 #[arg(long)]
1345 pub graph: Option<String>,
1346
1347 #[arg(long)]
1349 pub attempt: Option<String>,
1350
1351 #[arg(long)]
1353 pub since: Option<String>,
1354
1355 #[arg(long)]
1357 pub until: Option<String>,
1358
1359 #[arg(long, default_value = "100")]
1361 pub limit: usize,
1362}
1363
1364#[derive(Args)]
1366pub struct EventReplayArgs {
1367 pub flow_id: String,
1369
1370 #[arg(long)]
1372 pub verify: bool,
1373}
1374
1375#[derive(Subcommand)]
1377pub enum VerifyCommands {
1378 Override(VerifyOverrideArgs),
1380
1381 Run(VerifyRunArgs),
1383
1384 Results(VerifyResultsArgs),
1386}
1387
1388#[derive(Args)]
1390pub struct VerifyOverrideArgs {
1391 pub task_id: String,
1393
1394 pub decision: String,
1396
1397 #[arg(long)]
1399 pub reason: String,
1400}
1401
1402#[derive(Args)]
1403pub struct VerifyRunArgs {
1404 pub task_id: String,
1406}
1407
1408#[derive(Args)]
1409pub struct VerifyResultsArgs {
1410 pub attempt_id: String,
1412
1413 #[arg(long)]
1415 pub output: bool,
1416}
1417
1418#[derive(Subcommand)]
1420pub enum MergeCommands {
1421 #[command(
1422 about = "Prepare a completed flow for integration (sandbox merge)",
1423 long_about = "Prepare a completed flow for merge by building an integration sandbox, applying successful task branches, and running required integration checks before approval."
1424 )]
1425 Prepare(MergePrepareArgs),
1426
1427 #[command(
1428 about = "Approve a prepared merge (explicit human gate)",
1429 long_about = "Record the approving HUMAN user (HIVEMIND_USER or USER), ensure no unresolved conflicts/check failures remain, and emit MergeApproved so execute can proceed."
1430 )]
1431 Approve(MergeApproveArgs),
1432
1433 #[command(
1434 about = "Execute an approved merge (fast-forward target)",
1435 long_about = "Acquire the per-flow integration lock and fast-forward the chosen target branch from integration/<flow>/prepare, then clean up integration/<flow>/prepare, integration/<flow>/<task>, _integration_prepare, and exec branches. Emits MergeCompleted."
1436 )]
1437 Execute(MergeExecuteArgs),
1438}
1439
1440#[derive(Args)]
1442pub struct MergePrepareArgs {
1443 pub flow_id: String,
1445
1446 #[arg(long)]
1448 pub target: Option<String>,
1449}
1450
1451#[derive(Args)]
1453pub struct MergeApproveArgs {
1454 pub flow_id: String,
1456}
1457
1458#[derive(Args)]
1460pub struct MergeExecuteArgs {
1461 pub flow_id: String,
1463
1464 #[arg(long, value_enum, default_value = "local")]
1466 pub mode: MergeExecuteModeArg,
1467
1468 #[arg(long)]
1470 pub monitor_ci: bool,
1471
1472 #[arg(long)]
1474 pub auto_merge: bool,
1475
1476 #[arg(long)]
1478 pub pull_after: bool,
1479}
1480
1481#[derive(Subcommand)]
1483pub enum AttemptCommands {
1484 List(AttemptListArgs),
1486 Inspect(AttemptInspectArgs),
1488}
1489
1490#[derive(Args)]
1492pub struct AttemptListArgs {
1493 #[arg(long)]
1495 pub flow: Option<String>,
1496 #[arg(long)]
1498 pub task: Option<String>,
1499 #[arg(long, default_value = "50")]
1501 pub limit: usize,
1502}
1503
1504#[derive(Args)]
1506pub struct AttemptInspectArgs {
1507 pub attempt_id: String,
1509
1510 #[arg(long)]
1512 pub context: bool,
1513
1514 #[arg(long)]
1516 pub diff: bool,
1517
1518 #[arg(long)]
1520 pub output: bool,
1521}