plan: CLI registry step 1, plan review round 1 applied
Adds __drain-call; corpus isolation and determinism; projection and docsite move in Task 2; signature-keeping wrappers; replay per task; on-disk scratch. Round 1 findings beside the plan.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 files changed,
+130
−28
docs/superpowers/plans/2026-11-09-cli-registry-words.md+27 −26docs/superpowers/plans/CODEX-FINDINGS-cli-registry-words-plan.md+93 −0docs/superpowers/plans/CODEX-REVIEW-BRIEF-cli-registry-words-plan.md+10 −2
Intent
Human
<task-notification> <task-id>beb5am19l</task-id> <tool-use-id>toolu_01C6C43BzK4qsWPRJs5rxYUj</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/27979b8d-cc90-4f50-88f6-87ba41433627/tasks/beb5am19l.output</output-file> <status>completed</status> <summary>Background command "Wait for Astra plan review" completed (exit code 0)</summary> </task-notification>
diff --git a/docs/superpowers/plans/2026-11-09-cli-registry-words.md b/docs/superpowers/plans/2026-11-09-cli-registry-words.md| index 6eb2bb495..5de6afdf4 100644 |
| --- a/docs/superpowers/plans/2026-11-09-cli-registry-words.md |
| +++ b/docs/superpowers/plans/2026-11-09-cli-registry-words.md |
| @@ -18,7 +18,7 @@ |
| - No `init`-time tree: `commandRoot()` (`sync.Once`) is first called after `rootaws.ScrubEnvironment()` (A8). `Validate` runs only in tests. |
| - `cgroup.RunShimIfRequested()` stays `main`'s first statement with its `shimHooked` store (A9). |
| - Census: every file in the root binary's scope that changes is listed in the CLAIMS file in Task 9 (class: argument routing). |
| -- Tests: changed packages only, with `-run`, locally; CI runs the full suite. Root-package tests and anything binding sockets run with the Bash sandbox off and `TMPDIR=/tmp/g GOTMPDIR=/tmp/g GOFLAGS=-buildvcs=false` (`mkdir -p /tmp/g` first). Never set `GOCACHE`. |
| +- Tests: changed packages only, with `-run`, locally; CI runs the full suite. Scratch stays on disk, never in `/tmp` (shared RAM disk): use the session's `$TMPDIR`; the root package's `TestMain` already moves its temp root to `/var/tmp` (`main_test.go:35`). A package whose socket test fails only on path length may use a short directory under `/var/tmp`, removed afterwards. Root-package tests and socket tests run with the Bash sandbox off. Never set `GOCACHE`. **(plan R1-9)** |
| - Copy: no user-facing string changes in this step. AGENTS.md text added in Task 8 is agent-facing (no copy review). |
| - Commit subjects under 80 characters; end each message with `Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>`. |
| @@ -28,7 +28,7 @@ |
| 2. A default branch fed an unknown word (`instances foo`, `canary ./site`, `move --host h status`) must reach the same handler with the same args: Task 3 generates an unknown-word case for every branch. |
| 3. `system router ...` forms, including `system router` alone and `system router router`, must print today's messages: Task 7 adds them to the corpus explicitly. |
| 4. Handlers that `return` from `main()` before the update hint today must still skip it: Task 2's hint test runs every `NoUpdateHint` path. |
| -5. A test that calls an old dispatcher directly (`RunFleets`, `runDomains`, `RunApps`, `runDB`, `runSystem`, `runCanary`, `moveMain`) must keep passing unchanged: each conversion task keeps the function as a one-line wrapper over `clireg.Dispatch(subtree, args)` and runs that file's tests. |
| +5. A test that calls an old dispatcher directly (`RunFleets`, `runDomains`, `RunApps`, `runDB`, `runSystem`, `runCanary`, `configDestinations`, `moveMain`) must keep passing unchanged: each conversion task keeps the function with its exact signature (Tasks 4-7, item 2) and runs that file's tests. |
| --- |
| @@ -113,17 +113,22 @@ func ID(path []*Node) string // words joined with single spaces, root exc |
| **Interfaces:** |
| - Consumes: Task 1. |
| -- Produces: `commandRoot() *clireg.Node` (package main); `cgroup.Shims map[string]func([]string) int`; `maybeUpdateHint(path []*clireg.Node)`; every top-level command as a node. In this task every top-level command that has subcommands is a single leaf `Run: clireg.RawArgs(oldDispatcher)` with `Audience` set (Tasks 4-7 replace each with its subtree); top-level leaves that are true leaves (`ship`, `deploy`, `promote`, `restart`, `run`, `logs`, ...) are final here. |
| +- Produces: `commandRoot() *clireg.Node` (package main); `cgroup.Shims map[string]func([]string) int`; `maybeUpdateHint(path []*clireg.Node)`; `parity/cli.tsv` and `TestCLIProjection` (moved here from Task 8, **plan R1-5**); every top-level command as a node. In this task every top-level command that has subcommands is a single leaf `Run: clireg.RawArgs(oldDispatcher)` with `Audience` set (Tasks 4-7 replace each with its subtree); top-level leaves that are true leaves (`ship`, `deploy`, `promote`, `restart`, `run`, `logs`, ...) are final here. |
| -- [ ] **Step 1: Write `TestCommandTreeIsValid`** in `commands_test.go`: `clireg.Validate(commandRoot())` returns no errors. And `TestTopLevelWordsUnchanged`: the set of top-level names and aliases of `commandRoot()` equals exactly today's words (the `switch cmd` cases, the four `__` words before it, `cgroup.ShimVerb`, `cgroup.ProbeVerb`), written out as a literal list in the test. |
| +- [ ] **Step 1: Write `TestCommandTreeIsValid`** in `commands_test.go`: `clireg.Validate(commandRoot())` returns no errors. And `TestTopLevelWordsUnchanged`: the set of top-level names and aliases of `commandRoot()` equals exactly today's words (the `switch cmd` cases, the five `__` words before it: `__demo-snapshot`, `__drain-call`, `__registry-child`, `__rootfs-check-probe`, `__rootfs-check-prepare` **(plan R1-1)**, plus `cgroup.ShimVerb`, `cgroup.ProbeVerb`), written out as a literal list in the test. Re-read `main.go` at the branch tip for the list; do not copy it from the audit. |
| - [ ] **Step 2: Write `TestUpdateHintSkippedPerPath`**: for each of `edge agent adopt bootstrap add remove route ops status vet release-keygen version help update system`, `__demo-snapshot`, `__registry-child`, the path `Dispatch` would return has a node with `NoUpdateHint`; for `ship` and `apps list` it has none. Leave `channels resign`, `channels digests`, `releases retention` and `releases authorize` out here: Task 5 adds them when those subtrees exist. |
| - [ ] **Step 3: Run** `go test . -run 'TestCommandTree|TestTopLevelWords|TestUpdateHint' ` → FAIL. |
| - [ ] **Step 4: Implement** `cgroup.Shims` (keys `ShimVerb`, `ProbeVerb`; the probe wrapped as `func([]string) int { return runProbe() }`) and make `RunShimIfRequested` dispatch from it; add `TestShimsMapIsTheSwitch` in `internal/cgroup` asserting the map's keys equal `{ShimVerb, ProbeVerb}`. In package main, the two shim words are `Internal` leaves whose `Run` panics ("dispatched by cgroup before main"), built by ranging `cgroup.Shims`. |
| -- [ ] **Step 5: Implement `commandRoot()`** with: root `Fallback` = `usage(os.Stderr); os.Exit(2)`; `help` leaf (aliases `-h`, `--help`; `Audience: Customer`; `Run` prints `usage(os.Stdout)`); `version` branch with child `target` and `DefaultLeaf` printing the build id, `DefaultOn: OnAbsent|OnFlag|OnWord` (spec A3); `channels` and `releases` as leaves wrapping today's inline main.go bodies moved into functions `runChannelsTop(args)` and `runReleasesTop(args)` (Task 5 splits them); the `__demo-snapshot`, `__registry-child`, `__rootfs-check-probe`, `__rootfs-check-prepare` leaves (`Audience: Internal`, bodies moved verbatim from main.go; the two `os.Exit` ones keep exiting); `NoUpdateHint` on today's `noHintVerbs` words plus `__demo-snapshot` and `__registry-child`. |
| +- [ ] **Step 5: Implement `commandRoot()`** with: root `Fallback` = `usage(os.Stderr); os.Exit(2)`; `help` leaf (aliases `-h`, `--help`; `Audience: Customer`; `Run` prints `usage(os.Stdout)`); `version` branch with child `target` and `DefaultLeaf` printing the build id, `DefaultOn: OnAbsent|OnFlag|OnWord` (spec A3); `channels` and `releases` as leaves wrapping today's inline main.go bodies moved into functions `runChannelsTop(args)` and `runReleasesTop(args)` (Task 5 splits them); the `__demo-snapshot`, `__drain-call` (`os.Exit(host.RunDrainCall(args, os.Stdout))`, used by `internal/host/hadrain_call_linux.go:31`), `__registry-child`, `__rootfs-check-probe`, `__rootfs-check-prepare` leaves (`Audience: Internal`, `Golden.Skip` "plumbing", bodies moved verbatim from main.go; the `os.Exit` ones keep exiting); `NoUpdateHint` on today's `noHintVerbs` words plus `__demo-snapshot` and `__registry-child`. |
| - [ ] **Step 6: Rewrite `main()`**: `runtime.KeepAlive(...)`, `cgroup.RunShimIfRequested()`, `rootaws.ScrubEnvironment()`, `log.SetOutput(newErrorWriter(os.Stderr))`, the bare-`carlos` check unchanged, `path := clireg.Dispatch(commandRoot(), os.Args[1:])`, `maybeUpdateHint(path)`. `maybeUpdateHint` returns at once when any node on the path has `NoUpdateHint`; the rest of its body is unchanged. |
| - [ ] **Step 7: Rewrite `TestCanaryIsDispatchedNotStubbed`** (`canary_test.go`) to look `canary` up in `commandRoot()` and assert it is runnable (Task 5 tightens it to "a branch with a `deploy` default"); move `canary_test.go:307`'s `noHintVerbs` read and `update_test.go:83`'s `maybeUpdateHint("ship")` to the path form. |
| -- [ ] **Step 8: Run** `go build . && go test . -run 'TestCommandTree|TestTopLevelWords|TestUpdateHint|TestCanary|TestUpdate' && go test ./internal/cgroup/` → PASS. |
| -- [ ] **Step 9: Commit** `cli: main dispatches from the command tree`. |
| +- [ ] **Step 8: Projection and top-level consumers, in this task (plan R1-5).** The `switch cmd` the docsite scanner reads is gone after Step 6, so in this same task: |
| + - write `TestCLIProjection` (package main, `cli_projection_test.go`): renders every entry of `clireg.Runnable(commandRoot())`, internal ones included, as `id audience effect scope tool flags enums` (the last five `-` in step 1), sorted by ID; fails if `parity/cli.tsv` differs; `-update` writes it. `Makefile` `parity-doc` becomes `go test -run '^TestCLIProjection$$' -update . && go run ./internal/parity/cmd/parity-doc`. Every later task that changes the tree runs `make parity-doc`. |
| + - `internal/docsite`: a reader `TopLevelNames(path string) ([]string, error)` returning the deduplicated **first word** of every projected ID whose audience is not `internal` (**plan R1-3**: branches such as `apps` have no ID of their own, only descendants); `TestCLICommandsAreDocumented`, `TestFencedCarlosCommandsAreReal` and the non-vacuity test (at least 20 names; `ship`, `promote`, `deploy`, `domains`, `logs`, `fleets` present; no `-h`, `--help`, `""`) read it from `../../parity/cli.tsv`. Delete `cliscan.go` and its tests. |
| + - `internal/parity`: `TestParityCLITopLevel` reads the same first words through `docsite.TopLevelNames` instead of `TopLevelCommands`, with today's rule (C5) unchanged; Task 8 replaces it with full paths. |
| + - One-off check (in the task report, not a test): `TopLevelNames` on the new file equals `docsite.TopLevelCommands("main.go")` run at `BASE`. |
| +- [ ] **Step 9: Run** `go build . && go test . -run 'TestCommandTree|TestTopLevelWords|TestUpdateHint|TestCanary|TestUpdate|TestCLIProjection' && go test ./internal/cgroup/ ./internal/docsite/ ./internal/parity/` → PASS. |
| +- [ ] **Step 10: Commit** `cli: main dispatches from the command tree`. |
| ### Task 3: The golden corpus (Astra per-task review) |
| @@ -138,8 +143,9 @@ func ID(path []*Node) string // words joined with single spaces, root exc |
| One JSON object per line: `{"case":"<id> | <kind>","argv":[...],"env":{...},"exit":N,"stdout":"...","stderr":"..."}`, sorted by `case`. (Spec E2 names `.tsv`; JSON lines is used because outputs span lines. Marked call.) |
| - [ ] **Step 1: Write the case generator** `goldenCases(root *clireg.Node) []goldenCase`: for every branch (by `clireg.Runnable`'s parents plus every node with children): bare (unless `Golden.SkipBare`), `help`, `-h`, `--help`, `zz-unknown`, `--zz-unknown-flag`; for every leaf and unnamed default: `-h`, `--zz-unknown-flag`; for every alias, the same cases with the alias spelling; for every transparent word, the parent's cases prefixed with it, plus the word alone and twice; for every `When` node, its cases with the switch on and off (`CARLOS_HOST_CLAIM=1` for `ops host`). Nodes with `Golden.Skip` produce one `skipped: <reason>` line instead. |
| -- [ ] **Step 2: Write the runner**: each case runs the binary with an empty environment plus exactly `PATH`, `HOME` and working directory (a fresh directory under `t.TempDir()`), `TMPDIR`, `LANG=C`, `HTTP_PROXY=HTTPS_PROXY=http://127.0.0.1:9` and the case's own variables; stdin empty, no terminal; 10-second limit, and exceeding it fails the test naming the case. Normalise stdout/stderr: strip `^\d{4}/\d\d/\d\d \d\d:\d\d:\d\d ` at each line start, replace the case's directory with `$DIR`. Run at most 8 cases at once. |
| +- [ ] **Step 2: Write the runner**: each case runs the binary with an empty environment plus exactly `PATH`, `HOME` and working directory (a fresh directory under `t.TempDir()`, symlinks resolved with `filepath.EvalSymlinks` before use), `TMPDIR`, `LANG=C`, `HTTP_PROXY=HTTPS_PROXY=http://127.0.0.1:9`, `CARLOS_DATA_DIR=<case dir>/data` (so `instances`' default listing and anything else under `dataDir()` never opens the machine's `/data/registry.db`, **plan R1-2**), and the case's own variables; stdin empty, no terminal; 10-second limit, and exceeding it fails the test naming the case. Normalise stdout/stderr: strip `^\d{4}/\d\d/\d\d \d\d:\d\d:\d\d ` at each line start, replace the case's directory with `$DIR`. Run at most 8 cases at once. |
| - [ ] **Step 3: Write `TestCLIGolden`**: with `-record`, build `-base` with `git archive <base> | tar -x -C <dir under $TMPDIR>` then `go build -o <dir>/carlos .` there (remove the dir after), run every case, write the file; without it, run every case against `sharedCarlos(t)` and report each case whose line differs (case, field, want, got), plus cases in the file the tree no longer generates and cases the tree generates that the file lacks. `testing.Short()` skips. |
| +- [ ] **Step 3b: Determinism and isolation (plan R1-2, R1-4).** `-record` runs every case twice and fails, naming the case, if the two runs differ; such a node gets `Golden.Skip` with the reason (known: `secrets genkey`, which prints fresh keys and ignores its arguments, `appconfig_cli.go:1316`). Nothing is normalised beyond the timestamp prefix and the case directory. Before recording, list every branch whose default absorbs an unknown word (Task 5's `instances`, `channels`, `releases`, `canary`, `move`, `pipeline`, `email events`, `version`) and check, by reading its default handler, that with the case environment it touches nothing outside the case directory; record the result in the task report. |
| - [ ] **Step 4: Verify it can fail**: record from the fork point, then run replay against a binary with one deliberate change (`usage` text edited) and see the failure name the cases; revert. |
| - [ ] **Step 5: Mark `Golden` skips** on the nodes whose bare form starts a daemon or touches the box (`edge`, `agent`, `adopt`, `bootstrap`, `instance-control`, `instance-exec`, `instance-exit`, `instance-stop`, `instance-probe`, `relay serve` when it exists, `system apply` and other root leaves when they exist, the shim words, `__` plumbing): `SkipBare` where `-h` and an unknown flag are still safe, `Skip` only where even those are not. Each with its reason. |
| - [ ] **Step 6: Record and replay**: record at `BASE`, replay → PASS with zero differences. Commit the file. |
| @@ -150,10 +156,10 @@ One JSON object per line: `{"case":"<id> | <kind>","argv":[...],"env":{...},"exi |
| Each of Tasks 4-7 does the same thing for its list of dispatchers, following that dispatcher's rows in the audit: |
| 1. In the dispatcher's package, write `<name>Command() *clireg.Node` (package main: unexported; other packages: exported, e.g. `host.SystemCommands() []*clireg.Node`) declaring every word the dispatcher (and its nested dispatchers) switches on: names, aliases (one child with an alias, spec A5), `Default`/`DefaultLeaf` and `DefaultOn` copied from today's behaviour, `Fallback` = today's `default:` arm moved verbatim (help words included), `OnError` = the parent's error mapping where one exists (spec B1 "Errors": `RunAuth`, `RunConfig`, `billing`, `devbox`, `accounts plan`), leaves `Run: clireg.RawArgs(handler)` or `RawArgsErr`, `Audience` per the parity row's status (`operator`, `box-local`, `internal`, else `customer`). |
| -2. Replace the top-level leaf from Task 2 with the subtree. Keep the old dispatcher function as a one-line wrapper `clireg.Dispatch(<name>Command(), args)` (spec A5 "Thin wrappers") when any test calls it; delete it otherwise. |
| -3. Whole-function dispatchers (`billing`, `move`, `devbox`): leaves are closures that re-prepend their word and call the old function unchanged (spec A5); the inner switch stays until its args step. |
| -4. Re-record the corpus from `BASE`: no existing line may change; new lines are the subtree's new cases. Add any explicit cases the task names. |
| -5. Run the package's existing tests (`-run` on the touched files' tests) and `TestCommandTreeIsValid`. |
| +2. Replace the top-level leaf from Task 2 with the subtree. When a test calls the old dispatcher, keep it with **its exact signature** **(plan R1-6)**: a `func(args []string)` entry becomes `clireg.Dispatch(<name>Command(), args)`; an entry that takes an injected writer or returns an error or exit code (`configDestinations(out io.Writer, args []string) error`, `config_cli.go:79`, and its tests in `config_cli_test.go`) keeps its body and contract, and the registry's leaves call it, not the other way round. Delete an old dispatcher only when nothing calls it. |
| +3. Whole-function dispatchers (`billing`, `move` incl. `moveMain`, `move.go:223`, `devbox`): leaves are closures that re-prepend their word and call the old function unchanged (spec A5); the inner switch stays until its args step. (Review Focus 5's `moveMain` therefore stays as it is.) |
| +4. Re-record the corpus from `BASE` (no existing line may change; new lines are the subtree's new cases, read and checked by the implementer), then **replay** it against the branch binary: `go test . -run '^TestCLIGolden$'` with zero differences **(plan R1-7)**. Add any explicit cases the task names. |
| +5. Run the package's existing tests (`-run` on the touched files' tests), `TestCommandTreeIsValid`, and `make parity-doc` (the projection changes as subtrees appear). |
| 6. Commit per dispatcher group, subject `cli: <area> words in the registry`. |
| ### Task 4: Apps, config and settings |
| @@ -187,22 +193,17 @@ Dispatchers: `edge` (leaf, `SkipBare`), `agent`, `adopt`, `bootstrap`, `add`, `r |
| ### Task 8: Parity projection and guard, docsite, AGENTS.md |
| **Files:** |
| -- Create: `parity/cli.tsv`, `cli_projection_test.go` |
| -- Modify: `internal/parity/repo_test.go` (replace `TestParityCLITopLevel`), `internal/parity/rules.go` (audience check), `internal/parity/rules_test.go`, `internal/docsite/cli_test.go`, `internal/docsite/fences_test.go`, `Makefile:43-44`, `parity/parity.tsv` (rows the full coverage demands), `docs/parity.md` (regenerated), `AGENTS.md`, `parity/README.md` |
| -- Delete: `internal/docsite/cliscan.go` and its tests |
| +- Modify: `internal/parity/repo_test.go` (replace `TestParityCLITopLevel`), `internal/parity/rules.go` (audience check), `internal/parity/rules_test.go`, `parity/parity.tsv` (rows the full coverage demands), `docs/parity.md` (regenerated), `AGENTS.md`, `parity/README.md` |
| **Interfaces:** |
| -- Consumes: `clireg.Runnable`, `commandRoot()`. |
| -- Produces: `parity/cli.tsv`, columns `id audience effect scope tool flags enums` (step 1 writes `-` in the last five); `parity.LoadCLI(path string) ([]CLIEntry, error)` with `type CLIEntry struct { ID string; Audience string; Tool string; Flags, Enums []string; Line int }`. |
| - |
| -- [ ] **Step 1: Write `TestCLIProjection`** (package main): renders `clireg.Runnable(commandRoot())` to the format above, sorted by ID, and fails if it differs from `parity/cli.tsv`; with `-update` it writes the file. Generate it. |
| -- [ ] **Step 2: One-off check (not a test):** the projection's top-level IDs with audience other than `internal` equal today's `docsite.TopLevelCommands("main.go")` output taken at `BASE` (run it there, paste both lists into the task report). |
| -- [ ] **Step 3: Write the guard tests** in `internal/parity`: `TestParityCLIPaths` (spec D2: every non-internal projected ID is some row's CLI member, every CLI member is a projected ID or a `__` word); `TestParityCLIAudience` (spec D5: a `customer` entry appears in at least one customer-status row; an outside entry only in outside-status rows); `TestParityMCPColumn` (spec D4: each row's `mcp` column equals the comma-joined `tool` values of its CLI members' entries, `-` counting as none). Fixtures in `rules_test.go`: a leaf's row removed while its parent's row remains fails; a row naming `apps source delete` fails; the three `status` rows (`status [--instances,--layout]`, `status [--live]` as `operator`, `status [--dry-run]` as `box-local`) with an `operator` entry pass; a `customer` entry only in an `operator` row fails; an `operator` entry in a `both` row fails. |
| -- [ ] **Step 4:** Run them against the real table; add or fix rows until they pass. A new customer row's status comes from the console (find the route or record `gap` with an existing package from `parity/packages.tsv`); list every added row in the task report. |
| -- [ ] **Step 5: Docsite:** `TestCLICommandsAreDocumented` and `TestFencedCarlosCommandsAreReal` read top-level names from `parity/cli.tsv` via a small reader in `internal/docsite` (top-level = ID without a space, audience not `internal`); the scanner's non-vacuity test becomes one on the file (at least 20 names; `ship`, `promote`, `deploy`, `domains`, `logs`, `fleets` present; no `-h`, `--help`, `""`). Delete `cliscan.go`. |
| -- [ ] **Step 6:** `Makefile` `parity-doc`: `go test -run '^TestCLIProjection$$' -update . && go run ./internal/parity/cmd/parity-doc`. Run `make parity-doc`; `docs/parity.md` regenerates. |
| -- [ ] **Step 7: AGENTS.md** (beside the parity rule): "A word that selects code is a `clireg` node in `commands.go` or its package's subtree, with its `parity/parity.tsv` row in the same branch. A leaf compares arguments only to its declared enum values, flag spellings or ordinary value checks, never to a word that picks different behaviour." Same sentence, shortened, in `parity/README.md`. |
| -- [ ] **Step 8:** Run `go test ./internal/parity/ ./internal/docsite/ && go test . -run 'TestCLIProjection|TestCommandTree'` → PASS. Commit `parity: CLI coverage from the command registry`. |
| +- Consumes: `parity/cli.tsv` (Task 2). |
| +- Produces: `parity.LoadCLI(path string) ([]CLIEntry, error)` with `type CLIEntry struct { ID string; Audience string; Tool string; Flags, Enums []string; Line int }`. |
| + |
| +- [ ] **Step 1: Write the guard tests** in `internal/parity`: `TestParityCLIPaths` (spec D2: every non-internal projected ID is some row's CLI member, and every CLI member, `__` words included, is a projected ID: an internal member must be a real internal entry, **plan R1-8**; negative fixture: a row naming `__does-not-exist`); `TestParityCLIAudience` (spec D5: a `customer` entry appears in at least one customer-status row; an outside entry only in outside-status rows); `TestParityMCPColumn` (spec D4: each row's `mcp` column equals the comma-joined `tool` values of its CLI members' entries, `-` counting as none). Fixtures in `rules_test.go`: a leaf's row removed while its parent's row remains fails; a row naming `apps source delete` fails; the three `status` rows (`status [--instances,--layout]`, `status [--live]` as `operator`, `status [--dry-run]` as `box-local`) with an `operator` entry pass; a `customer` entry only in an `operator` row fails; an `operator` entry in a `both` row fails. |
| +- [ ] **Step 2:** Run them against the real table; add or fix rows until they pass. A new customer row's status comes from the console (find the route or record `gap` with an existing package from `parity/packages.tsv`); list every added row in the task report. |
| +- [ ] **Step 3:** Run `make parity-doc`; `docs/parity.md` regenerates. |
| +- [ ] **Step 4: AGENTS.md** (beside the parity rule): "A word that selects code is a `clireg` node in `commands.go` or its package's subtree, with its `parity/parity.tsv` row in the same branch. A leaf compares arguments only to its declared enum values, flag spellings or ordinary value checks, never to a word that picks different behaviour." Same sentence, shortened, in `parity/README.md`. |
| +- [ ] **Step 5:** Run `go test ./internal/parity/ ./internal/docsite/ && go test . -run 'TestCLIProjection|TestCommandTree'` → PASS. Commit `parity: CLI coverage from the command registry`. |
| ### Task 9: Census, branch review, merge |
diff --git a/docs/superpowers/plans/CODEX-FINDINGS-cli-registry-words-plan.md b/docs/superpowers/plans/CODEX-FINDINGS-cli-registry-words-plan.md| new file mode 100644 |
| index 000000000..25214b3e7 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/CODEX-FINDINGS-cli-registry-words-plan.md |
| @@ -0,0 +1,93 @@ |
| +Reviewed `bd90fc84daf0e268ade4bedd02848a1b7f31d9d9`, round 1. No files changed, subagents spawned, or tests run. |
| + |
| +1. **P1 — Task 2 omits `__drain-call`.** |
| + |
| + The [plan’s inventory](docs/superpowers/plans/2026-11-09-cli-registry-words.md:118) counts four pre-switch words, and its implementation list omits the fifth: [main.go:53](main.go:53). This entry point is already used by [drainCallExec](internal/host/hadrain_call_linux.go:31). |
| + |
| + **Failure:** Replacing the if-chains as written makes drain children print top-level usage and exit 2 instead of returning their JSON response. |
| + |
| + **Fix:** Include `__drain-call` in the literal inventory and registry, preserving `os.Exit(host.RunDrainCall(args, os.Stdout))`, its internal classification, and appropriate corpus exclusion. Refresh the inventory against the requested tip. |
| + |
| + **Fault family:** Complete command enumeration and preservation of production plumbing. |
| + |
| +2. **P1 — Task 3’s `instances` cases can open the machine’s real registry.** |
| + |
| + The [generator and environment](docs/superpowers/plans/2026-11-09-cli-registry-words.md:140) do not isolate `CARLOS_DATA_DIR`; Task 5 explicitly adds `instances foo`. The default registry is `/data/registry.db` at [cli.go:51](cli.go:51). Unknown words reach [registry.Open](cli.go:626), which applies database settings and runs migrations at [registry.go:646](internal/registry/registry.go:646). |
| + |
| + **Failure:** On a machine with an accessible registry, recording or replaying can modify that database and capture machine-specific routes. Empty `HOME`, scratch cwd, and a closed HTTP proxy do not prevent this. |
| + |
| + **Fix:** Give these cases a fresh, isolated data directory through explicit case variables, with symbolic paths resolved and normalized consistently. Audit all absorbing-default cases for equivalent filesystem access; `SkipBare` alone does not cover unknown-word cases. |
| + |
| + **Fault family:** Test isolation from real host storage. |
| + |
| +3. **P1 — Task 8’s top-level projection drops branch commands.** |
| + |
| + [Task 8 Step 5](docs/superpowers/plans/2026-11-09-cli-registry-words.md:202) defines top-level names as projected IDs without spaces. However, `Runnable` projects leaves and unnamed defaults only. After conversion, `apps`, `domains`, and `fleets` have descendant IDs but no standalone runnable ID; their dispatchers are visible at [apps.go:151](apps.go:151), [domains_cli.go:95](domains_cli.go:95), and [fleets.go:131](fleets.go:131). |
| + |
| + **Failure:** The planned equality check and required-name fixtures fail. Removing those assertions would also remove heading coverage for these commands and reject valid fenced examples. |
| + |
| + **Fix:** Derive and deduplicate the first word of every non-internal projected ID. Preserve the existing heading and fence checks. |
| + |
| + **Fault family:** Documentation coverage preserved through the registry migration. |
| + |
| +4. **P1 — Task 3 cannot replay `secrets genkey` deterministically.** |
| + |
| + The [case generator](docs/superpowers/plans/2026-11-09-cli-registry-words.md:140) generates `-h` and unknown-flag cases for every leaf. [runSecretsGenkey](appconfig_cli.go:1316) ignores its arguments and prints newly generated keys. The prescribed normalization removes only timestamps and temporary paths. |
| + |
| + **Failure:** After Task 4, unchanged base and branch binaries produce different stdout for both cases, so replay fails. |
| + |
| + **Fix:** Explicitly mark this node skipped with the random-output reason, and check other argument-ignoring handlers before recording. Do not normalize away arbitrary output differences. |
| + |
| + **Fault family:** Deterministic compatibility evidence. |
| + |
| +5. **P1 — Task 2 removes the scanner’s input six tasks before migrating its consumers.** |
| + |
| + [Task 2 Step 6](docs/superpowers/plans/2026-11-09-cli-registry-words.md:123) removes `switch cmd`. The existing scanner recognizes precisely that switch at [cliscan.go:41](internal/docsite/cliscan.go:41). Its consumers remain until Task 8. |
| + |
| + **Failure:** From Task 2 onward, [TestTopLevelCommandsReadsTheDispatch](internal/docsite/cli_test.go:14) and [TestParityCLITopLevel](internal/parity/repo_test.go:57) fail. The targeted Task 2 command simply omits them. |
| + |
| + **Fix:** Introduce the projection and migrate existing top-level consumers in the same task that removes the switch. Keep full descendant coverage enforcement for Task 8, and regenerate the projection as subtrees migrate. |
| + |
| + **Fault family:** Passing checks at each migration boundary. |
| + |
| +6. **P2 — Tasks 4–7 need signature-preserving adapters beyond the blanket one-line wrapper.** |
| + |
| + The [wrapper rule](docs/superpowers/plans/2026-11-09-cli-registry-words.md:153) does not cover dispatchers that accept injected writers or return results. For example, [configDestinations](config_cli.go:79) accepts an `io.Writer` and returns `error`; [its tests](config_cli_test.go:27) require both. Review Focus also names `moveMain` for conversion, although [moveMain](move.go:223) accepts dependencies and returns an exit code, and the whole-function exception says to retain it. |
| + |
| + **Failure:** Literal wrappers lose output injection and return values, or conflict with the retained whole-function implementation. |
| + |
| + **Fix:** Restrict the one-line rule to compatible entry points. Specify adapters preserving writer, error, and exit-code contracts; explicitly retain `moveMain` and the other approved whole-function bodies. |
| + |
| + **Fault family:** Existing callable interfaces and error propagation. |
| + |
| +7. **P2 — Tasks 4–6 re-record the base without requiring branch replay.** |
| + |
| + The [shared task steps](docs/superpowers/plans/2026-11-09-cli-registry-words.md:155) require re-recording from `BASE` and checking unchanged existing lines, then run dispatcher tests and tree validation. They do not require replay. Task 7 eventually does. |
| + |
| + **Failure:** A changed branch exit code, stream, or message can survive several completed tasks: comparing recordings from the same base never executes the changed binary. |
| + |
| + **Fix:** Require `TestCLIGolden` replay after every conversion task, following recording and review of added cases. |
| + |
| + **Fault family:** Compatibility evidence must exercise the implementation under review. |
| + |
| +8. **P2 — Task 8 permits invented internal command paths.** |
| + |
| + [Task 8 Step 3](docs/superpowers/plans/2026-11-09-cli-registry-words.md:200) accepts any CLI member that is “a `__` word.” Spec D2 permits an actual internal early word, not every spelling with that prefix. |
| + |
| + **Failure:** A row naming `__does-not-exist` passes the proposed exception despite having no dispatcher. |
| + |
| + **Fix:** Resolve internal members against the enumerated internal entries too, or an exact registered early-word inventory. Add an invented internal word as a negative fixture. |
| + |
| + **Fault family:** Parity members must name real dispatched paths. |
| + |
| +9. **P2 — The prescribed scratch directory violates the shared-machine rules.** |
| + |
| + [Global Constraints](docs/superpowers/plans/2026-11-09-cli-registry-words.md:21) and [Task 7](docs/superpowers/plans/2026-11-09-cli-registry-words.md:185) prescribe `/tmp/g` for both temporary roots. The supplied machine instructions prohibit putting these builds and scratch files under the shared RAM-backed `/tmp`. |
| + |
| + **Failure:** Following the plan puts extracted repositories, binaries, and test scratch on that shared RAM disk. |
| + |
| + **Fix:** Use the existing on-disk `$TMPDIR`, retain the default Go cache, and remove task-created scratch afterward. |
| + |
| + **Fault family:** Shared-machine resource isolation. |
| + |
| +**NOT READY** |
| \ No newline at end of file |
diff --git a/docs/superpowers/plans/CODEX-REVIEW-BRIEF-cli-registry-words-plan.md b/docs/superpowers/plans/CODEX-REVIEW-BRIEF-cli-registry-words-plan.md| index 237c37413..866218566 100644 |
| --- a/docs/superpowers/plans/CODEX-REVIEW-BRIEF-cli-registry-words-plan.md |
| +++ b/docs/superpowers/plans/CODEX-REVIEW-BRIEF-cli-registry-words-plan.md |
| @@ -1,6 +1,6 @@ |
| -# Review brief: CLI registry step 1 (words) plan, round 1 of 3 |
| +# Review brief: CLI registry step 1 (words) plan, round 2 of 3 |
| -Repo carlos/platform, branch `cli-registry-words`, commit 493901dbdf0d22446abbe81248727427790aa0a6. |
| +Repo carlos/platform, branch `cli-registry-words`, commit COMMIT_SHA. |
| Under review: `docs/superpowers/plans/2026-11-09-cli-registry-words.md`. |
| Authorities (merged on main): `docs/superpowers/specs/2026-11-09-cli-registry-design.md` |
| rev 5 (approved by Paul 2026-11-09), its findings files, the dispatcher |
| @@ -19,6 +19,14 @@ code it names, and check every claim against that code. |
| - This plan is step 1 only (words). Arguments, metadata beyond |
| `Audience`, tool eligibility and `GoldenArgs` are steps 2-6. |
| +## Round 2 |
| + |
| +Earlier round: `CODEX-FINDINGS-cli-registry-words-plan.md` (round 1). |
| +First give one line per P1 and P2 from round 1: resolved, partly, or |
| +not. Carry every unresolved or partly resolved finding forward at its |
| +current severity, then add new findings. The verdict covers everything |
| +outstanding, earlier rounds included. Fixes are marked **(plan R1-N)**. |
| + |
| ## What to check |
| 1. Does the plan implement every step-1 item of spec F (and A, D, E1-E2, |