mirror of
https://github.com/cline/cline.git
synced 2026-09-19 02:05:44 +08:00
* only doc changes * merge * fix installtion page redirects * fix redirect, remove unused parts * rm irrelevant info * clean up terminal guides * docs: add home page and reorganize navigation * chore: remove 71 unused docs files not referenced in navigation Remove .mdx files that are no longer referenced in docs.json navigation and only existed as stale content from previous documentation restructuring. These files were either completely orphaned or only served as redirect source pages (Mintlify handles redirects at the routing level without needing the source file to exist). Updated docs.json redirects that previously pointed to archive/ pages to point to current equivalents instead: - /archive/understanding-context-management → /model-config/context-windows - /archive/prompt-engineering-guide → /customization/cline-rules - /archive/telemetry → /enterprise-solutions/monitoring/telemetry Deleted files by category: Archive (entire directory removed): - archive/prompt-engineering-guide.mdx - archive/telemetry.mdx - archive/understanding-context-management.mdx Cline CLI: - cline-cli/cli-reference-deprecated.mdx Enterprise Solutions (16 files): - enterprise-solutions/bundled-endpoints.mdx - enterprise-solutions/configuration/overview.mdx - enterprise-solutions/configuration/choosing-your-deployment.mdx - enterprise-solutions/configuration/infrastructure-configuration/overview.mdx - enterprise-solutions/configuration/infrastructure-configuration/rules.mdx - enterprise-solutions/configuration/infrastructure-configuration/workflows.mdx - enterprise-solutions/configuration/infrastructure-configuration/control-other-cline-features/overview.mdx - enterprise-solutions/configuration/infrastructure-configuration/mcp/overview.mdx - enterprise-solutions/configuration/infrastructure-configuration/mcp/mcp-marketplace.mdx - enterprise-solutions/configuration/infrastructure-configuration/mcp/remote-mcp-servers.mdx - enterprise-solutions/configuration/infrastructure-configuration/providers/overview.mdx - enterprise-solutions/configuration/infrastructure-configuration/providers/custom.mdx - enterprise-solutions/configuration/infrastructure-configuration/providers/aws-bedrock/overview.mdx - enterprise-solutions/configuration/infrastructure-configuration/providers/google-vertex/overview.mdx - enterprise-solutions/configuration/infrastructure-configuration/providers/litellm/overview.mdx - enterprise-solutions/monitoring/opentelemetry_override.mdx Exploring Cline's Tools (entire directory removed): - exploring-clines-tools/cline-tools-guide.mdx - exploring-clines-tools/new-task-tool.mdx - exploring-clines-tools/remote-browser-support.mdx Features — old pages consolidated into core-workflows/ and customization/ (37 files): - features/checkpoints.mdx - features/drag-and-drop.mdx - features/editing-messages.mdx - features/explain-changes.mdx - features/skills.mdx - features/yolo-mode.mdx - features/at-mentions/ (7 files — all consolidated into core-workflows/working-with-files) - features/cline-rules/ (2 files — consolidated into customization/cline-rules) - features/commands-and-shortcuts/ (5 files — consolidated into core-workflows/using-commands) - features/customization/ (2 files) - features/hooks/ (3 files — consolidated into customization/hooks) - features/slash-commands/ (7 files) - features/slash-commands/workflows/ (3 files — consolidated into customization/workflows) - features/tasks/ (2 files — consolidated into core-workflows/task-management) Introduction (entire directory removed): - introduction/overview.mdx - introduction/welcome.mdx MCP: - mcp/adding-mcp-servers-from-github.mdx - mcp/configuring-mcp-servers.mdx More Info (entire directory removed): - more-info/telemetry.mdx Prompting (entire directory removed): - prompting/cline-memory-bank.mdx - prompting/prompt-engineering-guide.mdx - prompting/understanding-context-management.mdx Provider Config: - provider-config/fireworks-ai.mdx - provider-config/ollama.mdx Getting Started: - getting-started/selecting-your-model.mdx Total: 71 files deleted, 12,344 lines removed. * docs: update and add documentation pages * revert unintended formatting changes to src files * new first project docs --------- Co-authored-by: Juan Pablo Flores <juan@cline.bot>
458 lines
14 KiB
Plaintext
458 lines
14 KiB
Plaintext
---
|
|
title: "Getting Started"
|
|
description: "Run Cline AI coding agents directly in your terminal with an interactive CLI or automated workflows"
|
|
---
|
|
|
|
## What is Cline CLI?
|
|
|
|
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.
|
|
|
|
## Two Ways to Use Cline CLI
|
|
|
|
The CLI operates in two distinct modes, automatically selecting the appropriate one based on how you invoke it:
|
|
|
|
### Interactive Mode
|
|
|
|
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).
|
|
|
|
```bash
|
|
cline
|
|
```
|
|
|
|
Key features:
|
|
|
|
- **Real-time conversation** - Type messages, see Cline's responses, and iterate on tasks
|
|
- **Visual feedback** - Animated welcome screen, syntax-highlighted code, and progress indicators
|
|
- **File mentions** with `@` - Reference workspace files with fuzzy search autocomplete
|
|
- **Slash commands** with `/` - Quick access to `/settings`, `/history`, `/models`, and workflows
|
|
- **Keyboard shortcuts** - `Tab` to toggle Plan/Act, `Shift+Tab` for auto-approve all
|
|
- **Session summaries** - See tasks completed, files modified, and token usage on exit
|
|
- **Settings panel** - Configure providers, models, and features without leaving the CLI
|
|
|
|
Interactive mode keeps you in control. You review Cline's plan, approve or modify actions, and guide the conversation.
|
|
|
|
[Learn more about interactive mode →](/cline-cli/interactive-mode)
|
|
|
|
### Headless Mode (Non-Interactive)
|
|
|
|
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.
|
|
|
|
```bash
|
|
# 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:
|
|
|
|
- **No visual interface** - Clean text or JSON output suitable for scripting
|
|
- **Automatic execution** - With `-y`, Cline approves all actions and runs autonomously
|
|
- **Process control** - Exits automatically when the task completes
|
|
- **Piped workflows** - Read from stdin, write to stdout, chain with other commands
|
|
- **Machine-readable output** - Use `--json` to get structured output for parsing
|
|
|
|
<Warning>
|
|
Headless mode with `-y` gives Cline full autonomy. Run on a clean git branch so you can easily revert changes if needed.
|
|
</Warning>
|
|
|
|
### Mode Detection Summary
|
|
|
|
Cline 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/three-core-flows)
|
|
|
|
## Supported Model Providers
|
|
|
|
Cline CLI supports all providers available in the VS Code extension:
|
|
|
|
- **Anthropic** (Claude)
|
|
- **OpenAI** (GPT-4o, GPT-4)
|
|
- **OpenAI Codex** (ChatGPT subscription)
|
|
- **OpenRouter**
|
|
- **AWS Bedrock**
|
|
- **Google Gemini**
|
|
- **X AI (Grok)**
|
|
- **Cerebras**
|
|
- **DeepSeek**
|
|
- **Ollama** (local models)
|
|
- **LM Studio** (local models)
|
|
- **OpenAI Compatible** (any compatible API)
|
|
|
|
During setup, authenticate with `cline auth` to configure your preferred provider. [See authentication →](#authenticate)
|
|
|
|
## What You Can Build
|
|
|
|
### Automated Code Maintenance
|
|
|
|
Keep your codebase healthy with automated fixes. Cline scans for issues and applies corrections across multiple files.
|
|
|
|
```bash
|
|
cline -y "Fix all ESLint errors in src/"
|
|
```
|
|
Finds and fixes linting violations throughout your source directory.
|
|
|
|
```bash
|
|
cline -y "Update all deprecated React lifecycle methods"
|
|
```
|
|
Migrates legacy code patterns to modern equivalents (e.g., `componentWillMount` → `useEffect`).
|
|
|
|
```bash
|
|
cline -y "Update dependencies with known vulnerabilities"
|
|
```
|
|
Identifies outdated packages with security issues and updates them to safe versions.
|
|
|
|
### CI/CD Integration
|
|
|
|
Integrate Cline into your continuous integration pipelines for automated code review and documentation.
|
|
|
|
```bash
|
|
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.
|
|
|
|
```bash
|
|
git log --oneline v1.0..v1.1 | cline -y "Write release notes"
|
|
```
|
|
Generates human-readable release notes from your commit history between two tags.
|
|
|
|
```bash
|
|
cline -y "Run tests and fix failures" --timeout 600
|
|
```
|
|
Executes your test suite, analyzes failures, and attempts fixes with a 10-minute timeout.
|
|
|
|
### Development Workflows
|
|
|
|
From quick edits to complex refactors, Cline adapts to your workflow.
|
|
|
|
```bash
|
|
cline
|
|
```
|
|
Launches interactive mode for exploratory development and back-and-forth collaboration.
|
|
|
|
```bash
|
|
cline "Refactor this function to use async/await"
|
|
```
|
|
Executes a focused task directly from the command line with approval prompts at key steps.
|
|
|
|
```bash
|
|
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.
|
|
|
|
### Custom Shell Pipelines
|
|
|
|
Chain Cline with other CLI tools to build powerful automation workflows.
|
|
|
|
```bash
|
|
gh pr diff 123 | cline -y "Review this PR"
|
|
```
|
|
Fetches a GitHub PR diff and pipes it directly to Cline for review.
|
|
|
|
```bash
|
|
cline --json "List all TODO comments" | jq '.text'
|
|
```
|
|
Outputs structured JSON that you can process with tools like `jq` for scripting.
|
|
|
|
```bash
|
|
git diff | cline -y "explain" | cline -y "write a haiku about these changes"
|
|
```
|
|
Chains multiple Cline invocations together for creative multi-step workflows.
|
|
|
|
## Features at a Glance
|
|
|
|
| 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 | - | ✓ |
|
|
|
|
---
|
|
|
|
## Installation & Setup
|
|
|
|
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.
|
|
|
|
### Prerequisites
|
|
|
|
Cline CLI requires **Node.js version 20 or higher**. We recommend Node.js 22 for the best experience.
|
|
|
|
Check your Node.js version:
|
|
|
|
```bash
|
|
node --version
|
|
```
|
|
|
|
If you need to install or update Node.js, visit [nodejs.org](https://nodejs.org) or use a version manager like [nvm](https://github.com/nvm-sh/nvm).
|
|
|
|
### Install Cline CLI
|
|
|
|
Install globally via npm:
|
|
|
|
```bash
|
|
npm install -g cline
|
|
```
|
|
|
|
Verify the installation:
|
|
|
|
```bash
|
|
cline version
|
|
```
|
|
|
|
<Tip>
|
|
To install a specific version, use `npm install -g cline@2.0.0`. Check [npm](https://www.npmjs.com/package/cline) for available versions.
|
|
</Tip>
|
|
|
|
### Authenticate
|
|
|
|
After installation, run the authentication wizard:
|
|
|
|
```bash
|
|
cline auth
|
|
```
|
|
|
|
This launches an interactive wizard with multiple options. Choose the method that works best for your workflow.
|
|
|
|
#### Option 1: Sign in with Cline (Recommended)
|
|
|
|
Select **"Sign in with Cline"** to authenticate with your Cline account via OAuth. Your browser opens automatically to complete sign-in.
|
|
|
|
#### Option 2: Sign in with ChatGPT Subscription
|
|
|
|
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.
|
|
|
|
#### Option 3: Import from Existing Tools
|
|
|
|
Already using another AI coding CLI? Cline can import your existing configuration:
|
|
|
|
- **Import from Codex CLI** - Imports credentials from `~/.codex/auth.json`
|
|
- **Import from OpenCode** - Imports configuration from `~/.local/share/opencode/auth.json`
|
|
|
|
#### Option 4: Bring Your Own API Key
|
|
|
|
Select **"Bring your own API key"** to manually configure any supported provider. Or skip the wizard entirely with flags:
|
|
|
|
```bash
|
|
# 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 |
|
|
|
|
<Tip>
|
|
Flags are especially useful for scripting, CI/CD environments, or setting up multiple machines.
|
|
</Tip>
|
|
|
|
#### Supported 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 |
|
|
|
|
### Verify Your Setup
|
|
|
|
Confirm everything is working with a simple test:
|
|
|
|
```bash
|
|
cline "What is 2 + 2?"
|
|
```
|
|
|
|
If Cline responds with an answer, your installation and authentication are complete.
|
|
|
|
Check your current configuration:
|
|
|
|
```bash
|
|
cline config
|
|
```
|
|
|
|
### Quick Start
|
|
|
|
Now you're ready to use Cline. Choose how you want to work:
|
|
|
|
#### Interactive Mode
|
|
|
|
Launch the interactive CLI for development:
|
|
|
|
```bash
|
|
cline
|
|
```
|
|
|
|
You'll see the Cline welcome screen. Type your task and press Enter. Use:
|
|
- `Tab` to toggle between Plan and Act modes
|
|
- `Shift+Tab` to enable auto-approve
|
|
- `/help` for available commands
|
|
|
|
[Learn more about interactive mode →](/cline-cli/interactive-mode)
|
|
|
|
#### Direct Task Execution
|
|
|
|
Run a task directly from your shell:
|
|
|
|
```bash
|
|
cline "Add error handling to utils.js"
|
|
```
|
|
|
|
For non-interactive execution (perfect for scripts and CI/CD):
|
|
|
|
```bash
|
|
cline -y "Run tests and fix any failures"
|
|
```
|
|
|
|
[Learn more about headless mode →](/cline-cli/three-core-flows)
|
|
|
|
### Switching Providers
|
|
|
|
To change your configured provider at any time:
|
|
|
|
```bash
|
|
cline auth
|
|
```
|
|
|
|
You can also use the settings panel in interactive mode:
|
|
|
|
```bash
|
|
cline
|
|
# Then type: /settings
|
|
# Navigate to the API tab
|
|
```
|
|
|
|
### Updating
|
|
|
|
Check for updates and install the latest version:
|
|
|
|
```bash
|
|
cline update
|
|
```
|
|
|
|
Or update manually via npm:
|
|
|
|
```bash
|
|
npm update -g cline
|
|
```
|
|
|
|
### Troubleshooting
|
|
|
|
#### Command Not Found
|
|
|
|
If `cline` is not found after installation:
|
|
|
|
1. Ensure npm global bin is in your PATH:
|
|
```bash
|
|
npm bin -g
|
|
```
|
|
|
|
2. Add the path to your shell configuration (`.bashrc`, `.zshrc`, etc.):
|
|
```bash
|
|
export PATH="$PATH:$(npm bin -g)"
|
|
```
|
|
|
|
3. Restart your terminal or source your shell config.
|
|
|
|
#### Permission Errors
|
|
|
|
If you get permission errors during installation:
|
|
|
|
```bash
|
|
# 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
|
|
```
|
|
|
|
#### OAuth Flow Issues
|
|
|
|
If the browser doesn't open automatically during OAuth:
|
|
1. Copy the URL from the terminal
|
|
2. Paste it in your browser manually
|
|
3. Complete the sign-in flow
|
|
4. Return to the terminal
|
|
|
|
#### API Key Validation
|
|
|
|
If your API key is rejected:
|
|
1. Verify the key is correct and hasn't expired
|
|
2. Check that you've selected the correct provider
|
|
3. Ensure your API account has the necessary permissions
|
|
|
|
**Provider-specific tips:**
|
|
- **Anthropic**: Keys start with `sk-ant-`
|
|
- **OpenAI**: Keys start with `sk-`
|
|
- **AWS Bedrock**: Requires AWS credentials configured separately. See [AWS Bedrock documentation](/provider-config/aws-bedrock/api-key).
|
|
|
|
### Uninstallation
|
|
|
|
To remove Cline CLI:
|
|
|
|
```bash
|
|
npm uninstall -g cline
|
|
```
|
|
|
|
To also remove configuration data:
|
|
|
|
```bash
|
|
rm -rf ~/.cline
|
|
```
|
|
|
|
## Next Steps
|
|
|
|
- **[Interactive Mode](/cline-cli/interactive-mode)** - Master the interactive CLI with shortcuts and slash commands
|
|
- **[Headless Mode](/cline-cli/three-core-flows)** - Run Cline autonomously in scripts, CI/CD pipelines, and automated workflows
|
|
- **[Configuration](/cline-cli/configuration)** - Configure settings, rules, workflows, and environment variables
|
|
- **[CLI Reference](/cline-cli/cli-reference)** - Complete command documentation with all flags and options
|