2
0

cli-reference.mdx 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. ---
  2. title: "CLI Reference"
  3. description: "Complete command reference for Cline CLI including configuration, instance management, and task commands"
  4. ---
  5. Complete command reference for Cline CLI. Use this for detailed documentation on all commands, options, and configuration.
  6. For quick help in your terminal:
  7. ```bash
  8. cline --help # Show all commands
  9. cline task --help # Show task-specific commands
  10. man cline # View the full manual page
  11. ```
  12. ## Manual Page
  13. The complete manual page for the Cline CLI:
  14. ```
  15. CLINE(1) User Commands CLINE(1)
  16. NAME
  17. cline - orchestrate and interact with Cline AI coding agents
  18. SYNOPSIS
  19. cline [prompt] [options]
  20. cline command [subcommand] [options] [arguments]
  21. DESCRIPTION
  22. Try: cat README.md | cline "Summarize this for me:"
  23. cline is a command-line interface for orchestrating multiple Cline AI
  24. coding agents. Cline is an autonomous AI agent who can read, write,
  25. and execute code across your projects. He operates through a
  26. client-server architecture where Cline Core runs as a standalone
  27. service, and the CLI acts as a scriptable interface for managing tasks,
  28. instances, and agent interactions.
  29. The CLI is designed for both interactive use and automation, making it
  30. ideal for CI/CD pipelines, parallel task execution, and terminal-based
  31. workflows. Multiple frontends (CLI, VSCode, JetBrains) can attach to
  32. the same Cline Core instance, enabling seamless task handoff between
  33. environments.
  34. MODES OF OPERATION
  35. Instant Task Mode
  36. The simplest invocation: cline "prompt here" immediately spawns
  37. an instance, creates a task, and enters chat mode. This is
  38. equivalent to running cline instance new && cline task new &&
  39. cline task chat in sequence.
  40. Subcommand Mode
  41. Advanced usage with explicit control: cline <command>
  42. [subcommand] [options] provides fine-grained control over
  43. instances, tasks, authentication, and configuration.
  44. AGENT BEHAVIOR
  45. Cline operates in two primary modes:
  46. ACT MODE
  47. Cline actively uses tools to accomplish tasks. He can read
  48. files, write code, execute commands, use a headless browser, and
  49. more. This is the default mode for task execution.
  50. PLAN MODE
  51. Cline gathers information and creates a detailed plan before
  52. implementation. He explores the codebase, asks clarifying
  53. questions, and presents a strategy for user approval before
  54. switching to ACT MODE.
  55. INSTANT TASK OPTIONS
  56. When using the instant task syntax cline "prompt" the following options
  57. are available:
  58. -o, --oneshot
  59. Full autonomous mode. Cline completes the task and stops
  60. following after completion. Example: cline -o "what's 6 + 8?"
  61. -s, --setting setting value
  62. Override a setting for this task
  63. -y, --no-interactive, --yolo
  64. Enable fully autonomous mode. Disables all interactivity:
  65. • ask_followup_question tool is disabled
  66. • attempt_completion happens automatically
  67. • execute_command runs in non-blocking mode with timeout
  68. • PLAN MODE automatically switches to ACT MODE
  69. -m, --mode mode
  70. Starting mode. Options: act (default), plan
  71. GLOBAL OPTIONS
  72. These options apply to all subcommands:
  73. -F, --output-format format
  74. Output format. Options: rich (default), json, plain
  75. -h, --help
  76. Display help information for the command.
  77. -v, --verbose
  78. Enable verbose output for debugging.
  79. COMMANDS
  80. Authentication
  81. cline auth [provider] [key]
  82. cline a [provider] [key]
  83. Configure authentication for AI model providers. Launches an
  84. interactive wizard if no arguments provided. If provider is
  85. specified without a key, prompts for the key or launches the
  86. appropriate OAuth flow.
  87. Instance Management
  88. Cline Core instances are independent agent processes that can run in
  89. the background. Multiple instances can run simultaneously, enabling
  90. parallel task execution.
  91. cline instance
  92. cline i
  93. Display instance management help.
  94. cline instance new [-d|--default]
  95. cline i n [-d|--default]
  96. Spawn a new Cline Core instance. Use --default to set it as
  97. the default instance for subsequent commands.
  98. cline instance list
  99. cline i l
  100. List all running Cline Core instances with their addresses and
  101. status.
  102. cline instance default address
  103. cline i d address
  104. Set the default instance to avoid specifying --address in task
  105. commands.
  106. cline instance kill address [-a|--all]
  107. cline i k address [-a|--all]
  108. Terminate a Cline Core instance. Use --all to kill all running
  109. instances.
  110. Task Management
  111. Tasks represent individual work items that Cline executes. Tasks
  112. maintain conversation history, checkpoints, and settings.
  113. cline task [-a|--address ADDR]
  114. cline t [-a|--address ADDR]
  115. Display task management help. The --address flag specifies
  116. which Cline Core instance to use (e.g., localhost:50052).
  117. cline task new prompt [options]
  118. cline t n prompt [options]
  119. Create a new task in the default or specified instance.
  120. Options:
  121. -s, --setting setting value
  122. Set task-specific settings
  123. -y, --no-interactive, --yolo
  124. Enable autonomous mode
  125. -m, --mode mode
  126. Starting mode (act or plan)
  127. cline task open task-id [options]
  128. cline t o task-id [options]
  129. Resume a previous task from history. Accepts the same options
  130. as task new.
  131. cline task list
  132. cline t l
  133. List all tasks in history with their id and snippet
  134. cline task chat
  135. cline t c
  136. Enter interactive chat mode for the current task. Allows
  137. back-and-forth conversation with Cline.
  138. cline task send [message] [options]
  139. cline t s [message] [options]
  140. Send a message to Cline. If no message is provided, reads from
  141. stdin. Options:
  142. -a, --approve
  143. Approve Cline's proposed action
  144. -d, --deny
  145. Deny Cline's proposed action
  146. -f, --file FILE
  147. Attach a file to the message
  148. -y, --no-interactive, --yolo
  149. Enable autonomous mode
  150. -m, --mode mode
  151. Switch mode (act or plan)
  152. cline task view [-f|--follow] [-c|--follow-complete]
  153. cline t v [-f|--follow] [-c|--follow-complete]
  154. Display the current conversation. Use --follow to stream
  155. updates in real-time, or --follow-complete to follow until task
  156. completion.
  157. cline task restore checkpoint
  158. cline t r checkpoint
  159. Restore the task to a previous checkpoint state.
  160. cline task pause
  161. cline t p
  162. Pause task execution.
  163. Configuration
  164. Configuration can be set globally. Override these global settings for
  165. a task using the --setting flag
  166. cline config
  167. cline c
  168. cline config set key value
  169. cline c s key value
  170. Set a configuration variable.
  171. cline config get key
  172. cline c g key
  173. Read a configuration variable.
  174. cline config list
  175. cline c l
  176. List all configuration variables and their values.
  177. Context Window Configuration
  178. For local model providers, you can configure the context window size:
  179. Ollama
  180. cline config s ollama-api-options-ctx-num=32768
  181. LM Studio
  182. cline config s lm-studio-max-tokens=32768
  183. For other providers (Anthropic, OpenRouter, etc.), the context window
  184. is defined per model in the model metadata and is not user-settable.
  185. Cline uses each model's built-in context limits automatically.
  186. TASK SETTINGS
  187. Task settings are persisted in the ~/.cline/x/tasks directory. When
  188. resuming a task with cline task open, task settings are automatically
  189. restored.
  190. Common settings include:
  191. yolo Enable autonomous mode (true/false)
  192. mode Starting mode (act/plan)
  193. hooks_enabled
  194. Enable or disable hooks for the task (true/false)
  195. HOOKS INTEGRATION
  196. Hooks let you inject custom logic into Cline's workflow at key moments.
  197. They can validate operations before they execute, monitor tool usage,
  198. and shape AI decisions. This allows you to integrate hooks into
  199. automated workflows, CI/CD pipelines, and headless task execution.
  200. Enable hooks for a task:
  201. cline "prompt" -s hooks_enabled=true
  202. Configure hooks globally:
  203. cline config set hooks-enabled=true
  204. cline config get hooks-enabled
  205. Note: Hooks in the CLI are only supported on macOS and Linux.
  206. For complete hooks documentation, see:
  207. <https://docs.cline.bot/features/hooks/index>
  208. NOTES & EXAMPLES
  209. The cline task send and cline task new commands support reading from
  210. stdin, enabling powerful pipeline compositions:
  211. cat requirements.txt | cline task send
  212. echo "Refactor this code" | cline -y
  213. Instance Management
  214. Manage multiple Cline instances:
  215. # Start a new instance and make it default
  216. cline instance new --default
  217. # List all running instances
  218. cline instance list
  219. # Kill a specific instance
  220. cline instance kill localhost:50052
  221. # Kill all CLI instances
  222. cline instance kill --all-cli
  223. Task History
  224. Work with task history:
  225. # List previous tasks
  226. cline task list
  227. # Resume a previous task
  228. cline task open 1760501486669
  229. # View conversation history
  230. cline task view
  231. # Start interactive chat with this task
  232. cline task chat
  233. ARCHITECTURE
  234. Cline operates on a three-layer architecture:
  235. Presentation Layer
  236. User interfaces (CLI, VSCode, JetBrains) that connect to Cline
  237. Core via gRPC
  238. Cline Core
  239. The autonomous agent service handling task management, AI model
  240. integration, state management, tool orchestration, and real-time
  241. streaming updates
  242. Host Provider Layer
  243. Environment-specific integrations (VSCode APIs, JetBrains APIs,
  244. shell APIs) that Cline Core uses to interact with the host
  245. system
  246. BUGS
  247. Report bugs at: <https://github.com/cline/cline/issues>
  248. For real-time help, join the Discord community at:
  249. <https://discord.gg/cline>
  250. SEE ALSO
  251. Full documentation: <https://docs.cline.bot>
  252. AUTHORS
  253. Cline is developed by the Cline Bot Inc. and the open source community.
  254. COPYRIGHT
  255. Copyright © 2025 Cline Bot Inc. Licensed under the Apache License 2.0.
  256. ```
  257. ### Shell Completion
  258. Generate autocompletion scripts for various shells:
  259. #### Bash
  260. ```bash
  261. # Generate bash completion
  262. cline completion bash > /etc/bash_completion.d/cline
  263. # Or for user-level installation
  264. cline completion bash > ~/.local/share/bash-completion/completions/cline
  265. ```
  266. #### Zsh
  267. ```bash
  268. # Generate zsh completion
  269. cline completion zsh > "${fpath[1]}/_cline"
  270. # Or add to your .zshrc
  271. echo 'source <(cline completion zsh)' >> ~/.zshrc
  272. ```
  273. #### Fish
  274. ```bash
  275. # Generate fish completion
  276. cline completion fish > ~/.config/fish/completions/cline.fish
  277. ```
  278. #### PowerShell
  279. ```powershell
  280. # Generate PowerShell completion
  281. cline completion powershell > cline.ps1
  282. # Add to your PowerShell profile
  283. Add-Content $PROFILE "cline completion powershell | Out-String | Invoke-Expression"
  284. ```
  285. ### Version Command
  286. ```bash
  287. # Show version information
  288. cline version
  289. ```
  290. ### Environment Variables
  291. #### CLINE_DIR
  292. Override the default Cline directory location:
  293. ```bash
  294. # Override default Cline directory
  295. export CLINE_DIR=/custom/path
  296. # Default: ~/.cline
  297. ```
  298. This directory is used for:
  299. - Instance registry database
  300. - Configuration files
  301. - Task history
  302. - Checkpoints