Repository navigation
refactor(cli): own the shell completion protocol instead of incur's Completions - #11665
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. |
[Medium impact] The reviewed changes appear safe to merge; no actionable defects were found. SummaryMoves shell hooks, candidate selection, and shell-specific output from Incur into
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
S[Shell] --> C[completions.ts]
C --> H[completionScript]
H --> S
C --> T[Registered commands and builtins]
T --> W[completeWords]
W --> F[formatCompletions]
F --> S
Reviews (1) · Last reviewed commit: "refactor(cli): own the shell completion ..." · Reviewed by Greptile |
…1662) * test(cli): capture CLI parity goldens before replacing incur * test(cli): cover completion groups, aliases and hand-built enums in the parity goldens * refactor(cli): own the shell completion protocol instead of incur's Completions (#11665) * test(cli): keep root help goldens stable for longer names and let recording add cases
Summary
Move shell completion off incur: REA now owns the hook scripts for all four shells, candidate selection and the per-shell encoding. Output is unchanged; the parity goldens from #11662 (this PR's base) pass without edits. Refs #11654.
Problem and expected behavior
src/cli/completions.tscalledCompletions.register(zsh, fish, nushell scripts),Completions.completeandCompletions.formatfrom incur, while the bash script already lived in REA (bashCompletionRegistration.ts). Completion behaviour therefore had two owners, and one of them is the dependency #11654 removes. Expected: one REA owner, identical scripts and candidates.Change and scope
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.Contract and boundary impact
Semantic owner and earliest changed stage:
src/cli/completionProtocol.tsreplaces incur'sCompletionsmodule; the only consumer issrc/cli/completions.ts.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 (CLI completion output is byte-identical; MCP untouched).
Provider, bridge, target-format, or platform compatibility: none.
Evidence, artifact, provenance, or reconstruction contract: none.
Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable.
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
completionProtocol.test.tsis the renamed bash host test.COMPLETE=<shell>protocol cases from incur's implementation (command, option, alias, group, enum, hand-built enum,mcp doctoroptions, values after an aliased option, after a boolean flag and after--, zsh/fish/nushell descriptions). All pass unchanged on this branch.Validation performed
npm run test:focused -- tests/boundary/cli/cliParityGoldens.test.ts tests/boundary/cli/completions.test.ts tests/boundary/cli/completionProtocol.test.ts— 3 files, 90 tests passed.npm run check:fast— passed.npx oxfmt --checkon the changed files — passed (pre-commit hook).Compatibility, safety, and release
Author readiness
Human owner:
Before merge
type(scope): outcome.