Skip to content

refactor(cli): share completion metadata helpers - #133046

Merged
vincentkoc merged 1 commit into
mainfrom
refactor-share-completion-metadata
Aug 30, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
refactor-share-completion-metadata

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 30, 2026 •

Copy link
Copy Markdown
Member

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 (65 passed; environment-dependent shell cases skipped)
  • focused Oxlint and Oxfmt checks for both changed files
  • git diff --check
  • lead autoreview: no accepted or actionable findings
  • native hydrated review: READY FOR /prepare-pr, zero findings
  • exact-head CI: all required checks passed on 15b2552c1d9e525471f6e3ec42ff82da4e2c3f56 (run)
  • OPENCLAW_TESTBOX=1 scripts/pr prepare-run 133046

AI-assisted: yes. I reviewed the implementation and understand the completion metadata flow.

@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@vincentkoc vincentkoc self-assigned this Aug 30, 2026
@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: XS maintainer Maintainer-authored PR labels Aug 30, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 30, 2026 03:26
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 30, 2026
@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 29, 2026, 11:31 PM ET / August 30, 2026, 03:31 UTC.

ClawSweeper review

What this changes

The 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
Reviewed head: 15b2552c1d9e525471f6e3ec42ff82da4e2c3f56

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, net-negative refactor with unchanged helper behavior and existing cross-shell coverage.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored, behavior-neutral completion refactor is exempt from the external-contributor real-behavior-proof gate; existing source tests cover the affected shell output paths.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored, behavior-neutral completion refactor is exempt from the external-contributor real-behavior-proof gate; existing source tests cover the affected shell output paths.
Evidence reviewed 4 items Introduced change preserves helper logic: The two moved helpers retain the same projections; the consumer now imports them from the command-tree owner.
Current-main comparison: Current main retains the pre-refactor local helpers; the PR differs only by relocating and exporting those same operations.
Completion behavior coverage: Existing focused tests cover alias-expanded paths and parsed short/long option flags across generated shell completions.
Findings None None.
Security None None.

How this fits together

OpenClaw 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]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -6. Total -6 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 2 6 12 -6
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 6 12 -6

Review metrics

Metric Value Why it matters
Production versus test LOC production +6/-12 (net -6); tests unchanged The refactor removes duplicate production logic without expanding the behavioral surface.

Technical review

Best 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.

Labels

Label changes:

  • add P3: This is a small internal CLI cleanup with no intended change to user-visible completion behavior.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This MEMBER-authored, behavior-neutral completion refactor is exempt from the external-contributor real-behavior-proof gate; existing source tests cover the affected shell output paths.

Label justifications:

  • P3: This is a small internal CLI cleanup with no intended change to user-visible completion behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This MEMBER-authored, behavior-neutral completion refactor is exempt from the external-contributor real-behavior-proof gate; existing source tests cover the affected shell output paths.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@vincentkoc

Copy link
Copy Markdown
Member Author

Maintainer decision: merge.

Proceeding through the repository merge gates.

@vincentkoc
vincentkoc merged commit 1e2408c into main Aug 30, 2026
245 checks passed
@vincentkoc
vincentkoc deleted the refactor-share-completion-metadata branch August 30, 2026 03:39
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant