feat: add kiqr completion command (bash/zsh/fish)#19
Merged
Conversation
Add a `kiqr completion <bash|zsh|fish>` command that prints an idiomatic shell completion script to stdout for sourcing into the user's shell. Generation lives in a pure, unit-tested src/lib/completion.ts; the src/commands/completion.tsx command is a thin Pastel wrapper that validates the shell argument against COMPLETION_SHELLS via a zod enum. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a new
kiqr completion <bash|zsh|fish>command that prints an idiomatic shell completion script to stdout. Sourcing it gives tab-completion for kiqr's top-level subcommands (up,down,restart,init,info,open,logs,wp,watch,destroy,doctor,db).Why (the DX win)
Typing
kiqr <TAB>and getting the available commands is a meaningful quality-of-life improvement, especially while learning the CLI. The completion script is fully static and deterministic, so the shell can source it on startup without invoking the CLI.Install
Design
src/lib/completion.ts— pure, unit-tested generation. ExportsCOMPLETION_SHELLS,CompletionShell,KIQR_COMMANDS,isCompletionShell, andgenerateCompletion(shell, commands). Each shell gets its idiomatic markers (complete -Ffor bash,#compdef/compdeffor zsh,complete -c ... __fish_use_subcommandfor fish).src/commands/completion.tsx— thin Pastel command. Theshellpositional arg is a zod enum overCOMPLETION_SHELLS, so unsupported shells produce a clear validation error with the allowed choices.tests/lib/completion.test.ts— asserts each shell returns a non-empty script containing every command name plus the right shell-specific markers, custom command lists are honored, and unknown shells are rejected.No new files touch shared modules (
index.tsx/README.md); Pastel auto-discovers the command.Verification
npm run typecheck,npm test(126 passing),npm run build,npm run lintall green.🤖 Generated with Claude Code