1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! Command-line surface (clap derive).
//!
//! Eleven subcommands: `list`, `search`, `show`, `stats`, `agents`, `whoami`, `files`,
//! `recover`, `plan`, `verbatim`, `image`. Each carries example-rich help (`--help`) keyed off
//! the SPEC §6 baseline invocations. `list`/`search`/`stats`/`files`/`recover`/`plan`/`image`
//! span each session's subagent transcripts by default (`--no-subagents` opts out); `verbatim`
//! is the exception - a single-thread recovery tool whose per-session budget MULTIPLIES, so
//! it defaults to the TOP-LEVEL thread only, opts INTO spanning via `--subagents`, and
//! REQUIRES a target. `agents` reports a session's subagent lifecycle (it lists subagents as
//! targets, so it rejects both span flags). `show` FETCHES the records of exactly ONE
//! transcript by `--line`/`--uuid` (rendered full, or `--raw` verbatim bytes); `stats` is
//! the one-scan per-session aggregate view. `plan` resolves the plan file BOUND to a session
//! (its `plan_mode` attachment); `recover --file @plan` reconstructs that bound plan's
//! content.
//! The session-operating subcommands
//! (`list`/`search`/`show`/`stats`/`agents`/`files`/`recover`/`plan`/`verbatim`/`image`)
//! resolve their target through ONE shared resolver
//! ([`crate::path::resolve_session_files`]): a positional `[PATH]...` that is a cwd / encoded
//! dir, an `@<uuid>` / `@<agent-hex>` / `@main` / `@trap:<marker>` session token, or a `*.jsonl` file.
//! A BARE uuid (no `@`) is not special - prefix it `@<uuid>`. (For `search` the
//! first positional is PATTERN, so a session is targeted by an `@<uuid>` PATH positional - see
//! [`SearchArgs::pattern`].) `whoami` is the exception (no target - it reads
//! `$CLAUDE_CODE_SESSION_ID`).
//!
//! ## argv normalization (flag-ordering fix)
//!
//! The real entrypoint is [`parse_argv`], NOT `Cli::parse` - it runs [`normalize_argv`]
//! first so a `--format`/`--shape`/… flag works in ANY position relative to a
//! leading-`-` encoded project target (clap's `allow_hyphen_values` otherwise lets a
//! `Vec` positional greedily swallow the trailing flag). See [`normalize_argv`].
use PathBuf;
use ;
use crateClass;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;