> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cline.bot/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI Reference

> Complete command reference for Cline CLI including all commands, flags, and configuration options

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

```bash theme={"system"}
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 theme={"system"}
cline [prompt] [options]
cline <command> [options] [arguments]
```

## Global Options

These options work with any command:

| Option             | Description                                                      |
| ------------------ | ---------------------------------------------------------------- |
| `--config <path>`  | Use a custom configuration directory instead of `~/.cline/data/` |
| `-c, --cwd <path>` | Set the working directory for the task                           |
| `-v, --verbose`    | Show detailed output including model reasoning                   |
| `--help`           | Show help for the command                                        |

## Modes of Operation

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

| Mode            | When Activated                                             | Description                                                                         |
| --------------- | ---------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| **Interactive** | `cline` with no args, TTY connected                        | Rich terminal UI with real-time streaming, keyboard shortcuts, and visual feedback. |
| **Task**        | `cline "prompt"` with TTY connected                        | Interactive UI starts immediately with your task.                                   |
| **Plain Text**  | stdin piped, stdout redirected, or `--yolo`/`--json` flags | Clean text output without UI, suitable for scripting and CI/CD.                     |

## Agent Behavior

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

| Mode                   | Description                                                                                                                                                                                               |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **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 Mode**          | Cline 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 theme={"system"}
# Interactive mode (no arguments)
cline

# Start a task directly
cline "your prompt here"

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

**Options:**

| Option                    | Description                                                                                      |
| ------------------------- | ------------------------------------------------------------------------------------------------ |
| `-a, --act`               | Start in Act mode (default). Cline executes actions directly.                                    |
| `-p, --plan`              | Start in Plan mode. Cline analyzes and creates a strategy before acting.                         |
| `-y, --yolo`              | YOLO 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.                                                             |
| `--thinking`              | Enable extended thinking with a 1024 token budget.                                               |
| `--json`                  | Output messages as JSON (one object per line). Forces plain text mode.                           |
| `--timeout <seconds>`     | Maximum execution time before the task is stopped.                                               |
| `--continue`              | Resume the most recent task from the current working directory.                                  |

**Mode Behavior:**

| Invocation                   | Output Mode    | Why                         |
| ---------------------------- | -------------- | --------------------------- |
| `cline`                      | Interactive UI | No arguments, TTY connected |
| `cline "prompt"`             | Interactive UI | TTY connected               |
| `cline -y "prompt"`          | Plain text     | YOLO flag forces plain text |
| `cline --json "prompt"`      | JSON           | JSON flag forces plain text |
| `cat file \| cline "prompt"` | Plain text     | stdin is piped              |
| `cline "prompt" > out.txt`   | Plain text     | stdout is redirected        |

***

### cline task (alias: t)

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

```bash theme={"system"}
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 theme={"system"}
# Interactive wizard
cline auth

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

**Options:**

| Option                | Description                                                         |
| --------------------- | ------------------------------------------------------------------- |
| `-p, --provider <id>` | Provider ID. See [Supported Providers](#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 ID     | Description                             |
| --------------- | --------------------------------------- |
| `anthropic`     | Anthropic Claude (direct API)           |
| `openai-native` | OpenAI GPT models                       |
| `openai-codex`  | ChatGPT subscription via OAuth          |
| `openrouter`    | OpenRouter (access multiple providers)  |
| `bedrock`       | AWS Bedrock                             |
| `gemini`        | Google Gemini                           |
| `xai`           | X AI (Grok)                             |
| `cerebras`      | Cerebras (fast inference)               |
| `deepseek`      | DeepSeek                                |
| `ollama`        | Ollama (local models)                   |
| `lmstudio`      | LM Studio (local models)                |
| `openai`        | OpenAI-compatible API (custom base URL) |

***

### cline history (alias: h)

Browse task history with pagination.

```bash theme={"system"}
# Show recent tasks (default: 10)
cline history

# Show more tasks
cline history -n 20

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

**Options:**

| Option                 | Description                           |
| ---------------------- | ------------------------------------- |
| `-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 theme={"system"}
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 theme={"system"}
cline update
```

***

### cline version

Show the installed CLI version.

```bash theme={"system"}
cline version
```

***

### cline dev

Developer tools for debugging.

```bash theme={"system"}
# Open the log file
cline dev log
```

## Environment Variables

### CLINE\_DIR

Override the default configuration directory:

```bash theme={"system"}
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 theme={"system"}
export CLINE_COMMAND_PERMISSIONS='{"allow": ["npm *", "git *"], "deny": ["rm -rf *"]}'
```

**Format:**

```json theme={"system"}
{
  "allow": ["pattern1", "pattern2"],
  "deny": ["pattern3"],
  "allowRedirects": true
}
```

| Field            | Type       | Description                                                                                |
| ---------------- | ---------- | ------------------------------------------------------------------------------------------ |
| `allow`          | `string[]` | Glob patterns for allowed commands. If set, **only** matching commands are permitted.      |
| `deny`           | `string[]` | Glob patterns for denied commands. Deny rules **always take precedence** over allow rules. |
| `allowRedirects` | `boolean`  | Whether to allow shell redirects (`>`, `>>`, `<`). Default: `false`.                       |

**Examples:**

```bash theme={"system"}
# 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 theme={"system"}
{
  "type": "say",
  "text": "I'll create the file now.",
  "ts": 1760501486669,
  "say": "text"
}
```

**Required fields:**

| Field  | Type               | Description                    |
| ------ | ------------------ | ------------------------------ |
| `type` | `"ask"` \| `"say"` | Message category               |
| `text` | `string`           | Human-readable message content |
| `ts`   | `number`           | Unix timestamp in milliseconds |

**Optional fields:**

| Field       | Type       | Description                                                   |
| ----------- | ---------- | ------------------------------------------------------------- |
| `say`       | `string`   | Subtype when `type` is `"say"` (e.g., `"text"`, `"tool"`)     |
| `ask`       | `string`   | Subtype when `type` is `"ask"` (e.g., `"tool"`, `"followup"`) |
| `reasoning` | `string`   | Model reasoning (omitted when empty)                          |
| `partial`   | `boolean`  | `true` while streaming (omitted when complete)                |
| `images`    | `string[]` | Image URIs (omitted when empty)                               |
| `files`     | `string[]` | File paths (omitted when empty)                               |

## Configuration Files

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

```text theme={"system"}
~/.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 theme={"system"}
# Start interactive mode
cline

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

### Direct Task Execution

```bash theme={"system"}
# 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 theme={"system"}
# 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 theme={"system"}
# 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 theme={"system"}
# 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

* **Report bugs:** [https://github.com/cline/cline/issues](https://github.com/cline/cline/issues)
* **Discord community:** [https://discord.gg/cline](https://discord.gg/cline)
* **Documentation:** [https://docs.cline.bot](https://docs.cline.bot)

## 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>
