Skip to main content

cli/cli/cli_args/
commands_main.rs

1// SPDX-License-Identifier: Apache-2.0
2//! Top-level CLI commands.
3
4use clap::Subcommand;
5
6#[cfg(feature = "git-overlay")]
7use super::BridgeCommands;
8#[cfg(feature = "semantic")]
9use super::SemanticCommands;
10use super::{
11    AgentCommands, CheckpointArgs, CompletionSubject, ContextCommands, DiscussCommands,
12    HookCommands, IntegrationCommands, OplogCommands, QueryArgs, RedactCommands, RemoteCommands,
13    ReviewCommands, ShellCommands, StashCommands, ThreadCommands, TransactionCommands,
14    VisibilityCommands,
15    commands_args::{
16        ActorDoneArgs, ActorExplainArgs, ActorListArgs, ActorShowArgs, ActorSpawnArgs, AdoptArgs,
17        CloneArgs, CollapseArgs, CommitArgs, DiffArgs, DoctorArgs, ExpandArgs, InitArgs, LandArgs,
18        LogArgs, MergeArgs, PullArgs, PushArgs, ReadyArgs, ResolveArgs, RetroArgs, RevertArgs,
19        RunArgs, SessionEndArgs, SessionListArgs, SessionSegmentArgs, SessionShowArgs,
20        SessionStartArgs, SnapshotArgs, SwitchArgs, SyncArgs, ThreadStartArgs, TimelineArgs,
21        TryArgs, UndoArgs, WatchArgs,
22    },
23};
24#[cfg(feature = "client")]
25use super::{AuthCommands, SupportCommands};
26
27#[derive(Subcommand)]
28pub enum Commands {
29    /// Initialize a new Heddle repository.
30    Init(InitArgs),
31
32    /// Adopt the current Git repository into Heddle.
33    ///
34    /// Initializes Heddle sidecar data if needed and imports Git history
35    /// without modifying existing Git worktree changes. Use `--ref` to
36    /// adopt selected branches or tags; omit it to import all local refs.
37    #[command(visible_alias = "import")]
38    Adopt(AdoptArgs),
39
40    /// Curated, progressive-disclosure help.
41    ///
42    /// `heddle help` prints the curated everyday verbs and points at
43    /// `heddle help advanced` for everything else. `heddle help
44    /// <topic>` prints the topic page (e.g. `daemon`, `signals`,
45    /// `bridge`). `heddle help <command path>` falls through to that
46    /// command's `--help` so the printer never duplicates clap's
47    /// per-verb derivation.
48    Help {
49        /// Topic name (`advanced`, `daemon`, `signals`, …) or command
50        /// path. When omitted, prints the curated default.
51        #[arg(value_name = "TOPIC_OR_COMMAND")]
52        topics: Vec<String>,
53    },
54
55    /// Show what needs attention and the next safe Heddle action.
56    #[command(after_help = "\
57Examples:
58  heddle status               # current thread, dirty paths, recommended next step
59  heddle status --short       # one-line summary for shell prompts
60  heddle status --watch       # live dashboard that refreshes in place
61")]
62    Status {
63        /// Short format.
64        #[arg(short, long)]
65        short: bool,
66
67        /// Continuously refresh status.
68        #[arg(long)]
69        watch: bool,
70
71        /// Internal helper for tests: stop after N watch updates.
72        #[arg(long, hide = true)]
73        watch_iterations: Option<usize>,
74
75        /// Internal helper for tests: polling interval in milliseconds.
76        #[arg(long, hide = true)]
77        watch_interval_ms: Option<u64>,
78    },
79
80    /// Stream live oplog activity.
81    ///
82    /// Tails the repository's append-only oplog file like `tail -f`,
83    /// emitting snapshots, merges, and thread events as they happen.
84    /// Exits on Ctrl-C.
85    Watch(WatchArgs),
86
87    /// Verify this workspace; exits nonzero until every check is clean.
88    #[command(after_help = "\
89Checks: Git mapping, worktree, remote, operation, clone verification, machine contract.
90
91Examples:
92  heddle verify                # strict verification gate and next recovery step
93  heddle verify --verbose      # full proof rows and machine-contract details
94  heddle verify --output json  # proof JSON when clean; error envelope when blocked
95")]
96    Verify,
97
98    /// Explain repository health, or run targeted doctor checks.
99    ///
100    /// `heddle doctor` (no subcommand) reports repository health and
101    /// the next recovery step. `heddle doctor docs` diff-checks markdown
102    /// documentation against
103    /// the actual CLI surface and exits non-zero on drift — wire it
104    /// into CI to stop docs from going stale.
105    Doctor(DoctorArgs),
106
107    /// Show the low-friction Git-overlay workflow.
108    #[cfg(feature = "git-overlay")]
109    GitOverlay,
110
111    /// Print the JSON Schema for a `--output json`-emitting verb.
112    ///
113    /// Contract-table introspection over CLI output shapes —
114    /// useful when wiring tools that consume `heddle <verb>
115    /// --output json` and want to validate or generate types. The schemas
116    /// live in `crates/cli/src/cli/commands/schemas.rs`; the
117    /// command contract table registers available and documented
118    /// schema verbs for `heddle doctor schemas` drift detection
119    /// against `docs/json-schemas.md`.
120    ///
121    /// With no `<verb>`, prints the registered schema verbs. `<verb>`
122    /// is the joined subcommand path — e.g. `status`, `log`, `bridge
123    /// git status`, `marker list`.
124    #[command(visible_alias = "schema")]
125    Schemas {
126        /// The verb whose schema to emit. Run `heddle schemas --help`
127        /// or look at `docs/json-schemas.md` for the registered list.
128        ///
129        /// `trailing_var_arg = true` lets the verb spec carry literal
130        /// `--flag` tokens (e.g. `heddle schemas log --reflog`,
131        /// `heddle schemas marker delete --prefix`) without clap
132        /// parsing them as options on `schemas` itself.
133        #[arg(trailing_var_arg = true, allow_hyphen_values = true)]
134        verb: Vec<String>,
135    },
136
137    /// Create or resume an isolated thread for focused work.
138    Start(ThreadStartArgs),
139
140    /// Run a command in a sandboxed ephemeral thread.
141    ///
142    /// Heddle creates a fresh thread with an isolated checkout, runs
143    /// `<cmd>` inside it, and then either captures the result on a
144    /// zero exit or drops the thread on a non-zero exit. The parent
145    /// thread's working tree is never touched — the ephemeral thread
146    /// is the sandbox. Implements item 3.1 from the heddle 6→8 plan.
147    ///
148    /// `try` is the **new-sandbox** sibling to `run`. Reach for `run`
149    /// when you already have a thread and just want to exec a command
150    /// inside its checkout (no thread creation, no capture, no
151    /// rollback).
152    Try(TryArgs),
153
154    /// Automation/workflow command: run a command inside an existing
155    /// thread's execution root.
156    ///
157    /// `run` is the **existing-thread** sibling to `try`. It looks up
158    /// the named (or current) thread, sets the child's cwd to that
159    /// thread's checkout, exports `HEDDLE_THREAD_*`, and runs `<cmd>`.
160    /// It does NOT create a thread, capture
161    /// state on success, or roll back on failure — those are `try`'s
162    /// job. Reach for `try` when you want the sandbox lifecycle; reach
163    /// for `run` when you already have a thread and just need to exec
164    /// inside it.
165    Run(RunArgs),
166
167    /// Automation/workflow command: refresh the current thread onto its target when safe.
168    Sync(SyncArgs),
169
170    /// Continue the active operation without remembering the specific subcommand.
171    Continue,
172
173    /// Abort the active operation without remembering the specific subcommand.
174    Abort,
175
176    /// Land a ready thread and optionally publish it.
177    ///
178    /// `land` is the local integration verb: capture outstanding work if needed,
179    /// refresh against the target when safe, land the thread, write the
180    /// Git checkpoint, and optionally push. It fails closed when
181    /// conflicts or other blockers exist. Pair it with `ready` when you
182    /// want the verdict and next action before landing anything.
183    Land(LandArgs),
184
185    /// Prepare this thread for review or merge.
186    ///
187    /// `ready` captures outstanding work if needed, checks conflicts,
188    /// blockers, freshness, and semantic risk, then marks the thread
189    /// ready or blocked and prints the next action. It never lands,
190    /// checkpoints, or pushes; use it when you want Heddle's verdict
191    /// before integrating the work.
192    Ready(ReadyArgs),
193
194    /// Capture a recoverable Heddle step for undo, provenance, and review.
195    Capture(SnapshotArgs),
196
197    /// Save current work as one Heddle change, plus a Git checkpoint in Git-overlay repos.
198    Commit(CommitArgs),
199
200    /// Commit the current captured work to the Git-overlay branch/index.
201    Checkpoint(CheckpointArgs),
202
203    /// Show state history.
204    ///
205    /// By default, when a thread name is given (e.g. `heddle log master`),
206    /// the walk is *first-parent only* — equivalent to `git log
207    /// --first-parent <branch>`. To see every ancestor reachable through
208    /// merge commits, pass `--graph` (which renders the full DAG) or
209    /// `--all` (which lists every state regardless of ancestry).
210    #[command(visible_alias = "history")]
211    Log(LogArgs),
212
213    /// Navigate, fork, reset, and recover agent tool-call timelines.
214    #[command(after_help = "\
215Examples:
216  heddle log --timeline
217  heddle timeline fork --tool-call call_123 --branch tlb-alt
218  heddle timeline reset --step tls-abc --materialize
219  heddle timeline recover
220")]
221    Timeline(TimelineArgs),
222
223    /// Show state details.
224    Show {
225        /// State by change ID or hash prefix. Defaults to HEAD when omitted.
226        state: Option<String>,
227    },
228
229    /// Summarize a working session.
230    ///
231    /// Combines oplog, agent registry, marker, and context-annotation
232    /// reads into one structured payload — agent-readable retro of
233    /// captures, signals, and notable events since `--since`. Replaces
234    /// the reconstruct-from-`heddle log` boilerplate.
235    Retro(RetroArgs),
236
237    /// Remove untracked files from worktree.
238    Clean {
239        /// Actually remove files (required for safety).
240        #[arg(short, long)]
241        force: bool,
242
243        /// Only show what would be removed.
244        #[arg(long)]
245        dry_run: bool,
246    },
247
248    /// Show what changed in the worktree, a thread, or two states.
249    Diff(DiffArgs),
250
251    /// Git-compatible alias for `heddle thread switch`.
252    Switch(SwitchArgs),
253
254    /// Open or resolve discussions anchored to symbols.
255    ///
256    /// Open a discussion against a symbol; append turns;
257    /// resolve into an annotation, by edit, or dismissed. Anchors
258    /// travel across renames and cross-file moves on subsequent
259    /// state mutations.
260    #[command(after_help = "\
261Examples:
262  heddle discuss open src/auth.rs verify 'Should this reject expired tokens?'  # anchor a discussion
263  heddle discuss append <id> 'switched to argon2'          # add a turn
264  heddle discuss resolve <id> --mode into-annotation --annotation-kind rationale --annotation-content 'Kept for compatibility'
265")]
266    Discuss {
267        #[command(subcommand)]
268        command: DiscussCommands,
269    },
270
271    /// Structured query over the operation log. Filter by
272    /// actor, time window, signal kind, symbol, thread, verbs. Returns
273    /// structured results consumable by agents.
274    Query(QueryArgs),
275
276    /// Transactional multi-step edits. Begin, commit, abort,
277    /// status. Operations within don't produce intermediate states.
278    ///
279    /// Hidden in alpha: buffered-op replay at commit and rewind-on-abort
280    /// are still follow-on work; the verb stays available for testing
281    /// but is not advertised in `heddle help advanced`.
282    #[command(hide = true)]
283    Transaction {
284        #[command(subcommand)]
285        command: TransactionCommands,
286    },
287
288    /// Review a state — render the payload, sign, see signal health.
289    ///
290    /// `heddle review show` renders the review payload (summary,
291    /// agent narrative, in-budget signals, anchored discussions).
292    /// `heddle review sign` submits a `read` / `agent_preview` /
293    /// `agent_co_review` signature on the state. `heddle review
294    /// health` reports per-module signal fire rates over a rolling
295    /// window.
296    #[command(after_help = "\
297Examples:
298  heddle review show HEAD                                # render the review payload for HEAD
299  heddle review sign HEAD --kind read --public-key <hex> --signature <hex> --signed-at-unix <ts>
300  heddle review health --window 7                       # signal fire-rates over recent states
301")]
302    Review {
303        #[command(subcommand)]
304        command: ReviewCommands,
305    },
306
307    /// Redact a sensitive blob in a state so reads return a stub
308    /// instead of the content.
309    ///
310    /// `heddle redact apply` declares a redaction; the blob bytes stay
311    /// on disk and reads return the operator-supplied stub. `heddle
312    /// purge` afterward physically removes the bytes. Both are signed,
313    /// attributed, oplog-audited operations. See
314    /// `docs/PRINCIPLES.md` (the honesty principle) for context.
315    Redact {
316        #[command(subcommand)]
317        command: RedactCommands,
318    },
319
320    /// Declare and inspect a state's audience visibility tier.
321    ///
322    /// `heddle visibility set` binds a tier to a state; `promote` lifts it to
323    /// a less-restrictive tier via a superseding record; `show` reports the
324    /// effective tier; `list` enumerates non-public states. Capture binds the
325    /// inherited `[review.discussion] default_visibility` automatically
326    /// (Invariant A) — these verbs are the explicit operator overrides.
327    Visibility {
328        #[command(subcommand)]
329        command: VisibilityCommands,
330    },
331
332    /// Revert changes from a state.
333    Revert(RevertArgs),
334
335    /// Undo the last Heddle operation.
336    Undo(UndoArgs),
337
338    /// Collapse (squash) multiple states into one.
339    Collapse(CollapseArgs),
340
341    /// Expand a squashed land into the captures it collapsed.
342    Expand(ExpandArgs),
343
344    /// Manage threads.
345    Thread {
346        #[command(subcommand)]
347        command: ThreadCommands,
348    },
349
350    /// Shell integration helpers (auto-cd on thread start/switch/cd).
351    Shell {
352        #[command(subcommand)]
353        command: ShellCommands,
354    },
355
356    /// Internal shell-completion candidate helper.
357    #[command(name = "complete", alias = "__complete", hide = true)]
358    Complete {
359        /// Candidate set to print, one candidate per line.
360        #[arg(value_enum)]
361        subject: CompletionSubject,
362    },
363
364    /// Advanced/manual merge primitive. Prefer `heddle land` for managed threads.
365    Merge(MergeArgs),
366
367    /// Resolve merge conflicts.
368    Resolve(ResolveArgs),
369
370    /// Verify repository integrity.
371    Fsck {
372        /// Full check (includes content verification).
373        #[arg(long)]
374        full: bool,
375
376        /// Run slower graph and signature integrity checks.
377        #[arg(long)]
378        thorough: bool,
379
380        /// Attempt to repair issues.
381        #[arg(long)]
382        repair: bool,
383
384        /// Include Git-overlay mirror, mapping, notes, and checkout checks.
385        #[arg(long)]
386        bridge: bool,
387    },
388
389    /// Inspect and repair the operation log.
390    ///
391    /// `heddle oplog recover` explicitly salvages a truncated or torn oplog,
392    /// reporting what was recovered — the operator-facing entrypoint over the
393    /// same recovery the everyday read path runs automatically.
394    Oplog {
395        #[command(subcommand)]
396        command: OplogCommands,
397    },
398
399    /// Download objects and refs from remote.
400    ///
401    /// In Git-overlay mode this fetches branches and refs/notes/heddle, not Git tags.
402    Fetch {
403        /// Remote name or URL.
404        remote: Option<String>,
405
406        /// Fetch from all remotes.
407        #[arg(long)]
408        all: bool,
409    },
410
411    /// Push to a remote repository.
412    ///
413    /// In Git-overlay mode, push writes plain Git refs the remote's users can
414    /// inspect with `git ls-remote`: each Heddle thread's state goes to
415    /// `refs/heads/<thread>`, Heddle metadata (state identity carried as Git
416    /// notes) goes to `refs/notes/heddle`, and with `--all-threads` Git tags go
417    /// to `refs/tags/<tag>`. JSON output lists the refs actually written this
418    /// invocation in `refs_written`.
419    Push(PushArgs),
420
421    /// Pull from a remote repository.
422    Pull(PullArgs),
423
424    /// Manage remote repositories.
425    Remote {
426        #[command(subcommand)]
427        command: RemoteCommands,
428    },
429
430    /// Authenticate with a Heddle server.
431    #[cfg(feature = "client")]
432    Auth {
433        #[command(subcommand)]
434        command: AuthCommands,
435    },
436
437    /// Manage code context annotations.
438    #[command(after_help = "\
439Examples:
440  heddle context set --path src/auth.rs --scope symbol:verify --kind invariant -m 'returns false on timing mismatch'
441  heddle context get --path src/auth.rs --scope symbol:verify
442  heddle context list --prefix src/auth          # everything attached under a path
443  heddle context check --path src/auth.rs        # surface annotations for editor tooling
444")]
445    Context {
446        #[command(subcommand)]
447        command: ContextCommands,
448    },
449
450    /// Manage ambient harness integrations.
451    Integration {
452        #[command(subcommand)]
453        command: IntegrationCommands,
454    },
455
456    /// Manage stashed changes.
457    Stash {
458        #[command(subcommand)]
459        command: StashCommands,
460    },
461
462    /// Customer-issued temporary admin grants for Heddle staff.
463    /// Time-bounded and audit-trailed; staff need an active grant to
464    /// act on customer resources beyond the operator surface.
465    #[cfg(feature = "client")]
466    Support {
467        #[command(subcommand)]
468        command: SupportCommands,
469    },
470
471    /// Bridge to other version control systems.
472    #[cfg(feature = "git-overlay")]
473    #[command(after_help = "\
474Examples:
475  heddle bridge git status                       # what would import / export look like?
476  heddle bridge git import --ref main            # adopt one branch as a full Heddle lane
477  heddle bridge git sync                         # bidirectional export + import
478  heddle bridge git export ../mirror.git         # write a bare git mirror
479")]
480    Bridge {
481        #[command(subcommand)]
482        command: BridgeCommands,
483    },
484
485    /// Semantic analysis queries (call-graph hot-spots, churn,
486    /// signature-stability surfaces).
487    #[cfg(feature = "semantic")]
488    Semantic {
489        #[command(subcommand)]
490        command: SemanticCommands,
491    },
492
493    /// FUSE mount-daemon control plane — distinct from `agent`.
494    ///
495    /// `heddle daemon serve` runs a foreground mount daemon that
496    /// owns FUSE sessions for `--workspace virtualized --daemon`
497    /// threads. It is normally spawned on demand by the per-thread
498    /// CLI; running it interactively is for debugging.
499    /// `status` reports liveness/uptime/mount count without spawning;
500    /// `stop` asks a running daemon to drain mounts and exit.
501    Daemon {
502        #[command(subcommand)]
503        command: DaemonCommands,
504    },
505
506    /// Agent control surface — daemon lifecycle and reservation API.
507    ///
508    /// `heddle agent serve|status|stop` controls the local gRPC
509    /// daemon (Unix socket inside the repo). `heddle agent
510    /// reserve|capture|ready|release|list|heartbeat` is the stable
511    /// JSON contract orchestrators use to coordinate parallel
512    /// writers. Distinct from `heddle daemon` (FUSE mount control
513    /// plane) — different subsystem.
514    Agent {
515        #[command(subcommand)]
516        command: AgentCommands,
517    },
518
519    /// Inspect and refresh rebuildable performance sidecars.
520    Maintenance {
521        #[command(subcommand)]
522        command: MaintenanceCommands,
523    },
524
525    /// Apply specific commits.
526    CherryPick {
527        /// Commit to cherry-pick.
528        commit: String,
529
530        /// Commit message for the cherry-pick.
531        #[arg(short = 'm', long)]
532        message: Option<String>,
533
534        /// Apply changes to worktree without committing.
535        #[arg(long)]
536        no_commit: bool,
537
538        /// Discard uncommitted local changes instead of refusing.
539        #[arg(long)]
540        force: bool,
541    },
542
543    /// Clone from remote.
544    Clone(CloneArgs),
545
546    /// Rebase current thread onto another.
547    Rebase {
548        /// Thread to rebase onto.
549        thread: Option<String>,
550
551        /// Abort an in-progress rebase.
552        #[arg(long)]
553        abort: bool,
554
555        /// Continue an in-progress rebase after resolving conflicts.
556        #[arg(long = "continue", alias = "cont")]
557        cont: bool,
558
559        /// Discard uncommitted local changes instead of refusing.
560        #[arg(long)]
561        force: bool,
562    },
563
564    /// Manage repository hooks.
565    Hook {
566        #[command(subcommand)]
567        command: HookCommands,
568    },
569
570    /// Advanced debugging/provenance commands for Heddle actors attached to threads.
571    Actor {
572        #[command(subcommand)]
573        command: ActorCommands,
574    },
575
576    /// Advanced debugging/provenance commands for Heddle execution sessions.
577    Session {
578        #[command(subcommand)]
579        command: SessionCommands,
580    },
581
582    /// Advanced debugging/provenance commands for the hosted local-agent presence relay.
583    ///
584    /// `heddle presence publish` runs a foreground publisher that streams
585    /// agent_start / agent_heartbeat / agent_done events to the configured
586    /// hosted server over a bearer-authenticated WebSocket.
587    #[cfg(feature = "client")]
588    Presence {
589        #[command(subcommand)]
590        command: PresenceCommands,
591    },
592}
593
594/// Presence subcommands.
595#[cfg(feature = "client")]
596#[derive(Clone, Debug, clap::Subcommand)]
597pub enum PresenceCommands {
598    /// Publish presence events for the given agent session.
599    ///
600    /// Intended to be launched detached by an orchestrator (or called
601    /// manually for debugging). Reads agent metadata from
602    /// `.heddle/agents/<session>.toml` and hosted upstream from
603    /// `.heddle/config.toml` `[hosted]`. Exits 0 (with a log line) when no
604    /// upstream is configured.
605    Publish {
606        /// Agent session ID (matches `.heddle/agents/<session>.toml`).
607        #[arg(long)]
608        session: String,
609
610        /// Heartbeat interval in seconds (default 15).
611        #[arg(long, default_value = "15")]
612        interval_secs: u64,
613    },
614}
615
616/// Maintenance subcommands.
617#[derive(Clone, Debug, clap::Subcommand)]
618pub enum MaintenanceCommands {
619    /// Inspect repository performance sidecars and repo shape.
620    Inspect,
621
622    /// Rebuild repository performance sidecars without changing repository meaning.
623    Run,
624
625    /// Garbage collect unreachable objects.
626    Gc {
627        /// Prune unreachable objects.
628        #[arg(long)]
629        prune: bool,
630
631        /// Aggressive garbage collection.
632        #[arg(long)]
633        aggressive: bool,
634
635        /// Show what would be removed without removing.
636        #[arg(long)]
637        dry_run: bool,
638    },
639
640    /// Inspect and debug the worktree index.
641    #[command(hide = true)]
642    Index {
643        /// Dump the index contents in human-readable format.
644        #[arg(long)]
645        dump: bool,
646    },
647
648    /// Inspect the local change monitor state.
649    #[command(hide = true)]
650    Monitor {
651        /// Print changed paths as well as backend/status summary.
652        #[arg(long)]
653        paths: bool,
654
655        /// Internal helper mode: serve monitor queries for this repo.
656        #[arg(long, hide = true)]
657        serve: bool,
658    },
659}
660
661/// Daemon control plane subcommands. See `Commands::Daemon`.
662#[derive(Clone, Debug, clap::Subcommand)]
663pub enum DaemonCommands {
664    /// Run a foreground mount daemon for this repository.
665    ///
666    /// Normally spawned on demand by the per-thread CLI when
667    /// `--daemon` is passed. Running interactively is for
668    /// debugging the daemon protocol.
669    Serve,
670
671    /// Report daemon liveness, version, uptime, and active mount
672    /// count. No-op success when the daemon isn't running.
673    Status,
674
675    /// Ask the running daemon to drain its mounts and exit. Sweeps
676    /// any leftover registry entries with `fusermount -u` as a
677    /// safety net before returning.
678    Stop,
679}
680
681/// Actor subcommands.
682#[derive(Clone, Debug, clap::Subcommand)]
683pub enum ActorCommands {
684    /// Register a new actor lane (creates a thread + registry entry).
685    /// Does not create a filesystem-isolated checkout — for that use
686    /// `heddle start <name> --path <dir>`.
687    Spawn(ActorSpawnArgs),
688
689    /// List actors known to this repository.
690    List(ActorListArgs),
691
692    /// Show the current or selected actor.
693    Show(ActorShowArgs),
694
695    /// Explain why Heddle attached the current or selected actor.
696    Explain(ActorExplainArgs),
697
698    /// Mark the current or selected actor complete.
699    Done(ActorDoneArgs),
700}
701
702// `AgentCommands` lives in `commands_agent.rs`. Codex's foundation
703// commit added a parallel definition here; deleted during the rebase
704// onto main (which had already introduced the file). The reservation
705// variants Codex contributed are now folded into the canonical enum in
706// `commands_agent.rs`.
707
708/// Session subcommands.
709#[derive(Clone, Debug, clap::Subcommand)]
710pub enum SessionCommands {
711    /// Start a new session.
712    Start(SessionStartArgs),
713
714    /// Create a new segment (provider/model change).
715    Segment(SessionSegmentArgs),
716
717    /// End the current session.
718    End(SessionEndArgs),
719
720    /// Show session details.
721    Show(SessionShowArgs),
722
723    /// List all sessions.
724    List(SessionListArgs),
725}