Skip to content

feat: add autocomplete support#138

Merged
felipefreitag merged 6 commits intomainfrom
feat-add-autocomplete-support
Mar 23, 2026
Merged

feat: add autocomplete support#138
felipefreitag merged 6 commits intomainfrom
feat-add-autocomplete-support

Conversation

@felipefreitag
Copy link
Contributor

No description provided.

@felipefreitag felipefreitag marked this pull request as draft March 20, 2026 19:11
Add `resend completion <shell>` command that generates static completion
scripts by introspecting the Commander.js command tree. Completes commands,
subcommands, aliases, options, and option choice values. Help text includes
per-shell setup instructions following the gh/kubectl convention.
Auto-detect shell from $SHELL/$PSModulePath, fall back to interactive
select prompt. Add --install to write completions to the correct
location per shell (fpath for zsh, completions dir for fish, profile
eval for bash/powershell). Fix PowerShell profile path for Windows.
Show help instead of raw script when run interactively with no args.
…vior

- Show descriptions alongside commands/options in zsh completions
- Insert fpath before compinit in .zshrc so completions work immediately
- Stop suggesting root commands when deep in a command path
- Use explicit "" match for root level instead of catch-all *
@felipefreitag felipefreitag force-pushed the feat-add-autocomplete-support branch from 18e664b to c2cec88 Compare March 20, 2026 19:39
@felipefreitag felipefreitag marked this pull request as ready for review March 20, 2026 19:57
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 4 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/lib/completion.ts">

<violation number="1" location="src/lib/completion.ts:117">
P2: Choice completion is keyed only by flag name, so identical flags on different subcommands can overwrite each other and produce wrong suggestions.</violation>

<violation number="2" location="src/lib/completion.ts:176">
P2: Completion output omits short flags, so `-p`/`-q`-style options are not suggested in Bash/Zsh/PowerShell.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

- Use _describe for zsh completions to show descriptions like gh does
- Remove dead getProfilePath('fish') case
- Replace catch-all * with explicit "" for root-level completions
- Add escapeZsh helper for colon-safe descriptions
@felipefreitag felipefreitag requested a review from vcapretz March 20, 2026 20:34
Restructure bash, zsh, and PowerShell generators so each cmd_path
case handles its own choices, options, and subcommands. Previously
choice options were collected into a global map keyed by flag name,
which could produce wrong suggestions if different subcommands
reused the same flag with different choices.
@felipefreitag felipefreitag merged commit 5df9af5 into main Mar 23, 2026
7 checks passed
@felipefreitag felipefreitag deleted the feat-add-autocomplete-support branch March 23, 2026 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants