跳到正文
FunCoding

搜索

搜索文档、Skill 和 MCP

CLI Reference

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

cline --help           # Show all commands
cline <command> --help # Show help for a specific command

Synopsis

cline [options] [command] [prompt]

Help Menu

This is the output of cline --help. Run it to see the options in your version.

Usage: cline [options] [command] [prompt]

Cline CLI - AI coding assistant in your terminal

Arguments:
  prompt                        Your prompt. Default to start in act mode with auto-approve enabled.

Options:
  -V, --version                 Output the version number
  -p, --plan                    Run in plan mode
  --json                        Output messages as JSON instead of styled text
  --auto-approve <boolean>      Set tool auto-approval for all tools (default: true)
  -c, --cwd <path>              Working directory
  --thinking <level>            Set reasoning effort: none|low|medium|high|xhigh. Bare --thinking uses medium; omitted uses the level last chosen with /model, or the provider default.
  --compaction <mode>           Context compaction mode: agentic|basic|off (default: agentic)
  -i, --tui                     Open the terminal user interface (TUI) for interactive sessions
  --id <session-id>             Resume an existing session by ID
  -P, --provider <id>           Provider id (default: cline)
  -k, --key <api-key>           API key for this run, also saved as the provider's key
  -m, --model <model-id>        Model to use for the session with the selected provider
  -s, --system <system-prompt>  Override the default system prompt
  -z, --zen                     Start a session that runs in the background hub
  --retries <count>             Number of maximum consecutive mistakes (retries) before exiting (default: 3)
  -t, --timeout <seconds>       Optional timeout in seconds (default: 0 for no timeout)
  --acp                         Run in Agent Client Protocol (ACP) mode for editor integration
  --config <path>               Configuration directory (default: ~/.cline)
  --data-dir <path>             Use isolated local state at this directory path (default: ~/.cline/data)
  --hooks-dir <path>            Directory path to additional hooks for runtime hook injection (default: ~/.cline/hooks)
  --worktree                    Auto-create a detached git worktree under ~/.cline/worktrees/ and run the task there
  --update                      Check for updates and install if available
  --kanban                      Run the kanban app
  -v, --verbose                 Show verbose output
  -h, --help                    display help for command

Commands:
  auth [options] [provider]     Authenticate a provider and configure what model is used
  config [options]              Show current configuration
  plugin                        Manage Cline Plugins
  skill [args...]               Manage Cline Skills via the open skills CLI (npx skills)
  connect [options] [channel]   Connect to an external channel
  mcp                           Manage MCP servers
  doctor                        Diagnose and fix configuration issues
  history|h [options]           List session history or manage saved sessions
  hook                          Handle a hook payload from stdin
  schedule                      Manage scheduled tasks
  hub                           Manage the local hub daemon
  update [options]              Check for updates and install if available
  version                       Show Cline CLI version number
  kanban                        Run the kanban app

Global Options

OptionDescription
-V, --versionOutput the version number
-p, --planRun in plan mode
--jsonOutput messages as JSON instead of styled text
--auto-approve <boolean>Set tool auto-approval for all tools (default: true; in ACP mode the default is false)
-t, --timeout <seconds>Optional timeout in seconds (default: 0 for no timeout)
-m, --model <model-id>Model to use for the session with the selected provider
-v, --verboseShow verbose output
-c, --cwd <path>Working directory
--config <path>Configuration directory (default: ~/.cline)
--data-dir <path>Use isolated local state at this directory path (default: ~/.cline/data)
--thinking <level>Set reasoning effort: none|low|medium|high|xhigh. Bare --thinking uses medium. Without the flag, Cline uses the level you last chose with /model, or else the provider's default
--compaction <mode>Context compaction mode: agentic, basic or off (default: agentic)
--retries <count>Maximum consecutive mistakes (retries) before exiting (default: 3)
--hooks-dir <path>Directory path to additional hooks for runtime hook injection (default: ~/.cline/hooks)
--acpRun in Agent Client Protocol (ACP) mode for editor integration
-i, --tuiOpen the terminal user interface (TUI) for interactive sessions
--id <session-id>Resume an existing session by ID
-k, --key <api-key>API key for this run. The CLI also saves it as the provider's key
-P, --provider <id>Provider id (default: cline)
-s, --system <system-prompt>Override the default system prompt
-z, --zenStart a session that runs in the background hub
--worktreeCreate a detached git worktree under ~/.cline/worktrees/ and run the task there
--updateCheck for updates and install if available
--kanbanRun the Kanban app
-h, --helpDisplay help for command

Commands

cline (default)

Start a task or enter interactive mode.

cline
cline "your prompt here"
cline "Run tests and fix failures"
echo "prompt" | cline

auth [options] [provider]

Configure authentication with an AI provider. Without options, cline auth opens an interactive setup. To set up without prompts, pass the provider, key and model:

cline auth
cline auth -p anthropic -k "$ANTHROPIC_API_KEY" -m claude-sonnet-5-5
OptionDescription
-p, --provider <id>Provider ID (or pass it as the first argument)
-k, --apikey <key>API key
-m, --modelid <id>Model ID
-b, --baseurl <url>Base URL
--azure-api-version <version>Azure API version

config [options] [target]

cline config opens the configuration view in your terminal. To print one part of the configuration instead, for example in a script, name a target: workflows, rules, skills, agents, plugins, hooks, mcp or tools.

cline config
cline config mcp
cline config tools --json
OptionDescription
--jsonPrint the target as JSON

connect [options] [channel]

Connect Cline to a messaging channel: telegram, slack, discord, gchat, whatsapp or linear. Without a channel, cline connect opens a setup wizard. See Connectors.

cline connect
cline connect telegram -k <BOT-TOKEN>
cline connect telegram --help    # Options for one channel
OptionDescription
--stopStop every connector, or only the named channel's
--restartRestart the named channel's connector. Pass the same options you started it with

Put --stop and --restart before the channel, as in cline connect --stop telegram. Options after the channel go to the channel's connector.

mcp

Manage MCP servers. cline mcp opens a menu in your terminal to list, add, edit, enable or disable, authorize and delete servers. See MCP.

cline mcp
cline mcp add files --yes -- npx -y @modelcontextprotocol/server-filesystem .
cline mcp add docs https://example.com/mcp --transport http --header "Authorization: Bearer TOKEN" --yes
cline mcp remove docs

cline mcp add (or install) saves a server: a command and its arguments after -- for a local server, or a URL for a remote one. Without --yes, it opens the add wizard with those fields filled in. cline mcp remove (or uninstall) deletes a server by name.

doctor

Diagnose and fix configuration issues.

cline doctor
cline doctor fix    # Kill all running Cline processes
cline doctor log    # Open the CLI log file

history|h [options]

List session history or manage saved sessions. cline history opens a session picker in your terminal. When its output goes to a script or a file, it prints the list instead.

cline history
cline history --json --limit 10
cline history export <session-id> -o session.html
cline history delete --session-id <session-id>
Option or commandDescription
--jsonPrint the sessions as JSON
--limit <count>Maximum number of sessions to show, newest first (default: 50)
export <session-id>Export a session as a standalone HTML file (-o, --output <path> names the file)
delete --session-id <id>Delete a session from history
update --session-id <id>Change a session's --title, --prompt or --metadata <json>

hook

Handle a hook payload from stdin.

cat payload.json | cline hook

plugin

Manage Cline plugins. Install plugins from file URLs, npm, git repositories, or local paths. See Plugins for full details and the plugin manifest format.

cline plugin install <source>  # Install a plugin
cline plugin i <source>        # Shorthand alias
OptionDescription
--npmTreat source as an npm package
--gitTreat source as a git repository
--forceReplace an existing install for the same source
--jsonOutput result as JSON
--cwd <path>Install to <path>/.cline/plugins instead of the global directory

Try it with the TypeScript Navigation Plugin:

cline plugin install https://github.com/cline/typescript-lsp-plugin.git

schedule

Manage scheduled agents. See Scheduling.

cline schedule

skill [args...]

Manage skills through the open skills CLI (npx skills). add and remove install into Cline unless you pass your own --agent. See Skills.

cline skill add <owner/repo>
cline skill list
cline skill remove

hub

Manage the local hub daemon. The hub starts automatically when Cline needs it. Running cline hub without a subcommand prints help.

cline hub status     # Show whether the hub is running
cline hub ensure     # Start the hub if it isn't running and print its URL
cline hub start      # Same as ensure
cline hub stop       # Stop the hub and the sessions running in it
cline hub drain      # Refuse new work while accepted runs finish (--off lifts it)
cline hub upgrade    # Drain the hub and restart it; does not wait for --zen or scheduled tasks
cline hub dashboard  # Open the hub dashboard in a browser

hub dashboard [options]

Start the Cline Hub browser dashboard to view connected clients and sessions, send messages, and restart the hub. The command opens your default browser and stays running until you press Ctrl+C.

cline hub dashboard
cline hub dashboard --port 9090 --no-open
cline hub dashboard --help
OptionDescription
-c, --cwd <path>Workspace root (default: current directory).
--config <dir>Configuration directory.
--data-dir <dir>Use isolated local state and enable sandbox mode.
--host <host>Dashboard bind host (default: 127.0.0.1).
--port <port>Dashboard HTTP/WebSocket port (default: 8787).
--public-url <url>Public dashboard URL for LAN or tunnel access.
--room-secret <secret>Invite secret for browser access; required when binding to a non-local host.
--no-openPrint the dashboard URL without opening a browser.

Anyone with access to the dashboard can drive sessions and restart the hub. For LAN or tunnel access, use a strong room secret and share the printed invite URL only with trusted people.

The old cline dashboard invocation remains a hidden compatibility alias. Use cline hub dashboard in new scripts.

update [options]

Check for updates and install if available.

cline update

version

Show Cline CLI version number.

cline version
cline -V

kanban

Run the Kanban app. See Kanban.

cline kanban

Environment Variables

VariableDescription
CLINE_DIRCustom configuration directory (replaces ~/.cline/), like --config
CLINE_DATA_DIRCustom data directory (replaces ~/.cline/data/)
CLINE_HUB_PORTPort of the local hub (default: 25463)
CLINE_HUB_ADDRESSHub address for cline schedule commands, like their --address option
CLINE_SESSION_BACKEND_MODEForce backend mode (local, hub, remote, auto)
CLINE_SANDBOX_DATA_DIRSandbox session storage directory
CLINE_SANDBOXEnable sandbox mode
CLINE_HOOKS_DIRAdditional hooks directory
CLINE_LOG_PATHCLI log file (default: ~/.cline/data/logs/cline.log). cline doctor log opens it
CLINE_BUILD_ENVSet to development for debug features
CLINE_DEBUG_PORT_BASEBase port for Node.js inspector

The CLI has no allow or deny list for shell commands. To block commands, use a PreToolUse hook that cancels run_commands calls you don't allow. .clineignore shows a hook that blocks tool calls this way.

JSON Output for Agent Runs

When you give Cline a task with --json, the CLI prints one JSON object per line. Every line has a type and a ts (an ISO 8601 timestamp). Other commands print their own JSON shapes: for example, cline history --json prints one array of sessions, and cline config <target> --json prints that target's entries.

{"ts":"2026-10-07T04:49:43.041Z","type":"agent_event","event":{"type":"done","reason":"completed","text":"Hello!","iterations":1}}
typeDescription
agent_eventAn event from the agent, in event. event.type is one of the agent events: content_start, content_update, content_end, iteration_start, iteration_end, usage, notice, done or error
hook_eventA lifecycle hook ran (hookEventName, agentId, taskId)
team_eventAn event from an agent team, in event
run_resultThe run finished: finishReason, iterations, usage, durationMs, model and the final text. A stopped run has finishReason aborted
run_abortedFollows run_result when you or another client stopped the run (reason, message)

Errors, including a --timeout that stops the run, are printed to stderr as {"type":"error","message":...}. Other line types can appear, such as run_start with --verbose, so have scripts skip types they don't use.

To print only the final answer:

cline --json "summarize this changelog" | jq -r 'select(.type == "run_result") | .text'

Configuration Files

~/.cline/
  data/
    settings/
      providers.json             # API keys and provider config
      global-settings.json       # Global settings
      cline_mcp_settings.json    # MCP server config (override with CLINE_MCP_SETTINGS_PATH)
    teams/                       # Team state
    sessions/                    # One folder of messages per session
    db/
      sessions.db                # Session index (SQLite)
    logs/
      cline.log                  # CLI log (open with `cline doctor log`)
      hub-daemon.log             # Hub logs
  rules/                         # Global rules
  skills/                        # Global skills
  hooks/                         # Global hooks
  agents/                        # Global agent definitions
  plugins/                       # Global plugins
    _installed/                  # Managed by `cline plugin install`

.cline/                          # Project root
  rules/                         # Project rules
  skills/                        # Project skills
  hooks/                         # Lifecycle hooks
  agents/                        # Project agent definitions
  plugins/                       # Project plugins

Config lists every location Cline reads.