Skip to content
FunCoding

Search

Search docs, Skills and MCP

CLI 配置文件

区分全局与项目配置,设置交互界面、审批模式、沙箱和署名选项。

This page has not been translated into English yet. The original Chinese version is shown below.

CLI 使用纯 JSON 配置,不支持注释。项目级文件只接受权限配置,其他选项必须放在全局文件中。

位置与最小配置

范围位置
macOS/Linux 全局~/.cursor/cli-config.json
Windows 全局$env:USERPROFILE.cursor\cli-config.json
项目权限/.cursor/cli.json

CURSOR_CONFIG_DIR 可指定自定义目录;Linux/BSD 的 XDG_CONFIG_HOME 对应 $XDG_CONFIG_HOME/cursor/cli-config.json。

{
  "version": 1,
  "editor": { "vimMode": false },
  "permissions": { "allow": [], "deny": [] }
}

version 当前为 1,editor.vimMode 默认 false;以上四个叶字段是官方列出的必填项。permissions 的具体令牌见权限规则。

常用可选字段

字段用途
channelCLI 更新渠道
model、maxMode模型选择配置与 Max Mode 偏好
notifications、hints完成/等待输入通知及工作提示
rewind、suggestNextPrompt启用回退及后续提示建议
display.showLineNumbers代码块行号
display.showThinkingBlocks显示可用的思考块
display.showStatusIndicators终端标题状态
display.showStatusLineRunningTime状态栏运行时间
approvalModeallowlist、auto-review 或 unrestricted
sandbox.mode、sandbox.networkAccess沙箱模式与网络访问配置
sandbox.readBoundarysystem(默认)或 workspace
network.useHttp1ForAgentHTTP/1.1 回退,默认 false
attribution.attributeCommitsToAgent提交署名,默认 true
attribution.attributePRsToAgentPR 署名,默认 true

没有在此列出默认值的字段,不应由示例反推出默认行为。模型可通过 /model 选择,交互设置可用 /config 调整。

配置没有生效

确认修改的是正确范围的文件,JSON 能解析且目录可写。CLI 会修复缺失字段,损坏文件会备份为 .bad 并重建;手动恢复前先保留当前文件。hasChangedDefaultModel 等由 CLI 管理的字段可能被覆盖,优先使用对应 UI 或命令调整。