- 新增 10-cursor-agent.md: 安装 cursor-agent、配置 API Key、YOLO 模式 - 10-skills-sync → 11-skills-sync - skills 同步不再依赖 openclaw-imports 目录 - self-check.sh 同步更新 [小糯]
83 lines
1.2 KiB
Markdown
83 lines
1.2 KiB
Markdown
# 10. Cursor Agent (Coding Agent)
|
|
|
|
## 检查
|
|
|
|
```bash
|
|
cursor-agent --version
|
|
echo $CURSOR_API_KEY | head -c 10
|
|
```
|
|
|
|
✅ 达标:`cursor-agent` 可用,`CURSOR_API_KEY` 已配置
|
|
|
|
## 前置
|
|
|
|
- 已完成 01 (Node.js & nvm)
|
|
- 已完成 03 (cfg CLI) — API key 存入 cfg
|
|
|
|
## 安装
|
|
|
|
### 1. 安装 cursor-agent
|
|
|
|
```bash
|
|
# 下载最新版
|
|
curl -fsSL https://www.cursor.com/agent/install.sh | bash
|
|
```
|
|
|
|
安装后确认:
|
|
|
|
```bash
|
|
cursor-agent --version
|
|
```
|
|
|
|
### 2. 获取 API Key
|
|
|
|
向主人 (沙洲) 索取 Cursor API Key。拿到后存入 cfg:
|
|
|
|
```bash
|
|
cfg set CURSOR_API_KEY '拿到的key' --secret
|
|
```
|
|
|
|
### 3. 配置 YOLO 模式
|
|
|
|
编辑 `~/.cursor/cli-config.json`,设置:
|
|
|
|
```json
|
|
{
|
|
"approvalMode": "none"
|
|
}
|
|
```
|
|
|
|
这样 cursor-agent 执行命令时不需要逐条审批。
|
|
|
|
### 4. 环境变量
|
|
|
|
确认 `cfg env` 会导出 `CURSOR_API_KEY`:
|
|
|
|
```bash
|
|
eval "$(cfg env)"
|
|
echo $CURSOR_API_KEY | head -c 10
|
|
```
|
|
|
|
## 使用
|
|
|
|
Hermes 通过 delegate_tool 调用 cursor-agent 执行编码任务:
|
|
|
|
```bash
|
|
# 直接使用
|
|
cursor-agent "实现 xxx 功能"
|
|
|
|
# 在指定目录工作
|
|
cd /path/to/project && cursor-agent "修复 bug"
|
|
```
|
|
|
|
## 验证
|
|
|
|
```bash
|
|
cursor-agent --version
|
|
# 应显示版本号
|
|
|
|
eval "$(cfg env)"
|
|
echo $CURSOR_API_KEY | head -c 10
|
|
# 应显示 key 前缀
|
|
```
|