Repository navigation
refactor(cli): own shell completion behind new CLI parity goldens - #11662
Merged
Merged
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This was referenced Nov 16, 2026
Contributor
[Medium impact] The reviewed changes appear safe to merge; no blocking issue was established. SummaryMoves shell completion into REA-owned
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
Shell[Shell hook] --> Request["COMPLETE request"]
Request --> Adapter["completions.ts"]
Registry["Cli.toCommands"] --> Adapter
Adapter --> Candidates["completeWords"]
Candidates --> Encoding["formatCompletions"]
Encoding --> Shell
Goldens["CLI parity tests"] -. compare saved output .-> Adapter
Reviews (3) · Last reviewed commit: "test(cli): keep root help goldens stable..." · Reviewed by Greptile |
…he parity goldens
morluto
force-pushed
the
test/cli-parity-goldens
branch
from
November 16, 2026 02:42
b7a870c to
eb2e97c
Compare
This was referenced Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Capture the current CLI behaviour as parity goldens, then move shell completion off incur onto an REA-owned protocol module with the goldens unchanged. 81 cases run the compiled
reaand compare exit code, stdout and stderr with reviewed files intests/fixtures/cli-parity/. This PR carries #11665 (collapsed into it). Refs #11654, refs #10583.Problem and expected behavior
#11654 replaces incur's parser, help, completions, formatter, errors and dispatch with REA-owned modules, with no user-visible change unless the owner approves one. There was no byte-level record of what the CLI prints today, so a replacement could change help layout, completion protocol output, error codes or output formats without a failing test.
Change and scope
tests/boundary/cli/cliParityGoldens.test.ts: one case table, run through the public CLI (cliTest, shared process; the 16 shell-completion protocol cases and the launcher-routedmcp doctor --helpuse a fresh process).--help,-h, with--format),--version(root and after a command), per-command help for contract commands (inspect-byte-entropy,instructions,decompile,read-bytes) and hand-built ones (setup,doctor,guidance,capture-process,environment-build,update),mcp,mcp add,mcp doctor,completions, command--schema(TOON and JSON), command--llmsand--llms-full.COMPLETE=<shell>protocol for command, option, subcommand, enum and global-flag candidates, a group's no-space marker, short aliases, a hand-built command's enum values, values after an aliased option, words after a boolean flag and after--,mcp doctoroptions, and zsh/fish/nushell descriptions.mcpsubcommand), missing/extra positional, unknown flag, missing flag value, invalid and refined numbers (TOON, JSON, Markdown,--full-output), the--separator, invalid/missing--format, CSV without--columns, a non-collection JSON Lines selection, and--sensitive-valueredaction of an output value and a positional.--format json,--json,=spellings), YAML, Markdown, CSV, TSV,--full-output(TOON and JSON),--token-count,--token-limit,--token-offset,--timings.duration/command_mstimings, and control bytes shown as<0x0b>. Each file ends stdout and stderr with<end>so trailing newlines are exact.<registered command rows elided>.REA_RECORD_CLI_PARITY=1 npm run test:focused -- tests/boundary/cli/cliParityGoldens.test.ts, then review the diff.Completion owner (from #11665):
src/cli/bashCompletionRegistration.tsbecomessrc/cli/completionProtocol.tsand owns:completionScript(shell, name): bash (unchanged) plus zsh, fish and nushell scripts, byte-identical to incur 0.6.1's;completeWords(commands, words, index, globals): scope walk, option and short-alias candidates, enum values after a value-taking option, subcommands in registration order with a no-space marker for groups (the same rules as incur'scomplete, which took an unused root-command argument);formatCompletions(shell, candidates): bash\vrecords, zshvalue:description, fishvalue\tdescription, nushell JSON.completions.tskeeps the command tree (still read throughCli.toCommands) and the globals schema; it no longer importsCompletions._incur_complete_<name>prefix so hooks users already sourced keep working; renaming it is listed as an owner decision on Remove incur: run the CLI on an REA-owned, contract-generated layer with parity tests #11654.bashCompletionRegistration.test.tsis renamed with its module; its assertions are unchanged.Cli.toCommands,Cli.create) and every other incur owner.Goldens, not included:
--llms/--llms-full(they list every command),--update(contacts the npm registry), and analysis failure presentation owned by [Design] Name related input fields and operations in errors so the CLI renders flags and commands #11476.Contract and boundary impact
Semantic owner and earliest changed stage:
src/cli/completionProtocol.tsreplaces incur'sCompletions(scripts, candidates, encoding); the only consumer issrc/cli/completions.ts. Everything else is tests.Contribution scope fit and linked maintainer decision: [Design] Replace incur with a contract-generated CLI layer now that REA owns its MCP server #10583 (owner answered yes), tracked by Remove incur: run the CLI on an REA-owned, contract-generated layer with parity tests #11654.
CLI and MCP/tool-catalog contract: none changed; the goldens record the current CLI contract and pass unchanged with the REA completion owner.
Provider, bridge, target-format, or platform compatibility: macOS and Linux. Windows is not in the curated Windows lane.
Evidence, artifact, provenance, or reconstruction contract: none.
Target selection, authority, upstream behavior, and cleanup details (if applicable): output cases read one 20-byte file the test writes in its own workspace.
Generated metadata, package, or installation impact: none.
Read existing files or captured data.
Launch or attach to a process.
Inject instrumentation or run scripts/code.
Change process memory, registers, files, or configuration.
Contact network services.
Recover protected code or work around protections.
Documentation or usability only; no target interaction.
Not sure yet; investigation or maintainer guidance needed.
Evidence and regression coverage
tests/boundary/cli/cliParityGoldens.test.tsand 81 files intests/fixtures/cli-parity/;bashCompletionRegistration.test.tsrenamed tocompletionProtocol.test.tswith its module.help-contract-command.txtfailed exactly that case (1 failed | 74 passedbefore the second commit); the file was restored.--format <toon|json|yaml|md|jsonl>althoughcsvandtsvare accepted (fix(cli): advertise delimited output formats in help #10777); completion candidates follow command registration order, not alphabetical order;--after a command is reported asUnknown flag: --.Validation performed
REA_RECORD_CLI_PARITY=1 npm run test:focused -- tests/boundary/cli/cliParityGoldens.test.ts— recorded 74 files; a second commit added 7 completion cases (81 files).npm run test:focused -- tests/boundary/cli/cliParityGoldens.test.ts— 82 passed after the second commit (75 passed in 13.9 s elapsed, 17.7 s user CPU, 592 MB peak RSS before it). A first version with a workspace per case took 44.9 s because each new environment restarted the shared CLI process; one file-scoped workspace fixed that.version.txtand recorded (82 passed, file recreated byte-identical);npm run test:focused -- tests/boundary/cli/cliParityGoldens.test.ts tests/boundary/cli/completions.test.ts tests/boundary/cli/completionProtocol.test.ts— 90 passed, on both the goldens commit and the completion owner commit.npm run check:fast— passed (goldens commit and completion owner commit).completions.tsresolved toimport { Cli } from "incur";):npm run check:fastpassed; the same three focused test files — 90 passed, goldens unchanged.npx oxfmt --check tests/boundary/cli/cliParityGoldens.test.ts— passed.Compatibility, safety, and release
Author readiness
Human owner:
Before merge
type(scope): outcome.