Repository navigation
refactor(cli): share completion metadata helpers - #133046
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 29, 2026, 11:31 PM ET / August 30, 2026, 03:31 UTC. ClawSweeper reviewWhat this changesThe PR exports the command-alias and option-flag projection helpers from the completion command tree and reuses them in the Bash, Fish, PowerShell, and Zsh script generator. Merge readiness✅ Ready for maintainer review No blocking findings. This is a behavior-neutral, net-negative refactor that leaves the completion metadata projections unchanged while giving the command-tree owner the single implementation. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw builds Commander CLI definitions into a completion command tree, then generates scripts for each supported shell. The shared helpers determine the aliases and short/long flags advertised by those scripts. flowchart LR
A[Commander CLI commands] --> B[Completion command tree]
B --> C[Alias and flag metadata]
C --> D[Shell script generators]
D --> E[Bash Fish PowerShell and Zsh completion]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -6. Total -6 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Land the single-owner helper extraction once exact-head checks complete, retaining the existing cross-shell completion behavior tests. Do we have a high-confidence way to reproduce the issue? Not applicable: the PR is a behavior-preserving refactor, and its alias/flag output is covered by existing completion tests. Is this the best way to solve the issue? Yes. Moving the identical projections to the command-tree module makes the metadata owner canonical and removes the duplicate generator-local implementations. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a93a015a5695. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Maintainer decision: merge.
Proceeding through the repository merge gates. |
|
Merged via squash.
|
What Problem This Solves
Shell completion generation maintained separate copies of Commander command-name and option-flag projection logic. That duplication made it possible for the command tree and shell-specific generators to drift.
Why This Change Was Made
This makes the completion command-tree module the single owner of both metadata helpers and reuses them from the shell generators. The existing alias invariant comment moves with the canonical helper.
User Impact
No user-visible completion behavior changes. Maintainers get one implementation for command aliases and parsed short/long flags, with six fewer production lines.
Evidence
pnpm test src/cli/completion-command-tree.test.ts src/cli/completion-cli.aliases.test.ts src/cli/completion-cli.test.ts src/cli/program/root-command-descriptions.test.ts(65passed; environment-dependent shell cases skipped)git diff --checkREADY FOR /prepare-pr, zero findings15b2552c1d9e525471f6e3ec42ff82da4e2c3f56(run)OPENCLAW_TESTBOX=1 scripts/pr prepare-run 133046AI-assisted: yes. I reviewed the implementation and understand the completion metadata flow.