CLI Usage
The Cline CLI brings the power of HAI Build Code Generator directly to your terminal. Run AI-powered coding tasks, manage history, and automate workflows without leaving the command line.Installation
Install globally via npm:Modes of Operation
Interactive Mode
Launch the interactive terminal UI when you runcline without arguments:
- Real-time conversation display
- Task history navigation
- Live progress updates
- Interactive approval prompts
Task Mode
Execute tasks directly with a prompt:Plain Text Mode
Activated automatically when:- Output is redirected (
>or|) - stdin is piped
--jsonor--yoloflags are used
Core Commands
task (alias: t)
Run a new coding task:| Flag | Description |
|---|---|
-a, --act | Run in act mode (default - actively uses tools) |
-p, --plan | Run in plan mode (gather info before acting) |
-y, --yolo | Auto-approve all actions, enable plain text output |
-t, --timeout <seconds> | Timeout for yolo mode (default: 600) |
-m, --model <model> | Specify which model to use |
-v, --verbose | Show verbose output including reasoning |
-c, --cwd <path> | Set working directory |
--config <path> | Path to Cline config directory |
--thinking [tokens] | Enable extended thinking (default: 1024) |
--reasoning-effort <level> | Set reasoning effort: none/low/medium/high/xhigh |
--max-consecutive-mistakes <count> | Max mistakes before halting in yolo mode |
--json | Output as JSON for parsing |
--double-check-completion | Force re-verification of completions |
-T, --taskId <id> | Resume an existing task by ID |
history (alias: h)
View and navigate task history:| Flag | Description |
|---|---|
-n, --limit <number> | Tasks per page (default: 10) |
-p, --page <number> | Page number (default: 1) |
--config <path> | Config directory path |
config
View current configuration:auth
Authenticate providers and configure models:| Flag | Description |
|---|---|
-p, --provider <id> | Provider ID (anthropic, openai-native, etc.) |
-k, --apikey <key> | API key |
-m, --modelid <id> | Model ID |
-b, --baseurl <url> | Base URL (OpenAI-compatible only) |
version
Show CLI version:update
Check for and install updates:Agent Behavior Modes
Act Mode (Default)
Cline actively uses tools to accomplish tasks:- Creates and edits files
- Executes terminal commands
- Uses headless browser
- Searches codebases
- Makes API calls
Plan Mode
Cline gathers information and creates a plan before implementation:- Explores the codebase
- Asks clarifying questions
- Presents a detailed strategy
- Waits for approval before acting
Advanced Usage
Piped Input
Pass data directly from other commands:Image References
Include images in your prompts:JSON Output
Parse structured output for automation:Resuming Tasks
Continue where you left off:Scripting Examples
Automated Testing:Environment Variables
CLINE_DIR
Override the default configuration directory:CLINE_COMMAND_PERMISSIONS
Restrict shell commands Cline can execute:Configuration Files
Directory Structure
View Logs
Tips & Best Practices
Performance Optimization
- Use Plan Mode for Large Tasks: Let Cline explore and plan before taking action
- Enable Thinking for Complex Problems:
--thinkingprovides better reasoning - Leverage Task Resume: Continue expensive tasks without starting over
Security
- Use Command Permissions: Restrict what Cline can execute
- Review Before Yolo: Test tasks interactively before automating
- Keep API Keys Secure: Store in
~/.cline/data/secrets.json
Workflow Integration
- Combine with Git Hooks: Run Cline on pre-commit
- Pipe from Build Tools: Process compiler errors automatically
- Chain with Other CLIs: Use in complex shell pipelines
Troubleshooting
Authentication Issues
Task Not Starting
Plain Text Mode Unexpected
Plain text mode activates when:- Output is redirected
- stdin is piped
--jsonor--yoloflags are used
Next Steps
API Integration
Integrate Cline into your VS Code extensions
Custom Experts
Create domain-specific coding experts