@ia-ccun/code-agent-cli 0.0.50-beta.3 → 0.0.50-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -8
- package/config/agent/agents/agent-example.md +88 -0
- package/config/agent/settings.json +37 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -272,6 +272,68 @@ EOF
|
|
|
272
272
|
| `/feat` | 功能开发 - 辅助功能开发 |
|
|
273
273
|
| `/workflow` | 工作流 - 执行复杂工作流 |
|
|
274
274
|
|
|
275
|
+
## 自定义 Agents
|
|
276
|
+
|
|
277
|
+
内置 Agent 示例位于 `config/agent/agents/`(打包在 npm 包中)
|
|
278
|
+
|
|
279
|
+
| Agent | 说明 |
|
|
280
|
+
|-------|------|
|
|
281
|
+
| `agent-example` | 示例 Agent - 展示如何创建自定义 subagent |
|
|
282
|
+
|
|
283
|
+
### 创建自定义 Agent
|
|
284
|
+
|
|
285
|
+
在 `~/.aicode-cli/agent/agents/` 目录下创建 `<name>.md` 文件:
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
# 创建 Agent 文件
|
|
289
|
+
cat > ~/.aicode-cli/agent/agents/my-agent.md << 'EOF'
|
|
290
|
+
---
|
|
291
|
+
name: my-agent
|
|
292
|
+
description: "自定义 Agent 的简短描述"
|
|
293
|
+
tools: "read,bash,write,edit"
|
|
294
|
+
model: "qwen3.5-35b-a3b"
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
# My Agent
|
|
298
|
+
|
|
299
|
+
## 角色
|
|
300
|
+
你是一个专业的代码优化助手...
|
|
301
|
+
|
|
302
|
+
## 能力
|
|
303
|
+
1. 代码分析
|
|
304
|
+
2. 性能优化
|
|
305
|
+
3. 重构建议
|
|
306
|
+
|
|
307
|
+
## 工作流程
|
|
308
|
+
1. 阅读代码
|
|
309
|
+
2. 分析问题
|
|
310
|
+
3. 提供建议
|
|
311
|
+
EOF
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
**字段说明:**
|
|
315
|
+
|
|
316
|
+
| 字段 | 必填 | 说明 |
|
|
317
|
+
|------|------|------|
|
|
318
|
+
| `name` | 是 | Agent 标识符(小写+连字符) |
|
|
319
|
+
| `description` | 是 | 功能描述,用户据此选择 Agent |
|
|
320
|
+
| `tools` | 否 | 逗号分隔的工具列表 |
|
|
321
|
+
| `model` | 否 | 指定使用的模型 |
|
|
322
|
+
|
|
323
|
+
### 使用 Agent
|
|
324
|
+
|
|
325
|
+
在对话中自然语言调用:
|
|
326
|
+
|
|
327
|
+
```
|
|
328
|
+
使用 my-agent 来优化这段代码
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
或配合 pi-subagents 使用:
|
|
332
|
+
|
|
333
|
+
```
|
|
334
|
+
/run my-agent "Review this implementation"
|
|
335
|
+
```
|
|
336
|
+
|
|
275
337
|
## 项目结构
|
|
276
338
|
|
|
277
339
|
```
|
|
@@ -291,11 +353,3 @@ EOF
|
|
|
291
353
|
│ └── postinstall.js # 安装脚本
|
|
292
354
|
└── package.json
|
|
293
355
|
```
|
|
294
|
-
|
|
295
|
-
## 文档
|
|
296
|
-
|
|
297
|
-
更多功能请参考 [pi-coding-agent 文档](https://github.com/badlogic/pi-mono/tree/main/packages/coding-agent)
|
|
298
|
-
|
|
299
|
-
## License
|
|
300
|
-
|
|
301
|
-
MIT
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agent-example
|
|
3
|
+
description: "示例 Agent - 展示如何创建自定义 subagent。可删除或复制此文件作为模板。"
|
|
4
|
+
tools: "read,bash,write,edit"
|
|
5
|
+
model: "qwen3.5-35b-a3b"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# 示例 Agent
|
|
9
|
+
|
|
10
|
+
> 💡 这是一个自定义 subagent 示例,展示如何创建具有个性和能力的 Agent。
|
|
11
|
+
> 你可以复制此文件,修改 frontmatter 和下方内容来创建自己的 Agent。
|
|
12
|
+
|
|
13
|
+
## 角色
|
|
14
|
+
|
|
15
|
+
你是一个专业的代码优化助手,专注于提升代码质量和开发效率。
|
|
16
|
+
|
|
17
|
+
## 能力
|
|
18
|
+
|
|
19
|
+
1. **代码分析**:深入理解代码逻辑,识别潜在问题
|
|
20
|
+
2. **性能优化**:发现性能瓶颈,提供优化方案
|
|
21
|
+
3. **重构建议**:改善代码结构和可读性
|
|
22
|
+
4. **最佳实践**:推荐行业标准和设计模式
|
|
23
|
+
|
|
24
|
+
## 工作流程
|
|
25
|
+
|
|
26
|
+
1. 首先使用 `read` 工具阅读需要优化的代码
|
|
27
|
+
2. 分析问题并给出具体建议
|
|
28
|
+
3. 使用 `edit` 工具实施改进(需用户确认)
|
|
29
|
+
4. 使用 `bash` 工具验证修改结果
|
|
30
|
+
|
|
31
|
+
## 输出风格
|
|
32
|
+
|
|
33
|
+
- 简洁明了,避免冗长解释
|
|
34
|
+
- 使用 Markdown 格式展示代码变更
|
|
35
|
+
- 标注修改原因和预期效果
|
|
36
|
+
- 对重大变更提供回退方案
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 📖 创建自定义 Agent 指南
|
|
41
|
+
|
|
42
|
+
### 文件位置
|
|
43
|
+
|
|
44
|
+
| 类型 | 路径 |
|
|
45
|
+
|------|----------------------------------------|
|
|
46
|
+
| 用户级 | `~/.aicode-cli/agent/agents/<name>.md` |
|
|
47
|
+
| 项目级 | `.aicode-cli/agents/<name>.md` |
|
|
48
|
+
|
|
49
|
+
### 文件结构
|
|
50
|
+
|
|
51
|
+
Agent 文件必须是 `.md` 格式,包含 YAML frontmatter 和 Markdown body:
|
|
52
|
+
|
|
53
|
+
```markdown
|
|
54
|
+
---
|
|
55
|
+
name: my-agent # 必填:Agent 名称(小写+连字符)
|
|
56
|
+
description: "简短描述" # 必填:Agent 功能描述
|
|
57
|
+
tools: "read,bash,write" # 可选:允许使用的工具(逗号分隔)
|
|
58
|
+
model: "provider/model-id" # 可选:指定使用的模型
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
# Agent 标题
|
|
62
|
+
|
|
63
|
+
这里是 Agent 的 system prompt,定义:
|
|
64
|
+
- 角色定位
|
|
65
|
+
- 能力和职责
|
|
66
|
+
- 工作流程
|
|
67
|
+
- 输出风格
|
|
68
|
+
- 任何你希望 Agent 遵循的规则
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Frontmatter 字段说明
|
|
72
|
+
|
|
73
|
+
| 字段 | 必填 | 说明 |
|
|
74
|
+
|------|------|------|
|
|
75
|
+
| `name` | 是 | Agent 标识符,小写字母和连字符 |
|
|
76
|
+
| `description` | 是 | 功能描述,用户通过此描述选择 Agent |
|
|
77
|
+
| `tools` | 否 | 逗号分隔的工具列表,不填则使用默认工具集 |
|
|
78
|
+
| `model` | 否 | 指定模型,如 `qwen3.5-35b-a3b` |
|
|
79
|
+
|
|
80
|
+
### 使用方式
|
|
81
|
+
|
|
82
|
+
在对话中调用 subagent 时,aicode 会自动发现并使用这些自定义 Agent:
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
使用 agent-example 来优化这段代码
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
或在 settings.json 的 `subagents.agentOverrides` 中配置模型覆盖。
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"quietStartup":true,
|
|
3
|
+
"defaultProvider": "aicode",
|
|
4
|
+
"defaultModel": "qwen3.5-35b-a3b",
|
|
3
5
|
"theme":"light",
|
|
4
6
|
"extensions":[
|
|
5
7
|
"~/.aicode-cli/agent/extensions/bash-check.ts",
|
|
@@ -17,6 +19,39 @@
|
|
|
17
19
|
"npm:pi-mcp-adapter@2.4.0",
|
|
18
20
|
"npm:@juicesharp/rpiv-todo",
|
|
19
21
|
"npm:@juicesharp/rpiv-ask-user-question",
|
|
20
|
-
"npm:@juicesharp/rpiv-advisor"
|
|
21
|
-
|
|
22
|
+
"npm:@juicesharp/rpiv-advisor",
|
|
23
|
+
"npm:@samfp/pi-memory@1.1.1"
|
|
24
|
+
],
|
|
25
|
+
"memory": {
|
|
26
|
+
"lessonInjection": "selective",
|
|
27
|
+
"consolidationModel": "qwen3.5-35b-a3b"
|
|
28
|
+
},
|
|
29
|
+
"subagents": {
|
|
30
|
+
"agentOverrides": {
|
|
31
|
+
"scout": {
|
|
32
|
+
"model": "qwen3.5-35b-a3b"
|
|
33
|
+
},
|
|
34
|
+
"researcher": {
|
|
35
|
+
"model": "qwen3.5-35b-a3b"
|
|
36
|
+
},
|
|
37
|
+
"planner": {
|
|
38
|
+
"model": "qwen3.5-35b-a3b"
|
|
39
|
+
},
|
|
40
|
+
"worker": {
|
|
41
|
+
"model": "qwen3.5-35b-a3b"
|
|
42
|
+
},
|
|
43
|
+
"reviewer": {
|
|
44
|
+
"model": "qwen3.5-35b-a3b"
|
|
45
|
+
},
|
|
46
|
+
"context-builder": {
|
|
47
|
+
"model": "qwen3.5-35b-a3b"
|
|
48
|
+
},
|
|
49
|
+
"oracle": {
|
|
50
|
+
"model": "qwen3.5-35b-a3b"
|
|
51
|
+
},
|
|
52
|
+
"delegate": {
|
|
53
|
+
"model": "qwen3.5-35b-a3b"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
22
57
|
}
|