@ppdocs/mcp 3.2.28 → 3.2.30
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/dist/cli.js +50 -28
- package/package.json +1 -1
- package/templates/AGENT.md +38 -30
- package/templates/cursorrules.md +95 -102
- package/templates/kiro-rules/ppdocs.md +95 -102
package/dist/cli.js
CHANGED
|
@@ -486,37 +486,53 @@ function installClaudeTemplates(cwd) {
|
|
|
486
486
|
fs.writeFileSync(settingsPath, JSON.stringify(mergedSettings, null, 2));
|
|
487
487
|
console.log(`✅ Configured .claude/settings.json hooks (${process.platform})`);
|
|
488
488
|
console.log(`✅ Added ${mcpPermissions.length} MCP method permissions`);
|
|
489
|
-
// 4.
|
|
489
|
+
// 4. 生成 CLAUDE.md 全局规则 (Claude Code 官方标准)
|
|
490
|
+
installGlobalRules(cwd, 'CLAUDE.md');
|
|
491
|
+
// 5. 安装工作流到 .agents/workflows/ (全平台通用)
|
|
490
492
|
installWorkflows(cwd);
|
|
491
493
|
}
|
|
492
494
|
/** 安装 Codex 模板 (生成 AGENTS.md + 工作流) */
|
|
493
495
|
function installCodexTemplates(cwd) {
|
|
494
|
-
|
|
496
|
+
installGlobalRules(cwd, 'AGENTS.md');
|
|
495
497
|
installWorkflows(cwd);
|
|
496
498
|
}
|
|
497
|
-
/**
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
499
|
+
/**
|
|
500
|
+
* 生成全局规则文件 (各平台统一内容, 不同文件名)
|
|
501
|
+
* Claude Code → CLAUDE.md | Codex → AGENTS.md | Gemini → GEMINI.md
|
|
502
|
+
*/
|
|
503
|
+
function installGlobalRules(cwd, filename) {
|
|
504
|
+
const srcRules = path.join(TEMPLATES_DIR, 'cursorrules.md');
|
|
505
|
+
const destFile = path.join(cwd, filename);
|
|
506
|
+
if (fs.existsSync(srcRules)) {
|
|
507
|
+
// 总是覆盖写入最新版全局规则
|
|
508
|
+
fs.copyFileSync(srcRules, destFile);
|
|
509
|
+
console.log(`✅ Installed ${filename} (global rules)`);
|
|
504
510
|
}
|
|
505
|
-
else
|
|
506
|
-
console.log(`⚠️
|
|
511
|
+
else {
|
|
512
|
+
console.log(`⚠️ Global rules template not found`);
|
|
507
513
|
}
|
|
508
514
|
}
|
|
509
515
|
/** 安装 Cursor 模板 */
|
|
510
516
|
function installCursorTemplates(cwd, apiUrl, user) {
|
|
511
517
|
createMcpConfigAt(path.join(cwd, '.cursor', 'mcp.json'), apiUrl, { user });
|
|
512
|
-
// 2. 生成 .cursorrules
|
|
518
|
+
// 2. 生成 .cursor/rules/ppdocs.md (官方标准, .cursorrules 已废弃)
|
|
519
|
+
const cursorRulesDir = path.join(cwd, '.cursor', 'rules');
|
|
520
|
+
if (!fs.existsSync(cursorRulesDir)) {
|
|
521
|
+
fs.mkdirSync(cursorRulesDir, { recursive: true });
|
|
522
|
+
}
|
|
513
523
|
const srcRules = path.join(TEMPLATES_DIR, 'cursorrules.md');
|
|
514
|
-
const destRules = path.join(
|
|
515
|
-
if (fs.existsSync(srcRules)
|
|
524
|
+
const destRules = path.join(cursorRulesDir, 'ppdocs.md');
|
|
525
|
+
if (fs.existsSync(srcRules)) {
|
|
516
526
|
fs.copyFileSync(srcRules, destRules);
|
|
517
|
-
console.log(`✅
|
|
527
|
+
console.log(`✅ Installed .cursor/rules/ppdocs.md`);
|
|
518
528
|
}
|
|
519
|
-
// 3.
|
|
529
|
+
// 3. 清理废弃的 .cursorrules 文件
|
|
530
|
+
const legacyCursorrules = path.join(cwd, '.cursorrules');
|
|
531
|
+
if (fs.existsSync(legacyCursorrules)) {
|
|
532
|
+
fs.unlinkSync(legacyCursorrules);
|
|
533
|
+
console.log(`🗑️ Removed deprecated .cursorrules`);
|
|
534
|
+
}
|
|
535
|
+
// 4. 安装工作流到 .agents/workflows/
|
|
520
536
|
installWorkflows(cwd);
|
|
521
537
|
}
|
|
522
538
|
// ========================================================================
|
|
@@ -590,8 +606,8 @@ function installWorkflows(cwd, extraDirs = []) {
|
|
|
590
606
|
function installAntigravityTemplates(cwd, apiUrl, user) {
|
|
591
607
|
// Antigravity 由 gemini CLI 注册 env,文件配置不注入避免冲突
|
|
592
608
|
createMcpConfigAt(path.join(cwd, '.gemini', 'settings.json'), apiUrl, { noEnv: true, user });
|
|
593
|
-
// 2. 生成
|
|
594
|
-
|
|
609
|
+
// 2. 生成 GEMINI.md 全局规则 (Gemini CLI 官方标准)
|
|
610
|
+
installGlobalRules(cwd, 'GEMINI.md');
|
|
595
611
|
// 3. Antigravity 全局 workflows 目录 (额外安装目标)
|
|
596
612
|
const homeDir = process.env.USERPROFILE || process.env.HOME || '';
|
|
597
613
|
const globalWorkflowDir = path.join(homeDir, '.gemini', 'antigravity', 'global_workflows');
|
|
@@ -604,18 +620,24 @@ function installAntigravityTemplates(cwd, apiUrl, user) {
|
|
|
604
620
|
/** 安装 Kiro 模板 */
|
|
605
621
|
function installKiroTemplates(cwd, apiUrl, user) {
|
|
606
622
|
createMcpConfigAt(path.join(cwd, '.kiro', 'settings', 'mcp.json'), apiUrl, { user });
|
|
607
|
-
// 2. 生成 Kiro
|
|
608
|
-
const
|
|
609
|
-
if (!fs.existsSync(
|
|
610
|
-
fs.mkdirSync(
|
|
623
|
+
// 2. 生成 Kiro Steering 文件 (官方标准: .kiro/steering/ 而非 rules/)
|
|
624
|
+
const steeringDir = path.join(cwd, '.kiro', 'steering');
|
|
625
|
+
if (!fs.existsSync(steeringDir)) {
|
|
626
|
+
fs.mkdirSync(steeringDir, { recursive: true });
|
|
611
627
|
}
|
|
612
628
|
const srcRules = path.join(TEMPLATES_DIR, 'kiro-rules', 'ppdocs.md');
|
|
613
|
-
const
|
|
614
|
-
if (fs.existsSync(srcRules)
|
|
615
|
-
fs.copyFileSync(srcRules,
|
|
616
|
-
console.log(`✅
|
|
617
|
-
}
|
|
618
|
-
// 3.
|
|
629
|
+
const destSteering = path.join(steeringDir, 'ppdocs.md');
|
|
630
|
+
if (fs.existsSync(srcRules)) {
|
|
631
|
+
fs.copyFileSync(srcRules, destSteering);
|
|
632
|
+
console.log(`✅ Installed .kiro/steering/ppdocs.md`);
|
|
633
|
+
}
|
|
634
|
+
// 3. 清理废弃的 .kiro/rules/ 旧路径
|
|
635
|
+
const legacyRules = path.join(cwd, '.kiro', 'rules', 'ppdocs.md');
|
|
636
|
+
if (fs.existsSync(legacyRules)) {
|
|
637
|
+
fs.unlinkSync(legacyRules);
|
|
638
|
+
console.log(`🗑️ Removed deprecated .kiro/rules/ppdocs.md`);
|
|
639
|
+
}
|
|
640
|
+
// 4. 安装工作流到 .agents/workflows/
|
|
619
641
|
installWorkflows(cwd);
|
|
620
642
|
}
|
|
621
643
|
/** 检测当前工作区包含的 IDE */
|
package/package.json
CHANGED
package/templates/AGENT.md
CHANGED
|
@@ -1,30 +1,38 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
# ppdocs Knowledge Graph Agent
|
|
2
|
+
|
|
3
|
+
你是严谨的软件架构师,以**知识图谱流程图**为唯一真理源,以**任务系统**为记忆链。确保每个变动有据可查,每步执行都有验证和记录。
|
|
4
|
+
|
|
5
|
+
## 核心铁律
|
|
6
|
+
|
|
7
|
+
| 铁律 | 要求 |
|
|
8
|
+
|:---|:---|
|
|
9
|
+
| **图谱先行** | 动手前必须查流程图 `kg_flowchart(get/get_node)` + 节点文档 |
|
|
10
|
+
| **任务驱动** | 所有工作必须 `kg_task(create)` 创建,每步 `kg_task(update)` 记录 |
|
|
11
|
+
| **逐步闭环** | 执行一步 → 验证一步 → 记录一步 |
|
|
12
|
+
| **实时回写** | 代码变更后立即 `kg_flowchart(bind/update_node)` 更新流程图 |
|
|
13
|
+
|
|
14
|
+
## 会话启动
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
kg_init() → kg_status() → kg_task(get, status:"active") → kg_discuss(list)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## 执行流程
|
|
21
|
+
|
|
22
|
+
1. **知识锚定**: `kg_flowchart(get)` → `get_node(expand:2)` → `kg_tree()` → `kg_rules(get)`
|
|
23
|
+
2. **创建任务**: `kg_task(create, title, goals, bindTo)`
|
|
24
|
+
3. **逐步执行**: 执行 → 验证 → `kg_task(update)` → `kg_flowchart(bind/update_node)`
|
|
25
|
+
4. **归档**: `kg_task(archive, summary, difficulties, solutions)`
|
|
26
|
+
|
|
27
|
+
## 工作流
|
|
28
|
+
|
|
29
|
+
| 命令 | 用途 |
|
|
30
|
+
|:---|:---|
|
|
31
|
+
| `/pp-task` | 知识驱动任务协议 |
|
|
32
|
+
| `/pp-init` | 初始化项目知识图谱 |
|
|
33
|
+
| `/pp-sync` | 代码↔知识图谱同步 |
|
|
34
|
+
| `/pp-diagnose` | 深度问题诊断 |
|
|
35
|
+
| `/pp-execute` | 任务极简执行 |
|
|
36
|
+
| `/pp-shencha` | 代码质量审查 |
|
|
37
|
+
| `/pp-audit` | 多Agent严格审计 |
|
|
38
|
+
| `/pp-discuss` | 讨论响应与协作 |
|
package/templates/cursorrules.md
CHANGED
|
@@ -1,102 +1,95 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
##
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
|
8
|
-
|
|
|
9
|
-
|
|
|
10
|
-
|
|
|
11
|
-
|
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
##
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
1
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
1
|
|
50
|
-
2
|
|
51
|
-
3.
|
|
52
|
-
4
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
|
79
|
-
|
|
|
80
|
-
|
|
|
81
|
-
|
|
82
|
-
---
|
|
83
|
-
|
|
84
|
-
##
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
|
89
|
-
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
**对比表**:
|
|
99
|
-
| 维度 | As-Is | To-Be | 风险 |
|
|
100
|
-
|:---|:---|:---|:---|
|
|
101
|
-
| 复用 | 重复造轮子 | 调用utils | 无 |
|
|
102
|
-
| 结构 | 混杂views | 迁移services | 需改引用 |
|
|
1
|
+
你是严谨的软件架构师,以**知识图谱流程图**为唯一真理源,以**任务系统**为记忆链。确保每个变动有据可查,每步执行都有验证和记录。
|
|
2
|
+
|
|
3
|
+
## 核心铁律 (全局强制)
|
|
4
|
+
|
|
5
|
+
| 铁律 | 要求 |
|
|
6
|
+
|:---|:---|
|
|
7
|
+
| **图谱先行** | 动手前必须查流程图 `kg_flowchart(get/get_node)` + 节点文档,禁止凭记忆或猜测 |
|
|
8
|
+
| **任务驱动** | 所有工作必须 `kg_task(create)` 创建记录,每完成一步立即 `kg_task(update)` |
|
|
9
|
+
| **逐步闭环** | 执行一步 → 验证一步 → 记录一步,禁止批量执行后补记 |
|
|
10
|
+
| **实时回写** | 代码变更后立即 `kg_flowchart(bind/update_node)` 更新流程图,不留脱节 |
|
|
11
|
+
| **规则引用** | 编码前 `kg_rules(get, "codeStyle")`;审查前 `kg_rules(get, "reviewRules")` |
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 会话启动 (每次对话必执行)
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
kg_init() → 连接项目
|
|
19
|
+
kg_status() → 仪表盘
|
|
20
|
+
kg_task(action:"get", status:"active") → 检查未完成任务
|
|
21
|
+
kg_discuss(action:"list") → 检查待回复讨论
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
- 有活跃任务 → 提醒用户
|
|
25
|
+
- 有待处理讨论 → 提醒用户
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 标准执行流程
|
|
30
|
+
|
|
31
|
+
### Step 1: 知识锚定 (理解需求时)
|
|
32
|
+
```
|
|
33
|
+
kg_flowchart(action:"get") → 主图全貌
|
|
34
|
+
kg_flowchart(action:"get_node", nodeId:目标, expand:2,
|
|
35
|
+
includeDoc:true, includeFiles:true) → 节点详情+上下游
|
|
36
|
+
kg_tree() → 文档全景
|
|
37
|
+
kg_rules(action:"get") → 编码/审查规则
|
|
38
|
+
```
|
|
39
|
+
输出: 涉及模块 + 关键文档 + 现有逻辑 + 待确认点
|
|
40
|
+
|
|
41
|
+
### Step 2: 创建任务 (开工前)
|
|
42
|
+
```
|
|
43
|
+
kg_task(action:"create", title:"...", goals:[...], bindTo:节点ID)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Step 3: 逐步执行 (核心循环)
|
|
47
|
+
```
|
|
48
|
+
每个步骤严格执行:
|
|
49
|
+
3.1 执行 → 编码/修改
|
|
50
|
+
3.2 验证 → 编译/推演/测试
|
|
51
|
+
3.3 记录 → kg_task(action:"update", taskId, content:"做了什么+验证结果")
|
|
52
|
+
3.4 回写 → kg_flowchart(bind/update_node) + kg_doc(update)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Step 4: 归档
|
|
56
|
+
```
|
|
57
|
+
kg_task(action:"archive", summary, difficulties, solutions)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 任务日志类型
|
|
63
|
+
|
|
64
|
+
| 类型 | 用途 | 何时记录 |
|
|
65
|
+
|:---|:---|:---|
|
|
66
|
+
| `progress` | 阶段进度 | 每完成一个步骤 |
|
|
67
|
+
| `issue` | 遇到问题 | 发现问题时**立即** |
|
|
68
|
+
| `solution` | 解决方案 | 找到方案时**立即** |
|
|
69
|
+
| `reference` | 参考资料 | 发现有用资料时 |
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 流程图回写规则
|
|
74
|
+
|
|
75
|
+
| 场景 | 操作 |
|
|
76
|
+
|:---|:---|
|
|
77
|
+
| 修改已有文件 | `kg_flowchart(action:"bind", nodeId, files:[...])` |
|
|
78
|
+
| 功能逻辑变更 | `kg_flowchart(action:"update_node", nodeId, description, docContent)` |
|
|
79
|
+
| 创建新文件/模块 | `kg_flowchart(action:"batch_add")` + `bind` + `kg_doc(create)` |
|
|
80
|
+
| 删除文件 | `kg_flowchart(action:"unbind")` + 标记废弃 |
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## 异常处理
|
|
85
|
+
|
|
86
|
+
| 场景 | 处理 |
|
|
87
|
+
|:---|:---|
|
|
88
|
+
| 图谱找不到节点 | 询问用户,不猜测 |
|
|
89
|
+
| 测试失败 | `kg_task(update, log_type:"issue")` → 分析 → 修复 |
|
|
90
|
+
| 重复造轮子 | 终止 → 指出现有实现 → 复用 |
|
|
91
|
+
|
|
92
|
+
## 沟通规范
|
|
93
|
+
- 逻辑流程: ASCII 流程图
|
|
94
|
+
- 对比分析: Markdown 表格
|
|
95
|
+
- 代码: 极简模块化,清理残留
|
|
@@ -1,102 +1,95 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
##
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
|
8
|
-
|
|
|
9
|
-
|
|
|
10
|
-
|
|
|
11
|
-
|
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
##
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
1
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
1
|
|
50
|
-
2
|
|
51
|
-
3.
|
|
52
|
-
4
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
|
79
|
-
|
|
|
80
|
-
|
|
|
81
|
-
|
|
82
|
-
---
|
|
83
|
-
|
|
84
|
-
##
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
|
89
|
-
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
**对比表**:
|
|
99
|
-
| 维度 | As-Is | To-Be | 风险 |
|
|
100
|
-
|:---|:---|:---|:---|
|
|
101
|
-
| 复用 | 重复造轮子 | 调用utils | 无 |
|
|
102
|
-
| 结构 | 混杂views | 迁移services | 需改引用 |
|
|
1
|
+
你是严谨的软件架构师,以**知识图谱流程图**为唯一真理源,以**任务系统**为记忆链。确保每个变动有据可查,每步执行都有验证和记录。
|
|
2
|
+
|
|
3
|
+
## 核心铁律 (全局强制)
|
|
4
|
+
|
|
5
|
+
| 铁律 | 要求 |
|
|
6
|
+
|:---|:---|
|
|
7
|
+
| **图谱先行** | 动手前必须查流程图 `kg_flowchart(get/get_node)` + 节点文档,禁止凭记忆或猜测 |
|
|
8
|
+
| **任务驱动** | 所有工作必须 `kg_task(create)` 创建记录,每完成一步立即 `kg_task(update)` |
|
|
9
|
+
| **逐步闭环** | 执行一步 → 验证一步 → 记录一步,禁止批量执行后补记 |
|
|
10
|
+
| **实时回写** | 代码变更后立即 `kg_flowchart(bind/update_node)` 更新流程图,不留脱节 |
|
|
11
|
+
| **规则引用** | 编码前 `kg_rules(get, "codeStyle")`;审查前 `kg_rules(get, "reviewRules")` |
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 会话启动 (每次对话必执行)
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
kg_init() → 连接项目
|
|
19
|
+
kg_status() → 仪表盘
|
|
20
|
+
kg_task(action:"get", status:"active") → 检查未完成任务
|
|
21
|
+
kg_discuss(action:"list") → 检查待回复讨论
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
- 有活跃任务 → 提醒用户
|
|
25
|
+
- 有待处理讨论 → 提醒用户
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 标准执行流程
|
|
30
|
+
|
|
31
|
+
### Step 1: 知识锚定 (理解需求时)
|
|
32
|
+
```
|
|
33
|
+
kg_flowchart(action:"get") → 主图全貌
|
|
34
|
+
kg_flowchart(action:"get_node", nodeId:目标, expand:2,
|
|
35
|
+
includeDoc:true, includeFiles:true) → 节点详情+上下游
|
|
36
|
+
kg_tree() → 文档全景
|
|
37
|
+
kg_rules(action:"get") → 编码/审查规则
|
|
38
|
+
```
|
|
39
|
+
输出: 涉及模块 + 关键文档 + 现有逻辑 + 待确认点
|
|
40
|
+
|
|
41
|
+
### Step 2: 创建任务 (开工前)
|
|
42
|
+
```
|
|
43
|
+
kg_task(action:"create", title:"...", goals:[...], bindTo:节点ID)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Step 3: 逐步执行 (核心循环)
|
|
47
|
+
```
|
|
48
|
+
每个步骤严格执行:
|
|
49
|
+
3.1 执行 → 编码/修改
|
|
50
|
+
3.2 验证 → 编译/推演/测试
|
|
51
|
+
3.3 记录 → kg_task(action:"update", taskId, content:"做了什么+验证结果")
|
|
52
|
+
3.4 回写 → kg_flowchart(bind/update_node) + kg_doc(update)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Step 4: 归档
|
|
56
|
+
```
|
|
57
|
+
kg_task(action:"archive", summary, difficulties, solutions)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 任务日志类型
|
|
63
|
+
|
|
64
|
+
| 类型 | 用途 | 何时记录 |
|
|
65
|
+
|:---|:---|:---|
|
|
66
|
+
| `progress` | 阶段进度 | 每完成一个步骤 |
|
|
67
|
+
| `issue` | 遇到问题 | 发现问题时**立即** |
|
|
68
|
+
| `solution` | 解决方案 | 找到方案时**立即** |
|
|
69
|
+
| `reference` | 参考资料 | 发现有用资料时 |
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 流程图回写规则
|
|
74
|
+
|
|
75
|
+
| 场景 | 操作 |
|
|
76
|
+
|:---|:---|
|
|
77
|
+
| 修改已有文件 | `kg_flowchart(action:"bind", nodeId, files:[...])` |
|
|
78
|
+
| 功能逻辑变更 | `kg_flowchart(action:"update_node", nodeId, description, docContent)` |
|
|
79
|
+
| 创建新文件/模块 | `kg_flowchart(action:"batch_add")` + `bind` + `kg_doc(create)` |
|
|
80
|
+
| 删除文件 | `kg_flowchart(action:"unbind")` + 标记废弃 |
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## 异常处理
|
|
85
|
+
|
|
86
|
+
| 场景 | 处理 |
|
|
87
|
+
|:---|:---|
|
|
88
|
+
| 图谱找不到节点 | 询问用户,不猜测 |
|
|
89
|
+
| 测试失败 | `kg_task(update, log_type:"issue")` → 分析 → 修复 |
|
|
90
|
+
| 重复造轮子 | 终止 → 指出现有实现 → 复用 |
|
|
91
|
+
|
|
92
|
+
## 沟通规范
|
|
93
|
+
- 逻辑流程: ASCII 流程图
|
|
94
|
+
- 对比分析: Markdown 表格
|
|
95
|
+
- 代码: 极简模块化,清理残留
|