feat: add shell completion for bash, zsh, and fish#22
Merged
jsanter27 merged 3 commits intopolyai:mainfrom Mar 16, 2026
Merged
Conversation
Adds a `poly completion <shell>` command that prints a completion script users can eval or source to get tab completion for all poly/adk commands, subcommands, and flags. - Add `argcomplete>=3.0.0` dependency (Apache 2.0) - Call `argcomplete.autocomplete(parser)` in `main()` to enable completions - Add `completion` subcommand with per-shell installation instructions - Add `print_completion()` classmethod on `AgentStudioCLI` - Add unit tests for all three shells and invalid shell rejection Usage: # Bash — add to ~/.bashrc or ~/.bash_profile eval "$(poly completion bash)" # Zsh — add to ~/.zshrc eval "$(poly completion zsh)" # Fish — add to ~/.config/fish/completions/poly.fish poly completion fish | source
Contributor
|
Hi @HelenGreul , appreciate the nice feature here! I've enabled the Actions workflow for you as a first time contributor to the repo. PR looks good, can you just fix the formatting to pass CI? Should be good after that ✅ |
jsanter27
approved these changes
Mar 16, 2026
Contributor
|
LGTM, thanks again! |
Contributor
Author
|
Thanks for the quick review and for enabling the workflow @jsanter27! |
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.
Summary
Adds a
poly completion <shell>command that prints a shell completion script, enabling tab completion for allpoly/adkcommands, subcommands, and flags.Motivation
Shell completion is a standard ergonomic feature for any CLI tool — especially one with 12+ subcommands and numerous flags. Without it, users must remember exact command names and flags, slowing down daily use. Every major comparable CLI (Google ADK, AWS AgentCore,
gh,kubectl) ships with completion support.Changes
argcomplete>=3.0.0dependency (Apache 2.0 — passes license checks)argcomplete.autocomplete(parser)inmain()— this is the hook that makes tab completion work at runtime; it exits immediately when not in a completion context, so there is zero overhead for normal CLI usagecompletionsubparser withbash,zsh,fishchoices and per-shell installation instructions in the help textAgentStudioCLI.print_completion()classmethodpolyandadkentry points are registered in the generated scriptsUsage
Test strategy
poly <command>)Checklist
ruff check .andruff format --check .passpytestpassespolyCLI interface (or migration path documented)