configuration.mdx 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. ---
  2. title: "Configuration"
  3. description: "Manage Cline CLI settings with cline config, environment variables, and configuration files"
  4. ---
  5. Cline CLI provides multiple ways to configure settings, from the interactive `cline config` command to environment variables for automation.
  6. ## The Config Command
  7. Launch the configuration interface:
  8. ```bash
  9. cline config
  10. ```
  11. This opens an interactive view with tabs for different configuration categories.
  12. ## Configuration Tabs
  13. Navigate between tabs using arrow keys.
  14. ### Settings Tab
  15. View and edit global and workspace-specific settings:
  16. - **Global State**: Settings that apply across all workspaces
  17. - **Workspace State**: Settings specific to the current directory
  18. ### Rules Tab
  19. Manage Cline rules that guide AI behavior:
  20. - **`.clinerules` files**: Project-specific rules in your workspace
  21. - **Cursor rules**: Import rules from Cursor editor format
  22. - **Windsurf rules**: Import rules from Windsurf editor format
  23. Rules help Cline understand your project's conventions, coding standards, and preferences.
  24. ### Workflows Tab
  25. View and manage [workflows](/customization/workflows):
  26. - List available workflows
  27. - View workflow definitions
  28. - Workflows appear as slash commands in interactive mode
  29. ### Hooks Tab
  30. Configure [hooks](/customization/hooks) for custom logic integration:
  31. - Enable/disable hooks globally
  32. - View configured hook scripts
  33. - Hooks run at key points in Cline's workflow
  34. <Note>
  35. Hooks must be enabled via settings. Use `cline config` to toggle `hooks-enabled`.
  36. </Note>
  37. ### Skills Tab
  38. Manage [skills](/customization/skills) that extend Cline's capabilities:
  39. - View available skills
  40. - Enable/disable specific skills
  41. - Skills provide specialized instructions for specific tasks
  42. ## Configuration Directory
  43. Cline stores configuration in `~/.cline/data/`:
  44. ```text
  45. ~/.cline/
  46. ├── data/ # Configuration directory
  47. │ ├── globalState.json # Global settings
  48. │ ├── secrets.json # API keys (encrypted)
  49. │ ├── settings/ # Settings files
  50. │ │ └── cline_mcp_settings.json # MCP server configuration
  51. │ ├── workspace/ # Workspace-specific state
  52. │ └── tasks/ # Task history and data
  53. └── log/ # Log files
  54. ```
  55. ### Viewing Logs
  56. For debugging, view the log file:
  57. ```bash
  58. cline dev log
  59. ```
  60. This opens the log file in your default editor.
  61. ## Environment Variables
  62. ### CLINE_DIR
  63. Override the default configuration directory:
  64. ```bash
  65. export CLINE_DIR=/custom/path/to/cline
  66. cline "your task"
  67. ```
  68. When set, all Cline data is stored in this directory instead of `~/.cline/data/`.
  69. **Use cases:**
  70. - Running multiple isolated Cline configurations
  71. - Team-shared configurations
  72. - CI/CD with custom state directories
  73. ### CLINE_COMMAND_PERMISSIONS
  74. Restrict which shell commands Cline can execute:
  75. ```bash
  76. export CLINE_COMMAND_PERMISSIONS='{"allow": ["npm *", "git *"], "deny": ["rm -rf *"]}'
  77. ```
  78. **Format:**
  79. ```json
  80. {
  81. "allow": ["pattern1", "pattern2"],
  82. "deny": ["pattern3"],
  83. "allowRedirects": true
  84. }
  85. ```
  86. **Fields:**
  87. | Field | Type | Description |
  88. |-------|------|-------------|
  89. | `allow` | `string[]` | Glob patterns for allowed commands. If set, only matching commands are permitted. |
  90. | `deny` | `string[]` | Glob patterns for denied commands. Deny rules take precedence over allow. |
  91. | `allowRedirects` | `boolean` | Whether to allow shell redirects (`>`, `>>`, `<`). Default: `false` |
  92. **Examples:**
  93. ```bash
  94. # Allow only npm and git commands
  95. export CLINE_COMMAND_PERMISSIONS='{"allow": ["npm *", "git *"]}'
  96. # Allow dev commands but deny dangerous ones
  97. export CLINE_COMMAND_PERMISSIONS='{"allow": ["npm *", "git *", "node *"], "deny": ["rm -rf *", "sudo *"]}'
  98. # Allow file operations with redirects
  99. export CLINE_COMMAND_PERMISSIONS='{"allow": ["cat *", "echo *"], "allowRedirects": true}'
  100. ```
  101. <Warning>
  102. When `allow` is set, all commands not matching the allow patterns are denied. Use this for security-sensitive environments.
  103. </Warning>
  104. ## Using --config Flag
  105. Run Cline with a custom configuration directory:
  106. ```bash
  107. cline --config /path/to/custom/config "your task"
  108. ```
  109. This is useful for:
  110. - Running isolated Cline instances
  111. - Testing different configurations
  112. - Separating work and personal setups
  113. **Example: Multiple configurations**
  114. ```bash
  115. # Work configuration
  116. cline --config ~/.cline-work "review this PR"
  117. # Personal projects
  118. cline --config ~/.cline-personal "help me with this side project"
  119. ```
  120. ## MCP Server Configuration
  121. Cline CLI supports [MCP (Model Context Protocol)](/mcp/mcp-overview) servers, giving you access to external tools and data sources directly from the terminal. The CLI uses the same MCP configuration format as the VS Code extension.
  122. ### Setting Up MCP Servers
  123. You can add MCP servers from the CLI:
  124. ```bash
  125. # STDIO server
  126. cline mcp add kanban -- kanban mcp
  127. # Remote HTTP server
  128. cline mcp add linear https://mcp.linear.app/mcp --type http
  129. ```
  130. These commands update:
  131. ```
  132. ~/.cline/data/settings/cline_mcp_settings.json
  133. ```
  134. You can still edit this file directly. It uses the same JSON format as the VS Code extension:
  135. ```json
  136. {
  137. "mcpServers": {
  138. "my-server": {
  139. "command": "node",
  140. "args": ["/path/to/server.js"],
  141. "env": {
  142. "API_KEY": "your_api_key"
  143. },
  144. "alwaysAllow": ["tool1", "tool2"],
  145. "disabled": false
  146. }
  147. }
  148. }
  149. ```
  150. For the full configuration reference including STDIO and SSE transport types, see [Adding and Configuring MCP Servers](/mcp/adding-and-configuring-servers).
  151. <Note>
  152. The CLI does not yet have a `/mcp` slash command for interactive management inside the terminal UI. Use `cline mcp add` or edit `cline_mcp_settings.json` directly.
  153. </Note>
  154. ### Custom Config Directory
  155. If you use the `CLINE_DIR` environment variable or `--config` flag, the MCP settings file will be located at `<your-config-dir>/data/settings/cline_mcp_settings.json` instead.
  156. ## Configuration for Local Providers
  157. ### Ollama
  158. Configure context window size for Ollama:
  159. ```bash
  160. # In settings or via config
  161. cline config
  162. # Navigate to Settings tab, find ollama-api-options-ctx-num
  163. ```
  164. Or set via environment:
  165. ```bash
  166. # Set context window to 32K tokens
  167. cline -m ollama/llama3 "your task"
  168. ```
  169. ### LM Studio
  170. Configure max tokens for LM Studio:
  171. ```bash
  172. cline config
  173. # Navigate to Settings tab, find lm-studio-max-tokens
  174. ```
  175. ## Importing Configuration
  176. ### From VS Code Extension
  177. If you use the Cline VS Code extension, the CLI automatically detects and can share some settings. However, the CLI maintains its own configuration for terminal-specific features.
  178. ### From Other CLI Tools
  179. See [Installation & Setup](/cline-cli/installation#option-3-import-from-existing-tools) for importing configurations from:
  180. - Codex CLI
  181. - OpenCode
  182. ## Configuration Best Practices
  183. ### For Development
  184. Use the default configuration with workspace-specific rules:
  185. ```bash
  186. # Add project-specific rules
  187. echo "Use TypeScript strict mode" > .clinerules/typescript.md
  188. ```
  189. ### For CI/CD
  190. Use environment variables and `--yolo` mode:
  191. ```bash
  192. export CLINE_COMMAND_PERMISSIONS='{"allow": ["npm test", "npm run build"]}'
  193. cline -y "run tests and fix any failures"
  194. ```
  195. ### For Teams
  196. Share configuration via version control:
  197. ```bash
  198. # Commit .clinerules/ to your repo
  199. git add .clinerules/
  200. git commit -m "Add Cline rules for team"
  201. ```
  202. ## Troubleshooting
  203. ### Configuration Not Persisting
  204. 1. Check write permissions on `~/.cline/data/`
  205. 2. Ensure `CLINE_DIR` isn't set to a read-only location
  206. 3. Verify the config directory exists
  207. ### Environment Variables Not Working
  208. 1. Ensure variables are exported: `export CLINE_DIR=/path`
  209. 2. Check for typos in variable names
  210. 3. Verify JSON syntax for `CLINE_COMMAND_PERMISSIONS`
  211. ### Reset Configuration
  212. To start fresh, remove the configuration directory:
  213. ```bash
  214. rm -rf ~/.cline/data/
  215. cline auth # Re-authenticate
  216. ```
  217. ## Next Steps
  218. <Columns cols={2}>
  219. <Card title="Headless Mode" icon="robot" href="/cline-cli/three-core-flows">
  220. Run Cline autonomously in scripts, CI/CD pipelines, and automated workflows.
  221. </Card>
  222. <Card title="CLI Reference" icon="terminal" href="/cline-cli/cli-reference">
  223. Complete command documentation with all flags and options.
  224. </Card>
  225. </Columns>