feat(cli): shell completions for bash/zsh/fish - #122
Merged
Conversation
Add `riskkernel completion <bash|zsh|fish>`, which prints a completion script to stdout. It completes the top-level commands and the nested sub-subcommands (runs list|resume, audit export|tools|compliance, policy validate|dry-run, approvals list|approve|deny, memory list|show), and the `rk` alias is completed too. The scripts are hand-written static strings — no cobra, no new dependency. Each carries a one-line install hint, and the README shows how to wire it into each shell.
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.
Adds a
riskkernel completion <bash|zsh|fish>subcommand that prints a shell completion script to stdout — a small DX win so the CLI tab-completes.What it does
init,serve,chat,runs,audit,policy,approvals,memory,doctor,healthcheck,completion,version,help).runs list|resume,audit export|tools|compliance,policy validate|dry-run,approvals list|approve|deny,memory list|show, andcompletion bash|zsh|fish.rkalias as well.riskkernel completionwith no/invalid shell returns a clear usage error namingbash|zsh|fish.Notes
cmd/riskkernel/completion.gowithrunCompletion(args []string) error, wired into the dispatch switch andusage()inmain.go.Testing
cmd/riskkernel/completion_test.gocovers each shell's generator (non-empty + contains key subcommands and sub-subcommands), the bash/zsh script headers, and the no-arg / invalid-shell error paths.bash -n, and smoke-tested the built binary for all three shells plus both error paths.gofmt -lclean,go vet ./...clean,go test ./...all pass.Closes #93.