1#[cfg(feature = "git-overlay")]
5use super::commands_git_projection::SyncCommands;
6
7#[derive(Clone, Debug, clap::Args)]
9#[command(after_help = "\
10Examples:
11 heddle init # initialize here; existing Git becomes Git Overlay
12 heddle init my-project # initialize a native Heddle subdirectory
13 heddle init --principal-name 'Ada Lovelace' --principal-email ada@example.com
14")]
15pub struct InitArgs {
16 pub path: Option<std::path::PathBuf>,
18
19 #[arg(long)]
21 pub principal_name: Option<String>,
22
23 #[arg(long)]
25 pub principal_email: Option<String>,
26
27 #[arg(long)]
29 pub install_harnesses: Option<String>,
30
31 #[arg(long)]
33 pub no_harness_install: bool,
34
35 #[arg(long, visible_alias = "scope", default_value = "repo")]
37 pub harness_install_scope: String,
38
39 #[arg(long)]
41 pub harness_install_force: bool,
42}
43
44#[derive(Clone, Debug, clap::Args)]
46#[command(after_help = "\
47Examples:
48 heddle adopt # adopt all local Git refs into native Heddle storage
49 heddle adopt --ref main # adopt one branch or tag
50 heddle adopt ../repo --ref main --ref v1.0 # adopt selected refs in another repo
51
52Adoption imports Git refs, makes Heddle the source authority, and retains `.git` for explicit Git Projection. Normal Git Overlay setup uses `heddle init` instead.
53")]
54pub struct AdoptArgs {
55 pub path: Option<std::path::PathBuf>,
57
58 #[arg(long = "ref", value_name = "REF")]
60 pub refs: Vec<String>,
61}
62
63#[derive(Clone, Debug, clap::Args)]
70pub struct DoctorArgs {
71 #[arg(long, global = false)]
76 pub profile: bool,
77
78 #[command(subcommand)]
79 pub command: Option<DoctorCommands>,
80}
81
82#[derive(Clone, Debug, clap::Subcommand)]
84pub enum DoctorCommands {
85 Docs(DoctorDocsArgs),
96
97 Schemas(DoctorSchemasArgs),
107}
108
109#[derive(Clone, Debug, clap::Args)]
111pub struct DoctorDocsArgs {
112 #[arg(long, value_name = "PATH")]
117 pub path: Vec<std::path::PathBuf>,
118
119 #[arg(long)]
121 pub all: bool,
122}
123
124#[derive(Clone, Debug, clap::Args)]
126pub struct DoctorSchemasArgs {
127 #[arg(long)]
130 pub update_docs: bool,
131}
132
133fn parse_confidence(s: &str) -> Result<f32, String> {
134 let value = s
135 .parse::<f32>()
136 .map_err(|_| format!("confidence must be a finite number from 0.0 to 1.0, got `{s}`"))?;
137 if !value.is_finite() || !(0.0..=1.0).contains(&value) {
138 return Err(format!(
139 "confidence must be a finite number from 0.0 to 1.0, got `{s}`"
140 ));
141 }
142 Ok(value)
143}
144
145#[derive(Clone, Debug, clap::Args)]
147#[command(after_help = "\
148Examples:
149 heddle capture -m 'add login route' # capture the worktree with intent
150 heddle capture -m 'wip' --confidence 0.6 # honest confidence on a draft step
151
152Agent automation flags (provider/model/session/policy/split) are hidden here.
153Run `heddle help agent-flags`, or `heddle capture --help-agent` to list them inline.
154")]
155pub struct SnapshotArgs {
156 #[arg(long, hide = true)]
166 pub help_agent: bool,
167
168 #[arg(short = 'm', long, visible_alias = "message")]
170 pub intent: Option<String>,
171
172 #[arg(long, value_parser = parse_confidence)]
174 pub confidence: Option<f32>,
175
176 #[arg(short, long)]
178 pub force: bool,
179
180 #[arg(long, hide = true)]
182 pub agent_provider: Option<String>,
183
184 #[arg(long, hide = true)]
186 pub agent_model: Option<String>,
187
188 #[arg(long, hide = true)]
190 pub agent_session: Option<String>,
191
192 #[arg(long, hide = true)]
194 pub agent_segment: Option<String>,
195
196 #[arg(long, hide = true)]
198 pub policy: Option<String>,
199
200 #[arg(long, hide = true)]
202 pub no_policy: bool,
203
204 #[arg(long, hide = true)]
206 pub no_agent: bool,
207
208 #[arg(long, hide = true)]
210 pub split: bool,
211
212 #[arg(long, hide = true, requires = "split")]
214 pub into: Option<String>,
215
216 #[arg(long = "path", hide = true, requires = "split", value_name = "PATH")]
218 pub paths: Vec<String>,
219}
220
221#[derive(Clone, Debug, clap::Args)]
223#[command(after_help = "\
224Examples:
225 heddle capture -m 'add login route'
226 heddle commit
227 heddle commit -m 'add login route'
228
229Behavior:
230 Commits the complete captured tree and replaces the Git index with that tree.
231 Git pre-commit and commit-msg hooks are not run.
232")]
233pub struct CommitArgs {
234 #[arg(short = 'm', long = "message")]
236 pub message: Option<String>,
237}
238
239#[derive(Clone, Debug, clap::Args)]
241#[command(after_help = "\
242Examples:
243 heddle log # walk the current thread
244 heddle log --oneline -n 20 # 20 most recent states in compact form
245 heddle log --timeline # show agent timeline tool-call cursor
246 heddle log --reflog # include re-attributed history
247 heddle log --path src/auth.rs # restrict to states touching a path
248")]
249pub struct LogArgs {
250 pub state: Option<String>,
252
253 #[arg(short = 'n', long, default_value = "20")]
255 pub limit: usize,
256
257 #[arg(long)]
259 pub all: bool,
260
261 #[arg(long)]
263 pub graph: bool,
264
265 #[arg(long)]
267 pub oneline: bool,
268
269 #[arg(long)]
271 pub reflog: bool,
272
273 #[arg(long)]
275 pub timeline: bool,
276
277 #[arg(long, default_value = "main")]
279 pub thread: String,
280
281 #[arg(long)]
283 pub agent: Option<String>,
284
285 #[arg(long = "path", value_name = "PATH")]
287 pub paths: Vec<String>,
288
289 #[arg(long, value_name = "STATE")]
295 pub since: Option<String>,
296}
297
298#[derive(Clone, Debug, clap::Args)]
300pub struct TimelineArgs {
301 #[command(subcommand)]
302 pub command: TimelineCommands,
303}
304
305#[derive(Clone, Debug, clap::Subcommand)]
307pub enum TimelineCommands {
308 Status(TimelineStatusArgs),
310
311 #[command(name = "record-start")]
313 RecordStart(TimelineRecordStartArgs),
314
315 #[command(name = "record-finish")]
317 RecordFinish(TimelineRecordFinishArgs),
318
319 #[command(after_help = "\
321Examples:
322 heddle timeline fork --step tls-abc --branch tlb-experiment
323 heddle timeline fork --tool-call call_123 --session ses_456 --branch tlb-alt
324")]
325 Fork(TimelineForkArgs),
326
327 #[command(after_help = "\
329Examples:
330 heddle timeline reset --step tls-abc
331 heddle timeline reset --tool-call call_123 --materialize
332")]
333 Reset(TimelineResetArgs),
334
335 Recover(TimelineRecoverArgs),
337}
338
339#[derive(Clone, Debug, clap::Args)]
341pub struct TimelineTargetArgs {
342 #[arg(long, default_value = "main")]
344 pub thread: String,
345
346 #[arg(long = "from-branch", value_name = "BRANCH")]
348 pub from_branch: Option<String>,
349
350 #[arg(long, conflicts_with_all = ["tool_call", "undo", "redo", "current"])]
352 pub step: Option<String>,
353
354 #[arg(long = "tool-call", conflicts_with_all = ["step", "undo", "redo", "current"])]
356 pub tool_call: Option<String>,
357
358 #[arg(long, default_value = "opencode")]
360 pub harness: String,
361
362 #[arg(long)]
364 pub session: Option<String>,
365
366 #[arg(long)]
368 pub message: Option<String>,
369
370 #[arg(long, conflicts_with_all = ["step", "tool_call", "redo", "current"])]
372 pub undo: bool,
373
374 #[arg(long, conflicts_with_all = ["step", "tool_call", "undo", "current"])]
376 pub redo: bool,
377
378 #[arg(long, conflicts_with_all = ["step", "tool_call", "undo", "redo"])]
380 pub current: bool,
381}
382
383#[derive(Clone, Debug, clap::Args)]
385pub struct TimelineForkArgs {
386 #[command(flatten)]
387 pub target: TimelineTargetArgs,
388
389 #[arg(long, value_name = "BRANCH")]
391 pub branch: Option<String>,
392
393 #[arg(long, default_value = "explicit-fork")]
395 pub reason: String,
396}
397
398#[derive(Clone, Debug, clap::Args)]
400pub struct TimelineResetArgs {
401 #[command(flatten)]
402 pub target: TimelineTargetArgs,
403
404 #[arg(long)]
406 pub materialize: bool,
407
408 #[arg(long, default_value = "fail-if-dirty")]
410 pub mode: String,
411}
412
413#[derive(Clone, Debug, clap::Args)]
415pub struct TimelineRecoverArgs {
416 #[arg(long, default_value = "main")]
418 pub thread: String,
419}
420
421#[derive(Clone, Debug, clap::Args)]
423pub struct TimelineStatusArgs {
424 #[arg(long, default_value = "main")]
426 pub thread: String,
427}
428
429#[derive(Clone, Debug, clap::Args)]
431pub struct TimelineRecordToolArgs {
432 #[arg(long, default_value = "main")]
434 pub thread: String,
435
436 #[arg(long, default_value = "opencode")]
438 pub harness: String,
439
440 #[arg(long)]
442 pub session: Option<String>,
443
444 #[arg(long)]
446 pub message: Option<String>,
447
448 #[arg(long = "tool-call")]
450 pub tool_call: String,
451
452 #[arg(long = "step-id")]
454 pub step_id: Option<String>,
455
456 #[arg(long = "branch")]
458 pub branch: Option<String>,
459
460 #[arg(long = "summary")]
462 pub summary: Option<String>,
463
464 #[arg(long = "payload-hash")]
466 pub payload_hash: Option<String>,
467}
468
469#[derive(Clone, Debug, clap::Args)]
471pub struct TimelineRecordStartArgs {
472 #[command(flatten)]
473 pub tool: TimelineRecordToolArgs,
474
475 #[arg(long = "tool-name", default_value = "tool")]
477 pub tool_name: String,
478}
479
480#[derive(Clone, Debug, clap::Args)]
482pub struct TimelineRecordFinishArgs {
483 #[command(flatten)]
484 pub tool: TimelineRecordToolArgs,
485
486 #[arg(long, default_value = "succeeded")]
488 pub status: String,
489}
490
491#[derive(Clone, Debug, clap::Args)]
498pub struct RetroArgs {
499 #[arg(long)]
504 pub since: Option<String>,
505
506 #[arg(long)]
509 pub include_merges: bool,
510
511 #[arg(long)]
514 pub include_undos: bool,
515
516 #[arg(long = "full", alias = "expand")]
520 pub full: bool,
521}
522
523#[derive(Clone, Debug, clap::Args)]
525#[command(after_help = "\
526Patch compatibility:
527 --patch output uses Git-compatible unified diff, including extended headers for type and mode changes.
528")]
529pub struct DiffArgs {
530 pub from: Option<String>,
532
533 pub to: Option<String>,
535
536 #[arg(long)]
538 pub semantic: bool,
539
540 #[arg(long)]
542 pub stat: bool,
543
544 #[arg(long)]
546 pub name_only: bool,
547
548 #[arg(short = 'U', long = "unified", default_value_t = 3)]
550 pub unified: usize,
551
552 #[arg(long)]
554 pub context: bool,
555
556 #[arg(short = 'p', long = "patch")]
558 pub patch: bool,
559}
560
561#[derive(Clone, Debug, clap::Args)]
563pub struct RevertArgs {
564 pub state: String,
566
567 #[arg(short = 'm', long)]
569 pub message: Option<String>,
570
571 #[arg(long)]
573 pub no_commit: bool,
574}
575
576#[derive(Clone, Debug, clap::Args)]
578#[command(after_help = "\
579Examples:
580 heddle undo --preview # inspect the most recent operation
581 heddle undo --hard # roll it back and rewind the worktree
582 heddle undo -n 3 --hard # roll back the last three operations
583 heddle undo --recover # restore the state preserved by the last undo
584 heddle undo --list # preview undoable operations on this thread
585 heddle undo --dry-run # show what would change without applying
586
587Undoable operations:
588 - heddle capture (restores HEAD to the pre-capture parent)
589 - heddle land (non-FF) (restores HEAD + both thread refs)
590 - heddle land (FF) (restores HEAD + the landed-into thread ref to
591 the pre-merge tip; the merged-in thread is
592 untouched.)
593 - heddle thread switch (restores HEAD to the previous thread state)
594 - heddle thread create/drop/rename
595 - heddle thread marker create/drop
596 - heddle redact apply (with --allow-redact-undo; removes the
597 redaction record so future materializes
598 restore the original blob bytes. Refused
599 when a Purge has destroyed the bytes.)
600 - heddle undo --redo re-apply the most recently undone operation
601
602Not undoable (file a follow-up if you need one):
603 - heddle push / pull (remote-affecting; out of scope)
604 - heddle redact purge apply (destructive by design; irreversible)
605 - heddle start <name> --path <dir> (refused while the materialized worktree
606 still exists — run `heddle thread drop
607 <name> --delete-thread` first, then
608 re-run `heddle undo`)
609 - cross-worktree shared-backend undo (no worktree registry yet; single-
610 worktree usage is the supported
611 configuration for 0.3)
612")]
613pub struct UndoArgs {
614 #[arg(short = 'n', long, default_value = "1")]
616 pub steps: usize,
617
618 #[arg(long)]
620 pub list: bool,
621
622 #[arg(long, default_value = "20")]
624 pub depth: usize,
625
626 #[arg(long, visible_alias = "dry-run")]
629 pub preview: bool,
630
631 #[arg(long, conflicts_with_all = ["list", "preview", "redo", "recover"])]
635 pub hard: bool,
636
637 #[arg(long, conflicts_with = "list")]
639 pub redo: bool,
640
641 #[arg(
644 long,
645 conflicts_with_all = ["steps", "list", "preview", "hard", "redo", "allow_redact_undo"]
646 )]
647 pub recover: bool,
648
649 #[arg(long)]
657 pub allow_redact_undo: bool,
658}
659
660#[derive(Clone, Copy, Debug, clap::ValueEnum, PartialEq, Eq)]
666pub enum WorkspaceModeArg {
667 Auto,
669 Materialized,
671 Virtualized,
673 Solid,
675}
676
677#[derive(Clone, Debug, clap::Args)]
679#[command(after_help = "\
680Examples:
681 heddle start feature/auth --path ../feature-auth # create an isolated checkout
682 heddle start scratch --path ../scratch # place the checkout explicitly
683 heddle start fix-flake --task 'fix CI flake' # attach a task description
684
685Isolated checkouts are Heddle-managed working directories. They do not contain a .git directory; use Heddle commands inside them, and run Git-authority operations through Heddle from the parent Git-overlay repository.
686
687`heddle start <name> --path <dir>` is the one-step form of the advanced split flow: `heddle thread create <name>` creates the ref now, and `heddle thread promote <name> --path <dir>` materializes it later. Use the split form only when you intentionally need ref-first, checkout-later staging.
688
689Advanced (hidden) flags:
690 --agent-provider/--agent-model (agent attribution for the registered thread), --parent-thread (delegated child work), --print-cd-path (print only the checkout path for shell wrappers), --daemon/--no-daemon (virtualized-mount ownership), --shared-target/--no-shared-target (workspace-shared cargo target dir; default on for Rust solid/materialized). All are accepted here; they stay out of the flag list to keep everyday help terse.
691")]
692pub struct ThreadStartArgs {
693 pub name: String,
695
696 #[arg(long)]
698 pub from: Option<String>,
699
700 #[arg(long)]
702 pub path: Option<std::path::PathBuf>,
703
704 #[arg(long, value_enum, default_value_t = WorkspaceModeArg::Auto)]
706 pub workspace: WorkspaceModeArg,
707
708 #[arg(long, hide = true)]
710 pub agent_provider: Option<String>,
711
712 #[arg(long, hide = true)]
714 pub agent_model: Option<String>,
715
716 #[arg(long)]
718 pub task: Option<String>,
719
720 #[arg(long, hide = true)]
722 pub parent_thread: Option<String>,
723
724 #[arg(long, hide = true)]
726 pub automated: bool,
727
728 #[arg(long, hide = true, conflicts_with_all = ["agent_provider", "agent_model"])]
735 pub print_cd_path: bool,
736
737 #[arg(
744 long,
745 overrides_with = "no_daemon",
746 action = clap::ArgAction::SetTrue,
747 default_value_t = true,
748 hide = true,
749 )]
750 pub daemon: bool,
751
752 #[arg(
758 long,
759 overrides_with = "daemon",
760 action = clap::ArgAction::SetTrue,
761 hide = true,
762 )]
763 pub no_daemon: bool,
764
765 #[arg(long)]
769 pub interactive_setup: bool,
770
771 #[arg(
785 long,
786 overrides_with = "no_shared_target",
787 action = clap::ArgAction::SetTrue,
788 hide = true,
789 )]
790 pub shared_target: bool,
791
792 #[arg(
796 long,
797 overrides_with = "shared_target",
798 action = clap::ArgAction::SetTrue,
799 hide = true,
800 )]
801 pub no_shared_target: bool,
802
803 #[arg(long)]
814 pub hydrate: bool,
815}
816
817#[derive(Clone, Debug, clap::Args)]
825pub struct TryArgs {
826 #[arg(long)]
829 pub name: Option<String>,
830
831 #[arg(long, value_enum, default_value_t = WorkspaceModeArg::Materialized)]
836 pub workspace: WorkspaceModeArg,
837 #[arg(long = "auto-merge")]
840 pub auto_merge: bool,
841
842 #[arg(long = "keep-on-success")]
846 pub keep_on_success: bool,
847
848 #[arg(long)]
851 pub allow_heddle_global_args: bool,
852
853 #[arg(required = true, trailing_var_arg = true, allow_hyphen_values = true)]
856 pub command: Vec<String>,
857}
858
859#[derive(Clone, Debug, clap::Args)]
861pub struct RunArgs {
862 #[arg(long = "thread")]
864 pub thread: Option<String>,
865
866 #[arg(required = true, trailing_var_arg = true, allow_hyphen_values = true)]
868 pub command: Vec<String>,
869}
870
871#[derive(Clone, Debug, clap::Args)]
873pub struct ReadyArgs {
874 #[arg(long = "thread")]
876 pub thread: Option<String>,
877
878 #[arg(short = 'm', long)]
880 pub message: Option<String>,
881
882 #[arg(long, value_parser = parse_confidence)]
884 pub confidence: Option<f32>,
885
886 #[arg(long)]
890 pub dry_run: bool,
891}
892
893#[derive(Clone, Debug, clap::Args)]
895pub struct SyncArgs {
896 #[cfg(feature = "git-overlay")]
898 #[command(subcommand)]
899 pub command: Option<SyncCommands>,
900
901 #[arg(long = "thread")]
903 pub thread: Option<String>,
904}
905
906#[derive(Clone, Debug, clap::Args)]
908pub struct LandArgs {
909 #[arg(long = "thread")]
911 pub thread: Option<String>,
912
913 #[arg(long = "threads", value_delimiter = ',')]
918 pub threads: Vec<String>,
919
920 #[arg(short = 'm', long)]
922 pub message: Option<String>,
923
924 #[arg(long)]
926 pub no_squash: bool,
927
928 #[arg(long)]
932 pub dry_run: bool,
933}
934
935#[derive(Clone, Debug, clap::Args)]
937pub struct ThreadShowArgs {
938 pub thread: Option<String>,
940
941 #[arg(long)]
943 pub watch: bool,
944
945 #[arg(long, hide = true)]
947 pub watch_iterations: Option<usize>,
948
949 #[arg(long, hide = true)]
951 pub watch_interval_ms: Option<u64>,
952}
953
954#[derive(Clone, Debug, clap::Args)]
956pub struct ThreadCapturesArgs {
957 pub thread: Option<String>,
959
960 #[arg(long, default_value_t = 20)]
962 pub limit: usize,
963}
964
965#[derive(Clone, Debug, clap::Args)]
969pub struct ThreadNameArgs {
970 pub thread: Option<String>,
972}
973
974#[derive(Clone, Debug, clap::Args)]
976pub struct ThreadRenameArgs {
977 pub old: String,
979
980 pub new: String,
982}
983
984#[derive(Clone, Debug, clap::Args)]
986pub struct ThreadPromoteArgs {
987 pub thread: String,
989
990 #[arg(long)]
992 pub path: Option<std::path::PathBuf>,
993
994 #[arg(long)]
996 pub force: bool,
997}
998
999#[derive(Clone, Debug, clap::Args)]
1001pub struct ThreadMoveArgs {
1002 pub from: String,
1004
1005 pub to: String,
1007
1008 #[arg(long = "path", required = true, value_name = "PATH")]
1010 pub paths: Vec<String>,
1011
1012 #[arg(short = 'm', long)]
1014 pub message: Option<String>,
1015}
1016
1017#[derive(Clone, Debug, clap::Args)]
1019pub struct ThreadAbsorbArgs {
1020 pub thread: String,
1022
1023 #[arg(long)]
1025 pub into: Option<String>,
1026
1027 #[arg(short = 'm', long)]
1029 pub message: Option<String>,
1030
1031 #[arg(long)]
1033 pub preview: bool,
1034}
1035
1036#[derive(Clone, Debug, clap::Args)]
1038pub struct ThreadResolveArgs {
1039 pub thread: String,
1041}
1042
1043#[derive(Clone, Debug, clap::Args)]
1045pub struct ThreadDropArgs {
1046 pub thread: String,
1048
1049 #[arg(long)]
1051 pub delete_thread: bool,
1052
1053 #[arg(short, long)]
1055 pub force: bool,
1056}
1057
1058#[derive(Clone, Debug, clap::Args)]
1062pub struct ThreadApproveArgs {
1063 pub source: String,
1065
1066 pub target: String,
1068
1069 #[arg(long)]
1071 pub note: Option<String>,
1072
1073 #[arg(long, default_value = "origin")]
1075 pub remote: String,
1076}
1077
1078#[derive(Clone, Debug, clap::Args)]
1081pub struct ThreadApprovalsArgs {
1082 pub source: String,
1083 pub target: String,
1084 #[arg(long, default_value = "origin")]
1085 pub remote: String,
1086}
1087
1088#[derive(Clone, Debug, clap::Args)]
1091pub struct ThreadRevokeApprovalArgs {
1092 pub id: String,
1094 #[arg(long, default_value = "origin")]
1095 pub remote: String,
1096}
1097
1098#[derive(Clone, Debug, clap::Args)]
1101pub struct ThreadCheckMergeArgs {
1102 pub source: String,
1103 pub target: String,
1104
1105 #[arg(long, default_value = "merge")]
1107 pub gated_action: String,
1108
1109 #[arg(long = "path", value_delimiter = ',')]
1112 pub changed_paths: Vec<String>,
1113
1114 #[arg(long, default_value = "origin")]
1115 pub remote: String,
1116}
1117
1118#[derive(Clone, Debug, clap::Args)]
1120pub struct CollapseArgs {
1121 #[arg(required = true)]
1123 pub states: Vec<String>,
1124
1125 #[arg(long)]
1127 pub into: String,
1128
1129 #[arg(long)]
1131 pub confidence: Option<f32>,
1132}
1133
1134#[derive(Clone, Debug, clap::Args)]
1136pub struct ExpandArgs {
1137 pub reference: String,
1139}
1140
1141#[derive(Clone, Debug, clap::Args)]
1143pub struct ResolveArgs {
1144 pub path: Option<String>,
1146
1147 #[arg(long)]
1149 pub all: bool,
1150
1151 #[arg(long)]
1153 pub list: bool,
1154
1155 #[arg(long, conflicts_with = "theirs")]
1157 pub ours: bool,
1158
1159 #[arg(long, conflicts_with = "ours")]
1161 pub theirs: bool,
1162
1163 #[arg(long)]
1165 pub force: bool,
1166
1167 #[arg(long)]
1169 pub abort: bool,
1170}
1171
1172#[derive(Clone, Debug, clap::Args)]
1175pub struct RemoteOperationArgs {
1176 pub remote: Option<String>,
1178
1179 #[arg(short, long)]
1181 pub thread: Option<String>,
1182
1183 #[arg(long)]
1186 pub insecure: bool,
1187}
1188
1189#[derive(Clone, Debug, clap::Args)]
1191#[command(after_help = "\
1192Git Overlay refs:
1193 A normal push writes refs/heads/<thread> and refs/notes/heddle.
1194 --all-threads writes every refs/heads/<thread> and refs/tags/<tag>, plus refs/notes/heddle.
1195 JSON output lists changed refs in refs_written; verify with git ls-remote <remote>.
1196")]
1197pub struct PushArgs {
1198 pub remote: Option<String>,
1200
1201 #[arg(short, long, conflicts_with = "thread_arg")]
1203 pub thread: Option<String>,
1204
1205 #[arg(value_name = "THREAD")]
1207 pub thread_arg: Option<String>,
1208
1209 #[arg(short, long)]
1211 pub state: Option<String>,
1212
1213 #[arg(short, long)]
1215 pub force: bool,
1216
1217 #[arg(long)]
1219 pub all_threads: bool,
1220
1221 #[arg(long)]
1224 pub insecure: bool,
1225
1226 #[arg(long)]
1230 pub dry_run: bool,
1231}
1232
1233impl PushArgs {
1234 pub fn thread_name(&self) -> Option<String> {
1235 self.thread.clone().or_else(|| self.thread_arg.clone())
1236 }
1237}
1238
1239#[derive(Clone, Debug, clap::Args)]
1241#[command(after_help = "\
1242Advanced (hidden) flags:
1243 --lazy leaves blob content absent by design and hydrates it explicitly later. Hosted/network Heddle remotes only.
1244")]
1245pub struct PullArgs {
1246 #[command(flatten)]
1247 pub remote_op: RemoteOperationArgs,
1248
1249 #[arg(short, long)]
1251 pub local_thread: Option<String>,
1252
1253 #[arg(long, hide = true)]
1255 pub lazy: bool,
1256}
1257
1258#[derive(Clone, Debug, clap::Args)]
1266#[command(after_help = "\
1267Behavior:
1268 Clones native Heddle or Git repositories and checks out the selected default branch. Git transport runs through Sley and does not require a Git executable. Never prompts. Full details: `heddle help clone`.
1269
1270Advanced/planned flags: see `heddle help clone`.
1271
1272Examples:
1273 heddle clone ../native-repo ./clone # local native Heddle repository
1274 heddle clone heddle://host/repo ./clone --depth 1 # shallow Heddle clone: tip plus immediate parents
1275")]
1276pub struct CloneArgs {
1277 pub remote: String,
1279
1280 pub local: String,
1282
1283 #[arg(long)]
1285 pub thread: Option<String>,
1286
1287 #[arg(long)]
1289 pub depth: Option<u32>,
1290
1291 #[arg(long, hide = true)]
1295 pub lazy: bool,
1296
1297 #[arg(long)]
1299 pub insecure: bool,
1300
1301 #[arg(long, hide = true, value_name = "SPEC", value_parser = parse_clone_filter_spec)]
1307 pub filter: Option<String>,
1308
1309 #[arg(long, visible_alias = "monorepo")]
1313 pub recursive: bool,
1314}
1315
1316fn parse_clone_filter_spec(s: &str) -> Result<String, String> {
1317 match s {
1318 "blob:none" => Ok(s.to_string()),
1319 other => Err(format!(
1320 "unsupported --filter spec `{other}`; only `blob:none` is supported today"
1321 )),
1322 }
1323}
1324
1325#[derive(Clone, Debug, clap::Args)]
1327pub struct AgentProvenanceBeginArgs {
1328 #[arg(long)]
1330 pub provider: String,
1331
1332 #[arg(long)]
1334 pub model: String,
1335
1336 #[arg(long)]
1338 pub policy: Option<String>,
1339}
1340
1341#[derive(Clone, Debug, clap::Args)]
1343pub struct AgentProvenanceSegmentArgs {
1344 #[arg(long)]
1346 pub provider: String,
1347
1348 #[arg(long)]
1350 pub model: String,
1351
1352 #[arg(long)]
1354 pub policy: Option<String>,
1355}
1356
1357#[derive(Clone, Debug, clap::Args)]
1359pub struct AgentProvenanceEndArgs {
1360 pub session_id: Option<String>,
1362}
1363
1364#[derive(Clone, Debug, clap::Args)]
1366pub struct AgentProvenanceShowArgs {
1367 pub session_id: Option<String>,
1369}
1370
1371#[derive(Clone, Debug, clap::Args)]
1373pub struct AgentProvenanceListArgs {
1374 #[arg(long)]
1376 pub active: bool,
1377}
1378
1379#[derive(Clone, Debug, clap::Args)]
1381pub struct WorktreeAddArgs {
1382 pub path: std::path::PathBuf,
1384
1385 #[arg(long)]
1387 pub thread: Option<String>,
1388
1389 #[arg(long)]
1391 pub from: Option<String>,
1392}
1393
1394#[derive(Clone, Debug, clap::Args)]
1396pub struct WorktreeRemoveArgs {
1397 pub path: std::path::PathBuf,
1399
1400 #[arg(long)]
1402 pub delete_thread: bool,
1403}
1404
1405#[derive(Clone, Debug, clap::Args)]
1407pub struct AgentPresenceListArgs {
1408 #[arg(long)]
1410 pub active: bool,
1411}
1412
1413#[derive(Clone, Debug, clap::Args)]
1415pub struct AgentPresenceShowArgs {
1416 pub session: Option<String>,
1418}
1419
1420#[derive(Clone, Debug, clap::Args)]
1422pub struct AgentPresenceExplainArgs {
1423 pub session: Option<String>,
1425}
1426
1427#[derive(Clone, Debug, clap::Args)]
1429pub struct AgentPresenceCompleteArgs {
1430 #[arg(long)]
1432 pub session: Option<String>,
1433}
1434
1435#[derive(Clone, Debug, clap::Args)]
1437pub struct AgentReserveArgs {
1438 #[arg(long)]
1440 pub thread: String,
1441
1442 #[arg(long)]
1444 pub anchor: Option<String>,
1445
1446 #[arg(long)]
1448 pub task: Option<String>,
1449
1450 #[arg(long)]
1452 pub task_id: Option<String>,
1453
1454 #[arg(long, value_name = "PID")]
1456 pub hold_for_pid: Option<u32>,
1457}
1458
1459#[derive(Clone, Debug, clap::Args)]
1461pub struct AgentHeartbeatArgs {
1462 #[arg(long)]
1464 pub lease: String,
1465
1466 #[arg(long, env = "HEDDLE_RESERVATION_TOKEN", hide_env_values = true)]
1468 pub token: String,
1469}
1470
1471#[derive(Clone, Debug, clap::Args)]
1473pub struct AgentReleaseArgs {
1474 #[arg(long)]
1476 pub lease: String,
1477
1478 #[arg(long, env = "HEDDLE_RESERVATION_TOKEN", hide_env_values = true)]
1480 pub token: String,
1481
1482 #[arg(long, default_value = "complete")]
1484 pub status: AgentReleaseStatusArg,
1485}
1486
1487#[derive(Clone, Debug, clap::ValueEnum)]
1488pub enum AgentReleaseStatusArg {
1489 Complete,
1490 Abandoned,
1491}
1492
1493#[derive(Clone, Debug, clap::Args)]
1495pub struct AgentApiListArgs {
1496 #[arg(long)]
1498 pub thread: Option<String>,
1499
1500 #[arg(long)]
1502 pub alive_only: bool,
1503}
1504
1505#[derive(Clone, Debug, clap::ValueEnum)]
1506pub enum AgentTaskStatusArg {
1507 Open,
1508 InProgress,
1509 Blocked,
1510 Complete,
1511 Abandoned,
1512}
1513
1514#[derive(Clone, Debug, clap::Args)]
1516pub struct AgentTaskCreateArgs {
1517 #[arg(long)]
1519 pub task_id: Option<String>,
1520
1521 #[arg(long)]
1523 pub title: String,
1524
1525 #[arg(long)]
1527 pub body: Option<String>,
1528
1529 #[arg(long)]
1531 pub thread: String,
1532
1533 #[arg(long)]
1535 pub base_state: Option<String>,
1536
1537 #[arg(long)]
1539 pub base_root: Option<String>,
1540
1541 #[arg(long)]
1543 pub parent_task_id: Option<String>,
1544
1545 #[arg(long)]
1547 pub coordination_discussion_id: Option<String>,
1548
1549 #[arg(long)]
1551 pub allow_offline: bool,
1552
1553 #[arg(long)]
1555 pub delegated_by: Option<String>,
1556}
1557
1558#[derive(Clone, Debug, clap::Args)]
1560pub struct AgentTaskListArgs {
1561 #[arg(long)]
1563 pub thread: Option<String>,
1564
1565 #[arg(long)]
1567 pub status: Option<AgentTaskStatusArg>,
1568}
1569
1570#[derive(Clone, Debug, clap::Args)]
1572pub struct AgentTaskShowArgs {
1573 pub task_id: String,
1575}
1576
1577#[derive(Clone, Debug, clap::Args)]
1579pub struct AgentTaskUpdateArgs {
1580 pub task_id: String,
1582
1583 #[arg(long)]
1585 pub title: Option<String>,
1586
1587 #[arg(long)]
1589 pub body: Option<String>,
1590
1591 #[arg(long)]
1593 pub status: Option<AgentTaskStatusArg>,
1594
1595 #[arg(long)]
1597 pub thread: Option<String>,
1598
1599 #[arg(long)]
1601 pub base_state: Option<String>,
1602
1603 #[arg(long)]
1605 pub base_root: Option<String>,
1606
1607 #[arg(long)]
1609 pub parent_task_id: Option<String>,
1610
1611 #[arg(long)]
1613 pub coordination_discussion_id: Option<String>,
1614
1615 #[arg(long, conflicts_with = "no_allow_offline")]
1617 pub allow_offline: bool,
1618
1619 #[arg(long, conflicts_with = "allow_offline")]
1621 pub no_allow_offline: bool,
1622
1623 #[arg(long)]
1625 pub delegated_by: Option<String>,
1626}
1627
1628#[derive(Clone, Debug, clap::Args)]
1630pub struct AgentFanoutPlanArgs {
1631 #[arg(long)]
1633 pub title: String,
1634
1635 #[arg(long, value_name = "THREAD=PATH:TITLE")]
1637 pub lane: Vec<String>,
1638
1639 #[arg(long)]
1641 pub coordination_discussion_id: Option<String>,
1642}
1643
1644#[derive(Clone, Debug, clap::Args)]
1646pub struct AgentFanoutStartArgs {
1647 #[arg(long)]
1649 pub title: String,
1650
1651 #[arg(long, value_name = "THREAD=PATH:TITLE")]
1653 pub lane: Vec<String>,
1654
1655 #[arg(long)]
1657 pub coordination_discussion_id: Option<String>,
1658}
1659
1660#[derive(Clone, Debug, clap::Args)]
1662pub struct AgentCaptureArgs {
1663 #[arg(long)]
1665 pub lease: String,
1666
1667 #[arg(long, env = "HEDDLE_RESERVATION_TOKEN", hide_env_values = true)]
1669 pub token: String,
1670
1671 #[arg(long, short = 'm', alias = "intent")]
1673 pub message: Option<String>,
1674
1675 #[arg(long, value_parser = parse_confidence)]
1677 pub confidence: Option<f32>,
1678}
1679
1680#[derive(Clone, Debug, clap::Args)]
1682pub struct AgentReadyArgs {
1683 #[arg(long)]
1685 pub lease: String,
1686
1687 #[arg(long, env = "HEDDLE_RESERVATION_TOKEN", hide_env_values = true)]
1689 pub token: String,
1690
1691 #[arg(long, short = 'm')]
1693 pub message: Option<String>,
1694
1695 #[arg(long, value_parser = parse_confidence)]
1697 pub confidence: Option<f32>,
1698}
1699
1700#[derive(Clone, Debug, clap::Args)]
1708pub struct WatchArgs {
1709 #[arg(long, value_name = "DURATION")]
1713 pub since: Option<String>,
1714
1715 #[arg(long, value_name = "KINDS")]
1719 pub filter: Option<String>,
1720
1721 #[arg(long, hide = true)]
1724 pub max_iterations: Option<usize>,
1725
1726 #[arg(long, hide = true)]
1729 pub poll_interval_ms: Option<u64>,
1730}
1731
1732#[cfg(test)]
1738mod capture_message_alias_tests {
1739 use clap::Parser;
1740
1741 use crate::cli::{Cli, Commands, SnapshotArgs};
1742
1743 fn parse_capture(extra: &[&str]) -> Result<SnapshotArgs, clap::Error> {
1744 let mut argv: Vec<&str> = vec!["heddle", "capture"];
1745 argv.extend_from_slice(extra);
1746 let cli = Cli::try_parse_from(argv)?;
1747 match cli.command {
1748 Commands::Capture(args) => Ok(args),
1749 _ => panic!("expected Commands::Capture"),
1750 }
1751 }
1752
1753 #[test]
1754 fn capture_accepts_message_alias() {
1755 let args = parse_capture(&["--message", "my change"]).expect("--message should parse");
1756 assert_eq!(args.intent.as_deref(), Some("my change"));
1757 }
1758
1759 #[test]
1760 fn capture_accepts_intent_long_form() {
1761 let args = parse_capture(&["--intent", "my change"]).expect("--intent should parse");
1762 assert_eq!(args.intent.as_deref(), Some("my change"));
1763 }
1764
1765 #[test]
1766 fn capture_accepts_short_m() {
1767 let args = parse_capture(&["-m", "my change"]).expect("-m should parse");
1768 assert_eq!(args.intent.as_deref(), Some("my change"));
1769 }
1770
1771 #[test]
1772 fn capture_rejects_non_finite_or_out_of_range_confidence() {
1773 for value in ["NaN", "inf", "-0.1", "1.7"] {
1774 let confidence_arg = format!("--confidence={value}");
1775 let err = parse_capture(&["-m", "bad confidence", &confidence_arg])
1776 .expect_err("invalid confidence should fail to parse");
1777 assert!(
1778 err.to_string()
1779 .contains("confidence must be a finite number from 0.0 to 1.0"),
1780 "unexpected parse error for {value}: {err}"
1781 );
1782 }
1783 }
1784}
1785
1786#[cfg(test)]
1787mod clone_filter_tests {
1788 use clap::Parser;
1789
1790 use crate::cli::{Cli, CloneArgs, Commands};
1791
1792 fn parse_clone(extra: &[&str]) -> Result<CloneArgs, clap::Error> {
1793 let mut argv: Vec<&str> = vec!["heddle", "clone", "remote", "local"];
1794 argv.extend_from_slice(extra);
1795 let cli = Cli::try_parse_from(argv)?;
1796 match cli.command {
1797 Commands::Clone(args) => Ok(args),
1798 _ => panic!("expected Commands::Clone"),
1799 }
1800 }
1801
1802 #[test]
1803 fn parses_clone_filter_blob_none() {
1804 let args = parse_clone(&["--filter", "blob:none"]).expect("parse --filter blob:none");
1805 assert_eq!(args.filter.as_deref(), Some("blob:none"));
1806 assert!(!args.lazy);
1807 }
1808
1809 #[test]
1810 fn rejects_unknown_filter_spec() {
1811 let err = parse_clone(&["--filter", "tree:0"])
1812 .expect_err("unknown --filter spec should fail to parse");
1813 let msg = err.to_string();
1814 assert!(
1815 msg.contains("tree:0") && msg.contains("blob:none"),
1816 "error should name the bad spec and the supported one: {msg}"
1817 );
1818 }
1819}