Skip to content

Tab

Tab is a powerful tool that brings shell autocompletions to JavaScript CLI tools. Inspired by tools like git and their excellent autocompletion experience, Tab makes the same functionality available for any JavaScript CLI project.

Shell Integration

Seamless integration with zsh, bash, fish, and PowerShell. Get native autocompletion experience for your CLI tools.

Framework Adapters

Built-in adapters for popular CLI frameworks including CAC, Citty, and Commander.js for easy integration.

Package Manager Support

Built-in completions for npm, pnpm, yarn, and bun with automatic CLI discovery and completion detection.

Type-Safe

Full TypeScript support with type-safe completion handlers and autocomplete suggestions.

Custom Completions

Define custom completion logic for commands and options with dynamic suggestions based on context.

Easy Setup

Simple installation and configuration with minimal code changes to add autocompletion to your CLI.

Add shell autocompletions to your CLI in just a few lines:

import { RootCommand, script } from '@bombsh/tab';
const t = new RootCommand();
// Add commands with completions
t.command('dev', 'Start development server')
.option('--port', 'Port number', function(complete) {
complete('3000', 'Development port');
complete('8080', 'Production port');
}, 'p');
// Handle completion requests
if (process.argv[2] === 'complete') {
const shell = process.argv[3];
if (shell && ['zsh', 'bash', 'fish', 'powershell'].includes(shell)) {
t.setup('my-cli', process.execPath, shell);
} else {
const separatorIndex = process.argv.indexOf('--');
const completionArgs = separatorIndex !== -1 ? process.argv.slice(separatorIndex + 1) : [];
t.parse(completionArgs);
}
}

Get enhanced package manager completions with automatic CLI discovery:

Terminal window
# Install tab CLI
npm install -g @bombsh/tab
# Generate completions for your preferred package manager
tab pnpm zsh > ~/.zsh_completions/tab-pnpm.zsh
echo 'source ~/.zsh_completions/tab-pnpm.zsh' >> ~/.zshrc
# Now you get enhanced completions for all CLI tools!
pnpm vite dev --port # ← Tab completion works here