completions command that generates shell hook scripts for tab completion. The hook calls back into your binary at every tab press, so completions are always in sync with your commands.
Installation
Generate and install completions for your shell:Bash
~/.bashrc for persistence:
Zsh
~/.zshrc for persistence:
Fish
~/.config/fish/config.fish for persistence:
Nushell
How It Works
Completions are dynamic—the hook calls back into your CLI at every tab press:- Completions are always accurate
- No generated files to maintain
- Subcommands, options, and enum values are suggested automatically
- Works with mounted CLIs and OpenAPI-generated commands
Command Completions
Tab completion suggests available commands:Subcommand Completions
Command groups suppress trailing space so you can keep tabbing:Option Completions
Options are suggested when the current word starts with-:
Enum Value Completions
Enum options suggest their valid values:Boolean Options
Boolean options don’t expect values, so completion continues:Descriptions in Completions
Descriptions from schemas appear in completions:Multi-Command CLI
Completions work with complex command structures:Completion Help
Runcompletions --help for setup instructions:
Implementation
Completions are handled automatically. No additional code needed:my-cli completions bashmy-cli completions zshmy-cli completions fishmy-cli completions nushell
Source Code
The completions implementation is insrc/Completions.ts:
Register Hook
Complete Function
Environment Variables
Completions use these environment variables:
The shell hook sets these when invoking the CLI.
Debugging Completions
Test completions manually:Multiple Binaries
If your CLI has multiple binary names (aliases inpackage.json), completions work for all of them:

