| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330 |
- ---
- title: "Configuration"
- description: "Manage Cline CLI settings with cline config, environment variables, and configuration files"
- ---
- Cline CLI provides multiple ways to configure settings, from the interactive `cline config` command to environment variables for automation.
- ## The Config Command
- Launch the configuration interface:
- ```bash
- cline config
- ```
- This opens an interactive view with tabs for different configuration categories.
- ## Configuration Tabs
- Navigate between tabs using arrow keys.
- ### Settings Tab
- View and edit global and workspace-specific settings:
- - **Global State**: Settings that apply across all workspaces
- - **Workspace State**: Settings specific to the current directory
- ### Rules Tab
- Manage Cline rules that guide AI behavior:
- - **`.clinerules` files**: Project-specific rules in your workspace
- - **Cursor rules**: Import rules from Cursor editor format
- - **Windsurf rules**: Import rules from Windsurf editor format
- Rules help Cline understand your project's conventions, coding standards, and preferences.
- ### Workflows Tab
- View and manage [workflows](/customization/workflows):
- - List available workflows
- - View workflow definitions
- - Workflows appear as slash commands in interactive mode
- ### Hooks Tab
- Configure [hooks](/customization/hooks) for custom logic integration:
- - Enable/disable hooks globally
- - View configured hook scripts
- - Hooks run at key points in Cline's workflow
- <Note>
- Hooks must be enabled via settings. Use `cline config` to toggle `hooks-enabled`.
- </Note>
- ### Skills Tab
- Manage [skills](/customization/skills) that extend Cline's capabilities:
- - View available skills
- - Enable/disable specific skills
- - Skills provide specialized instructions for specific tasks
- ## Configuration Directory
- Cline stores configuration in `~/.cline/data/`:
- ```text
- ~/.cline/
- ├── data/ # Configuration directory
- │ ├── globalState.json # Global settings
- │ ├── secrets.json # API keys (encrypted)
- │ ├── settings/ # Settings files
- │ │ └── cline_mcp_settings.json # MCP server configuration
- │ ├── workspace/ # Workspace-specific state
- │ └── tasks/ # Task history and data
- └── log/ # Log files
- ```
- ### Viewing Logs
- For debugging, view the log file:
- ```bash
- cline dev log
- ```
- This opens the log file in your default editor.
- ## Environment Variables
- ### CLINE_DIR
- Override the default configuration directory:
- ```bash
- export CLINE_DIR=/custom/path/to/cline
- cline "your task"
- ```
- When set, all Cline data is stored in this directory instead of `~/.cline/data/`.
- **Use cases:**
- - Running multiple isolated Cline configurations
- - Team-shared configurations
- - CI/CD with custom state directories
- ### CLINE_COMMAND_PERMISSIONS
- Restrict which shell commands Cline can execute:
- ```bash
- export CLINE_COMMAND_PERMISSIONS='{"allow": ["npm *", "git *"], "deny": ["rm -rf *"]}'
- ```
- **Format:**
- ```json
- {
- "allow": ["pattern1", "pattern2"],
- "deny": ["pattern3"],
- "allowRedirects": true
- }
- ```
- **Fields:**
- | Field | Type | Description |
- |-------|------|-------------|
- | `allow` | `string[]` | Glob patterns for allowed commands. If set, only matching commands are permitted. |
- | `deny` | `string[]` | Glob patterns for denied commands. Deny rules take precedence over allow. |
- | `allowRedirects` | `boolean` | Whether to allow shell redirects (`>`, `>>`, `<`). Default: `false` |
- **Examples:**
- ```bash
- # Allow only npm and git commands
- export CLINE_COMMAND_PERMISSIONS='{"allow": ["npm *", "git *"]}'
- # Allow dev commands but deny dangerous ones
- export CLINE_COMMAND_PERMISSIONS='{"allow": ["npm *", "git *", "node *"], "deny": ["rm -rf *", "sudo *"]}'
- # Allow file operations with redirects
- export CLINE_COMMAND_PERMISSIONS='{"allow": ["cat *", "echo *"], "allowRedirects": true}'
- ```
- <Warning>
- When `allow` is set, all commands not matching the allow patterns are denied. Use this for security-sensitive environments.
- </Warning>
- ## Using --config Flag
- Run Cline with a custom configuration directory:
- ```bash
- cline --config /path/to/custom/config "your task"
- ```
- This is useful for:
- - Running isolated Cline instances
- - Testing different configurations
- - Separating work and personal setups
- **Example: Multiple configurations**
- ```bash
- # Work configuration
- cline --config ~/.cline-work "review this PR"
- # Personal projects
- cline --config ~/.cline-personal "help me with this side project"
- ```
- ## MCP Server Configuration
- 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.
- ### Setting Up MCP Servers
- You can add MCP servers from the CLI:
- ```bash
- # STDIO server
- cline mcp add kanban -- kanban mcp
- # Remote HTTP server
- cline mcp add linear https://mcp.linear.app/mcp --type http
- ```
- These commands update:
- ```
- ~/.cline/data/settings/cline_mcp_settings.json
- ```
- You can still edit this file directly. It uses the same JSON format as the VS Code extension:
- ```json
- {
- "mcpServers": {
- "my-server": {
- "command": "node",
- "args": ["/path/to/server.js"],
- "env": {
- "API_KEY": "your_api_key"
- },
- "alwaysAllow": ["tool1", "tool2"],
- "disabled": false
- }
- }
- }
- ```
- For the full configuration reference including STDIO and SSE transport types, see [Adding and Configuring MCP Servers](/mcp/adding-and-configuring-servers).
- <Note>
- 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.
- </Note>
- ### Custom Config Directory
- 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.
- ## Configuration for Local Providers
- ### Ollama
- Configure context window size for Ollama:
- ```bash
- # In settings or via config
- cline config
- # Navigate to Settings tab, find ollama-api-options-ctx-num
- ```
- Or set via environment:
- ```bash
- # Set context window to 32K tokens
- cline -m ollama/llama3 "your task"
- ```
- ### LM Studio
- Configure max tokens for LM Studio:
- ```bash
- cline config
- # Navigate to Settings tab, find lm-studio-max-tokens
- ```
- ## Importing Configuration
- ### From VS Code Extension
- 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.
- ### From Other CLI Tools
- See [Installation & Setup](/cline-cli/installation#option-3-import-from-existing-tools) for importing configurations from:
- - Codex CLI
- - OpenCode
- ## Configuration Best Practices
- ### For Development
- Use the default configuration with workspace-specific rules:
- ```bash
- # Add project-specific rules
- echo "Use TypeScript strict mode" > .clinerules/typescript.md
- ```
- ### For CI/CD
- Use environment variables and `--yolo` mode:
- ```bash
- export CLINE_COMMAND_PERMISSIONS='{"allow": ["npm test", "npm run build"]}'
- cline -y "run tests and fix any failures"
- ```
- ### For Teams
- Share configuration via version control:
- ```bash
- # Commit .clinerules/ to your repo
- git add .clinerules/
- git commit -m "Add Cline rules for team"
- ```
- ## Troubleshooting
- ### Configuration Not Persisting
- 1. Check write permissions on `~/.cline/data/`
- 2. Ensure `CLINE_DIR` isn't set to a read-only location
- 3. Verify the config directory exists
- ### Environment Variables Not Working
- 1. Ensure variables are exported: `export CLINE_DIR=/path`
- 2. Check for typos in variable names
- 3. Verify JSON syntax for `CLINE_COMMAND_PERMISSIONS`
- ### Reset Configuration
- To start fresh, remove the configuration directory:
- ```bash
- rm -rf ~/.cline/data/
- cline auth # Re-authenticate
- ```
- ## Next Steps
- <Columns cols={2}>
- <Card title="Headless Mode" icon="robot" href="/cline-cli/three-core-flows">
- Run Cline autonomously in scripts, CI/CD pipelines, and automated workflows.
- </Card>
-
- <Card title="CLI Reference" icon="terminal" href="/cline-cli/cli-reference">
- Complete command documentation with all flags and options.
- </Card>
- </Columns>
|