docs/cline-cli/getting-started.mdx
Cline CLI brings the full power of Cline to your terminal. Whether you prefer an interactive experience or automated workflows for CI/CD pipelines, the CLI adapts to your needs.
The CLI supports macOS, Linux, and Windows, and works with all the same AI providers as the VS Code extension.
The CLI operates in two distinct modes, automatically selecting the appropriate one based on how you invoke it:
Interactive mode is designed for hands-on development sessions where you want to collaborate with Cline in real-time. It provides a rich terminal interface that feels like chatting with an AI assistant.
When it activates: Running cline without arguments, or when stdin is a TTY (terminal).
cline
Key features:
@ - Reference workspace files with fuzzy search autocomplete/ - Quick access to /settings, /history, /models, and workflowsTab to toggle Plan/Act, Shift+Tab for auto-approve allInteractive mode keeps you in control. You review Cline's plan, approve or modify actions, and guide the conversation.
Learn more about interactive mode →
Headless mode is designed for automation, scripting, and CI/CD pipelines where human interaction isn't possible or desired.
When it activates: Using the -y/--yolo flag, --json flag, piping input/output, or when stdin is not a TTY.
# Headless with auto-approval (YOLO mode)
cline -y "Run tests and fix any failures"
# Headless with JSON output for parsing
cline --json "List all TODO comments" | jq '.text'
# Headless via piped input
cat README.md | cline "Summarize this document"
# Chain multiple headless commands
git diff | cline -y "explain these changes" | cline -y "write a commit message"
Key features:
-y, Cline approves all actions and runs autonomously--json to get structured output for parsingCline automatically detects which mode to use based on your invocation. This table shows how different command patterns trigger each mode, helping you predict behavior in scripts and interactive sessions.
| Invocation | Mode | Reason |
|---|---|---|
cline | Interactive | No arguments, TTY connected |
cline "task" | Interactive | TTY connected |
cline -y "task" | Headless | YOLO flag forces headless |
cline --json "task" | Headless | JSON flag forces headless |
cat file | cline "task" | Headless | stdin is piped |
cline "task" > output.txt | Headless | stdout is redirected |
Learn more about headless mode →
Cline CLI supports all providers available in the VS Code extension:
During setup, authenticate with cline auth to configure your preferred provider. See authentication →
Keep your codebase healthy with automated fixes. Cline scans for issues and applies corrections across multiple files.
cline -y "Fix all ESLint errors in src/"
Finds and fixes linting violations throughout your source directory.
cline -y "Update all deprecated React lifecycle methods"
Migrates legacy code patterns to modern equivalents (e.g., componentWillMount → useEffect).
cline -y "Update dependencies with known vulnerabilities"
Identifies outdated packages with security issues and updates them to safe versions.
Integrate Cline into your continuous integration pipelines for automated code review and documentation.
git diff origin/main | cline -y "Review these changes for issues"
Pipes your PR diff to Cline for automated code review, catching bugs and style issues before merge.
git log --oneline v1.0..v1.1 | cline -y "Write release notes"
Generates human-readable release notes from your commit history between two tags.
cline -y "Run tests and fix failures" --timeout 600
Executes your test suite, analyzes failures, and attempts fixes with a 10-minute timeout.
From quick edits to complex refactors, Cline adapts to your workflow.
cline
Launches interactive mode for exploratory development and back-and-forth collaboration.
cline "Refactor this function to use async/await"
Executes a focused task directly from the command line with approval prompts at key steps.
cline "Based on @src/api.ts, add error handling to all endpoints"
Uses file mentions (@) to give Cline context about specific files in your workspace.
Chain Cline with other CLI tools to build powerful automation workflows.
gh pr diff 123 | cline -y "Review this PR"
Fetches a GitHub PR diff and pipes it directly to Cline for review.
cline --json "List all TODO comments" | jq '.text'
Outputs structured JSON that you can process with tools like jq for scripting.
git diff | cline -y "explain" | cline -y "write a haiku about these changes"
Chains multiple Cline invocations together for creative multi-step workflows.
| Feature | Interactive Mode | Non-Interactive Mode |
|---|---|---|
| Interactive chat | ✓ | - |
| File mentions (@) | ✓ | ✓ (inline) |
| Slash commands (/) | ✓ | - |
| Settings panel | ✓ | cline config |
| Plan/Act toggle | ✓ (Tab) | -p / -a flags |
| Auto-approve | ✓ (Shift+Tab) | -y flag |
| Session summary | ✓ | - |
| JSON output | - | --json |
| Piped input | - | ✓ |
In just a few minutes, you can install the CLI, authenticate with your preferred AI provider, and start running tasks from any directory on your machine.
Cline CLI requires Node.js version 20 or higher. We recommend Node.js 22 for the best experience.
Check your Node.js version:
node --version
If you need to install or update Node.js, visit nodejs.org or use a version manager like nvm.
Install globally via npm:
npm install -g cline
Verify the installation:
cline version
After installation, run the authentication wizard:
cline auth
This launches an interactive wizard with multiple options. Choose the method that works best for your workflow.
Select "Sign in with Cline" to authenticate with your Cline account via OAuth. Your browser opens automatically to complete sign-in.
If you have a ChatGPT Plus or Pro subscription, select "Sign in with ChatGPT Subscription". This uses OpenAI's Codex OAuth to authenticate with your existing subscription.
Already using another AI coding CLI? Cline can import your existing configuration:
~/.codex/auth.json~/.local/share/opencode/auth.jsonSelect "Bring your own API key" to manually configure any supported provider. Or skip the wizard entirely with flags:
# Anthropic (Claude)
cline auth -p anthropic -k sk-ant-api-xxxxx -m claude-sonnet-4-5-20250929
# OpenAI
cline auth -p openai-native -k sk-xxxxx -m gpt-4o
# OpenRouter
cline auth -p openrouter -k sk-or-xxxxx -m anthropic/claude-sonnet-4-5-20250929
# OpenAI-compatible provider with custom base URL
cline auth -p openai -k your-api-key -b https://api.example.com/v1
Quick Setup Flags:
| Flag | Description |
|---|---|
-p, --provider <id> | Provider ID (e.g., anthropic, openai-native, openrouter) |
-k, --apikey <key> | Your API key |
-m, --modelid <id> | Model ID (e.g., claude-sonnet-4-5-20250929, gpt-4o) |
-b, --baseurl <url> | Base URL for OpenAI-compatible providers |
| Provider | Provider ID | Notes |
|---|---|---|
| Anthropic | anthropic | Direct Claude API access |
| OpenAI | openai-native | GPT-4o, GPT-4, etc. |
| OpenAI Codex | openai-codex | ChatGPT subscription OAuth |
| OpenRouter | openrouter | Access multiple providers |
| AWS Bedrock | bedrock | Claude via AWS |
| Google Gemini | gemini | Gemini Pro, etc. |
| X AI (Grok) | xai | Grok models |
| Cerebras | cerebras | Fast inference |
| DeepSeek | deepseek | DeepSeek models |
| Ollama | ollama | Local models |
| LM Studio | lmstudio | Local models |
| OpenAI Compatible | openai | Any OpenAI-compatible API |
Confirm everything is working with a simple test:
cline "What is 2 + 2?"
If Cline responds with an answer, your installation and authentication are complete.
Check your current configuration:
cline config
Now you're ready to use Cline. Choose how you want to work:
Launch the interactive CLI for development:
cline
You'll see the Cline welcome screen. Type your task and press Enter. Use:
Tab to toggle between Plan and Act modesShift+Tab to enable auto-approve/help for available commandsLearn more about interactive mode →
Run a task directly from your shell:
cline "Add error handling to utils.js"
For non-interactive execution (perfect for scripts and CI/CD):
cline -y "Run tests and fix any failures"
Learn more about headless mode →
To change your configured provider at any time:
cline auth
You can also use the settings panel in interactive mode:
cline
# Then type: /settings
# Navigate to the API tab
Check for updates and install the latest version:
cline update
Or update manually via npm:
npm update -g cline
If cline is not found after installation:
Ensure npm global bin is in your PATH:
npm bin -g
Add the path to your shell configuration (.bashrc, .zshrc, etc.):
export PATH="$PATH:$(npm bin -g)"
Restart your terminal or source your shell config.
If you get permission errors during installation:
# Option 1: Use a Node version manager (recommended)
# nvm, fnm, or volta handle permissions automatically
# Option 2: Fix npm permissions
# See: https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
If the browser doesn't open automatically during OAuth:
If your API key is rejected:
Provider-specific tips:
sk-ant-sk-To remove Cline CLI:
npm uninstall -g cline
To also remove configuration data:
rm -rf ~/.cline