Skip to content

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.

Instead of typing full commands:

Terminal window
jpd install --agent yarn --dev lodash

Use tab completion to speed up entry:

Terminal window
jpd i<TAB> --a<TAB> y<TAB> --d<TAB> lodash
# Expands to: jpd install --agent yarn --dev lodash

Discover available commands and flags without consulting documentation:

Terminal window
jpd <TAB><TAB>
# Shows: install run exec update uninstall clean-install agent completion
jpd install --<TAB><TAB>
# Shows: --agent --cwd --debug --dev --global --production --search

Completion prevents typos and ensures valid values:

Terminal window
jpd install --agent <TAB><TAB>
# Shows: npm yarn pnpm bun deno
# Prevents invalid agent names

jpd provides completion for these shells:

ShellStatusNotes
Bash✅ Full supportWorks with Bash 4.0+
Zsh✅ Full supportCompatible with Oh My Zsh
Fish✅ Full supportNative Fish completion format
PowerShell✅ Full supportWindows PowerShell and PowerShell Core
Nushell✅ Full supportModern shell with custom output option
Terminal window
# Generate and install system-wide
sudo jpd completion bash > /etc/bash_completion.d/jpd
# Reload bash completion
source /etc/bash_completion.d/jpd
Terminal window
# Generate completion for Oh My Zsh
jpd completion zsh > ~/.oh-my-zsh/completions/_jpd
# Reload your shell
exec zsh
Terminal window
# Generate completion for Fish
jpd completion fish > ~/.config/fish/completions/jpd.fish
# Reload Fish completions
fish -c "complete -f"
Terminal window
# Load completion for current session
jpd completion powershell | Out-String | Invoke-Expression

You can write completion output directly to a file using the --output flag (supported for all shells):

Terminal window
# Generate completion with output flag
jpd completion nushell --output ~/.config/nushell/completions/jpd_completions.nu
# Add to config.nu or env.nu
echo 'source ~/.config/nushell/completions/jpd_completions.nu' >> ~/.config/nushell/config.nu
# Restart Nushell

After installing completion, test that it works:

Terminal window
jpd <TAB><TAB>
# Should show: install run exec update uninstall clean-install agent completion
Terminal window
jpd install --<TAB><TAB>
# Should show: --agent --cwd --debug --dev --global --production --search --help
Terminal window
jpd install --agent <TAB><TAB>
# Should show: npm yarn pnpm bun deno
Terminal window
jpd i<TAB> # Should complete to: jpd install
jpd r<TAB> # Should complete to: jpd run
jpd u<TAB> # Should complete to: jpd update (or show uninstall)
  1. Check shell: Ensure you’re using a supported shell

    Terminal window
    echo $SHELL
  2. Verify completion is loaded:

    Terminal window
    # For Bash
    complete -p jpd
    # For Zsh
    which _jpd
    # For Fish
    complete -C jpd
  3. Reload shell configuration:

    Terminal window
    # Bash
    source ~/.bashrc
    # Zsh
    source ~/.zshrc
    # Fish
    source ~/.config/fish/config.fish

If jpd commands have changed and completion is outdated:

Terminal window
# Regenerate completion for your shell
jpd completion bash > ~/.bash_completion.d/jpd # Bash
jpd completion zsh > ~/.zsh/completions/_jpd # Zsh
jpd completion fish > ~/.config/fish/completions/jpd.fish # Fish
# Reload shell
exec $SHELL

If you get permission errors:

Terminal window
# 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/jpd

If you use multiple shells, set up completion for each:

Terminal window
# Set up for all your shells
jpd completion bash > ~/.bash_completion.d/jpd
jpd completion zsh > ~/.zsh/completions/_jpd
jpd completion fish > ~/.config/fish/completions/jpd.fish

You can generate completion to any location:

Terminal window
# Custom location
jpd completion bash > /path/to/my/completions/jpd
# Source from custom location in your shell config
echo 'source /path/to/my/completions/jpd' >> ~/.bashrc

Load completion only if jpd is available:

Terminal window
# Add to .bashrc/.zshrc
if command -v jpd &> /dev/null; then
source <(jpd completion bash) # or zsh
fi

Include completion setup in your team’s development documentation:

## Shell Completion Setup
After installing jpd, enable shell completion:
### Bash
```bash
jpd completion bash > ~/.bash_completion.d/jpd
source ~/.bash_completion.d/jpd
Terminal window
jpd completion zsh > ~/.oh-my-zsh/completions/_jpd
exec zsh

This 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 managers
jpd install --agent <TAB>
# Shows: npm yarn pnpm bun deno
# After typing a command, shows relevant flags
jpd install --<TAB>
# Shows: --agent --cwd --debug --dev --global --production --search --help

jpd completions are:

  • Fast: Generated statically, no runtime overhead
  • Accurate: Based on actual jpd command definitions
  • Complete: Covers all commands, flags, and valid values

For enhanced completions across multiple shells, jpd supports Carapace, a universal completion framework:

Terminal window
# Install Carapace spec to global directory
jpd integrate carapace
# Generate spec to custom file
jpd integrate carapace --output ./jpd-carapace.yaml
# Print spec to stdout
jpd integrate carapace --stdout

Carapace provides intelligent completions including:

  • Package name suggestions from npm registry
  • Script name completions from package.json
  • File and directory completions for --cwd flag
  • Package manager enum completions for --agent flag

For Warp terminal users, jpd can generate workflow files for enhanced command execution:

Terminal window
# Generate individual workflow files
jpd integrate warp --output-dir ./warp-workflows/
# Print workflows as multi-document YAML
jpd integrate warp

Warp workflows provide:

  • Pre-built templates for common jpd commands
  • Interactive argument prompts
  • Command history and sharing