Commands
Configuration
API Keys
Configure API keys for various services:
# Set API key for a service
ai config <service> <apiKey>
# List configured services
ai config-list
# Get help with configuration
ai config-help [service]
AI Models
Configure which AI model to use for each command:
# Set model for a command
ai config-model <command> <service> <model>
# List current configuration
ai config-model list
Git Settings
Configure Git-related settings:
# Set default branch
ai config-git default-branch <branch>
# View current configuration
ai config-git show
Search
Search for code solutions with AI analysis:
ai search <query> [options]
Options:
-g, --github-limit <n>
- Number of GitHub issues to search (default: 3)-s, --stackoverflow-limit <n>
- Number of Stack Overflow posts to search (default: 3)
Debug
Get AI assistance for debugging:
ai debug <error-message>
Features:
- Error analysis
- Debugging strategies
- Solution suggestions
Describe
Generate documentation from code:
ai describe <file> [options]
Options:
-o, --output <path>
- Custom output file path (default:<input>.md
)
Collect
Collect and concatenate files for AI processing:
ai collect [path] [options]
Options:
-c, --config <name>
- Use a specific collection configuration
This command will:
- Search for files matching the configured extensions recursively in the specified directory
- Concatenate them into a single file in the
.ai-cli
folder - Exclude files matching the configured ignore patterns
- Optionally analyze the collected code using the configured AI model
If no path is specified, the current directory will be used.
Collection Configurations
Manage file collection configurations:
# List all configurations
ai config-collect list
# Create a new configuration
ai config-collect create
# Edit an existing configuration
ai config-collect edit <name>
# Delete a configuration
ai config-collect delete <name>
# Set a configuration as default
ai config-collect set-default <name>
Each configuration specifies:
- File extensions to collect
- Patterns to ignore
- Whether it's the default configuration
The default "TypeScript" configuration includes:
- Extensions:
.ts
,.tsx
- Ignore patterns:
**/node_modules/**
,**/dist/**
,**/*.test.ts
,**/*.config.ts
,**/*.spec.ts
Example:
# Create a Python configuration
ai config-collect create
# Follow prompts to set name, extensions (.py), and ignore patterns
# Use the Python configuration
ai collect ./src -c python
Git Worktree Management
Create Worktrees
Create and manage Git worktrees for parallel development:
ai worktree [options] <branches...>
Options:
-p, --pnpm
- Install dependencies using pnpm in each worktree
Example:
# Create worktrees for multiple features
ai worktree feature-a feature-b feature-c
# Create worktrees and install dependencies
ai worktree -p feature-a feature-b
List Worktrees
View all worktrees created by AI CLI:
ai worktree-list
This shows:
- Branch names
- Worktree paths
- Creation timestamps
- Current status (Active/Removed)
Merge Worktrees
Merge changes from a worktree branch:
ai worktree-merge <branch> [target-branch]
If no target branch is specified, uses the configured default branch.
Example:
# Merge into default branch
ai worktree-merge feature-a
# Merge into specific branch
ai worktree-merge feature-a release/1.0
Merge All Worktrees
Merge all tracked worktrees in one command:
ai worktree-merge-all [target-branch]
Features:
- Merges all worktrees into target branch
- Uses configured default branch if none specified
- Handles each worktree independently
- Continues if one merge fails
- Cleans up successfully merged worktrees
Remove Worktree
Remove a worktree without merging changes:
ai worktree-remove <branch>
Features:
- Safely removes worktree directory
- Warns about uncommitted changes
- Deletes associated branch
- Interactive confirmation
Help
Show help information for all commands:
ai help
Or get help for a specific command:
ai <command> --help