Files
cline/docs/cline-cli/three-core-flows.mdx
T
b57aefb5a1 Cli 2.0 docs (#9060)
* docs: restructure CLI reference to web-friendly format

Replace embedded man page format with structured markdown sections
for better readability. Simplify description, reorganize commands and
options into clear categories, and update Next Steps navigation cards.

* Add ACP editor integrations documentation (#9036)

* Add ACP editor integrations documentation with JetBrains and Neovim video demos

* Add Model Orchestration documentation with --config and --thinking flags

- Document --config and --thinking flags in CLI reference
- Create new model-orchestration.mdx sample page
- Add patterns for CI/CD review, task phase optimization, and multi-model consensus
- Link to production GitHub Actions workflow
- Update samples overview with new card
- Update docs navigation

* Add Worktree Workflows documentation with --cwd flag

- Document --cwd flag in CLI reference
- Create comprehensive worktree-workflows.mdx sample page
- Add patterns for parallel execution and cross-worktree piping
- Include real-world examples and best practices
- Add CLI section to features/worktrees.mdx for discoverability
- Update samples overview and navigation
- Cross-link between CLI and VS Code worktree docs

* Remove broken image references from worktrees documentation

- Remove worktrees-overview.png Frame (image not available)
- Remove worktrees-merge.png Frame (image not available)
- Documentation remains fully functional with comprehensive text explanations

* Remove accidentally committed local test file

- Delete src/test/verify-platformio-mcp.ts which was causing CI failures
- File contained TypeScript errors and hardcoded local paths
- Was meant for local testing only, should not have been committed

* Add native JetBrains plugin recommendation to ACP docs

- Add prominent Note recommending native JetBrains plugin
- Link directly to JetBrains installation section
- Position ACP setup as an alternative approach
- Keep all existing ACP content and video

* docs: refine CLI reference formatting and ACP title

Improve CLI reference readability with clearer headings and descriptions, and clarify the ACP editor integration page title for better discovery.docs: refine CLI reference formatting and ACP title

Improve CLI reference readability with clearer headings and descriptions, and clarify the ACP editor integration page title for better discovery.

* Fix CLI 2.0 syntax in model-orchestration.mdx

- Updated issue analysis pipeline to use shell variables for passing context
- Added explanatory note about why direct piping doesn't work
- Corrected example to complete each phase before starting the next
- All examples now use proper CLI 2.0 syntax

* Completely rewrite cli-reference.mdx with accurate CLI 2.0 information

- Removed all outdated CLI 1.0 content (instance management, Cline Core architecture, gRPC references)
- Added accurate CLI 2.0 commands: task, history, config, auth, update, version, dev
- Corrected all command flags and options based on actual man page
- Added proper examples for all commands
- Included environment variables documentation (CLINE_DIR, CLINE_COMMAND_PERMISSIONS)
- Added shell completion instructions
- Removed incorrect three-layer architecture description
- All content now matches cli/man/cline.1.md source of truth

Fixes outdated documentation issue mentioned in PR#9036

* Fix MDX syntax error in cli-reference.mdx

- Replace angle bracket URLs with proper markdown links
- MDX parser was interpreting <https://...> as invalid HTML tags
- Now uses [url](url) format which is proper MDX syntax

Fixes deployment validation error

---------

Co-authored-by: Renee Huang <renee@cline.bot>

* docs: enhance interactive mode documentation with structured settings overview

* docs: restructure and improve CLI reference documentation

- Reorganize command structure with clearer global options section
- Add mode behavior table explaining interactive vs plain text modes
- Improve option descriptions with consistent formatting
- Add horizontal rules between sections for better readability
- Document timeout option and environment variables more clearly
- Add Tips & Tricks section for common usage patterns
- Update frontmatter description to reflect content changes

* docs: improve ACP editor integrations page with editor descriptions

- Update page title to be more concise ("ACP: Editor Integrations")
- Remove redundant H1 header that duplicated the title
- Add introductory descriptions for JetBrains, Neovim, and Zed sections
- Rename "Zed Editor" section to just "Zed" for consistency

* docs: expand CLI reference with modes of operation and agent behavior

* Update docs/cline-cli/cli-reference-deprecated.mdx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Tony Loehr <turingxo@gmail.com>
Co-authored-by: Renee Huang <renee@cline.bot>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-03 11:29:15 -08:00

293 lines
7.5 KiB
Plaintext

---
title: "CLI Workflows"
description: "Learn the three ways to use Cline CLI: interactive mode, direct task execution, and automation"
---
Cline CLI supports three primary workflows, each optimized for different use cases. Choose the approach that best fits your needs.
<Note>
**Migrating from an older CLI version?** Instance commands (`cline instance new/list/kill`) have been removed in Cline CLI 2.0. The new architecture is simpler. Just run `cline` for interactive mode or `cline "task"` for direct execution.
</Note>
## 1. Interactive Mode
The interactive CLI provides the richest experience for interactive development.
### Getting Started
```bash
cline
```
This launches an interactive session in your current directory. Type your task, and Cline will analyze and execute it.
### Key Features
**Plan/Act Mode Toggle** - Press `Tab` to switch between modes:
- **Plan Mode**: Cline analyzes your request and presents a strategy
- **Act Mode**: Cline executes actions directly
**Auto-approve Toggle** - Press `Shift+Tab` to enable automatic approval for all actions.
**Slash Commands** - Type `/` for quick access to:
- `/settings` - Configure providers, models, and features
- `/models` - Quick model switching
- `/history` - Browse and resume previous tasks
- `/clear` - Start a fresh task
- `/help` - Show available commands
**File Mentions** - Type `@` to reference workspace files:
```
@src/utils.ts add error handling to this file
```
**Session Summary** - When you exit with `Ctrl+C`, Cline displays a summary of your session including tasks completed, files modified, and token usage.
### When to Use Interactive Mode
- Exploring a new codebase
- Complex refactoring that requires back-and-forth
- Learning how Cline approaches problems
- Tasks where you want to review before executing
[Full Interactive Mode Guide →](/cline-cli/interactive-mode)
## 2. Direct Task Execution
Execute tasks directly from the command line without entering interactive mode.
### Basic Usage
```bash
cline "Add unit tests to utils.js"
```
Cline analyzes your task, creates a plan, and executes it. You'll be prompted for approval at key decision points.
### Piping Context
Pipe file contents or command output into Cline:
```bash
# Explain a file
cat README.md | cline "Summarize this document"
# Review git changes
git diff | cline "Review these changes and suggest improvements"
# Analyze command output
npm test 2>&1 | cline "Analyze these test failures and fix them"
```
### Chaining Cline Commands
Pipe Cline's output into another Cline instance for creative workflows:
```bash
# Explain changes, then write a commit message
git diff | cline -y "explain these changes" | cline -y "write a commit message for this"
# Generate code, then write tests
cline -y "create a fibonacci function" | cline -y "write unit tests for this code"
# Fun: Generate a poem about your code
git diff | cline -y "explain" | cline -y "write a haiku about this"
```
### Including Images
Attach images to your task:
```bash
cline task -i screenshot.png "Fix the layout issue shown in this screenshot"
# Or reference inline
cline "Fix the UI shown in @./design-mockup.png"
```
### Mode Selection
```bash
# Start in Plan mode (analyze before acting)
cline -p "Design a REST API for user management"
# Start in Act mode (default)
cline -a "Fix the typo in README.md"
```
### When to Use Direct Execution
- Quick, well-defined tasks
- Tasks with sufficient context in the prompt
- Scripting and shell workflows
- When you don't need interactive conversation
## 3. Automation & CI/CD
For fully autonomous operation in scripts, CI/CD pipelines, and automated workflows.
### YOLO Mode (Yes Mode)
The `-y` or `--yolo` flag enables fully autonomous operation:
```bash
cline -y "Run the test suite and fix any failures"
```
In YOLO mode:
- All actions are auto-approved
- Output is plain text (non-interactive)
- Process exits automatically when complete
- Perfect for CI/CD and scripts
<Warning>
Run YOLO mode on a clean git branch or directory. You get speed in exchange for oversight, so be ready to revert if needed.
</Warning>
### JSON Output
Use `--json` for machine-readable output:
```bash
cline --json "List all TODO comments in the codebase" | jq '.text'
```
JSON output follows the same format as task files in `~/.cline/data/tasks/<id>/ui_messages.json`.
**JSON Message Schema:**
| Field | Type | Description |
|-------|------|-------------|
| `type` | `"ask"` or `"say"` | Message category |
| `text` | `string` | Message content |
| `ts` | `number` | Unix timestamp (ms) |
| `reasoning` | `string` | (Optional) Model reasoning |
| `partial` | `boolean` | (Optional) Streaming flag |
### Timeout Control
Set a maximum execution time:
```bash
cline -y --timeout 600 "Run full test suite"
```
### Environment Variables
Control Cline behavior via environment variables:
**CLINE_DIR** - Custom configuration directory:
```bash
export CLINE_DIR=/path/to/config
cline -y "your task"
```
**CLINE_COMMAND_PERMISSIONS** - Restrict allowed commands:
```bash
export CLINE_COMMAND_PERMISSIONS='{"allow": ["npm *", "git *"], "deny": ["rm -rf *"]}'
cline -y "your task"
```
See [Configuration](/cline-cli/configuration#environment-variables) for full documentation.
### GitHub Actions Example
Automate PR reviews with Cline:
```yaml
name: AI Code Review
on:
pull_request:
types: [opened, synchronize]
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install Cline
run: npm install -g cline
- name: Configure Cline
run: cline auth -p anthropic -k ${{ secrets.ANTHROPIC_API_KEY }}
- name: Review PR
run: |
git diff origin/main...HEAD | cline -y "Review this PR for:
- Potential bugs
- Security issues
- Performance concerns
- Code style violations
Provide a summary of findings."
```
### Shell Script Example
Create a code review script:
```bash
#!/bin/bash
# review.sh - AI-powered code review
set -e
# Get the diff
DIFF=$(git diff HEAD~1)
if [ -z "$DIFF" ]; then
echo "No changes to review"
exit 0
fi
# Run Cline review
echo "$DIFF" | cline -y --json "Review this code diff for issues" | jq -r '.text'
```
### When to Use Automation Mode
- CI/CD pipelines
- Scheduled maintenance tasks
- Batch processing
- Any workflow requiring non-interactive execution
## Choosing the Right Flow
| Use Case | Recommended Flow |
|----------|------------------|
| Exploring a new codebase | Interactive Mode |
| Complex refactoring | Interactive Mode (Plan first) |
| Quick file edits | Direct Execution |
| Code review | Direct Execution with pipe |
| CI/CD integration | Automation (`-y` flag) |
| Scheduled tasks | Automation (`-y` flag) |
| Learning Cline | Interactive Mode |
## Next Steps
<Columns cols={2}>
<Card title="Interactive Mode" icon="terminal" href="/cline-cli/interactive-mode">
Master keyboard shortcuts, slash commands, and file mentions.
</Card>
<Card title="CLI Reference" icon="book" href="/cline-cli/cli-reference">
Complete command documentation with all flags and options.
</Card>
<Card title="Configuration" icon="gear" href="/cline-cli/configuration">
Environment variables, rules, and advanced settings.
</Card>
<Card title="YOLO Mode" icon="zap" href="/features/yolo-mode">
Deep dive into autonomous execution and safety considerations.
</Card>
</Columns>