| name | cursor-cli |
| description | 使用 Cursor CLI(agent)进行交互式与非交互式编码协作;包含模式切换、会话恢复、云代理、沙箱和模型参数说明,以及本机兼容性检查要点。 |
Cursor CLI Skill
基于官方文档(已按你提供的 overview 页面重新校对):https://cursor.com/cn/docs/cli/overview
1) 官方核心命令(文档)
安装
irm 'https://cursor.com/install?win32=true' | iex
交互模式
agent
agent "重构认证模块以使用 JWT 令牌"
模式切换
- Agent(默认)
- Plan:
--plan 或 --mode=plan
- Ask:
--mode=ask
非交互(脚本/CI)
agent -p "find and fix performance issues" --model "gpt-5.2"
agent -p "review these changes for security issues" --output-format text
Cloud Agent
agent -c "refactor the auth module and add comprehensive tests"
会话中也可用 & 前缀把任务交给云端。
会话管理
agent ls
agent resume
agent --continue
agent --resume="chat-id-here"
沙箱
agent --sandbox enabled
agent --sandbox disabled
2) 当前机器实测结论(重要)
在本机(Cursor 2.5.26)实测:
cursor --version 可用
cursor --help 可用
cursor agent --model gpt-5.4 "hello" 会提示:model 不是已知选项
agent --help 当前不可用(命令未找到)
含义
当前环境更像是“编辑器 CLI”可用,但文档里的独立 agent CLI 工作流尚未就绪(或未在 PATH 中)。因此:
- 不能通过
cursor ... --model gpt-5.4 来指定模型
- 若要按文档方式使用
--model,需先确保 agent 命令本身可用
3) 诊断与排查清单
- 检查命令路径
Get-Command cursor -ErrorAction SilentlyContinue
Get-Command agent -ErrorAction SilentlyContinue
- 确认版本与帮助
cursor --version
cursor --help
agent --help
- 若
agent 不存在,按文档重新安装 CLI,并重开终端
irm 'https://cursor.com/install?win32=true' | iex
- 重新验证模型参数(仅在
agent 可用后)
agent -p "hello" --model "gpt-5.4"
4) 给未来自己的简短规则
- 想指定模型:优先用
agent ... --model ...(不是 cursor --model)
- 如果
agent 不在 PATH,先修安装/环境变量,再谈模型参数
- 先做一次最小验证:
agent --help + agent -p "ping"