| new file mode 100644 |
| index 000000000..24e301039 |
| --- /dev/null |
| +++ b/docs/superpowers/notes/2026-11-09-cli-dispatch-audit.md |
| @@ -0,0 +1,720 @@ |
| +# CLI dispatch audit (2026-11-09, main fd68e4ee) |
| + |
| +Read-only audit of every carlos dispatcher, written for the CLI registry design |
| +(`docs/superpowers/specs/2026-11-09-cli-registry-design.md`). Part A covers top-level |
| +commands a-l, part B m-z plus the pre-switch words, the docsite scanner and the |
| +update hint. Line numbers are against fd68e4ee. Two Sonnet readers; rows marked |
| +lighter in each part were read from signatures and usage only. |
| + |
| +# Part A |
| + |
| +# carlos CLI dispatch audit A: top-level commands a-l (+ help) |
| + |
| +Repo: /home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-cli-registry |
| +Read-only audit. Line numbers are in this worktree (branch design-cli-registry, fd68e4ee). |
| + |
| +## 0. Global conventions (apply unless a row says otherwise) |
| + |
| +- Entry: main.go:25 `main()`. `len(os.Args) < 2` -> `usage(os.Stderr)`, exit 2 (main.go:38-41). `cmd, args := os.Args[1], os.Args[2:]` (main.go:42). |
| +- Hidden plumbing commands handled BEFORE the switch (main.go:43-67): `__demo-snapshot` (must have 0 args, else log.Fatal), `__registry-child`, `__rootfs-check-probe`, `__rootfs-check-prepare` (own flagsets in ship_check_probe.go:66,109, ContinueOnError). Not in a-l scope, but a generic dispatcher must not claim `__*`. |
| +- `switch cmd` (main.go:68-247): exact string match, no prefix match, no aliases except `help|-h|--help`. `default:` -> `usage(os.Stderr)`, exit 2 (main.go:243-245). |
| +- After a handler RETURNS normally, `maybeUpdateHint(cmd)` runs (main.go:249; update.go:116). Handlers that `return` early inside main.go's switch (channels sub-verbs) still reach it? NO: `channels resign|digests` do `return` from main() itself (main.go:149-164), skipping maybeUpdateHint. Same for `releases retention|authorize` (not in scope). `channels` bare falls through to the hint. |
| +- `flag.ExitOnError` (used by nearly every leaf): `-h/--help` prints usage (stderr unless SetOutput) and exits 0 (Go >= 1.15 semantics, go.mod says go 1.26.0); a bad/undefined flag prints error + usage and exits 2. Fatal validation errors use `log.Fatal*` = stderr with log timestamp prefix (no log.SetFlags in the main binary) via `newErrorWriter`, exit 1. Wherever a row says "usage->exit 1" this is log.Fatal(usage). |
| +- `flag.ContinueOnError` leaves return the error to a caller that maps it (rows say how). |
| +- Go `flag` accepts `-x` and `--x` identically. `-x=v` and `-x v` both work for non-bool flags. Standard parse stops at the first non-flag word (`std`), and `--` terminates flags. |
| +- Flag aliases registered by `aliasedString`/`appFlag`/`channelFlag`/`environmentFlag`/`versionFlag` (flags.go; internal/cliflag/cliflag.go:22): app=a, channel=c, destination=d, environment=e, version=v. `-a` etc. exist only on flagsets that used those registrars (`flagWasSet` flags.go:98 is alias-aware). |
| +- Common flag helper groups: `consoleOption(fs)` (flags.go:41) registers `--console` and `--destination/-d`; `-d` WRITES THE PACKAGE GLOBAL `destinationFlag` (flags.go destinationValue.Set) which `loadConfig` reads later (a flag with a global side effect, not just a local value). `accountFlags(fs)` (cli.go:2315) = `--account`, `--account-id`, `--registry`. `addMutationMessageFlags(fs)` (mutation_message.go:36) = `--message`, `--no-prompt`. Many leaves hand-register `--account`/`--account-id` without `--registry`. |
| +- "bare" below = no further args after the command words; "-h" = a first arg of `-h`. |
| +- Where a row says positionals are "ignored", the leaf never reads `fs.Args()`/`NArg()`, so trailing words are silently dropped (does not error). |
| + |
| +Abbreviations in the dispatch-style column: WS = word-switch, F-then-W = flags-then-word, leaf = leaf. |
| + |
| +## 1. Rows |
| + |
| +Format: `path | handler (file:line) | dispatch style | positionals | flag parsing | bare/unknown-word behaviour | notes` |
| + |
| +### help / usage (main.go) |
| + |
| +- `help`, `-h`, `--help` | inline main.go:70-73 -> usage(os.Stdout) (main.go:253) | leaf (3 aliases of one case) | extra args ignored (`carlos help foo` prints top usage) | none | prints usage on STDOUT, exit 0 (fallthrough to maybeUpdateHint) | the only exit-0 help at top; bare `carlos` is stderr/exit 2 (main.go:38). |
| + |
| +### add |
| + |
| +- `add` | runAdd (cli.go:268) | leaf | `<host>` exactly 1, free value (hostname) | std, ExitOnError (cli.go:269) | `NArg()!=1` -> log.Fatal("usage: carlos add [flags] <host>") exit 1; `-h` exit 0 | flags: --registry --app/-a --account --account-id --slug --kind(instance|service|static) --socket --addr --channel/-c --hibernate --status-named --backing --unit --db. Host must come AFTER flags (std parse); `add host --app x` leaves --app unparsed and NArg=3 -> usage. Value `--kind` is an enum but a flag value, not positional. |
| + |
| +### accounts (RunAccounts accounts.go:76) |
| + |
| +- `accounts` | RunAccounts | WS on args[0] | n/a | n/a | bare -> accountsUsage stderr exit 1; unknown word (incl. `-h`) -> same, exit 1 (accounts.go:77-80,89-92) | words: create, list, migrate, plan. No aliases, no default child. |
| +- `accounts create` | runAccountsCreate (accounts.go:96) | leaf | none (ignored) | std, ExitOnError | `--name` empty -> log.Fatal("usage: ...") exit 1 | flags --registry --name --owner --console/-d. Rest of file not read for further positional use; NArg not checked. |
| +- `accounts list` | runAccountsList (accounts.go:223) | leaf | none (ignored) | std, ExitOnError | -h exit 0 | flags --registry --console/-d. Uses `fs.Visit` to learn if --registry was explicit (mode choice: registry vs console). |
| +- `accounts migrate` | runAccountsMigrate (accounts.go:323) | leaf | none | std, ExitOnError | missing --app/--to -> log.Fatal(usage) exit 1 (accounts.go:333) | flags --app --to --from --dry-run (+ registry). |
| +- `accounts plan` | runAccountsPlan (accounts_plan.go:87) -> runAccountsPlanWithSession (accounts_plan.go:96) | leaf | none; `NArg()!=0` -> error "unexpected argument %q" | std, ContinueOnError, SetOutput(stdout) (accounts_plan.go:97-98) | ErrHelp -> return (exit 0, usage printed to STDOUT); other error -> log.Fatalf("accounts plan: %v") exit 1 | flags --account --set --pack (repeatable packFlags) --sponsored --reason --console/-d. |
| + |
| +### adopt (host.RunAdopt internal/host/agent.go:5617) |
| + |
| +- `adopt` | RunAdopt -> runAdopt (agent.go:5619) -> runAdoptWithEnsureSystemUnits (5627) -> runAdoptUnderRootRelease (5642); flagset at agent.go:5663 | leaf | none (ignored) | std, ExitOnError, `_ = fs.Parse(args)` (agent.go:5671) | -h exit 0 (after expensive startup work: reapStagingWrites, claim wiring happen BEFORE flags are parsed) | flags -registry -config-only -stage-only -restart-only (Bool). Several systemd units exec this with these flags; startup side effects precede flag parse (agent.go:5643-5662), so a generic parse-first dispatcher changes ordering for `adopt -h`/bad flag. |
| + |
| +### agent (host.RunAgent internal/host/agent.go:236) |
| + |
| +- `agent` | RunAgent (agent.go:236) -> runAgent (agent.go:264) -> edge.RunWithActivatorReady (edge.go:4602, agent.go:1188) | leaf | none (ignored) | PARENT PEEKS: `peekRegistryPath` (agent.go:1640) and `peekAcmeCache` (agent.go:3731) each run a throwaway ContinueOnError flagset (io.Discard) over the SAME args, then the edge's ExitOnError flagset does the authoritative parse (edge.go:4606-4614, `_ = fs.Parse`) | unknown flag ends the peek early; the edge parse then reports it and exits 2; -h from the edge flagset exit 0 | flags (edge's): -registry -acme-cache -https(:443) -http(:80) -fallback -dev. RunAgent does loadGroupConfiguration/IMDS work (agent.go:237-261) before any flag parse. Hard case (5). |
| + |
| +### analytics |
| + |
| +- `analytics` | runAnalytics (analytics_cmd.go:25) | leaf | none (ignored) | std, ExitOnError | -h exit 0; no --app and no default app -> resolvedApp usage | flags --app/-a --range(today|7d|30d) --set-count(edge|off) --set-door(on|off) --console/-d --account --account-id. Enums are FLAG VALUES. |
| + |
| +### apps (RunApps apps.go:151) |
| + |
| +- `apps` | RunApps | WS on args[0] | n/a | n/a | bare -> appsUsage stderr exit 1; unknown word (incl `-h`) -> same exit 1 (apps.go:152-155,179-182) | words: source create place region build-probe set show delete restore ttl keep list. No aliases. |
| +- `apps source` | runAppsSource (apps_source.go:26) | WS-ish: requires `args[0]=="pull"` else log.Fatal(sourcePullUsage) exit 1 (also when bare) | the word `pull` | n/a before pull | no `-h` special-case: `apps source -h` -> Fatal exit 1 | only child: pull. |
| +- `apps source pull` | runAppsSource continues inline, flagset "apps source pull" (apps_source.go:30) | leaf | none; `NArg()!=0 || app==""` -> Fatal(usage) | std on `args[1:]`, ExitOnError | | flags --app/-a --account --account-id --console/-d --output. |
| +- `apps create` | runAppsCreate (apps.go:514) | leaf | none (ignored) | std, ExitOnError | `--app` empty -> Fatal(usage) exit 1 | flags --app/-a --place (""|fleet/<name>) --control-plane --build-probe --region --analytics --no-analytics --account --account-id --console/-d. |
| +- `apps place` | runAppsPlace (apps.go:702) | leaf | none | std, ExitOnError | missing --app or --target (tri-state via fs.Visit) -> Fatal(placeUsage) exit 1 | `--target ""` is a legal value (clears). |
| +- `apps region` | runAppsRegion (apps_region_cmd.go:55) | leaf | none; `NArg()!=0` -> Fatal(usage) | std, ExitOnError | | flags --app/-a --set (presence via fs.Visit = write mode) --account --account-id --console/-d. |
| +- `apps build-probe` | runAppsBuildProbe (apps_buildprobe.go:42) | leaf | `<path|->` exactly 1 (`-` = clear sentinel, a free value that LOOKS like a flag prefix; std parse treats a lone `-` as a non-flag) | std, ExitOnError | NArg!=1 or no --app -> Fatal(buildProbeUsage) | positional must be AFTER flags. |
| +- `apps set` | runAppsSet (apps_swap.go:163) | leaf with leading positional | `<app>` : before the flags (leadingArg apps_swap.go:91), via --app/-a, OR after the flags (appsSetApp apps_swap.go:100); 2 different names -> error | std, ExitOnError; first arg lifted BY HAND if it does not start with "-" | no app -> Fatal(appsSetUsage); nothing to set -> Fatal(appsSetNothing); -h exit 0 | flags --app/-a --copies --message --no-prompt --swap(overlap|hold) --swap-concurrency --account --account-id --instance-control --default-updates --default-channel --default-major --egress-allow --size --interactive --console/-d. Hard case (2): first word may be a free value (app) OR a flag; never a sub-command word. |
| +- `apps show` | runAppsShow (apps_policy.go:312) | leaf with leading positional | `<app>` before flags (leadingArg) OR exactly 1 after flags | std after leadingArg | no app -> Fatal(appsShowUsage) exit 1 | flags --account --account-id --console/-d. |
| +- `apps delete` | runAppsDelete (apps.go:243) | leaf | `<app>` exactly 1, free, AFTER flags | std, ExitOnError | NArg!=1 -> Fatal usage exit 1 | accountFlags (+--registry), --console/-d. `apps delete app --account x` leaves --account unparsed -> NArg 3 -> usage. |
| +- `apps restore` | runAppsRestore (apps.go:390) | leaf | `<app>` exactly 1 after flags | std, ExitOnError | NArg!=1 -> Fatal usage | same flags as delete. |
| +- `apps ttl` | runAppsTTL (temporary.go:257) | leaf | `<ttl>` (1h to 30d, e.g. 5d; free value validated by parseTTL), exactly 1, BEFORE or AFTER flags | INTERSPERSED parseInterspersed (config_cli.go:182) on an ExitOnError flagset (appsLifecycleFlags temporary.go:247) | missing --app or len(pos)!=1 -> Fatal(usage) exit 1 | flags --app/-a --account --account-id --console/-d. `--` is eaten by fs.Parse, then following words continue to be parsed as FLAGS (quirk of parseInterspersed: it re-calls fs.Parse after each positional). |
| +- `apps keep` | runAppsKeep (temporary.go:286) | leaf | none (`len(pos)!=0` -> usage) | parseInterspersed | missing --app -> Fatal(usage) | shares appsLifecycleFlags. |
| +- `apps list` | runAppsList (temporary.go:304) | leaf | none (`len(pos)!=0` -> usage) | parseInterspersed | | shares appsLifecycleFlags (its --app unused). |
| + |
| +### assets (runAssets assets_cli.go:50) |
| + |
| +- `assets` | runAssets | WS on args[0] | n/a | n/a | bare or unknown (incl `-h`) -> log.Fatal(assetsUsage) exit 1 | words: purge, status. |
| +- `assets purge` | runAssetsPurge (assets_cli.go:79) | leaf | none (ignored) | std, ExitOnError | | --app/-a --account --account-id --console/-d. |
| +- `assets status` | runAssetsStatus (assets_cli.go:126) | leaf | none (ignored) | std, ExitOnError | | same flags. |
| + |
| +### auth (RunAuth auth.go:84) |
| + |
| +- `auth` | RunAuth | WS on args[0], then errors mapped centrally (auth.go:90-109) | n/a | n/a | bare or unknown word (incl `-h`) -> authUsage stderr exit 1. A leaf `error` return prints `carlos auth <args[0]>: <err>` to stderr (coloured), exit 1 | words: login, whoami, logout, default. Child functions get `os.Stdout` and return error; they never exit themselves. |
| +- `auth login` | authLogin (auth.go:802) | leaf | none (ignored) | std, ContinueOnError, SetOutput(out=stdout) | `-h`: Parse returns ErrHelp (usage on STDOUT) and RunAuth prints "carlos auth login: flag: help requested" exit 1 (NOT 0). Bad flag: Parse prints error+usage to stdout, then RunAuth also prints it, exit 1 (not 2) | flags --console/-d --label --no-wait --wait (--no-wait with --wait refused). |
| +- `auth whoami` | authWhoami (auth.go:903) | leaf | none | std, ContinueOnError, SetOutput(stdout) | same ErrHelp->exit 1 behaviour | --console/-d. |
| +- `auth logout` | authLogout (auth.go:958) | leaf | none | std, ContinueOnError | same | --console/-d. |
| +- `auth default` | authDefault (auth.go:1004) | leaf | `[<url>]` 0 or 1 (free value); `switch fs.NArg()` 0=show, 1=set, >1 -> error "usage: carlos auth default ..." | std, ContinueOnError. NB: the url must come AFTER flags | exit 1 on error | flags --project --destination/-d (destinationOption only, NOT --console). `-d` global side effect. |
| + |
| +### availability |
| + |
| +- `availability` | runAvailability (availability_cmd.go:28) | leaf | none (ignored) | std, ExitOnError | | --app/-a --since(24h) --until --host --release --fp --console/-d --account --account-id. |
| + |
| +### billing (runBilling billing_cli.go:35 -> runBillingWithSession billing_cli.go:44) |
| + |
| +- `billing` | runBillingWithSession | F-then-W-ish: builds the flagset `"billing "+verb` and registers `--console` BEFORE the switch, then `switch verb` registers verb-specific flags and parses `rest` (billing_cli.go:44-148) | the verb word (problems|close|house), taken from args[0] | std, ContinueOnError, SetOutput(stdout) | bare -> `errors.New(cliBillingCopyUsage)` -> log.Fatalf("billing: usage: ...") exit 1; unknown verb (incl `-h`) same exit 1; per-verb `-h` -> ErrHelp -> runBilling returns (exit 0, usage on stdout) | words: problems, close, house. Flag-parse errors surface as log.Fatalf exit 1 (not 2). |
| +- `billing problems` | billing_cli.go:54 (inline case) | leaf | none; NArg!=0 -> error | std | | --all (+ --console/-d). |
| +- `billing close` | billing_cli.go:83 | leaf | none | std | `-id`<=0 or empty `-note` -> error exit 1 | --id (int64) --note. |
| +- `billing house` | billing_cli.go:111 | leaf | none | std | needs exactly one of --on/--off, --account, --note | --account --on --off --note. |
| + |
| +### bootstrap (host.RunBootstrap internal/host/bootstrap.go:302) |
| + |
| +- `bootstrap` | RunBootstrap | leaf | none (ignored) | std, ExitOnError, `_ = fs.Parse` (bootstrap.go:302-310) | -h exit 0 | flags -root(/) -offcloud -plan-json (only with non-/ root) -socket-consumer (repeatable repeatableFlag). |
| + |
| +### canary (runCanary canary.go:78) |
| + |
| +- `canary` | runCanary | WS with a NON-ERROR DEFAULT: `switch args[0]` ls|list, rm|delete, deploy; ANYTHING else (incl no args, flags, or an artifact path) falls through to `runCanaryDeploy(args)` (canary.go:79-95) | | | | Hard cases (3)+(2): the first positional of the deploy form is a file path; a file literally named `ls`/`list`/`rm`/`delete`/`deploy` would be captured as a sub-verb. Aliases: ls=list, rm=delete. |
| +- `canary` / `canary deploy` | runCanaryDeploy (canary.go:493; flagset canary.go:494) | leaf | `<files-or-site-dir>...` 1+ (free paths); `NArg()==0` -> Fatal(canaryUsage) exit 1 (canary.go:514) | std, ExitOnError | `-h` exit 0 | flags --app/-a --name --account --account-id --registry --console/-d --kind(binary|static) --region --environment/-e --scope --version/-v --target --label --timeout. Paths must follow flags. |
| +- `canary ls|list` | runCanaryList (canary.go:673) | leaf | none (ignored) | std, ExitOnError | | --app/-a --account --account-id --registry --console/-d. Flagset name "canary ls" for both spellings. |
| +- `canary rm|delete` | runCanaryRemove (canary.go:743) | leaf | none | std, ExitOnError | empty --name -> Fatal | --app/-a --name --account --account-id --registry --console/-d. |
| + |
| +### channels (main.go:149-165 + cli.go:3113 + channels_digests.go) |
| + |
| +- `channels` | main.go:149-165 inline word peek, then runChannels (cli.go:3113) | WS in main.go on args[0]: `resign`, `digests`; otherwise the bare form runChannels(args) | n/a | n/a | any other first word (incl. `-h` or an app name) goes to runChannels where std flag parse stops at the word and it is ignored | words: resign, digests. Hard case (3): unknown word is NOT a usage error; trailing words are dropped. `channels resign|digests` `return` from main() directly (skips maybeUpdateHint). |
| +- `channels` (list) | runChannels (cli.go:3113) | leaf | none (ignored) | std, ExitOnError | -h exit 0 | accountFlags(--account --account-id --registry) --app/-a --console/-d. Works in API and direct-bucket mode. |
| +- `channels resign` | runChannelsResign (channels_digests.go:60) | leaf | `[<app>] <channel>`: 1 positional = channel; 2 positionals AND `--app` empty -> first is the APP, second the channel (channels_digests.go:69-72); else usage | std, ExitOnError; positionals AFTER flags | len(pos)!=1 -> Fatal(usage) | flags --app/-a --account(s) --account-id --registry --yes --console/-d. Hard case (2): positional arity changes meaning depending on whether --app was given. |
| +- `channels digests` | runChannelsDigests (channels_digests.go:149) | F-then-W: peels a leading `on`|`off` word from args BEFORE flags (channels_digests.go:160-162); no word = show | `[on|off]` enum, must be FIRST (before flags); `NArg()!=0` after flag parse -> Fatal(usage) | std, ExitOnError | | flags --account-id (repeatable multiFlag) --console/-d. Hard case (1)/(2): the word is positioned BEFORE flags only; `digests --account-id x on` leaves `on` as a positional -> usage error. |
| + |
| +### config (RunConfig config_cli.go:52) |
| + |
| +- `config` | RunConfig | WS | n/a | n/a | bare or unknown (incl `-h`) -> configUsage stderr exit 1 (config_cli.go:53-55,60-63) | word: destinations only. Error mapping after the call (config_cli.go:65-73): ErrHelp -> return (exit 0); flagParseError -> exit 2; other error -> "carlos config <args[0]>: <err>" stderr exit 1. |
| +- `config destinations` | configDestinations (config_cli.go:79) | WS with DEFAULT CHILD and a flag-peek: `verb := "list"`; if args[0] exists and does not start with "-", it is the verb (config_cli.go:80-83) | the verb | n/a | no verb or a flag first = list. Unknown verb -> error "no verb %q\n<destinationsUsage>" -> RunConfig prints it, exit 1. `help` -> destinationsUsage to stdout, exit 0 | words: list|ls, add, set, default, remove|rm, rename, help. Hard cases (3)+(4-ish): default child; aliases ls/rm. |
| +- `config destinations list|ls` | destinationsList (config_cli.go:344) | leaf | none (`len(pos)!=0` -> error "usage: ...") | INTERSPERSED parseInterspersed (config_cli.go:182), ContinueOnError via destinationsFlagSet (config_cli.go:203-208), output = stdout | -h -> ErrHelp -> RunConfig returns (exit 0) | flags --global. |
| +- `config destinations add` | destinationsAdd (config_cli.go:398) | leaf | `<name>` exactly 1 (free, validDestinationName) before or after flags | parseInterspersed | len(pos)!=1 -> error exit 1 | flags --global --console --account --app/-a --kind(binary|static) --artifact --target --default --from-current. |
| +- `config destinations set` | destinationsSet (config_cli.go:517) | leaf | `<name>` exactly 1 | parseInterspersed | | flags --global + destinationKeyFlags (console, account, app/-a, kind, artifact, target); `--key ""` removes a key. |
| +- `config destinations default` | destinationsDefault (config_cli.go:561) | leaf | `[<name>]` 0 (show) or 1 (set); more -> usage error | parseInterspersed | | --global. |
| +- `config destinations remove|rm` | destinationsRemove (config_cli.go:605) | leaf | `<name>` exactly 1 | parseInterspersed | | --global. |
| +- `config destinations rename` | destinationsRename (config_cli.go:653) | leaf | `<old> <new>` exactly 2 | parseInterspersed | | --global. |
| + Note for all config destinations leaves: ContinueOnError + bad flag => flagParseError => exit 2 (usage already printed); other errors exit 1. `--` quirk of parseInterspersed applies (words after `--` are still flag-parsed). |
| + |
| +### console |
| + |
| +- `console` | runConsole (interactive_cli.go:613) -> parseConsoleArgs (interactive_cli.go:589) | leaf | none: `NArg()>0` or a literal `--` anywhere in args -> error consoleNoCommandMsg | std, ContinueOnError, SetOutput(stderr) | ErrHelp -> exit 0; no --instance -> errRunUsage -> consoleUsage to stderr exit 2; any other parse error: message + usage, exit 2 | flags --app/-a --instance (required) --account --account-id --registry --console/-d. Uses `slices.Contains(args,"--")` to forbid `--` (interactive-run counterpart `run` allows `-- cmd`). |
| + |
| +### db (runDB db.go:58) |
| + |
| +- `db` | runDB | WS | n/a | n/a | bare -> dbUsage stderr exit 2; `-h|--help|help` -> dbUsage to stdout, exit 0; unknown -> "carlos db: unknown verb %q\n<usage>" stderr exit 2 (db.go:59-72) | words: pull, query, -h, --help, help. One of few dispatchers with exit 2 and help-words. |
| +- `db pull` | runDBPull (db.go:258) | leaf | none (ignored) | std, ExitOnError | `--out` blank -> stderr + exit 2 (db.go:264-267); out exists -> exit 2 | flags --out + dbFlags (db.go:~108): --app/-a --instance --account --account-id --registry? (accountFlags) --console/-d --at. |
| +- `db query` | runDBQuery (db.go:371) | leaf | none | std, ExitOnError | `--sql` blank -> exit 2 | flags --sql + dbFlags. |
| + |
| +### deploy |
| + |
| +- `deploy` | runDeploy (deploy.go:133) | leaf | `<files-or-site-dir>...` 0+ (free paths). ZERO positionals = distinct mode (saved-defaults / first-run wizard, deploy.go:278) | std, ExitOnError | -h exit 0; usage->exit 1 when no app resolvable (deploy.go:266) | flags --app/-a --account --account-id --registry --console/-d --kind(binary|static) --version/-v --target --capabilities --channel/-c --host --timeout --label --notes --temporary --ttl --region --swap --assets (repeatable assetPathsFlag) --env (repeatable deployEnvFlag) --no-assets. Paths come after flags. Arity-dependent behaviour (0 vs 1+) must survive. |
| + |
| +### devbox (runDevbox devbox_cli.go:245) |
| + |
| +- `devbox` | runDevbox | WS in two stages: (a) `args[0]=="serve"` peeled in runDevbox (devbox_cli.go:246-251); (b) everything else to `devboxCLI.run` (devbox_cli.go:291) | n/a | n/a | run(): bare -> usage stderr, returns 2; `help|-h|--help` -> usage stdout, 0; unknown -> `devboxUnknownCommand` (devbox_cli.go:164) stderr, returns 2. Exit code mapping at devbox_cli.go:310-328: nil/ErrHelp -> 0; errDevboxUsage or flagParseError -> 2; devboxRefusal -> prints lines, 1; other error -> 1 | words: share, unshare, list, help/-h/--help, serve (hidden-from-usage, handled first). |
| +- `devbox serve` | runDevboxServe (devbox_cli.go:714) | leaf | none; `NArg()>0` -> error | std, ContinueOnError, usage via flagUsage | ErrHelp swallowed in runDevbox -> exit 0; other errors log.Fatal exit 1 | flag --env-file. Note it is NOT in `usage()`; the name is matched only in runDevbox. |
| +- `devbox share` | (*devboxCLI).share (devbox_cli.go:364) | leaf | `[<name>]` 0 or 1 (free); >1 -> usage printed + errDevboxUsage (exit 2) | INTERSPERSED parseInterspersed (devbox_cli.go:370), ContinueOnError, output stderr (flagSet devbox_cli.go:337) | | flags --port --dir --socket --allow; exactly ONE of port/dir/socket required (flagGiven). Without a name, the name comes from the git branch. |
| +- `devbox unshare` | unshare (devbox_cli.go:507) | leaf | `[<name>]` 0 or 1 | parseInterspersed | >1 -> exit 2 | none beyond -h. |
| +- `devbox list` | list (devbox_cli.go:532) | leaf | none (`len(pos)>0` -> usage exit 2) | parseInterspersed | | flag --allowed. |
| + |
| +### domains (runDomains domains_cli.go:95) |
| + |
| +- `domains` | runDomains | WS | n/a | n/a | bare or unknown (incl `-h`) -> log.Fatal(domainsUsage) exit 1 | words: check, buy, attach, verify, detach, list, paths, placements. |
| +- `domains check` | runDomainsCheck (domains_buy_cli.go:24) -> runDomainBuyVerb(args,false) (domains_buy_cli.go:27) | leaf | `<domain>` exactly 1 (free; before or after flags) | INTERSPERSED parseInterspersed (domains_buy_cli.go:47) on ExitOnError set | len(pos)!=1 -> Fatal(domainsCheckUsage) exit 1 | flags --account --account-id --console/-d --country (2 letters). A shared handler; flagset name "domains check". |
| +- `domains buy` | runDomainsBuy (domains_buy_cli.go:25) -> runDomainBuyVerb(args,true) | leaf | `<domain>` exactly 1; `--app` required | parseInterspersed | | flags --account --account-id --console/-d --app/--(StringVar "app" only, NO -a alias) --contact-file --yes --no-wait. Note: buy's `--app` is a plain fs.StringVar, not appFlag; no `-a`. |
| +- `domains attach` | runDomainsAttach (domains_cli.go:127) | leaf | `<hostname>` exactly 1 AFTER flags | std, ExitOnError | Fatal(domainsAttachUsage) exit 1 | flags --app/-a --route --wildcard --catchall --platform --account --account-id --console/-d. |
| +- `domains verify` | runDomainsVerify (domains_cli.go:265) | leaf | `<hostname>` exactly 1 AFTER flags | std | | --app/-a --channel/-c --account --account-id --console/-d. |
| +- `domains detach` | runDomainsDetach (domains_cli.go:318) | leaf | `<hostname>` 1 AFTER flags | std | | |
| +- `domains list` | runDomainsList (domains_cli.go:345) | leaf | none (ignored) | std | | |
| +- `domains paths` | runDomainsPaths (domains_cli.go:443) | leaf | `<hostname>` 1 AFTER flags | std | | |
| +- `domains placements` | runDomainsPlacements (domains_cli.go:489) | leaf | `<hostname>` 1 AFTER flags | std | | --set <region>=<instance> (repeatable) --wildcard --catchall. |
| + attach/verify/detach/paths/placements all do `host := fs.Arg(0)`; `host=="" || NArg()>1` -> Fatal(usage). Non-bool flags after the hostname are NOT parsed (they count as extra positionals -> usage). |
| + |
| +### economics (runEconomics economics.go:117) |
| + |
| +- `economics` | runEconomics | WS | n/a | n/a | bare or unknown (incl `-h`) -> economicsUsage stderr, exit 2 (economics.go:118-134) | words: bill, backhaul. Comment at economics.go:107-116 states exit 2 for dispatch errors vs exit 1 for leaf validation (deliberate, must be kept). |
| +- `economics bill` | runEconomicsBill (economics.go:275) | leaf | none | std, ExitOnError | missing --month or --total (presence via fs.Visit) -> log.Fatal(economicsUsage) exit 1 | flags --month(YYYY-MM) --total(float) --line (repeatable serviceLines Service=usd) --console/-d. |
| +- `economics backhaul` | runEconomicsBackhaul (economics.go:190) | leaf | none | std, ExitOnError | | --period(mtd|last|7d) --console/-d. |
| + |
| +### edge (edge.Run internal/edge/edge.go:4579) |
| + |
| +- `edge` | Run -> RunWithActivator -> RunWithActivatorReady (edge.go:4602) | leaf | none (ignored) | std, ExitOnError, `_ = fs.Parse` (edge.go:4606-4614) | -h exit 0 | flags -registry -acme-cache -https -http -fallback -dev. Shared with `agent` (see its row). |
| + |
| +### email (runEmail mail_cli.go:145) |
| + |
| +- `email` | runEmail | WS | n/a | n/a | bare or unknown (incl `-h`) -> emailUsage stderr, exit 1 (mail_cli.go:146-149,164-167) | words: enable, domains, status, events, test, credentials, rotate, pause, resume. pause/resume share ONE handler `runEmailPause(args, paused bool)`. |
| +- `email enable` | runEmailEnable (mail_cli.go:679) | leaf | none (ignored) | std, ExitOnError | | flags --app/-a --env-prefix --from --domain --timeout --account --account-id --registry(accountFlags) --console/-d. |
| +- `email domains` | runEmailDomains (mail_cli.go:787) | WS | n/a | n/a | bare/unknown -> emailUsage stderr exit 1 | words: add, rm|remove (alias). |
| +- `email domains add` | runEmailDomainsAdd (mail_cli.go:807) | leaf | `<domain>` exactly 1 AFTER flags | std | NArg!=1 -> Fatal(usage) | flags --app/-a --timeout --account --account-id --registry --console/-d. |
| +- `email domains rm|remove` | runEmailDomainsRemove (mail_cli.go:880), flagset "email domains rm" | leaf | `<domain>` 1 AFTER flags | std | | --app/-a --account --account-id --registry --console (plain, NO destination -d). |
| +- `email status` | runEmailStatus (mail_cli.go:974) | leaf | none (ignored) | std | | |
| +- `email events` | runEmailEvents (mail_cli.go:1060) | WS on args[0]=="push" else leaf | `push` word | n/a then std | not an error path: any other first word is simply parsed by flag (std stops, word ignored) | Hard case (3). Leaf flags --app/-a --account --account-id --registry --since --message --to -n --json --console/-d. |
| +- `email events push` | runEmailEventsPush (mail_cli.go:1175) | leaf | none | std, ExitOnError | --path and --off mutually exclusive | flags --app/-a --account --account-id --registry --path --off --json --console/-d. |
| +- `email test` | runEmailTest (mail_cli.go:1465) | leaf | none | std | `--to` lacking "@" -> Fatal(usage) | --app/-a --to + account/console. |
| +- `email credentials` | runEmailCredentials (mail_cli.go:1679) | WS | n/a | n/a | bare/unknown -> emailUsage stderr exit 1 | words: create, list, revoke. |
| +- `email credentials create` | runEmailCredentialsCreate (mail_cli.go:1697) | leaf | none | std | empty --name -> Fatal(usage) | --app/-a --name + account/console. |
| +- `email credentials list` | runEmailCredentialsList (mail_cli.go:1743) | leaf | none | std | | |
| +- `email credentials revoke` | runEmailCredentialsRevoke (mail_cli.go:1785) | leaf | none | std | empty --name -> Fatal(usage) | |
| +- `email rotate` | runEmailRotate (mail_cli.go:1819) | leaf | none | std | | --app/-a --finish + account/console. |
| +- `email pause` / `email resume` | runEmailPause(args, true|false) (mail_cli.go:1862); flagset "email pause"/"email resume" | leaf | none | std | | --app/-a + account/console. Two words, one handler with a bool. |
| + |
| +### env (RunEnv appconfig_cli.go:306) |
| + |
| +- `env` | RunEnv | WS | n/a | n/a | bare or unknown (incl `-h`) -> envUsage stderr exit 1 (appconfig_cli.go:307-310,331-334) | words: set, unset, list, environments, exec-delivery, sync, adopt, release, fork. |
| +- `env set` | runEnvSet (appconfig_cli.go:440) | leaf | `KEY=value ...` 1+ (free `k=v` words, parseKV) AFTER flags | std, ExitOnError | none -> usage exit 1 | flags --message --no-prompt, --app/-a, --environment/-e, accountFlagsWithRegistry (--account --account-id --registry), --console/-d. |
| +- `env unset` | runEnvUnset (appconfig_cli.go:506) | leaf | `KEY ...` 1+ | std | NArg==0 -> usage | same flags. |
| +- `env list` | runEnvList (appconfig_cli.go:560) | leaf | none | std | | |
| +- `env environments` | runEnvEnvironments (appconfig_cli.go:768) | leaf | none | std | | |
| +- `env exec-delivery` | runEnvExecDelivery (appconfig_cli.go:663) | leaf | ONE enum word: `file`|`off` when --environment is empty; `file`|`inherit` when --environment is set. `off` with --environment is a dedicated Fatal (appconfig_cli.go:691-696) | std, ExitOnError | NArg!=1 -> usage exit 1 | Hard case: the ALLOWED SET of the positional enum depends on a flag's value (--environment), so positional validation must run after flag parse. |
| +- `env sync` | runEnvSync (appconfig_cli.go:822) | leaf | none | std | | |
| +- `env adopt` | runEnvAdopt (appconfig_cli.go:1374) | leaf | none | std | missing --environment/--scope -> usage | flags --app --environment --scope --console. |
| +- `env release` | runEnvRelease (appconfig_cli.go:1404) | leaf | none | std | | --app --environment --console. |
| +- `env fork` | runEnvFork (appconfig_cli.go:1431) | leaf | none | std | | --app --from --to --scope --console. |
| + |
| +### errors |
| + |
| +- `errors` | runErrors (errors_cmd.go:28) | leaf | none (ignored) | std, ExitOnError | | flags --app/-a --since(24h) --until --source(log|edge|server|browser) --level(error|warn) --host --release --fp --set-level(error|warn) --console/-d --account --account-id. `--set-level` switches read->write mode. |
| + |
| +### explain |
| + |
| +- `explain` | runExplain (explain_cmd.go:47) | leaf with leading positional | `<code>` exactly 1 (free) before OR after flags | std after `ipLast(args)` (geo_cmd.go:95): if args[0] exists and does not start with "-" it is moved to the end | NArg!=1 -> fs.Usage() + os.Exit(2) (not log.Fatal); 404 -> stderr message + exit 1 | flags --app/-a --json --console/-d --account --account-id. Hard case (2): hand-rewritten argument order. |
| + |
| +### features (runFeatures features_cli.go:46) |
| + |
| +- `features` | runFeatures | WS | n/a | n/a | bare/unknown (incl `-h`) -> log.Fatal(featuresUsage) exit 1 | words: set, list. |
| +- `features set` | runFeaturesSet (features_cli.go:94) | leaf | `key=value ...` 1+ (free; `key=` clears) AFTER flags | std, ExitOnError | none -> Fatal exit 1 | flags --app/-a --message --no-prompt --console/-d --account --account-id. |
| +- `features list` | runFeaturesList (features_cli.go:129) | leaf | none (ignored) | std | | |
| + |
| +### fleets (RunFleets fleets.go:131) |
| + |
| +- `fleets` | RunFleets | WS (+ one nested inline check) | n/a | n/a | bare/unknown (incl `-h`) -> fleetsUsage stderr exit 1 (fleets.go:132-135,162-165) | words: create, boxes, add-box, rotate-token, tag-box, drain, detach-box, secrets-key, show, ls. |
| +- `fleets boxes add` | inline check fleets.go:141-146 then runFleetsManagedAdd (fleets_managed.go:86) | two-word WS: `boxes` requires `args[1]=="add"` else log.Fatal("usage: carlos fleets boxes add ...") exit 1 (also for bare `fleets boxes`) | `<fleet>` exactly 1 AFTER flags | std, ExitOnError (fleets_managed.go:87) | `NArg!=1 || boxes<=0` -> Fatal | flag --boxes (int) + account/console. |
| +- `fleets create` | runFleetsCreate (fleets.go:205) | leaf | `<name>` exactly 1 | std | Fatal(usage) if NArg!=1 or (not --managed and no --bucket) | flags --managed --region --size --boxes --bucket --account --account-id --console/-d. |
| +- `fleets add-box` | runFleetsAddBox (fleets.go:251) | leaf | `<fleet> <label>` exactly 2 | std | | |
| +- `fleets rotate-token` | runFleetsRotateToken (fleets.go:280) | leaf | `<fleet> <label>` exactly 2 | std | | |
| +- `fleets tag-box` | runFleetsTagBox (fleets.go:344) | leaf | `<fleet> <label>` exactly 2 | std | requires --tags | |
| +- `fleets drain` | runFleetsDrain (fleets.go:395) | leaf | `<fleet> <label>` exactly 2 | std | | |
| +- `fleets detach-box` | runFleetsDetachBox (fleets.go:424) | leaf | `<fleet> <label>` exactly 2 | std | | flag --terminated. |
| +- `fleets secrets-key` | runFleetsSecretsKey (fleets.go:568) | leaf | `<fleet> [<pubkey>]` 1 or 2; with --file only 1 | std | Fatal(keyUsage) | flags --account --file. |
| +- `fleets show` | runFleetsShow (fleets_managed.go:17) | leaf | `<fleet>` exactly 1 | std | NArg!=1 -> fs.Usage() then log.Fatal("fleets show: provide one fleet name") | |
| +- `fleets ls` | runFleetsList (fleets.go:457) | leaf | none (ignored) | std | | |
| + All fleets leaves: flagset name "fleets <verb>", ExitOnError, mostly `--account --account-id --console/-d` hand-registered; positionals must follow flags. |
| + |
| +### gate (runGate gate_cli.go:39) |
| + |
| +- `gate` | runGate | WS | n/a | n/a | bare/unknown (incl `-h`) -> log.Fatal(gateUsage) exit 1 | words: set, clear, list. |
| +- `gate set` | runGateSet (gate_cli.go:117) | leaf (shared gateFlags gate_cli.go:107) | none (ignored) | std, ExitOnError | empty -password given -> Fatal; password also readable from stdin | flags --app/-a --host --console/-d --account --account-id --password (presence via fs.Visit). |
| +- `gate clear` | runGateClear (gate_cli.go:181) | leaf | none | std | | gateFlags. |
| +- `gate list` | runGateList (gate_cli.go:194) | leaf | none | std | | gateFlags (--host accepted, unused). |
| + |
| +### geo |
| + |
| +- `geo` | runGeo (geo_cmd.go:35) | leaf with leading positional | `<ip>` exactly 1 (free) before or after flags | std after `ipLast(args)` | NArg!=1 -> fs.Usage() + os.Exit(2) | flags --app/-a --json --console/-d --account --account-id. |
| + |
| +### instance-* (internal/host, internal/instanceexec) -- systemd-exec'd, not human verbs |
| + |
| +- `instance-control` | host.RunInstanceControl (internal/host/claimstop_run.go:24) | F-then-W-ish (exact single-arg matches): `len(args)==1 && args[0]==` `--group-hairpin-verify-identity` | `--group-hairpin-install` | `--group-hairpin-reset` handled BEFORE any flag parse (claimstop_run.go:25-49); everything else -> instancectl.runWithClaim (internal/instancectl/server.go:294) | none | std, ExitOnError flagset "instance-control" with ZERO flags (server.go:295-297, `_ = fs.Parse`): any flag other than -h errors exit 2; non-flag words ignored | -h exit 0 | the three `--group-hairpin-*` are WORDS in flag clothing: exact-match, only when they are the sole arg; they must NOT be given to a flag parser. |
| +- `instance-exec` | instanceexec.RunExec (internal/instanceexec/exec.go:44) via parseExecArgs (exec.go:96) | leaf | `<role> <instance-id>` exactly 2; role enum from instancectl.ParseRole (names.go:52): run, gvisor-run, seed, sidecar, cmd, worker, tty (error text lists only run/seed/sidecar/cmd; `worker` needs --rootfs; ParseRole accepts `gvisor-run` too) | std, ExitOnError, `_ = fs.Parse` (exec.go:96-104) | NArg!=2 -> fs.Usage(), errUsage -> os.Exit(2); bad role -> log.Fatal exit 1 | flags --claim-reservation --rootfs --sandbox. Positionals AFTER flags. Enum positional. |
| +- `instance-exit` | instanceexec.RunExit (exit.go:33) via parseExitArgs (exit.go:63) | leaf | `<role> <instance-id>` exactly 2, same enum as instance-exec | std, ExitOnError | usage -> exit 2; other parse error: log.Print and RETURN (exit 0, "never fails the unit") | flags --run-dir --rootfs --sandbox. |
| +- `instance-stop` | instanceexec.RunStop (stop_linux.go:34) -> stopMain (stop_linux.go:47) | leaf, NO flag parsing | `[<main-pid>]` 0 or 1 (int); empty/0 args -> exit 0; >1 or non-integer -> stderr usage exit 2 | none (hand-checks len(args)) | non-linux build: prints "instance-stop: linux only", exit 2 (stop_other.go:11) | `-h` is NOT a flag here: "-h" is not an int -> usage, exit 2. |
| +- `instance-probe` | instanceexec.RunProbe (probe.go:116) | leaf | none (ignored) | std, ExitOnError, `_ = fs.Parse` | -h exit 0; always exits 0 otherwise (verdict is in stdout JSON) | flags --rootfs --sandbox. |
| + |
| +### instances (runInstances cli.go:574) |
| + |
| +- `instances` | runInstances | WS WITH A NON-ERROR DEFAULT: if args[0] is one of the words below -> that handler; ANY other first word (or none) falls to the bare LISTING flow, which std-parses flags and silently ignores non-flag words (cli.go:575-626) | | | `instances` bare = list THIS box's registry routes. `instances foo` = list (foo ignored, exit 0). `instances -h` -> listing's flagset -> usage exit 0. | words: enable, create, import, list, delete, door-key, set, update, set-upstreams, set-channel, set-environment, set-assets, set-pages, retry. Hard cases (3). NB `list` here (API records) is a DIFFERENT code path from the bare form (registry routes). |
| +- `instances` (bare list) | runInstances inline, flagset cli.go:626 | leaf | none (ignored) | std, ExitOnError | | flag --registry only. Prints HOST/APP/KIND/... table from the local registry. |
| +- `instances enable` | runInstancesEnable (instances_cli.go:63) | leaf | none | std, ExitOnError | missing --app or --domain -> Fatal(instancesEnableUsage) | flags --app/-a --domain --pool --channel/-c --regions --seed --private-storage + accountFlags + --console/-d. |
| +- `instances create` | runInstancesCreate (instances_cli.go:311) | leaf | none | std | missing --host -> Fatal(instancesRecordsUsage) | flags --message --no-prompt --app/-a --host --region --channel/-c --kind(instance|service|static) --environment/-e --scope --addr --health-path --health-status --account --account-id --console/-d --role --from --at --replicas --restore. |
| +- `instances import` | runInstancesImport (instances_import.go:116) | F-then-W-ish WS: `args[0]` is `commit`|`abort` -> runInstancesImportVerb(verb, args[1:]) (instances_import.go:117-120); else the import itself | `commit`/`abort` word first | leaf std, ExitOnError | missing --host/--file/--replaces -> fs.Usage() + exit 2 | flags --message --no-prompt --app/-a --host --file --replaces --environment/-e --verify --console/-d --account --account-id. Hard case (2)-ish: first word selects different code, otherwise flags. |
| +- `instances import commit|abort` | runInstancesImportVerb (instances_import.go:394), flagset "instances import <verb>" | leaf | none | std | missing --host -> usage, exit 2 | --app/-a --host --console/-d --account --account-id. |
| +- `instances list` | runInstancesList (instances_cli.go:758) | leaf | none | std | | --app/-a --match --health --console/-d --account --account-id. |
| +- `instances delete` | runInstancesDelete (instances_cli.go:796) | leaf | none | std | missing --host -> Fatal(usage) | --message --no-prompt --app/-a --host ... |
| +- `instances door-key` | runInstancesDoorKey (doorkeys_cli.go:127) | WS | n/a | n/a | bare/unknown -> log.Fatal(doorKeyUsage) exit 1 | words: create, list, revoke. |
| +- `instances door-key create` | runInstancesDoorKeyCreate (doorkeys_cli.go:144) | leaf | none | std | | --app/-a --label --console/-d --account --account-id. |
| +- `instances door-key list` | runInstancesDoorKeyList (doorkeys_cli.go:174) | leaf | none | std | | |
| +- `instances door-key revoke` | runInstancesDoorKeyRevoke (doorkeys_cli.go:213) | leaf | `<key-id>` exactly 1 (free) AFTER flags | std | empty or >1 -> Fatal(doorKeyUsage) | |
| +- `instances set` | runInstancesSet (instances_updates.go:96) | leaf with leading positional | `<host>`: BEFORE flags (leadingArg apps_swap.go:91, taken only if args[0] does not begin with "-") OR exactly 1 after flags | std after leadingArg | usage->exit 1 | flags --app/-a --updates --channel/-c --major --pin --size --console/-d --account --account-id. Host is lowercased. |
| +- `instances update` | runInstancesUpdate (instances_updates.go:216) | leaf with leading positional | `<host>` same as set | std after leadingArg | | flags --app/-a --fast-track + console/account. |
| +- `instances set-upstreams` | runInstancesSetUpstreams (instances_cli.go:839) | leaf | none (host is `--host`) | std | missing --host -> Fatal | --app/-a --host --addrs --health-path --health-status. |
| +- `instances set-channel` | runInstancesSetChannel (instances_cli.go:991) | leaf | none | std | needs --host and --channel | --app/-a --host --channel/-c. |
| +- `instances set-environment` | runInstancesSetEnvironment (instances_cli.go:1117) | leaf | none | std | needs --host and --environment (presence via flagWasSet; empty value legal = clear) | --app/-a --host --environment/-e --scope. |
| +- `instances set-assets` | runInstancesSetAssets (instances_assets.go:18) | leaf | `<host> <on|off>` exactly 2; second is a FIXED ENUM (on|off); both before or after flags | MANUAL interspersed loop (instances_assets.go:~27-37): fs.Parse(rest); take rest[0]; repeat | wrong count/enum -> Fatal(instancesSetAssetsUsage) exit 1 | flags --message --no-prompt --app/-a --console/-d --account --account-id. Not parseInterspersed itself, but identical logic (hand-copied); `--` quirk same. |
| +- `instances set-pages` | runInstancesSetPages (instances_pages.go:18) | leaf | `<host> <on|off>` (enum) | MANUAL interspersed loop (same copy) | Fatal(instancesSetPagesUsage) | same flags. |
| +- `instances retry` | runInstancesRetry (instances_cli.go:1212) | leaf with leading positional | `<host>` before flags (leadingArg) or exactly 1 after | std | | --message --no-prompt --app/-a + console/account. |
| + |
| +### ledger (RunLedger cli.go:3514) |
| + |
| +- `ledger` | RunLedger | WS | n/a | n/a | bare/unknown (incl `-h`) -> ledgerUsage stderr exit 1 | words: append, head, list, publish, blob, verify. |
| +- `ledger append` | runLedgerAppend (cli.go:3578) | leaf | `<ledger> <entry.json|->` exactly 2 (free; `-` = stdin) AFTER flags | std, ExitOnError | NArg!=2 -> Fatal(usage) | flags --app/-a --account --account-id --console/-d (ledgerAccountFlags: no --registry). |
| +- `ledger head` | runLedgerHead (cli.go:3626) | leaf | `<ledger>` exactly 1 | std | | |
| +- `ledger list` | runLedgerList (cli.go:3656) | leaf | none (ignored) | std | | |
| +- `ledger publish` | runLedgerPublish (cli.go:3705) | leaf | `<ledger>...` 1+ | std | NArg==0 -> Fatal | + --public(bool) --title. |
| +- `ledger blob` | runLedgerBlob (cli.go:3751) | leaf | `<ledger> <file>...` 2+ | std | NArg<2 -> Fatal | |
| +- `ledger verify` | runLedgerVerify (cli.go:3796) | leaf | `<ledger>` exactly 1 | std | needs --app --account(sqid) --url | no console used. |
| + |
| +### logs |
| + |
| +- `logs` | runLogs (logs.go:38) | leaf | none (ignored) | std, ExitOnError | | flags --app/-a --since(1h) --until --stream(app|platform|edge|release) --host --level --grep --field (repeatable) -n -f (single-letter primaries, no alias) --console/-d --account --account-id. `-f` and `-n` are claimed short primaries (cliflag.go:19-21). |
| + |
| +## 2. Hard cases |
| + |
| +### (1) A word that selects different code comes AFTER flags (or is peeled before flags in an order-sensitive way) |
| +- `channels digests [on|off]`: the on/off word only counts when FIRST (channels_digests.go:160-162 peels args[0] before fs.Parse). `digests --account-id x on` => `on` becomes a stray positional => usage Fatal at channels_digests.go:164. Dispatched from main.go:149-164. |
| +- `canary deploy` is the default: a flag or path first goes to deploy (canary.go:91-94). Sub-verb words only recognised as args[0]. |
| +- `env exec-delivery file|off|inherit`: the positional word follows flags AND its legal set depends on --environment (appconfig_cli.go:684-702). |
| +- `instances set-assets|set-pages <host> on|off`: positional enum word may appear before or after flags via a hand loop (instances_assets.go:~27-38, instances_pages.go:~27-38). |
| +- `billing <verb>`: verb word is args[0], but `--console` is registered before the verb switch (billing_cli.go:50-52); per-verb flags are registered in the case. |
| +- `instance-control`: `--group-hairpin-*` are exact-match words in flag form, checked before parsing (claimstop_run.go:25-49). |
| +- `instance-exec/instance-exit <role> <iid>`: enum role word is positional AFTER flags (exec.go:96-111, exit.go:63-80). |
| + |
| +### (2) One position can hold either a sub-command word or a free value (or positional arity changes meaning) |
| +- `canary [ls|list|rm|delete|deploy] | <artifact-path>...` (canary.go:79-95): first position is a verb OR a file path. |
| +- `instances [enable|create|...|retry] | (flags only)`: first position is a verb or nothing; an unknown word is silently ignored by the listing flow (cli.go:575-626, 626-631). |
| +- `channels [resign|digests] | (flags only)` in main.go:149-165: unknown first word flows into runChannels where std parsing stops at it and it is ignored. |
| +- `email events [push] | (flags only)` (mail_cli.go:1060-1063): any other first word is ignored by std parse. |
| +- `config destinations [verb | -flag]`: a first arg not starting with "-" is the verb (config_cli.go:80-83); a first arg starting with "-" means list. A destination NAME can never be first. |
| +- `channels resign [<app>] <channel>`: 2 positionals => (app, channel) only if --app unset (channels_digests.go:69-72). |
| +- `apps set <app> ...`, `apps show <app>`, `instances set <host>`, `instances update <host>`, `instances retry <host>`: leadingArg (apps_swap.go:91) lifts args[0] if it does not start with "-"; same value can also come via --app or as one positional after flags. `apps set` refuses two different names (apps_swap.go:100-114). |
| +- `geo <ip>`, `explain <code>`: ipLast (geo_cmd.go:95) moves a non-flag args[0] to the end. |
| +- `auth default [<url>]`: 0 = show, 1 = set (auth.go:1017-1054). `fleets secrets-key <fleet> [<pubkey>]` (fleets.go:577-593). `config destinations default [<name>]` (config_cli.go:561-603). |
| +- `deploy [<paths>...]`: ZERO positionals triggers a different mode (deploy.go:278). |
| +- `apps build-probe <path|->`: the sentinel `-` is a lone-dash non-flag (apps_buildprobe.go:~55). |
| + |
| +### (3) Dispatcher behaves differently for unknown words than "usage error" |
| +- `canary`: unknown -> deploy (canary.go:94). Exit code is whatever deploy does (usage Fatal if no paths). |
| +- `instances`: unknown -> bare listing, exit 0, word ignored (cli.go:623-631). |
| +- `channels`: unknown -> runChannels, ignored (main.go:158). |
| +- `email events`: unknown first word -> flags (mail_cli.go:1060-1065). |
| +- `config destinations`: no word / flag-first -> list (config_cli.go:80); unknown word -> error text on stderr exit 1 (via RunConfig, not log.Fatal) (config_cli.go:96). |
| +- `help`/`-h`/`--help` at top level: stdout, exit 0 (main.go:70). `db help|-h|--help` stdout exit 0 (db.go:69). `devbox help|-h|--help` stdout exit 0 (devbox_cli.go:297). All other dispatchers treat `-h` as an unknown word => usage on STDERR, exit 1 (e.g. accounts, apps, assets, auth, config, domains, email, env, features, fleets, gate, ledger, instances door-key) or exit 2 (top-level default, db unknown, devbox unknown, economics). |
| +- EXIT CODE SPLIT for "usage" at a dispatcher: exit 2 = main default (main.go:243), `db` (db.go:61,69), `economics` (economics.go:119,131), `devbox` (devbox_cli.go:293,307), `console` errors; exit 1 = accounts, apps, auth, config, email, env, fleets, ledger (Fprint stderr + os.Exit(1)) and assets, domains, features, gate, instances door-key, `apps source`, `fleets boxes` (log.Fatal(usage)); `billing`: log.Fatalf exit 1. |
| +- `auth *`: `-h` on a leaf returns ErrHelp, which RunAuth turns into "carlos auth <word>: flag: help requested" exit 1 (auth.go:100-108) rather than the usual exit 0; bad flags exit 1 not 2. `config destinations *` and `devbox *`, `billing *`: ErrHelp -> exit 0; bad flags: config 2, devbox 2, billing 1. |
| +- `instance-stop`: `-h` is an invalid pid -> exit 2. `instance-exit`: parse failures other than usage log and exit 0 (exit.go:35-40). |
| +- `adopt`/`agent`/`bootstrap`/`edge`: unknown flags -> exit 2 via ExitOnError; non-flag words ignored. |
| + |
| +### (4) Words dispatched via a map/slice instead of a switch |
| +- None in this a-l slice. All sub-verb dispatch is `switch` on a literal string (runInstances, runDomains, runAssets, runFeatures, runGate, runDB, runEmail*, RunEnv, RunAuth, RunConfig, configDestinations, RunApps, RunFleets, RunLedger, RunAccounts, runEconomics, runCanary, runDevbox.run, billing's switch). |
| +- Data-driven word sets inside leaves (not dispatchers): `ParseRole` (internal/instancectl/names.go:52, switch over Role consts: run, gvisor-run, seed, sidecar, cmd, worker, tty) used by instance-exec/instance-exit; `cliAliases` map (flags.go:20; internal/cliflag/cliflag.go:22) maps flag names to short flags; `destinationKeys` slice (config_cli.go) names destination keys used to register flags. |
| +- (`offlineVerbs`-style slices mentioned by the brief belong to other letters, e.g. `move`; none seen in a-l.) |
| + |
| +### (5) Flags parsed by the parent and passed down to children |
| +- `agent` -> `edge`: runAgent pre-parses -registry and -acme-cache with throwaway flagsets (agent.go:1640, 3731) and passes the SAME raw `args` to edge.RunWithActivatorReady which re-parses (agent.go:1188; edge.go:4606). The peek flagsets must list every edge flag (-registry -acme-cache -https -http -fallback -dev) or an unknown one ends the peek early. |
| +- `billing`: parent registers `--console` on the flagset before choosing the verb (billing_cli.go:50-52). |
| +- `consoleOption`/`destinationOption` (flags.go:41-56): `-d/--destination` writes the package-global `destinationFlag` during Parse; later `loadConfig`/`resolveMode` read it (`deploy` re-runs auth login on a moved console and relies on not wiping it, flags.go comments). A generic dispatcher that parses flags centrally must keep this side effect. |
| +- Shared flag-registrars called by children, not parents: appsLifecycleFlags (temporary.go:247) for apps ttl/keep/list; gateFlags (gate_cli.go:107) for gate set/clear/list; dbFlags (db.go) for db pull/query; destinationsFlagSet (config_cli.go:203) for all `config destinations *`; runDomainBuyVerb shares one flagset builder for check and buy; runEmailPause for pause/resume. |
| +- `instances` bare listing and `runChannels` are the parent's own flow (flags parsed for the "default child"). |
| +- `runInstancesImport` peeks args[0] for commit/abort BEFORE building its flagset (instances_import.go:117). |
| + |
| +## 3. Other notes a generic walker would trip on |
| + |
| +- Positionals after flags: with std parsing (the majority), `carlos apps delete myapp --account x` fails (the flag is treated as a positional); only parseInterspersed users (apps ttl/keep/list, config destinations *, devbox share/unshare/list, domains check/buy, temporary.go flows) and manual-loop users (instances set-assets/set-pages) accept them in either order. leadingArg users (apps set/show, instances set/update/retry) and ipLast users (geo/explain) accept a leading positional. |
| +- Hand-rolled loops duplicating parseInterspersed: instances_assets.go:~27-37 and instances_pages.go:~27-37. |
| +- Usage text conventions: ExitOnError leaves print `flagUsage(fs, header)` via fs.Usage; a dispatcher's own usage constants differ (e.g. `accountsUsage`, `appsUsage`, `fleetsUsage`, `emailUsage`, `envUsage`, `ledgerUsage`, `authUsage`, `configUsage`, `dbUsage`, `economicsUsage`, `domainsUsage`, `featuresUsage`, `assetsUsage`, `gateUsage`, `doorKeyUsage`, `sourcePullUsage`); some are printed to stdout on explicit help (db, devbox, top-level) and stderr elsewhere. |
| +- Some leaves read stdin (gate set password; ledger append `-`; domains buy prompt; fleets) or the terminal (deploy wizard, mutation message prompt): behaviour depends on TTY, not on the command words. |
| +- Handlers reached from main.go with different capitalisation (`RunApps`, `RunAuth`, ...) vs lowercase are only a naming accident; the exported ones are used by tests/other packages too. |
| +- Not examined (outside a-l / outside this brief): `ship`, `promote`, `restart`, `run`, `route(s)`, `ratelimit`, `remove`, `schedule`, `store`, `relay`, `steering`, `sidecars`, `services`, `secrets`, `skills`, `status`, `system`, `update`, `vet`, `version`, `pipeline`, `releases`, `proof`, `ops`, `move`, `protection`, `rollback`, `release-keygen`. |
| + |
| + |
| +# Part B |
| + |
| +# CLI dispatch audit B: commands m-z, pre-switch dispatch, docsite scanner, update hint |
| + |
| +Repo: .../platform/.claude/worktrees/design-cli-registry (read-only audit; nothing run). |
| +Paths are relative to the repo root. Line numbers are from this tree (main.go is 371 lines; the |
| +`switch cmd` is main.go:68-235, so the brief's "25-245" is approximate). |
| + |
| +Conventions used below |
| +- "std/ExitOnError": `flag.NewFlagSet(name, flag.ExitOnError)` + `fs.Parse(args)`. Go semantics: stops at the |
| + first non-flag argument (so flags after a positional become positionals); `-h`/`-help`/`--help` calls |
| + fs.Usage then exit 0; any bad flag exits 2; every `-x` may be written `--x`. Almost all leaves use this. |
| +- `log.Fatal(...)` exits 1 (the logger is wrapped by newErrorWriter, main.go:34). "usage->1" means log.Fatal(usage). |
| +- appFlag registers `--app` plus alias `-a`; consoleOption registers `--console` plus `--destination`/`-d` |
| + (flags.go:39-51); the alias table (internal/cliflag/cliflag.go:16) is app=a, channel=c, destination=d, |
| + environment=e, version=v. accountFlags registers `--account`, `--account-id`. |
| +- "NArg unchecked" = after fs.Parse the leaf never looks at fs.NArg()/fs.Args(), so stray positionals are |
| + silently ignored. |
| +- Every top-level verb that RETURNS normally (does not os.Exit / log.Fatal) falls out of the switch into |
| + maybeUpdateHint(cmd) (main.go:242, see section D). |
| + |
| +====================================================================== |
| +## B. Dispatched BEFORE the switch (main.go:25-66) |
| + |
| +Order in main() (main.go:25-66): |
| +1. main.go:26 `runtime.KeepAlive(execsandbox.ProtocolMarker)` (linker keepalive, no argv). |
| +2. main.go:30 `cgroup.RunShimIfRequested()` (internal/cgroup/shim.go:39). Sets shimHooked, then, only if |
| + len(os.Args) >= 2, `switch os.Args[1]`: |
| + - `__cgexec` (cgroup.ShimVerb, shim.go:21) -> `os.Exit(runShim(os.Args[2:]))` (shim_linux.go:394). Takes exactly 3 |
| + decimal fd numbers (keep, keep+1, keep+2, with keep>=3); anything else returns 125. Never reaches the |
| + logger. On non-linux runShim returns 127 (shim_other.go:16). The parent starts it with |
| + argv `carlos-cgexec __cgexec <keep> <keep+1> <keep+2>` (shim_linux.go:192) via /proc/self/exe, empty env. |
| + - `__cgprobe` (cgroup.ProbeVerb, shim.go:25) -> `os.Exit(runProbe())` (shim_linux.go:544): prints own cgroup |
| + path, exit 0/1; no args read. Non-linux returns 127. |
| + - any other os.Args[1] (including real commands): returns, main continues. |
| + No flags, no help, no usage. These two words are matched on os.Args[1] only. |
| +3. main.go:31 `rootaws.ScrubEnvironment()` then main.go:36 log.SetOutput(newErrorWriter(os.Stderr)). |
| +4. main.go:37-40 `len(os.Args) < 2` -> usage(os.Stderr), exit 2. |
| +5. main.go:41 `cmd, args := os.Args[1], os.Args[2:]`. |
| +6. main.go:42-50 `cmd == "__demo-snapshot"`: if len(args) != 0 -> log.Fatal(democlaim.ErrSnapshot) (exit 1); |
| + else democlaim.RunSnapshotWorker(ctx) (internal/democlaim/worker.go:13; refuses euid 0 with ErrSnapshot); |
| + error -> log.Fatal; success -> `return` from main (skips maybeUpdateHint). No flags. |
| +7. main.go:51-57 `cmd == "__registry-child"`: host.RunRegistryChild(args) (internal/host/registrychild_unix.go:87). |
| + Positionals: `<registry-path> <uid> <gid> [read-only]` (len 3, or len 4 with args[3]=="read-only"; else |
| + "registry: invalid child arguments"). No flags. Error -> log.Fatal (exit 1); success -> `return` (no hint). |
| + Non-unix returns an error (registrychild_other.go:14). |
| +8. main.go:58-65 (comment at 58-59): `__rootfs-check-probe` -> `os.Exit(runRootfsCheckProbe(args))` |
| + (ship_check_probe.go:65): ContinueOnError flag set (no SetOutput change; errors go to stderr), flags |
| + `--socket <path>` (required), `--timeout <dur>`; any parse error, missing --socket or any positional -> exit 2. |
| + `__rootfs-check-prepare` -> `os.Exit(runRootfsCheckPrepare(args))` (ship_check_probe.go:108): ContinueOnError, |
| + output discarded, flags `--dir <d>` (required) `--uid <n>` (required, >=0); parse error/positional -> exit 2; |
| + prepare failure -> message on stderr, exit 1. |
| +Note all four `__` words are plain `if cmd == "..."` statements, NOT cases of the `switch cmd`, so the docsite |
| +scanner never sees them (section C). `__cgexec`/`__cgprobe` are not even in main.go's own text. |
| + |
| +====================================================================== |
| +## A. Top-level commands m-z (main.go `switch cmd`) |
| + |
| +Entry format: path | handler (file:line) | dispatch style | positionals | flag parsing | bare/unknown-word behaviour | notes |
| + |
| +Pre-switch top-level arms that are not in m-z but affect all of them: unknown cmd -> `default:` main.go:235 |
| +usage(os.Stderr), exit 2, with NO message naming the word. `help|-h|--help` -> usage(os.Stdout), exit 0, extra |
| +args ignored (`carlos help ship` prints the general usage). |
| + |
| +### move (main.go:209; moveMain move.go:223; runMove move.go:107) |
| +runMove does `os.Exit(moveMain(...))`: it never returns, so maybeUpdateHint never runs for `move` (it is also |
| +not in noHintVerbs: irrelevant because of os.Exit). Exit codes: moveExit* consts move.go:56-61 |
| +(0 done, 1 error, 2 usage, 3 rolled, 4 waiting, 5 refused). ALL output (usage sentences, flag help) goes to stdout. |
| + |
| +Parse = parseMoveArgs (move.go:138-217): word-switch on args[0] BEFORE flags, but the word selects which flag |
| +SET is built (flag set differs per verb), then std flag.ContinueOnError parse, then a post-parse check. |
| +- `move [flags]` (no verb word, "request") | parseMoveArgs move.go:138, mutate path move.go:223+ | word-switch on args[0] in {status,cut,abort,resolve,offline}; anything else (including no args, a flag, or an unknown word) = implicit verb "request" | positionals none (any leftover -> "carlos move needs --host <host>." exit 2) | std ContinueOnError, output captured to a buffer; flags --host --app/-a --account --account-id --console (all verbs) + request: --to --manual-cut --no-wait | bare `move` -> request path -> "needs --host" (exit 2). `move -h` -> flag.ErrHelp -> flag help printed on stdout, exit 0 (move.go:226-228). Unknown word e.g. `move foo` -> request path, NArg>0 -> moveNeedsHost, exit 2 (misleading message) | `move --host h status` does NOT select status: the flag-first form makes "status" a stray positional. A generic "walk words then leaf" is fine but the DEFAULT child (request) must keep catching unknown words with this exact message. |
| +- `move status` | parseMoveArgs move.go:146 -> mover.status move.go:637 | word-switch | none | std ContinueOnError; verb flags: common + --wait | usage as above; unknown flag from another verb (e.g. `--to`) -> flag error text + defaults on stdout, exit 2 | requires --host. |
| +- `move cut` | move.go:146 -> m.mutate POST /cut | word-switch | none | common + --no-wait | as above | --wait is derived: `a.wait = !a.noWait` (move.go:213). |
| +- `move abort` | move.go:146 -> m.mutate DELETE | word-switch | none | common + --no-wait | as above | . |
| +- `move resolve` | move.go:146 -> m.mutate POST /resolve or m.declareLost move.go:893 | word-switch | none | common + --retry --declare-lost <box> --no-wait | needs exactly one of --retry / --declare-lost (post-parse checks move.go:196-205, messages moveNeedsRetry / moveRetryOrLost, exit 2) | . |
| +- `move offline <verb>` | parseMoveArgs move.go:144-150 -> mover.offline move.go:1493 | TWO-LEVEL word-switch: args[0]=="offline", then args[1] checked with `slices.Contains(offlineVerbs, args[1])` (slice `offlineVerbs` move.go:1005 = stage,start,seal,flip,open,finish,abort,status) | the offline verb word is an ENUM positional | std ContinueOnError on args[2:]; common flags, plus --to only for offline stage|start (move.go:171-174) | `move offline` with <2 args or unknown word: prints moveOfflineUsage (move.go:84) on stdout, returns "no offline verb", exit 2. Note `move offline -h` hits the same branch (usage, exit 2, not help-exit-0). | a.offline stays "" for non-offline verbs; `--to` is rejected on seal/flip/open/finish/abort/status (unknown flag). The offline verbs are dispatched inside m.offline by a.offline, so the registry must expose them as sub-commands, driven by a slice not a switch. |
| +- Phase-1 gate: for status/request/cut/abort/resolve the handler first GETs the status and refuses (moveNotEnabled, exit 5) if protocol != "phase1"; offline skips that (move.go:240-260). Also refuses euid 0 (moveAsRoot, exit 5) after parsing. |
| + |
| +### ops (main.go:205; runOps hostclaim_cli.go:35 -> internal/ops/ops.go:32 Run) |
| +- `ops` dispatcher | runOps hostclaim_cli.go:35 | word-switch with an ENV GATE: if env CARLOS_HOST_CLAIM is non-blank AND args[0]=="host" -> runOpsHost(args[1:]); otherwise boxops.Run(args) (so `ops host ...` with the env unset falls to boxops.Run -> "unknown verb host", exit 2) | - | - | see below | The word `host` exists only when the env var is set. A static registry cannot express this; it needs a runtime predicate. |
| +- `ops host resolve <host> (--declare-lost <box> | --readmit <box>) [--yes] [--console <url>]` | runOpsHost hostclaim_cli.go:92, parseHostResolve hostclaim_cli.go:43 | word-switch on args[0]=="resolve" (any other/no word -> error "usage: carlos ops host resolve ..." via log.Fatal, exit 1) | `<host>` free value (one; a second -> "unexpected argument") | MANUAL loop (hostclaim_cli.go:52-86): `--yes`, `--declare-lost V`/`--readmit V` (mutually exclusive, `--x` only, no single-dash form; value is next token), `--console V` and `--console=V`; any other token starting with "-" -> `unknown option`; first non-dash = host. Flags and the host can be interleaved in any order. | needs host + exactly one action. Single-dash `-yes` is NOT accepted (only the exact strings `--yes`, `--declare-lost`, `--readmit`, `--console`). |
| +- `ops litestream` | internal/ops/ops.go:93 runLitestream | word-switch (internal/ops/ops.go:38-54) | none, NArg unchecked | std ExitOnError, fs.Usage = cliflag.Usage | flags: --registry --data --bucket --prefix --region --out --litestream-bin --allow-shrink --memory-dropin; --bucket/--prefix required (log.Fatal) | . |
| +- `ops restore-verify` | ops.go:223 | word-switch | none, NArg unchecked | std ExitOnError | - | . |
| +- `ops hibernate-verify` | ops.go:267 | word-switch | none, NArg unchecked | std ExitOnError | - | . |
| +- `ops` bare/unknown/help | ops.go:32-54 | | | | bare (verb ""): usage() to STDERR then exit 2. `help`, `-h`, `--help`: usage() to stderr, exit 0 (falls out; in noHintVerbs). Unknown verb: `ops: unknown verb "x"` + usage to stderr, exit 2. | `ops` is in noHintVerbs. |
| + |
| +### pipeline (main.go:161; runPipeline pipeline.go:69) |
| +- `pipeline` | pipeline.go:69 | word-switch on args[0] in {init,set,add,remove,show} with DEFAULT = show: unknown first word or leading flag falls through to runPipelineShow(args) (pipeline.go:90) | none for show | see below | bare `pipeline` = show. `pipeline foo` -> runPipelineShow(["foo"]) -> NArg != 0 -> log.Fatal(pipelineUsage) (exit 1). So unknown word does error, but through the default child. | The word `show` is also accepted explicitly. Comment pipeline.go:63-68 states this is deliberate, same shape as `instances`. |
| +- `pipeline show` | runPipelineShow pipeline.go:246 | leaf | none (NArg != 0 -> usage->1) | std ExitOnError via pipelineFlagSet (pipeline.go:~113): --app/-a --account --account-id --console/--destination/-d; fs.Usage = flagUsage(fs, pipelineUsage) (every subcommand's -h prints the whole pipeline help) | . |
| +- `pipeline init --template edge-production|full-ladder` | runPipelineInit pipeline.go:285 | leaf | none; template is a flag whose value is an enum (pipelineTemplate) | std ExitOnError | bad/missing template -> log.Fatal(usage) | positional NArg unchecked. |
| +- `pipeline set --channel <n> [--bake --passkey --promote-approvals --change-approvals]` | pipeline.go:319 | leaf | none, NArg unchecked | std ExitOnError; uses fs.Visit for tri-state | missing --channel -> usage->1 | . |
| +- `pipeline add --channel <n> [--after <n>] [policy flags]` | pipeline.go:382 | leaf | none, NArg unchecked | std | - | . |
| +- `pipeline remove --channel <n>` | pipeline.go:437 | leaf | none, NArg unchecked | std | - | . |
| + |
| +### promote (main.go:111; runPromote cli.go:2941) |
| +- `promote [flags] <version> [channel]` | cli.go:2941 | leaf | `<version>` free, `[channel]` free optional (1 or 2 positionals, else usage->1). Channel may be omitted only in console mode (resolved via promoteChannel); in direct-bucket mode with no channel -> usage->1 | std ExitOnError; flags: --message --no-prompt (addMutationMessageFlags) --app/-a --hotfix --retry --account --account-id --console/--destination/-d | bare `promote` -> NArg 0 -> log.Fatal(usage) exit 1; `-h` -> help exit 0 | Positionals MUST come after flags (std parse). `promote 1.2.3 --app x` fails: --app becomes a positional and NArg is 3. |
| + |
| +### proof (main.go:203; runProof proof_cli.go:33) |
| +- `proof` dispatcher | proof_cli.go:33 | word-switch on args[0] in {history,keygen,get,put}, flag sets built inline per case | - | - | bare -> log.Fatal(proofUsage) exit 1. Unknown word, `-h`, `help` -> default log.Fatal(proofUsage), exit 1 (no help-exit-0) | . |
| +- `proof history <status|reconstruct|retire|resume> ...` | runHistory history_cli.go:27 -> historyCommandWithSave history_cli.go:47 | SECOND word-switch (history_cli.go:51-54: verb must be exactly status|reconstruct|retire|resume, else error historyUsage) | verb is an ENUM positional | std flag.ContinueOnError, output = stdout; flags --bucket (default env CARLOS_DEPLOYMENT_BUCKET) --box --enrollment --account --app --host --state --input --wait(dur) | all errors (including bad verb, no verb, leftover positional) -> log.Fatal(err) exit 1 EXCEPT flag.ErrHelp (swallowed, exit 0, history_cli.go:38) | per-verb field rules enforced by a single big boolean (history_cli.go:71); `--app` here is a plain fs.String (no -a alias). |
| +- `proof keygen [--out <file>]` | proof_cli.go:43 (inline) | word | none (NArg!=0 -> usage->1) | std ExitOnError, flagUsage | . |
| +- `proof get --app <a> --sha256 <hex> [--prover <name>] [acct flags]` | proof_cli.go:55 (inline) | word | none (NArg must be 0) | std ExitOnError | missing --app/--sha256 -> usage->1. |
| +- `proof put --app <a> <file>` | proof_cli.go:68 (inline) | word | `<file>` free path (exactly 1) | std ExitOnError | usage->1 | file after flags. |
| + |
| +### protection (main.go:147; runProtection protection_cmd.go:28) |
| +- `protection [--record-only on|off]` | protection_cmd.go:28 | leaf | none, NArg unchecked | std ExitOnError, flagUsage; --app/-a --record-only --console/-d --account --account-id | `--record-only` value is an enum (on|off|""), validated by protectionMode (protection_cmd.go:~68); bad value -> log.Fatalf exit 1. No `protection on`/`off` word form. | mode flag decides show vs set. |
| + |
| +### ratelimit (main.go:107; runRatelimit ratelimit_cli.go:79) |
| +- `ratelimit` | ratelimit_cli.go:79 | word-switch on args[0] in {show,set,clear}; fallthrough = log.Fatal(ratelimitUsage) | - | - | bare, `-h`, `help`, unknown -> log.Fatal(ratelimitUsage), exit 1 (no help-exit-0 at this level) | . |
| +- `ratelimit show` | ratelimit_cli.go:156 | word | none, NArg unchecked | std ExitOnError via ratelimitFlags (ratelimit_cli.go:~111), fs.Usage prints ratelimitUsage; flags --app/-a --host --console/-d --account --account-id | `ratelimit show -h` prints usage, exit 0 | . |
| +- `ratelimit set` | ratelimit_cli.go:371 | word | none, NArg unchecked | std; adds --busy-at --share --rate --burst (int) --path (repeatable pathFlags) --remove-path (repeatable) | - | . |
| +- `ratelimit clear` | ratelimit_cli.go:424 | word | none, NArg unchecked | std | - | . |
| + |
| +### relay (main.go:131; runRelay relay.go:83) |
| +- `relay` | relay.go:83 | word-switch on args[0] in {enable,status,disable,adopted,rotate,serve,keygen,-h,--help,help} | - | - | bare: relayUsage to STDERR, exit 2. `-h|--help|help`: relayUsage to STDOUT (fmt.Println), exit 0. Unknown word: relayUsage to stderr, exit 2 | . |
| +- `relay enable --app <a> [--regions r1,r2]` | relay.go:189 | word | none, NArg unchecked | std ExitOnError, flagUsage; --app/-a --regions --account --account-id --console/-d | . |
| +- `relay status --app <a>` | relay.go:222 | word | NArg unchecked | std | . |
| +- `relay disable --app <a>` | relay.go:248 | word | NArg unchecked | std | . |
| +- `relay adopted ...` | relay.go:274 | word | NArg unchecked | std | . |
| +- `relay rotate --region <r> ...` | relay.go:310 | word | NArg unchecked | std | . |
| +- `relay serve` | runRelayServe relay.go:116 | word | args IGNORED (`_ []string`, no parse) | none | what carlos-relay.service execs; handles SIGTERM/SIGINT via signal.NotifyContext. `relay serve -h` starts the server. |
| +- `relay keygen` | runRelayKeygen relay.go:149 | word | args IGNORED | none | prints one `<kid> <b64key> -` line. `relay keygen -h` mints a key. |
| + |
| +### release-keygen (main.go:201; runKeygen cli.go:3839) |
| +- `release-keygen [--scope rungs --name label --expires dur]` | cli.go:3839 | leaf | none, NArg unchecked | std ExitOnError, flagUsage; --scope --name --expires | `--name`/`--expires` without `--scope` -> log.Fatalf "only apply with --scope" (uses fs.Visit) | mode decided by flags (--scope present = scoped key, absent = ROOT key). In noHintVerbs. |
| + |
| +### releases (main.go:165-178; runReleases cli.go:3370) |
| +- `releases` dispatcher | main.go:165-178 (inline in main, NOT a function) | word-switch on args[0] in {retention,authorize} before any flag parse; anything else falls to runReleases(args) (default child = list) | - | - | `releases foo` -> runReleases(["foo"]): positional silently ignored, lists (or demands --app) | The dispatch lives inside main.go's case body, so a registry must replace it (and `channels`, same shape, main.go:149-160). |
| +- `releases [--app a]` (list) | cli.go:3370 | leaf | none, NArg unchecked (silently ignores `foo`) | std ExitOnError, flagUsage; --app/-a --account --account-id --console/-d | no app and no console -> usage->1 | . |
| +- `releases retention` | runReleasesRetention retention.go:22 | word (main.go:168) | none, NArg unchecked | std; --app/-a --keep --off --dry-run --account --account-id --console | combinations validated post-parse (log.Fatal) | . |
| +- `releases authorize [--app a] [--yes] <version> | <app> <version>` | runReleasesAuthorize releases_authorize.go:25 | word (main.go:172) | 1 positional `<version>` free; OR 2 positionals `<app> <version>` when --app is empty (releases_authorize.go:~38-41: pos[0] becomes the app) | std ExitOnError; --app/-a --account --account-id --yes --console | otherwise usage->1 | ONE POSITION CAN BE EITHER app OR version depending on count and on --app. |
| + |
| +### remove (main.go:89; runRemove cli.go:548) |
| +- `remove <host>` | cli.go:548 | leaf | `<host>` free (exactly 1, NArg != 1 -> log.Fatal("usage: carlos remove <host>")) | std ExitOnError; --registry | box-local; in noHintVerbs. |
| + |
| +### restart (main.go:115; runRestart restart.go:50) |
| +- `restart [--app a] [--host h] [--environment e] [--dry-run]` | restart.go:50 | leaf | none, NArg unchecked | std ExitOnError; --message --no-prompt --app/-a --host --environment/-e --dry-run --account --account-id --console/-d; fs.Usage = flagUsage(fs, restartUsage) | a flag given with an empty value (`--host ""`) is refused via flagWasSet (restart.go:~64-72) | route choice (whole app vs scoped door) depends on flags, not words. |
| + |
| +### rollback (main.go:179; runRollback cli.go:3422) |
| +- `rollback [flags] <channel>` | cli.go:3422 | leaf | `<channel>` free (exactly 1) | std ExitOnError; --message --no-prompt --app/-a --account --account-id --console/-d; fs.Usage = flagUsage(fs, usage) | NArg != 1 -> log.Fatal(usage) exit 1 | channel after flags. |
| + |
| +### route (main.go:91; runRoute cli.go:796-1507) |
| +- `route --host h ... | --app a ...` | cli.go:796 | leaf; MODE chosen by which flags are present (cli.go:~855-1507: --grant/--revoke, --hibernate, --backing, --unit, --tunnel, --replication, --channel/--environment) via fs.Visit | none, NArg unchecked | std ExitOnError; --registry --host --app/-a --account --account-id --channel/-c --environment/-e --grant --revoke --hibernate (tri-state via Visit) --backing --unit --tunnel --replication --allow-version-change --dry-run; flagUsage(fs, usage+...) | bare `route` -> goes through flag checks, then a usage log.Fatal (not verified in detail); `route foo` silently ignores foo | in noHintVerbs. Different modes of one verb are flag-selected: no word dispatch to preserve. |
| + |
| +### routes (main.go:97; runRoutes routes_cli.go:43) |
| +- `routes [--app a] [--match s]` | routes_cli.go:43 | leaf | none, NArg unchecked | std ExitOnError; --app/-a --match --console/-d --account --account-id; flagUsage(fs, routesUsage) | . |
| + |
| +### run (main.go:119; runRun run.go:864, parseRunArgs run.go:65) |
| +- `run --app a --instance h [--file p]... [--timeout d] [--follow id] [--idempotency-key k] [-it|--interactive] -- <argv>...` | run.go:864 | leaf with a SEPARATOR: the FIRST literal `--` in args (slices.Index, run.go:67) splits flagArgs from the tenant argv; everything after is argv, untouched | `argv...` after `--` are free values (the command to run); no positionals before `--` (NArg>0 -> errRunUsage) | std flag.ContinueOnError on args[:i] only, output stderr; flags --app/-a --instance --file (multiFlag, repeatable) --timeout (duration) --follow --idempotency-key -it and --interactive (bool, both registered; single-dash `-it` is a flag NAME "it") --account --account-id --console/-d | runRun (run.go:864-872): parse error: ErrHelp -> os.Exit(0); errRunUsage -> run usage on stderr exit 2; other errors -> message + run usage, exit 2. Always os.Exit (never reaches hint). | Hard case: `--` splitting happens BEFORE flag.Parse and flag values that equal `--` are impossible. Keep `--` handling in the leaf; a generic dispatcher must not strip `--` itself. |
| + |
| +### schedule (main.go:125; runSchedule schedule.go:67) |
| +- `schedule` | schedule.go:67 | word-switch on args[0] in {ls,set,rm,run}, before any flag parse | - | - | bare/unknown/`-h`/`help` -> log.Fatal(scheduleUsage), exit 1 | . |
| +- `schedule ls` | schedule.go:106 | word | NArg unchecked | std ExitOnError, flagUsage(fs, scheduleLsUsage); --app/-a --account --account-id --console | . |
| +- `schedule set --name n (--every d | --cron expr) --path /p` | schedule.go:125 | word | NArg unchecked | std; --app/-a --name --every --cron --path ... | . |
| +- `schedule rm --name n` | schedule.go:174 | word | NArg unchecked | std | . |
| +- `schedule run --name n` | schedule.go:198 | word | NArg unchecked | std | usage const scheduleRunUsage at schedule.go~60. |
| + |
| +### secrets (main.go:199; RunSecrets appconfig_cli.go:890) |
| +- `secrets` | appconfig_cli.go:890 | word-switch on args[0] in {set,unset,list,genkey,fingerprint} | - | - | bare: secretsUsage to stderr, exit 1. Unknown (incl. -h, help): secretsUsage to stderr, exit 1 | . |
| +- `secrets set KEY=value ...` | runSecretsSet appconfig_cli.go:1007 | word | one or more `KEY=value` free pairs (parseKV appconfig_cli.go:422: split on first `=`, empty key rejected, 0 pairs rejected) | std ExitOnError, flagUsage; --app/-a --environment/-e --account --account-id --registry (accountFlagsWithRegistry) --console/-d | pairs must follow all flags (std stop at first non-flag; a later `--x` would be treated as a pair and rejected by position without echoing it) | values are secrets: never echo. |
| +- `secrets unset KEY ...` | appconfig_cli.go:1208 | word | one or more free key names (NArg==0 -> usage->1) | std | same as above. |
| +- `secrets list` | appconfig_cli.go:1267 | word | none, NArg unchecked | std | . |
| +- `secrets genkey` | runSecretsGenkey appconfig_cli.go:1316 | word | args IGNORED, no flag set | none | `genkey -h` mints a key. Prints KEY/PUBKEY on stdout and notes on stderr. |
| +- `secrets fingerprint [--file path]` | appconfig_cli.go:1355 | word | none (NArg != 0 -> usage->1) | std | default file /etc/carlos/host.env. |
| + |
| +### services (main.go:195; RunServices services.go:87) |
| +- `services` | services.go:87 | word-switch on args[0] in {create,ls,rotate,revoke} | - | - | bare: servicesUsage stderr, exit 1. Unknown (incl. -h): servicesUsage stderr, exit 1 | `services` was not in the brief's list but starts with "s". |
| +- `services create --role r [flags] <name>` | services.go:159 | word | `<name>` free (exactly 1; NArg != 1 or empty --role -> usage->1) | std ExitOnError, flagUsage; --role (enum value checked via svcrole.Parse) --app/-a --rungs --commands --scope --account --account-id --console | name AFTER flags. |
| +- `services ls` | services.go:314 | word | none, NArg unchecked | std. |
| +- `services rotate <name>` | services.go:383 | word | `<name>` free (exactly 1) | std. |
| +- `services revoke <handle>` | services.go:432 | word | `<handle>` free (exactly 1; validServiceHandle) | std. |
| + |
| +### ship (main.go:109; runShip cli.go:2477) |
| +- `ship [flags] <files-or-site-dir>...` | cli.go:2477 | leaf | one or more free paths (NArg == 0 -> usage->1), EXCEPT `--rootfs` where the file list is not used; rootfs source comes from the flag and the ship branches into runShipRootfs(fs, ...) (ship_rootfs.go) passing the parsed FlagSet | std ExitOnError; huge flag set: --message --no-prompt --app/-a --account --account-id --console/-d --kind (binary|static, enum flag) --version/-v --target --capabilities --label --notes --notes-file --stateless --swap --assets (repeatable assetPathsFlag) --program-change --rootfs --processes --hibernate --jit --check --env (shipCheckEnvFlag, repeatable) | bare -> usage->1 | Hard case (5): the FlagSet is parsed by the parent and handed into runShipRootfs, and rootfs-only flags are refused elsewhere via shipRootfsOnlyRefusal(fs) using fs.Visit. Files must come after flags. |
| + |
| +### sidecars (main.go:95; runSidecars sidecars_cli.go:527) |
| +- `sidecars` | sidecars_cli.go:527 | word-switch on args[0] BEFORE any flag parse in {enable,create,ls,wake,rm,logs} | - | - | bare: log.Fatal(sidecarsEnableUsage) exit 1. Unknown: log.Fatalf `carlos sidecars: unknown subcommand %q` + usage, exit 1 (so `-h` gives this unknown-subcommand error, exit 1) | no bare default child (comment: "every word is required"). |
| +- `sidecars enable` | sidecars_cli.go:103 | word | NArg unchecked | std ExitOnError; fs.String("app") (NO `-a` alias here, plain fs.String) --args --placement --pool --channel (plain fs.String, no -c) --regions --idle --max-run --no-hibernate --console/-d --account --account-id | . |
| +- `sidecars create <name>` | :339 | word | `<name>` free (exactly 1, non-blank) | std | . |
| +- `sidecars ls` | :392 | word | NArg unchecked | std; --app --long ... | . |
| +- `sidecars wake <name>` | :436 | word | `<name>` exactly 1 | std. |
| +- `sidecars rm <name>` | :465 | word | `<name>` exactly 1 | std. |
| +- `sidecars logs <name>` | :492 | word | `<name>` exactly 1 | std; then REBUILDS an argv `-app A -host H [-console C] [-account X] [-account-id Y]` and calls runLogs(logsArgs) (sidecars_cli.go:~513-521) | Hard case (5)-like: the parent parses, then synthesises single-dash flags for another command's parser (runLogs). runLogs must keep accepting `-app`, `-host`, `-console`, `-account`, `-account-id`. |
| + |
| +### skills (main.go:163; runSkills skills.go:152) |
| +- `skills [--index url] [<name>]` | skills.go:152 | leaf | `<name>` OPTIONAL FREE value: 0 positionals -> list; >=1 -> prints that skill (only fs.Arg(0) used; extras ignored) | std ExitOnError, flagUsage(fs, skillsUsage); --index | no word set: any word (`help`, `list`, ...) is treated as a skill NAME and fetched. | Hard case (2): free-value in the first position, so a registry must not add child words to `skills`. |
| + |
| +### status (main.go:211; RunStatus cli.go:3945) |
| +- `status` | cli.go:3945 | leaf; MODE chosen by flags in priority order --instances > --layout > --live > --dry-run (cli.go:3957-3989) | none, NArg unchecked | std ExitOnError, flagUsage(fs, statusUsage); --dry-run <dir> --live --instances --account --layout --console/-d | no mode flag -> statusUsage to stderr, exit 1 | in noHintVerbs. |
| + |
| +### steering (main.go:123; runSteering instances_cli.go:944) |
| +- `steering --app a --host h latency|off` | instances_cli.go:944 | flags-then-word: std parse first, THEN `switch fs.Arg(0)` at instances_cli.go:957 with words `latency` -> "latency", `off` -> "" | positional is an ENUM {latency, off} | std ExitOnError; --app/-a --host --console/-d --account --account-id; flagUsage(fs, steeringUsage) | `*host == "" || NArg != 1` -> usage->1; other word -> usage->1 | Hard case (1). Word must come after flags and any other word is an error. |
| + |
| +### store (main.go:129; runStore store.go:111) |
| +- `store` | store.go:111 | word-switch on args[0] in {create,status,grant,rotate,apply,approvals,approve,decline,scan} | - | - | bare: storeUsage stderr, exit 1. Unknown: storeUsage stderr, exit 1 | . |
| +- `store create` | :168 | word | NArg unchecked | std ExitOnError; --app/-a --env-prefix --environment (storeEnvironmentFlag store.go:205) --account --account-id --console |
| +- `store status` | :257 | word | NArg unchecked | std |
| +- `store grant` | :287 | word | NArg unchecked | std |
| +- `store rotate` | :318 | word | NArg unchecked | std |
| +- `store apply` | :349 | word | NArg must be 0 | std |
| +- `store approvals` | :369 | word | NArg must be 0 | std |
| +- `store approve` | runStoreApprove :397 -> runStoreApproveWithSession :406 | word | NArg must be 0 (error `unexpected argument`) | std flag.ContinueOnError with output to stdout; --account --console | ErrHelp swallowed (exit 0); other errors -> log.Fatalf `store approve: %v` exit 1 | different error plumbing from siblings (returns an error). |
| +- `store decline` | :434 | word | NArg must be 0 | std ExitOnError |
| +- `store scan` | runStoreScan scan.go:61 | SECOND word-switch on args[0] in {request,status,grant,revoke,sweep,enforce,rotate-webhook-key} | - | - | bare / unknown: storeScanUsage stderr, exit 1 | . |
| + - `store scan request` scan.go:111 | word | NArg unchecked | std (via scanTarget scan.go:88); extra --plaintext --client-encrypted (exactly one required) |
| + - `store scan status` scan.go:134 | word | std |
| + - `store scan grant|revoke|sweep|rotate-webhook-key` | runStoreScanSimple scan.go:146 (verb passed in) | word | std via scanTarget (fs.String app uses appFlag; scanTarget scan.go:88 builds app/account/console flags AND calls fs.Parse) |
| + - `store scan enforce --app a on|off` | runStoreScanEnforce scan.go:169 | PRE-FLAG WORD EXTRACTION: scans the whole args slice for bare tokens `on`/`off` BEFORE flag parsing (scan.go:178-196), removing them, last one wins; then scanTarget parses the remainder | positional is an ENUM {on, off}, accepted ANYWHERE (before, between or after flags) | std ExitOnError on the leftover args | not seen -> log.Fatal("store scan enforce: say which ..."), exit 1 | Hard case (1). The takesValue skip-list (scan.go:182-185) protects only `--app/-app/--account/-account/--account-id/-account-id/--console/-console` followed by a separate token. It does NOT include `-a` (the alias) or `-d`/`--destination`, so `-a on` (an app named "on") is eaten as the switch today. The forms `--app=on` are safe (single token). Must be preserved byte-for-byte or deliberately fixed. |
| + |
| +### system (main.go:207; runSystem system.go:62; systemVerb system.go:~48) |
| +Dispatcher: systemVerb(args) (system.go:46-60): (1) if args[0]=="router" it is dropped (an optional COMPONENT word; `component` is returned but runSystem ignores it: `verb, rest, _ := systemVerb(args)`); (2) if len(args)==0 -> verb ""; (3) word-switch on args[0] against the long list in the `case` at system.go:51-52: runsc-ensure, exec-sandbox-allows-prev, group-maintenance, demos, managed-fleets, files, guard-arm, guard-exec, journal-migrate, floor-allows-prev, update, status, rollback, cancel-activation, apply, antivirus, pdf, layout, geoip, seeds-floor, legacy-routes, lifetimes, hosts-used, box, group, install-channel, host-env, db-worker, named-units, help, -h, --help; (4) anything else -> verb "" with rest = args (so the "unknown verb" message reads rest[0]). |
| +runSystem (system.go:62-132): `default:` -> optional message line via systemUnknownVerbMessage (system.go:145: `system: unknown verb "x"` if rest non-empty; `system: no verb given` if only `router` was typed; nothing for bare `system`), then systemUsage() to stderr, os.Exit(2). `help|-h|--help` -> systemUsage() to stderr and RETURN (exit 0). Note `system router router update` -> unknown verb "router". |
| +Nothing is printed to stdout by the usage. `system` is in noHintVerbs. |
| + |
| +- `system update` | runSystemUpdate system.go:307 | word | none, NArg unchecked | std ExitOnError, flagUsage; --console/-d --channel (default stable; canary|stable, free string) --version --file --platform --spread --yes + the three release.*FloorOverrideFlag bools | `--file` requires `--version` (log.Fatal) |
| +- `system status` | system.go:505 | word | NArg unchecked | std; --console --channel |
| +- `system rollback` | system.go:600 | word | NArg unchecked | std; --console --channel(required) --yes + 3 override bools |
| +- `system cancel-activation` | runSystemCancelActivation system_activation.go:20 | word | NArg unchecked | std; --console --channel(required) --activation --yes |
| +- `system apply` | host.RunSystemApply internal/host/systemapply.go:116 | word | NArg unchecked | std ExitOnError, `_ = fs.Parse` ; --recover + rootfs-floor override | root only (euid check after parse) |
| +- `system antivirus <status|enable|disable|rotate-webhook-key>` | runSystemAntivirusVerb system.go:~700; leaf runSystemAntivirus system.go:719 | SECOND word-switch at system.go:709 (word BEFORE flags; the verb string is passed into the leaf) then `switch verb` at system.go:731 inside the leaf after flags | enum | std ExitOnError on rest[1:]; --console | bare: "system antivirus: no verb given" + systemUsage, exit 2; unknown (incl. -h, help): `system antivirus: unknown verb "x"` + usage, exit 2 | the verb is selected before flags; the post-flag `switch verb` is just a payload switch. NArg unchecked. |
| +- `system pdf [status]` | runSystemPDFVerb system.go:646 | word-switch at system.go:651 on rest[0] in {help,-h,--help (usage, exit 0 via return), status}; bare -> usage, exit 2; unknown -> usage, exit 2 | none (NArg != 0 -> fs.Usage + exit 2) | std ExitOnError on rest[1:]; --console | . |
| +- `system layout <status|migrate|revert>` | runSystemLayout system.go:813 | word-switch at system.go:819 (before flags) {help,-h,--help -> systemLayoutUsage on stderr, RETURN exit 0; status|migrate|revert}; bare -> usage exit 2; unknown -> `system layout: unknown verb "x"` + usage, exit 2 | enum | std ExitOnError on rest; --console --box --force --yes; flagUsage(fs, systemLayoutUsage) | the same FlagSet serves all three; `status` ignores --box/--force/--yes silently. |
| +- `system geoip <publish|status|off>` | runSystemGeoipVerb system_geoip.go:20 | word-switch at system_geoip.go:26 BEFORE flags | publish: `<file.mmdb>` free path (exactly 1, else fs.Usage + exit 2) | std ExitOnError on rest[1:]; publish: --console --force; fs.Usage = flagUsage(fs,"<file.mmdb>"); status: system_geoip.go:186 --console; off: :261 --console | bare: "system geoip: no verb given" + systemUsage, exit 2; unknown: `system geoip: unknown verb "x"` + usage, exit 2 | status/off: NArg unchecked. |
| +- `system demos ...` | runSystemDemos system_demos.go:19 | MANUAL, no flag package (see Hard cases). Grammar: `help|--help|-h` (exactly one arg, stdout, exit 0); `reports [resolve] [--console v] [--after v] [--limit v] [--id v]`; else `<verb> [on|off] [--host h] [--console c]` where verb in {status, serving, takedown, takedown-status} | positionals: verb word (enum), and for `serving` a required enum `on|off` (system_demos.go:35-41) | manual pairwise loop (system_demos.go:43-65): every option MUST be `--host V`/`-host V`/`--console V`/`-console V` as two tokens; `--host=V` is rejected; duplicates rejected; a trailing odd token rejected; empty args -> invalid | every error: systemDemosInvalid ("Check the command arguments. Run carlos system demos help.") to stderr, exit 2 (no usage text). `-h` only as the sole argument. | Hard case (1)(3): the verb is validated AFTER the flag loop (system_demos.go:69-83): status/serving forbid --host; takedown/takedown-status require a valid lower-case --host. Unknown verb words are only discovered after flag parsing (so `demos foo --bar` reports the same invalid message either way). |
| + - `system demos reports` | runSystemDemosReports system_demos.go:162 | word `resolve` optional (first arg only) | none | manual pairs; accepts `-key` and `--key` spelling (system_demos.go:177-182) for keys console|after|limit|id; `--key=V` rejected | invalid() -> stderr message, exit 2; runtime errors exit 1 (log.Print) | `resolve` requires --id and forbids --after/--limit; list forbids --id. |
| +- `system managed-fleets <show|set --file f.json>` | runSystemManagedFleets system_managedfleets.go:24 | word-switch (inline ifs) BEFORE flags | enum {show,set} | std ExitOnError on args[1:]; --console/-d --file | bare: usage to stderr, exit 2. `help|--help|-h`: usage to STDOUT, exit 0. Other word: log.Fatal(usage) exit 1 | `show` forbids --file; `set` requires it (post-parse check). |
| +- `system seeds-floor publish --min-release v` | runSystemSeedsFloorVerb system_seeds.go:14 | word (only `publish`; bare/other -> systemUsage, exit 2) | none (NArg!=0 -> fs.Usage exit 2) | std ExitOnError on rest[1:]; --console --min-release; NO fs.Usage set (stock Go usage) | . |
| +- `system legacy-routes assign --name n --to acct/app` | system_legacy_routes.go:20 | word (only `assign`; else systemUsage exit 2) | none | std; --console --name --to; no fs.Usage | . |
| +- `system lifetimes cutover [--no-wait]` | system_lifetimes.go:110 | word (only `cutover`) | none | std; --console --no-wait; no fs.Usage | . |
| +- `system hosts-used status` | system_hostsused.go:82 | word (only `status`) | none | std; --console; no fs.Usage | . |
| +- `system box role <box> <role> [--console c]` | runSystemBoxVerb system_roles.go:98 | word: rest[0]=="publish-record" -> host.RunSystemBoxPublishRecord(rest[1:]) (internal/host/boxpublish.go:317; std ExitOnError, NArg must be 0 else usage exit 2); else roleArgs (system_roles.go:80) | positionals: `role` word REQUIRED at rest[0], then `<box>` free, `<role>` free (validated server side; documented default|legacy|platform) | MANUAL: roleArgs allows only 3 positionals plus an optional trailing `--console V` / `-console V` pair (two tokens, nothing else; `--console=V` rejected) | any other shape -> systemUsage, exit 2 | positional-first grammar: NO std flag parse here; flags only at the very end. |
| +- `system group role <region> <role> [--console c]` | runSystemGroupVerb system_roles.go:115 | roleArgs | same as box | same. |
| +- `system install-channel [--policy p --identity i]` | host.RunSystemInstallChannel internal/host/installchannel.go:117 | word | none (NArg != 0 -> usage exit 2) | std ExitOnError | --policy and --identity must both be set or neither | root only. |
| +- `system host-env <write|seed> --deployment d --region r [--aws-region --kms-key --from --group --install]` | hostenv.RunSystemHostEnv internal/hostenv/cli.go:38 -> runHostEnv :60 | word (args[0] in {write,seed} else usage error) | none | PRE-SCAN of raw args for `--group`, `-group`, `--group=...`, `-group=...` (cli.go:39-45) to pick an SSM opener BEFORE the real flag.ContinueOnError parse (output discarded, cli.go:68-79) | any error -> message on stderr, exit 1 (usage errors too, exit 1 not 2) | Hard case (5)-like: a flag sniffed by a parent before the leaf parses it. |
| +- `system named-units install <file>` | host.RunSystemNamedUnits internal/host/unitops.go:96 | MANUAL: exactly 2 args, args[0]=="install" | `<file>` free path | none | else log.Fatal usage exit 1; root only | . |
| +- `system runsc-ensure` | host.RunSystemRunscEnsure internal/host/runscensure.go:22 | word | args must be empty (else log.Fatal(execsandbox.ErrConfig)) | none | . |
| +- `system exec-sandbox-allows-prev <path>` | host.RunSystemExecSandboxAllowsPrev internal/host/execsandboxfloor.go:41 | word | exactly 1, and it must equal the literal `/opt/carlos/carlos.prev` | none | else log.Fatal(ErrConfig) | . |
| +- `system group-maintenance <permit|revoke|status|apply|rollback | prepare --sha256 hex | help>` | host.RunGroupMaintenance internal/host/group_maintenance_verbs.go:54 (returns an int; runSystem does os.Exit on it) | word, parsed by maintenanceArguments :360: `prepare` takes --sha256 via std flag.ContinueOnError; other verbs require len(args)==1 | enum | help (exactly one arg) -> stdout, exit 0; any bad shape -> help text to stderr, exit 2; runtime failure exit 1 | stdin/stdout/stderr passed in. |
| +- `system files seed [--host h]` | host.RunSystemFiles internal/host/claimfilesseed_command.go:49, parseFilesSeed :28 | word (args[0]=="seed" else hostbox.ErrUnsupported) | none | std ContinueOnError, output discarded | errors -> log.Printf + os.Exit(1) (2 if incomplete) | . |
| +- `system guard-arm` | host.RunSystemGuardArm internal/host/guardarm.go:23 | word | none | std ExitOnError, `_ = fs.Parse`; --console --policy --identity --enrollment | root only, missing -> log.Fatal(hostfloor.ErrFloor). |
| +- `system guard-exec <apply|recover|console <bin> [args...]|edge>` | host.RunSystemGuardExec internal/host/guardexec.go:27 | word-switch on args[0] (guardexec.go:~69-95); `console` takes a candidate path then passes the REST OF ARGV UNPARSED to that binary | enum + free tail | none | bare/unknown -> log.Fatal(hostfloor.ErrFloor) | this verb re-invokes the binary as `system apply [--recover]` or `agent` or <candidate> args: a registry must keep `system apply --recover` spelling valid. |
| +- `system journal-migrate [--window w]` | host.RunSystemJournalMigrate internal/host/claimjournal_migration.go:34 | word | none (NArg != 0 -> log.Fatal(ErrUnavailable)) | std ExitOnError, `_ = fs.Parse` | root only. |
| +- `system floor-allows-prev (--root <dir> | <abs> <abs>)` | host.RunSystemFloorAllowsPrev internal/host/movesfloorgate.go:62 | MANUAL: exactly 2 args; args[0]=="--root" or two absolute paths | free | none | else err -> stderr, exit 1. |
| +- `system db-worker` | dbreads.RunWorker internal/dbreads/worker_linux.go:21 | word | args must be empty (else `db-worker: takes no arguments`, exit 2) | none | non-linux: exit 2. |
| + |
| +### update (main.go:231; runUpdate update.go:203) |
| +- `update [-y]` | update.go:203 | leaf | none, NArg unchecked | std ExitOnError, flagUsage; `-y` only (single dash is the registered name; `--y` also parses) | refuses root/box env | in noHintVerbs. |
| + |
| +### vet (main.go:229; vet.Run internal/vet/vet.go:185) |
| +- `vet --app a --version v [--account sqid] [--boot]` | internal/vet/vet.go:185 | leaf | none, NArg unchecked | std ExitOnError, `_ = fs.Parse`; cliflag.String for --app/-a and --version/-v; --account (default ops account) --boot | missing app/version -> log.Fatal(vetUsage), exit 1; problems -> stderr, exit 1 | in noHintVerbs. Out-of-package: internal/vet registers aliases through the shared cliflag table. |
| + |
| +### version (main.go:71-83) |
| +- `version` / `version target ...` | inline in main.go:71-83 | word-switch (single `if len(args) > 0 && args[0] == "target"`) | - | - | `carlos version` prints `carlos <build>` and nothing else. Any other trailing words/flags (`version -h`, `version foo`) are silently ignored and also print the build. | in noHintVerbs because the Homebrew formula test asserts on its output. |
| +- `version target [flags] [<semver>]` | runVersionTarget cli.go:3208 | word | `<semver>` OPTIONAL free (0 = print, 1 = set; >1 -> usage->1) | std ExitOnError; --app/-a --account --account-id --console/-d, flagUsage | . |
| +- This is a nested dispatcher in main.go, not a function; the registry must own it. |
| + |
| +====================================================================== |
| +## C. internal/docsite CLI scanner |
| + |
| +File: internal/docsite/cliscan.go. API: `func TopLevelCommands(mainFile string) ([]string, error)`. |
| +What it extracts: parses the single file `mainFile` with go/parser (SkipObjectResolution; NOT type-checked), walks |
| +every `*ast.SwitchStmt` with ast.Inspect, keeps only switches whose Tag is a bare identifier named exactly `cmd` |
| +(`switch cmd {`), and for each `CaseClause` collects every expression that is a string BASIC LITERAL (strconv.Unquote'd). |
| +Filter isCommandWord: non-empty; every rune in a-z or `-`; first rune is not `-`. Duplicates removed; result sorted. |
| +Consequences: (a) it reads only main.go's `switch cmd`; (b) the pre-switch `if cmd == "__..."` words are invisible |
| +(also `_` and digits are rejected, so `__x` words could never pass); (c) `-h`/`--help` are dropped, `help` and |
| +`version` kept; (d) case expressions that are constants/identifiers/function calls are ignored (only literals); |
| +(e) sub-verbs are not seen (explicit doc comment, and the object-storage plan says so); (f) if `switch cmd` stops being a |
| +`switch` with tag `cmd` in main.go, it returns an empty slice and the tests fail. The scan is syntactic: renaming the |
| +variable or moving the dispatch to another file or a map/registry silently yields nothing/too little. |
| + |
| +Callers (grep of whole repo): |
| +- internal/docsite/cli_test.go:14 TestTopLevelCommandsReadsTheDispatch: asserts >= 20 commands, includes ship/promote/deploy/domains/logs/fleets, excludes "-h","--help","". |
| +- internal/docsite/cli_test.go:67 TestCLICommandsAreDocumented: every returned word needs a heading whose anchor is `Anchor("carlos "+cmd)` on the page slug `cli` (docs/site cli page; `mainFile = "../../main.go"`, cli_test.go:6). The test comment says a bare substring check was rejected on purpose. |
| +- internal/docsite/fences_test.go:75 TestFencedCarlosCommandsAreReal: the verb after `carlos` in every code fence on the docs site must be one of the returned words. |
| +- internal/parity/repo_test.go:59 TestParityCLITopLevel (`repoMain = "../../main.go"`): (i) every word MUST be the first word of some CLI member of a parity.tsv row, (ii) every CLI member's first word must be dispatched unless it starts with `__`. Plan docs/superpowers/plans/2026-11-09-parity-guard.md:164 and the spec say "unchanged, both directions, __ words shape-only". |
| +- Non-callers that read main.go as TEXT: canary_test.go:287 (`os.ReadFile("main.go")`, cuts at the literal `case "canary":` and then at the next `case "`, requires `runCanary(args)` in between and no "not implemented"); approved_moves_copy_test.go:1370 (main.go is in its file list for the copy gate); internal/provision/*_census_test.go entries ({"main.go","main","key-site","lit:instances,lit:sidecars", <sha256>}) pin a hash of main()'s declaration for the write-census, so any change to main() changes that hash and needs a census rebase/envelope update. |
| +- Prior design notes that already flag this dependency: docs/superpowers/specs/CODEX-FINDINGS-parity-guard.md:42 ("If that fallback replaces main's switch, it also requires updating the documentation scanner"), docs/superpowers/specs/2026-09-01-object-storage-virus-scanning-design.md:616. |
| + |
| +Also note: the usage() text in main.go (lines 260-371) is prose, hand-maintained, and not checked against the switch by this scanner; main.go:254 const moveUsageLine / moveUsageWrapped are referenced by approved_moves_copy_test.go copy gate. |
| + |
| +====================================================================== |
| +## D. maybeUpdateHint(cmd) (main.go:242; update.go:116) |
| + |
| +Placement: the last statement of main() after the switch (main.go, "After a verb that ran to success"). Reached only by |
| +verbs that RETURN. `help`/`-h`/`--help`, `version`, and every command that ends in os.Exit/log.Fatal never get there in a |
| +way that matters; `__demo-snapshot` and `__registry-child` `return` earlier so they skip it. |
| +What it uses `cmd` for: ONLY as a map key: `if noHintVerbs[cmd] || !interactiveTerminal() || !releaseBuild(version.Build) { return }` |
| +(update.go:117). `args` is not passed. noHintVerbs (update.go:67-72) = {edge, agent, adopt, bootstrap, add, remove, route, |
| +ops, status, vet, release-keygen, version, help, -h, --help, update, system}. Every other word (including future |
| +commands and the commands not in that list: instances, canary, devbox, ship, promote ...) is eligible. |
| +Then it additionally requires: no CARLOS_DEPLOYMENT_BUCKET / CARLOS_DEPLOYMENT_DIR, euid != 0, no CARLOS_NO_UPDATE_CHECK, |
| +config update_check != "off", and a ~/.carlos/update-check.json cache older than 24h; it then fetches the feed |
| +(1.5 s) and prints the hint to `stdout` via mutedf. So a registry needs a per-command "suppress update hint" attribute |
| +that reproduces exactly that set, and keys by the TOP-LEVEL word only (nested paths are not distinguished). |
| + |
| +====================================================================== |
| +## Hard cases |
| + |
| +### (1) A word that selects different code appears AFTER flags (or flags can precede the word) |
| +- steering: `latency|off` via `switch fs.Arg(0)` AFTER std flag.Parse: instances_cli.go:944 (parse), :957 (switch). Only flags before the word; the word must be the single positional. |
| +- store scan enforce: `on|off` is pulled out of args from ANY position BEFORE flag.Parse, last one wins: scan.go:169-196; the value-skip list scan.go:182-185 does not know the `-a` alias or `-d`/`--destination`, so `store scan enforce -a on` consumes `on` as the switch. (Byte-compat hazard.) |
| +- system demos: verb word first, but `serving` then requires `on|off` as the next token (system_demos.go:35-41), the flags are a manual pairs loop after it (system_demos.go:43-65), and the verb is only validated AFTER the loop (system_demos.go:69-83). `--flag=value` is rejected; every error is the single message systemDemosInvalid (exit 2). |
| +- system demos reports: word `resolve` only in position 0 of the rest (system_demos.go:164-167), keys accepted as `-k`/`--k` with a value token (system_demos.go:177-189). |
| +- system box role / system group role: positional-first grammar `role <name> <role>` and then at most `--console V` (system_roles.go:80-93). Not std flags. |
| +- system antivirus: `runSystemAntivirus(args, verb)` (system.go:719) is given the verb chosen at system.go:709 and then re-switches on it AFTER flags (system.go:731). The earlier brief cited system.go:651/709; in this tree 651 is `switch rest[0]` for `pdf` and 709 for `antivirus`, both BEFORE flags (word-first). The post-flag switch is at 731. |
| +- system layout: word chosen at system.go:819 before flags; then `if sub == "status"` after flags (system.go:~840). Same FlagSet for all three words. |
| +- system geoip (system_geoip.go:26): word-first; no post-flag word. |
| +- move: word first selects the flag SET (move.go:146-176), then std parse; flags BEFORE the verb word are not recognised (`move --host h status` = request with stray positional). Also `move offline <verb>` second word. |
| +- releases authorize: positional count decides whether the first positional is an app or a version (releases_authorize.go:~38). |
| +- run: `--` anywhere splits flags from the tenant argv before flag.Parse (run.go:66-69). |
| +- route, status, restart, protection, ship, release-keygen: behaviour selected by which FLAGS are present (mode by flag, not by word). A word-based registry should leave them as leaves. |
| + |
| +### (2) One position can hold either a sub-command word or a free value |
| +- pipeline: args[0] is a subcommand word {init,set,add,remove,show} OR (in practice) the start of flags for the default `show` (pipeline.go:69-90). No free value, but an unknown first word reaches `show` as a positional and dies there with pipelineUsage (exit 1). |
| +- releases: args[0] in {retention,authorize} OR flags for the default list (main.go:165-178); a stray word is silently ignored by the list. |
| +- channels (not m-z but same pattern): main.go:149-160. |
| +- version: `target` or ignored anything (main.go:71-83). |
| +- move: args[0] in {status,cut,abort,resolve,offline} OR flags for the implicit `request` (move.go:141-150). Unknown words fall into request and produce "needs --host". |
| +- skills: args[0] is a free skill NAME (or flags). No sub-commands may be added under `skills`. |
| +- releases authorize: `<app> <version>` vs `<version>`. |
| +- promote `<version> [channel]`, rollback `<channel>`, remove `<host>`, services create/rotate/revoke `<name|handle>`, sidecars create/wake/rm/logs `<name>`, secrets set `KEY=value`/unset `KEY`: free values after flags; they never share a position with a word, but they are why "walk words, hand the rest to leaf" must stop at the first non-word. |
| +- ops: `host` exists only when env CARLOS_HOST_CLAIM is non-blank (hostclaim_cli.go:35-41). |
| +- system: optional component word `router` (system.go:46-49) that is stripped before the verb. |
| +- store scan enforce: `on`/`off` mixed with flags. |
| + |
| +### (3) Unknown words that do NOT produce a usage error |
| +- Silently ignored stray positionals (NArg unchecked): version (anything after, including `-h`), releases, releases retention, protection, restart, route, routes, status, update, vet, release-keygen, ratelimit show/set/clear, relay enable/status/disable/adopted/rotate, relay serve, relay keygen, secrets list, secrets genkey, services ls, schedule ls/set/rm/run, sidecars enable/ls, store create/status/grant/rotate, store scan request/status/grant/revoke/sweep/rotate-webhook-key, pipeline init/set/add/remove, ops litestream/restore-verify/hibernate-verify, system update/status/rollback/cancel-activation/apply/antivirus */geoip status|off/layout, and `help <anything>`. |
| +- Unknown word falling into a default child: pipeline (-> show), releases (-> list), move (-> request, "needs --host"), skills (-> treated as skill name), `version` (prints build). |
| +- Unknown top-level command: `default:` usage to stderr, exit 2 with no mention of the word (main.go:235). |
| +- Unknown at sub-level but exit 1 instead of 2 (inconsistent): proof, ratelimit, schedule, sidecars (with message), secrets/services/store/store scan (usage to stderr, exit 1), system managed-fleets unknown word (log.Fatal, exit 1). Exit 2: ops, relay, system*, move, run, flag errors from the flag package. |
| +- No -h at word level: proof, ratelimit, schedule, sidecars, secrets, services, store treat `-h`/`help` as an unknown word (usage + exit 1; sidecars adds `unknown subcommand "-h"`). Help-exit-0: relay (stdout), ops (stderr, exit 0), system (stderr, exit 0), system pdf/layout/managed-fleets/demos/group-maintenance (see above), flag leaves (ExitOnError, usage on stderr, exit 0), move (-h on a verb only: stdout, exit 0). |
| +- system antivirus / system geoip unknown verb -> message + exit 2; system seeds-floor / legacy-routes / lifetimes / hosts-used with a wrong word -> bare systemUsage (no message), exit 2. |
| + |
| +### (4) Words dispatched via map/slice, not switch |
| +- `offlineVerbs` slice (move.go:1005, used at move.go:145 with slices.Contains; also iterated by move_test.go:1712): stage, start, seal, flip, open, finish, abort, status. |
| +- scan.go:182 `takesValue` map of flag spellings (not words) used by enforce. |
| +- update.go:67 `noHintVerbs` map keyed by top-level cmd. |
| +- system.go:51-52: the long `case` string list in systemVerb is a switch case list, but it is the only place that decides which words are "system verbs" (the arms in runSystem are a second, separate switch: the two lists must be kept in sync; a verb in the first list but missing in the second falls to `default`). |
| +- store/relay/secrets/services/sidecars/schedule/ratelimit/proof/pipeline all use real `switch`, no maps. |
| +- svcrole.Parse and pipelineTemplate (pipeline init --template) validate enum FLAG values via helpers, not dispatch. |
| +- internal/docsite scanner reads only literal case strings (section C). |
| + |
| +### (5) Flags parsed by the parent and passed (or re-synthesised) for children |
| +- sidecars logs: parses --app --console --account --account-id then builds `[-app A -host H -console C -account X -account-id Y]` and calls runLogs (sidecars_cli.go:~513-521). |
| +- ship: parent parses the big FlagSet then calls runShipRootfs(fs, rootfsShipOpts{...}) with the same FlagSet for fs.Visit refusals (cli.go:~2503-2520; shipRootfsOnlyRefusal(fs), shipEnvRefusal(fs, ...)). `--env` is refused before anything else. |
| +- pipeline: every subcommand builds its set via the shared pipelineFlagSet (pipeline.go:~113) whose Usage prints the SHARED pipelineUsage block (so -h on any subcommand explains all). |
| +- store scan: scanTarget (scan.go:88) builds app/account/console flags into the CALLER's FlagSet, parses, validates, opens the session and resolves account/app; leaves only add their own flags BEFORE calling it (request adds --plaintext/--client-encrypted). |
| +- ratelimit: ratelimitFlags (ratelimit_cli.go:~111) shared by show/set/clear. |
| +- system host-env: raw-args scan for `--group`/`-group`/`--group=` BEFORE the real parse (hostenv/cli.go:39-45). |
| +- system guard-exec: re-execs the candidate binary with a constructed argv (`system apply [--recover]`, `agent`, or user args after `console <bin>`) (guardexec.go:~69-95). |
| +- move: one parseMoveArgs builds a different flag set per verb (move.go:152-176) and checks cross-flag rules after parse. |
| +- run: parseRunArgs splits at `--` first. |
| +- Global/destination: consoleOption (flags.go:39) registers --console AND --destination/-d on each leaf's own FlagSet; the value lands in the package-level destinationFlag read later by loadConfig; there is no global pre-parse of argv (the only os.Args reads are main.go:37/41 and cgroup/shim.go:41-46). So a generic dispatcher must not consume any flag; each leaf still declares them. |
| + |
| +### (6) Other things a generic "walk words then hand the rest to the leaf" dispatcher would break |
| +- Exit codes and output streams differ per level (stdout vs stderr usage, exit 0/1/2) as listed above; every bare/unknown/-h behaviour is part of the contract. |
| +- Std flag parsing stops at the first non-flag, so positionals-before-flags invocations (`promote 1.2.3 --app x`, `secrets set K=v --app x`, `services create name --role r`, `ship file --app a`, `rollback chan --app a`) already do not work; do not "fix" by interspersing, and do not intersperse in a generic parser either. No leaf in my scope uses an interspersing/reorder helper; the only hand-rolled parsers are ops host resolve (hostclaim_cli.go:52), system demos (system_demos.go:43), system demos reports (system_demos.go:170), roleArgs (system_roles.go:80), floor-allows-prev, named-units, store scan enforce's pre-extraction. |
| +- Single-dash vs double-dash: Go flag accepts both for every std flag; the manual parsers accept only the exact spellings listed (e.g. ops host resolve takes `--declare-lost` but not `-declare-lost`; demos accepts `--host`/`-host` only as two tokens). |
| +- Dispatch happens inside main.go bodies for `version`, `channels`, `releases` (not in a function) and inside `maybeUpdateHint` by top-level word. |
| +- `ops host` is conditional on an environment variable; `ops` falls to `boxops.Run` otherwise. |
| +- Handlers that never return (os.Exit) skip maybeUpdateHint: move, run, relay serve (SIGTERM path returns), system group-maintenance; handlers that return normally trigger it for any cmd not in noHintVerbs. |
| +- Pre-switch words (`__demo-snapshot`, `__registry-child`, `__rootfs-check-*`, `__cgexec`, `__cgprobe`) must stay reachable before logging/env scrubbing (cgroup shim runs before rootaws.ScrubEnvironment and before log setup) and must stay invisible to the docsite scanner. |
| +- Not verified in this pass: exact `route` bare behaviour (cli.go:~855-1507 body) and the per-flag lists of relay adopted/rotate, ratelimit set, sidecars create/wake/rm, store grant/rotate/status beyond what is listed. |