Enable shell completion
Shell completion makes jpd faster and more discoverable by providing tab completion for commands, flags, and values. jpd supports completion for all major shells and provides easy setup instructions.
Why Use Shell Completion?
Section titled “Why Use Shell Completion?”Faster Command Entry
Section titled “Faster Command Entry”Instead of typing full commands:
jpd install --agent yarn --dev lodashUse tab completion to speed up entry:
jpd i<TAB> --a<TAB> y<TAB> --d<TAB> lodash# Expands to: jpd install --agent yarn --dev lodashDiscoverability
Section titled “Discoverability”Discover available commands and flags without consulting documentation:
jpd <TAB><TAB># Shows: install run exec update uninstall clean-install agent completion
jpd install --<TAB><TAB># Shows: --agent --cwd --debug --dev --global --production --searchError Prevention
Section titled “Error Prevention”Completion prevents typos and ensures valid values:
jpd install --agent <TAB><TAB># Shows: npm yarn pnpm bun deno# Prevents invalid agent namesSupported Shells
Section titled “Supported Shells”jpd provides completion for these shells:
| Shell | Status | Notes |
|---|---|---|
| Bash | ✅ Full support | Works with Bash 4.0+ |
| Zsh | ✅ Full support | Compatible with Oh My Zsh |
| Fish | ✅ Full support | Native Fish completion format |
| PowerShell | ✅ Full support | Windows PowerShell and PowerShell Core |
| Nushell | ✅ Full support | Modern shell with custom output option |
Installation by Shell
Section titled “Installation by Shell”# Generate and install system-widesudo jpd completion bash > /etc/bash_completion.d/jpd
# Reload bash completionsource /etc/bash_completion.d/jpd# Create user completion directory if it doesn't existmkdir -p ~/.bash_completion.d
# Generate completion scriptjpd completion bash > ~/.bash_completion.d/jpd
# Add to .bashrc if not already thereecho 'source ~/.bash_completion.d/jpd' >> ~/.bashrc
# Reload your shellsource ~/.bashrc# Direct sourcing (temporary, lost on restart)source <(jpd completion bash)
# Make permanent by adding to .bashrcecho 'source <(jpd completion bash)' >> ~/.bashrc# Generate completion for Oh My Zshjpd completion zsh > ~/.oh-my-zsh/completions/_jpd
# Reload your shellexec zsh# Create completion directorymkdir -p ~/.zsh/completions
# Generate completion scriptjpd completion zsh > ~/.zsh/completions/_jpd
# Add to .zshrc if not already thereecho 'fpath=(~/.zsh/completions $fpath)' >> ~/.zshrcecho 'autoload -U compinit && compinit' >> ~/.zshrc
# Reload your shellexec zsh# Direct sourcing (temporary)source <(jpd completion zsh)
# Make permanentecho 'source <(jpd completion zsh)' >> ~/.zshrc# Generate completion for Fishjpd completion fish > ~/.config/fish/completions/jpd.fish
# Reload Fish completionsfish -c "complete -f"PowerShell
Section titled “PowerShell”# Load completion for current sessionjpd completion powershell | Out-String | Invoke-Expression# Add to PowerShell profilejpd completion powershell >> $PROFILE
# Reload profile. $PROFILE# See where your profile is locatedecho $PROFILE
# Create profile if it doesn't existif (!(Test-Path -Path $PROFILE)) { New-Item -ItemType File -Path $PROFILE -Force}Nushell
Section titled “Nushell”You can write completion output directly to a file using the --output flag (supported for all shells):
# Generate completion with output flagjpd completion nushell --output ~/.config/nushell/completions/jpd_completions.nu
# Add to config.nu or env.nuecho 'source ~/.config/nushell/completions/jpd_completions.nu' >> ~/.config/nushell/config.nu
# Restart NushellTesting Completion
Section titled “Testing Completion”After installing completion, test that it works:
Basic Command Completion
Section titled “Basic Command Completion”jpd <TAB><TAB># Should show: install run exec update uninstall clean-install agent completionFlag Completion
Section titled “Flag Completion”jpd install --<TAB><TAB># Should show: --agent --cwd --debug --dev --global --production --search --helpValue Completion
Section titled “Value Completion”jpd install --agent <TAB><TAB># Should show: npm yarn pnpm bun denoAlias Completion
Section titled “Alias Completion”jpd i<TAB> # Should complete to: jpd installjpd r<TAB> # Should complete to: jpd runjpd u<TAB> # Should complete to: jpd update (or show uninstall)Troubleshooting
Section titled “Troubleshooting”Completion Not Working
Section titled “Completion Not Working”-
Check shell: Ensure you’re using a supported shell
Terminal window echo $SHELL -
Verify completion is loaded:
Terminal window # For Bashcomplete -p jpd# For Zshwhich _jpd# For Fishcomplete -C jpd -
Reload shell configuration:
Terminal window # Bashsource ~/.bashrc# Zshsource ~/.zshrc# Fishsource ~/.config/fish/config.fish
Outdated Completions
Section titled “Outdated Completions”If jpd commands have changed and completion is outdated:
# Regenerate completion for your shelljpd completion bash > ~/.bash_completion.d/jpd # Bashjpd completion zsh > ~/.zsh/completions/_jpd # Zshjpd completion fish > ~/.config/fish/completions/jpd.fish # Fish
# Reload shellexec $SHELLPermission Issues
Section titled “Permission Issues”If you get permission errors:
# For system-wide installation (Linux/macOS)sudo jpd completion bash > /etc/bash_completion.d/jpd
# For user installation (no sudo needed)jpd completion bash > ~/.bash_completion.d/jpdMultiple Shell Support
Section titled “Multiple Shell Support”If you use multiple shells, set up completion for each:
# Set up for all your shellsjpd completion bash > ~/.bash_completion.d/jpdjpd completion zsh > ~/.zsh/completions/_jpdjpd completion fish > ~/.config/fish/completions/jpd.fishAdvanced Configuration
Section titled “Advanced Configuration”Custom Completion Location
Section titled “Custom Completion Location”You can generate completion to any location:
# Custom locationjpd completion bash > /path/to/my/completions/jpd
# Source from custom location in your shell configecho 'source /path/to/my/completions/jpd' >> ~/.bashrcConditional Loading
Section titled “Conditional Loading”Load completion only if jpd is available:
# Add to .bashrc/.zshrcif command -v jpd &> /dev/null; then source <(jpd completion bash) # or zshfiTeam Setup
Section titled “Team Setup”Include completion setup in your team’s development documentation:
## Shell Completion Setup
After installing jpd, enable shell completion:
### Bash```bashjpd completion bash > ~/.bash_completion.d/jpdsource ~/.bash_completion.d/jpdZsh (Oh My Zsh)
Section titled “Zsh (Oh My Zsh)”jpd completion zsh > ~/.oh-my-zsh/completions/_jpdexec zshThis enables tab completion for jpd commands and flags.
## Completion Features
### What Gets Completed
jpd completion provides suggestions for:
1. **Commands**: `install`, `run`, `exec`, `update`, etc.2. **Aliases**: `i`, `r`, `e`, `u`, etc.3. **Global flags**: `--agent`, `--cwd`, `--debug`4. **Command-specific flags**: `--dev`, `--global`, `--search`, etc.5. **Agent values**: `npm`, `yarn`, `pnpm`, `bun`, `deno`6. **Help options**: `--help`, `-h`
### Smart Completion
jpd completion is context-aware:
```bash# After typing --agent, only shows valid package managersjpd install --agent <TAB># Shows: npm yarn pnpm bun deno
# After typing a command, shows relevant flagsjpd install --<TAB># Shows: --agent --cwd --debug --dev --global --production --search --helpPerformance
Section titled “Performance”jpd completions are:
- Fast: Generated statically, no runtime overhead
- Accurate: Based on actual jpd command definitions
- Complete: Covers all commands, flags, and valid values
Advanced Integrations
Section titled “Advanced Integrations”Carapace Integration
Section titled “Carapace Integration”For enhanced completions across multiple shells, jpd supports Carapace, a universal completion framework:
# Install Carapace spec to global directoryjpd integrate carapace
# Generate spec to custom filejpd integrate carapace --output ./jpd-carapace.yaml
# Print spec to stdoutjpd integrate carapace --stdoutCarapace provides intelligent completions including:
- Package name suggestions from npm registry
- Script name completions from
package.json - File and directory completions for
--cwdflag - Package manager enum completions for
--agentflag
Warp Terminal Integration
Section titled “Warp Terminal Integration”For Warp terminal users, jpd can generate workflow files for enhanced command execution:
# Generate individual workflow filesjpd integrate warp --output-dir ./warp-workflows/
# Print workflows as multi-document YAMLjpd integrate warpWarp workflows provide:
- Pre-built templates for common jpd commands
- Interactive argument prompts
- Command history and sharing
See Also
Section titled “See Also”- Getting Started - Basic jpd installation and usage
- Complete Commands Reference - All commands that benefit from completion
- Shell-specific documentation - Learn more about your shell’s completion system