feat(cli): add shell completion generated from the argument declarations - #456
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (16)
📝 WalkthroughWalkthroughThe CLI adds a lazily loaded ChangesShell completion
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant runCli
participant runCompleteCliGunshi
participant GunshiCompletionPlugin
User->>runCli: invoke complete with arguments
runCli->>runCompleteCliGunshi: pass full argument vector
runCompleteCliGunshi->>GunshiCompletionPlugin: process shell setup or callback
GunshiCompletionPlugin-->>User: output completion script or candidates
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
gunshi adoption item 1 (per the approved utilization plan): shell completion for bash/zsh/fish/PowerShell via
@gunshi/plugin-completion(0.37.1, exact pin), surfaced as a newsvelte-vitals complete <shell>command.Design (probe-driven)
The Phase-A compatibility probe found that wiring the plugin into an existing surface silently breaks behavior — on
docs, the plugin's auto-addedcompletesub-command shadowed the "unknown docs subcommand" exit-2 path with a bare directive on stdout, exit 0. So the integration is a dedicated sixth entry: a completion-onlydefine()tree mirroring all five real surfaces, dispatched by an exact-matchcompletebranch inrunCli(lazy-loaded; the analyzer hot path pays nothing), with no-op runners the plugin never executes.docs completestill errors exactly as before — verified.No second flag declaration anywhere: the tree is built from the same exported
*_ARGSconsts that drive parsing and--help, and enum value completion (--reporter,--fail-on,--category,--treat-dynamic-as) reuses newly single-sourced value arrays (REPORTER_NAMESetc. —isReporterNamenow derives from the same array). Two plugin gotchas found and fixed: it reads raw object keys with notoKebab/hiddenawareness, which would have leaked--noSuppressionsand the hidden--scope— aforCompletion()transform normalizes both.What completes
Sub-command names (incl. nested
list/show/install/upgrade), every flag per surface (context-correct:ci upgradeexcludes--force), and enum values. Setup verified end-to-end in real bash and zsh shells against the built dist; fish/PowerShell instructions come from the plugin's README and are marked as such in the docs (en/ja).Honest dependency footprint (declared in the changeset + design-doc addendum)
Not one package:
@gunshi/plugin-completionbrings@gunshi/plugin,@bomb.sh/tab, and a non-optional peer dependency on@gunshi/plugin-i18nthat installs even though this integration never uses it. All 0.37.1 lockstep, exact-pinned.Verification
Characterization suite: zero behavioral churn — the only golden change is one new Usage line in root
--help. 20 new tests (tree shape, kebab/hidden normalization, value completion, dispatch precedence, spawn-based dist checks). Full gates green: 2,701 tests, e2e 10/10, smoke 8/8, check:publish 0. Rebased onto #455 (both touchedreporter-resolve.ts; the delegation and theREPORTER_NAMESsingle-sourcing compose — full suite re-run post-rebase).🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
completecommand for Bash, Zsh, Fish, and PowerShell.Documentation
Tests