Back to Cline

CLI Reference

docs/cline-cli/cli-reference.mdx

3.82.011.5 KB
Original Source

This page documents all available commands, flags, and configuration options for Cline CLI. For quick help in your terminal, use:

bash
cline --help          # Show all commands
cline task --help     # Show task command options
cline auth --help     # Show auth command options
man cline             # View the full manual page (if installed)

Synopsis

bash
cline [prompt] [options]
cline <command> [options] [arguments]

Global Options

These options work with any command:

OptionDescription
--config <path>Use a custom configuration directory instead of ~/.cline/data/
-c, --cwd <path>Set the working directory for the task
-v, --verboseShow detailed output including model reasoning
--helpShow help for the command

Modes of Operation

Cline CLI automatically detects the best output mode based on how you invoke it:

ModeWhen ActivatedDescription
Interactivecline with no args, TTY connectedRich terminal UI with real-time streaming, keyboard shortcuts, and visual feedback.
Taskcline "prompt" with TTY connectedInteractive UI starts immediately with your task.
Plain Textstdin piped, stdout redirected, or --yolo/--json flagsClean text output without UI, suitable for scripting and CI/CD.

Agent Behavior

Cline operates in two primary modes that control how it approaches tasks:

ModeDescription
Act Mode (default)Cline actively uses tools to accomplish tasks. It can read files, write code, execute commands, use a headless browser, and more.
Plan ModeCline gathers information and creates a detailed plan before implementation. It explores the codebase, asks clarifying questions, and presents a strategy for your approval before switching to Act Mode.

Use -a, --act or -p, --plan flags to explicitly set the mode.

Commands

cline (default)

Run Cline without a subcommand to start a task or enter interactive mode.

bash
# Interactive mode (no arguments)
cline

# Start a task directly
cline "your prompt here"

# Resume the latest task for the current directory
cline --continue

Options:

OptionDescription
-a, --actStart in Act mode (default). Cline executes actions directly.
-p, --planStart in Plan mode. Cline analyzes and creates a strategy before acting.
-y, --yoloYOLO mode: auto-approve all actions, use plain text output, exit when complete. Ideal for CI/CD.
-m, --model <id>Use a specific model (e.g., claude-sonnet-4-5-20250929, gpt-4o).
-i, --images <paths...>Include image files with the prompt.
--thinkingEnable extended thinking with a 1024 token budget.
--jsonOutput messages as JSON (one object per line). Forces plain text mode.
--timeout <seconds>Maximum execution time before the task is stopped.
--continueResume the most recent task from the current working directory.

Mode Behavior:

InvocationOutput ModeWhy
clineInteractive UINo arguments, TTY connected
cline "prompt"Interactive UITTY connected
cline -y "prompt"Plain textYOLO flag forces plain text
cline --json "prompt"JSONJSON flag forces plain text
cat file | cline "prompt"Plain textstdin is piped
cline "prompt" > out.txtPlain textstdout is redirected

cline task (alias: t)

Run a task with a prompt. This is equivalent to cline "prompt".

bash
cline task "Create a REST API endpoint"
cline t "Fix the bug in utils.js"

Options: Same as the default command above.


cline auth

Configure authentication with an AI provider.

bash
# Interactive wizard
cline auth

# Quick setup with flags
cline auth -p anthropic -k sk-ant-api-xxxxx -m claude-sonnet-4-5-20250929

Options:

OptionDescription
-p, --provider <id>Provider ID. See Supported Providers below.
-k, --apikey <key>API key for the provider.
-m, --modelid <id>Model ID to use (e.g., claude-sonnet-4-5-20250929, gpt-4o).
-b, --baseurl <url>Base URL for OpenAI-compatible providers.

Supported Providers:

Provider IDDescription
anthropicAnthropic Claude (direct API)
openai-nativeOpenAI GPT models
openai-codexChatGPT subscription via OAuth
openrouterOpenRouter (access multiple providers)
bedrockAWS Bedrock
geminiGoogle Gemini
xaiX AI (Grok)
cerebrasCerebras (fast inference)
deepseekDeepSeek
ollamaOllama (local models)
lmstudioLM Studio (local models)
openaiOpenAI-compatible API (custom base URL)

cline history (alias: h)

Browse task history with pagination.

bash
# Show recent tasks (default: 10)
cline history

# Show more tasks
cline history -n 20

# Paginate through history
cline history -n 10 -p 2

Options:

OptionDescription
-n, --limit <number>Number of tasks to show (default: 10)
-p, --page <number>Page number, 1-based (default: 1)

cline config

View and manage configuration settings.

bash
cline config

Opens an interactive configuration view with tabs for:

  • Settings - Global and workspace-specific settings
  • Rules - .clinerules files and imported rules
  • Workflows - Available workflows (appear as slash commands)
  • Hooks - Configured hook scripts
  • Skills - Enabled skills

cline update

Check for updates and install the latest version.

bash
cline update

cline version

Show the installed CLI version.

bash
cline version

cline dev

Developer tools for debugging.

bash
# Open the log file
cline dev log

Environment Variables

CLINE_DIR

Override the default configuration directory:

bash
export CLINE_DIR=/path/to/custom/config
cline "your task"

When set, all Cline data (settings, secrets, task history) is stored in this directory instead of ~/.cline/data/.

Use cases:

  • Running isolated Cline instances with different settings
  • CI/CD environments with custom state directories
  • Testing configuration changes without affecting your main setup

CLINE_COMMAND_PERMISSIONS

Restrict which shell commands Cline can execute:

bash
export CLINE_COMMAND_PERMISSIONS='{"allow": ["npm *", "git *"], "deny": ["rm -rf *"]}'

Format:

json
{
  "allow": ["pattern1", "pattern2"],
  "deny": ["pattern3"],
  "allowRedirects": true
}
FieldTypeDescription
allowstring[]Glob patterns for allowed commands. If set, only matching commands are permitted.
denystring[]Glob patterns for denied commands. Deny rules always take precedence over allow rules.
allowRedirectsbooleanWhether to allow shell redirects (>, >>, <). Default: false.

Examples:

bash
# Allow only npm and git commands (deny everything else)
export CLINE_COMMAND_PERMISSIONS='{"allow": ["npm *", "git *"]}'

# Allow dev commands but explicitly deny dangerous ones
export CLINE_COMMAND_PERMISSIONS='{"allow": ["npm *", "git *", "node *"], "deny": ["rm -rf *", "sudo *"]}'

# Allow file reading with redirects
export CLINE_COMMAND_PERMISSIONS='{"allow": ["cat *", "echo *"], "allowRedirects": true}'

How commands are evaluated:

  1. Check for dangerous characters (backticks outside single quotes, unquoted newlines)
  2. Parse command into segments split by operators (&&, ||, |, ;)
  3. If redirects are detected and allowRedirects is not true, command is denied
  4. Each segment is validated against deny rules first, then allow rules
  5. Subshell contents ($(...) and (...)) are recursively validated
  6. All segments must pass for the command to be allowed

JSON Output Format

When using --json, each message is output as a JSON object (one per line):

json
{
  "type": "say",
  "text": "I'll create the file now.",
  "ts": 1760501486669,
  "say": "text"
}

Required fields:

FieldTypeDescription
type"ask" | "say"Message category
textstringHuman-readable message content
tsnumberUnix timestamp in milliseconds

Optional fields:

FieldTypeDescription
saystringSubtype when type is "say" (e.g., "text", "tool")
askstringSubtype when type is "ask" (e.g., "tool", "followup")
reasoningstringModel reasoning (omitted when empty)
partialbooleantrue while streaming (omitted when complete)
imagesstring[]Image URIs (omitted when empty)
filesstring[]File paths (omitted when empty)

Configuration Files

Cline stores all data in ~/.cline/ by default:

text
~/.cline/
├── data/                    # Configuration directory
│   ├── globalState.json     # Global settings
│   ├── secrets.json         # API keys (stored securely)
│   ├── workspace/           # Workspace-specific state
│   └── tasks/               # Task history and conversations
└── log/                     # Debug logs (view with cline dev log)

Examples

Interactive Development

bash
# Start interactive mode
cline

# Start with a task and use interactive UI
cline "Help me refactor this codebase"

Direct Task Execution

bash
# Run a task directly
cline "Add error handling to utils.js"

# Start in Plan mode to review strategy first
cline -p "Design a caching layer for the API"

# Use a specific model
cline -m gpt-4o "Explain this code"

Piped Input

bash
# Pipe file contents
cat README.md | cline "Summarize this document"

# Review git changes
git diff | cline "Review these changes"

# Analyze test output
npm test 2>&1 | cline "Fix any failing tests"

Automation and CI/CD

bash
# YOLO mode for automated workflows
cline -y "Run tests and fix failures"

# JSON output for scripting
cline --json "List all TODO comments" | jq '.text'

# With timeout
cline -y --timeout 600 "Run the full test suite"

# Chain commands
git diff | cline -y "explain" | cline -y "write a commit message"

Authentication

bash
# Interactive wizard
cline auth

# Quick setup: Anthropic
cline auth -p anthropic -k sk-ant-api-xxxxx -m claude-sonnet-4-5-20250929

# Quick setup: OpenAI
cline auth -p openai-native -k sk-xxxxx -m gpt-4o

# Quick setup: OpenRouter
cline auth -p openrouter -k sk-or-xxxxx

# OpenAI-compatible with custom URL
cline auth -p openai -k your-key -b https://api.example.com/v1

Support

See Also

<Columns cols={2}> <Card title="Installation & Setup" icon="download" href="/cline-cli/installation"> Install Cline CLI and configure authentication. </Card> <Card title="Interactive Mode" icon="terminal" href="/cline-cli/interactive-mode"> Keyboard shortcuts, slash commands, and file mentions. </Card> <Card title="Headless Mode" icon="robot" href="/cline-cli/three-core-flows"> Run Cline autonomously in scripts, CI/CD pipelines, and automated workflows. </Card> <Card title="Configuration" icon="gear" href="/cline-cli/configuration"> Environment variables and advanced settings. </Card> </Columns>