Skip to content

refactor(cli): own the shell completion protocol instead of incur's Completions - #11665

Merged
morluto merged 1 commit into
test/cli-parity-goldensfrom
refactor/cli-owned-completions
Nov 16, 2026
Merged

morluto merged 1 commit into
test/cli-parity-goldensfrom
refactor/cli-owned-completions

Conversation

@morluto

@morluto morluto commented Nov 16, 2026

Copy link
Copy Markdown
Owner

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.ts called Completions.register (zsh, fish, nushell scripts), Completions.complete and Completions.format from 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.ts becomes src/cli/completionProtocol.ts and 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's complete, which took an unused root-command argument);
    • formatCompletions(shell, candidates): bash \v records, zsh value:description, fish value\tdescription, nushell JSON.
  • completions.ts keeps the command tree (still read through Cli.toCommands) and the globals schema; it no longer imports Completions.
  • The hook functions keep the _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.ts is renamed with its module; its assertions are unchanged.
  • Not included: the command registry and dispatch (Cli.toCommands, Cli.create) and every other incur owner.

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/cli/completionProtocol.ts replaces incur's Completions module; the only consumer is src/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

  • Tests added or updated: none beyond the base PR's goldens; completionProtocol.test.ts is the renamed bash host test.
  • Base reproduction or other evidence: the base PR records 4 completion scripts and 16 COMPLETE=<shell> protocol cases from incur's implementation (command, option, alias, group, enum, hand-built enum, mcp doctor options, values after an aliased option, after a boolean flag and after --, zsh/fish/nushell descriptions). All pass unchanged on this branch.
  • User-visible CLI/MCP output (if applicable): none changed.
  • Remaining proof gaps: the goldens were recorded on macOS; Linux CI runs them for the first time. Real shells beyond the existing bash host test were not exercised.

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 --check on the changed files — passed (pre-commit hook).

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: not applicable.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-16T02:25:03.905373Z
We couldn’t complete this review. Comment @codex review to try again.
ea389f4 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@greptile-apps

greptile-apps Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The reviewed changes appear safe to merge; no actionable defects were found.

Summary

Moves shell hooks, candidate selection, and shell-specific output from Incur into completionProtocol.ts. completions.ts keeps command discovery and request routing.

  • REA now owns hooks and suggestions for all four shells.

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
Loading

Reviews (1) · Last reviewed commit: "refactor(cli): own the shell completion ..." · Reviewed by Greptile

@morluto
morluto merged commit 5365cae into test/cli-parity-goldens Nov 16, 2026
1 check passed
@morluto
morluto deleted the refactor/cli-owned-completions branch November 16, 2026 02:29
morluto added a commit that referenced this pull request Nov 16, 2026
morluto added a commit that referenced this pull request Nov 16, 2026
…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
@morluto morluto added the area: cli CLI adapter and one-shot commands label Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI adapter and one-shot commands

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant