add-coder 0.1.0

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.
Files changed (97) hide show
  1. package/README.md +50 -0
  2. package/bin/add-coder.js +2 -0
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.js +576 -0
  5. package/package.json +64 -0
  6. package/templates/adapters/claude/hooks/doc-format-guard.sh +17 -0
  7. package/templates/adapters/claude/hooks/notification.sh +9 -0
  8. package/templates/adapters/claude/hooks/permission-gate.sh +18 -0
  9. package/templates/adapters/claude/hooks/post-tool-failure.sh +10 -0
  10. package/templates/adapters/claude/hooks/post-tool-use.sh +18 -0
  11. package/templates/adapters/claude/hooks/pre-compact.sh +14 -0
  12. package/templates/adapters/claude/hooks/pre-tool-use.sh +28 -0
  13. package/templates/adapters/claude/hooks/prompt-submit.sh +16 -0
  14. package/templates/adapters/claude/hooks/review-checklist.sh +10 -0
  15. package/templates/adapters/claude/hooks/session-start.sh +23 -0
  16. package/templates/adapters/claude/hooks/stop-check.sh +10 -0
  17. package/templates/adapters/claude/hooks/subagent-guard.sh +15 -0
  18. package/templates/adapters/claude/mcp.json +13 -0
  19. package/templates/adapters/claude/settings.json +125 -0
  20. package/templates/adapters/qoder/hooks/doc-format-guard.sh +164 -0
  21. package/templates/adapters/qoder/hooks/lib/context-inject.sh +96 -0
  22. package/templates/adapters/qoder/hooks/lib/state-detect.sh +104 -0
  23. package/templates/adapters/qoder/hooks/lib/vocabulary.sh +49 -0
  24. package/templates/adapters/qoder/hooks/notification.sh +22 -0
  25. package/templates/adapters/qoder/hooks/permission-gate.sh +8 -0
  26. package/templates/adapters/qoder/hooks/post-tool-failure.sh +8 -0
  27. package/templates/adapters/qoder/hooks/post-tool-use.sh +20 -0
  28. package/templates/adapters/qoder/hooks/pre-compact.sh +12 -0
  29. package/templates/adapters/qoder/hooks/pre-tool-use.sh +77 -0
  30. package/templates/adapters/qoder/hooks/prompt-submit.sh +72 -0
  31. package/templates/adapters/qoder/hooks/review-checklist.sh +157 -0
  32. package/templates/adapters/qoder/hooks/session-start.sh +16 -0
  33. package/templates/adapters/qoder/hooks/stop-check.sh +71 -0
  34. package/templates/adapters/qoder/hooks/subagent-guard.sh +11 -0
  35. package/templates/adapters/qoder/mcp.json +13 -0
  36. package/templates/adapters/qoder/settings.json +125 -0
  37. package/templates/adapters/qoder/sync-policy.json +18 -0
  38. package/templates/adapters/vscode/extensions.json +5 -0
  39. package/templates/adapters/vscode/launch.json +16 -0
  40. package/templates/adapters/vscode/settings.json +16 -0
  41. package/templates/adapters/vscode/tasks.json +38 -0
  42. package/templates/core/agents/add-flow-guardian.md +276 -0
  43. package/templates/core/agents/add-orchestrator.md +217 -0
  44. package/templates/core/plans/2026-07/08/farm-agent-add-coder-npm-package-add-route-v1.md +323 -0
  45. package/templates/core/plans/2026-07/08/farm-agent-add-coder-npm-package-handoff-v1.md +678 -0
  46. package/templates/core/plans/2026-07/08/farm-agent-add-coder-npm-package-plan-v1.md +785 -0
  47. package/templates/core/prisma/add.prisma +34 -0
  48. package/templates/core/reports/REPORT-WORKFLOW.md +250 -0
  49. package/templates/core/reports/boundary-runtime-report.md +134 -0
  50. package/templates/core/reports/code-review-combined-report.md +227 -0
  51. package/templates/core/reports/code-review-fix-verification-report.md +505 -0
  52. package/templates/core/reports/code-review-suggestions.md +66 -0
  53. package/templates/core/reports/index.md +57 -0
  54. package/templates/core/reports/runtime-report/gateway.md +741 -0
  55. package/templates/core/rules/project_rules.md +905 -0
  56. package/templates/core/rules/theory-practice-map.toml +105 -0
  57. package/templates/core/scripts/mcp-server.ts +3492 -0
  58. package/templates/core/skills/add-paradigm/SKILL.md +1086 -0
  59. package/templates/core/skills/session-init/SKILL.md +215 -0
  60. package/templates/core/specs/farm-agent-add-coder-npm-package/checklist.md +125 -0
  61. package/templates/core/specs/farm-agent-add-coder-npm-package/spec.md +343 -0
  62. package/templates/core/specs/farm-agent-add-coder-npm-package/tasks.md +203 -0
  63. package/templates/core/templates/01-/346/236/266/346/236/204//343/200/212ADD/345/274/200/345/217/221/345/267/245/344/275/234/350/267/257/345/276/204/344/270/216/346/226/207/346/241/243/345/215/217/345/220/214/350/247/204/350/214/203/343/200/213.md +386 -0
  64. package/templates/core/templates/TERMINOLOGY.md +81 -0
  65. package/templates/core/templates/add-route-template-heavyweight.md +288 -0
  66. package/templates/core/templates/add-route-template.md +242 -0
  67. package/templates/core/templates/add-route-template.schema.json +35 -0
  68. package/templates/core/templates/checklist-template.md +72 -0
  69. package/templates/core/templates/checklist-template.schema.json +20 -0
  70. package/templates/core/templates/fix-verification-template.md +132 -0
  71. package/templates/core/templates/fix-verification-template.schema.json +54 -0
  72. package/templates/core/templates/handoff-multi-round-template.md +295 -0
  73. package/templates/core/templates/handoff-multi-round.schema.json +48 -0
  74. package/templates/core/templates/handoff-single-round-template.md +145 -0
  75. package/templates/core/templates/handoff-single-round.schema.json +92 -0
  76. package/templates/core/templates/index.md +60 -0
  77. package/templates/core/templates/report-template.md +126 -0
  78. package/templates/core/templates/report-template.schema.json +69 -0
  79. package/templates/core/templates/review-implementation-template.md +66 -0
  80. package/templates/core/templates/review-implementation-template.schema.json +58 -0
  81. package/templates/core/templates/review-runtime-template.md +73 -0
  82. package/templates/core/templates/review-runtime-template.schema.json +47 -0
  83. package/templates/core/templates/review-template.md +37 -0
  84. package/templates/core/templates/review-template.schema.json +42 -0
  85. package/templates/core/templates/runtime-report-template.md +73 -0
  86. package/templates/core/templates/runtime-report-template.schema.json +48 -0
  87. package/templates/core/templates/simple-plan-template.md +166 -0
  88. package/templates/core/templates/simple-plan-template.schema.json +109 -0
  89. package/templates/core/templates/spec-template.md +22 -0
  90. package/templates/core/templates/spec-template.schema.json +41 -0
  91. package/templates/core/templates/standard-plan-template.md +96 -0
  92. package/templates/core/templates/standard-plan-template.schema.json +73 -0
  93. package/templates/core/templates/tasks-template.md +54 -0
  94. package/templates/core/templates/tasks-template.schema.json +43 -0
  95. package/templates/core/tools/README.md +361 -0
  96. package/templates/core/vocabulary/add-governance-vocabulary.md +370 -0
  97. package/templates/shared/hooks-lib/common.sh +22 -0
@@ -0,0 +1,47 @@
1
+ {
2
+ "template": "review-runtime-template.md",
3
+ "sections": [
4
+ {
5
+ "id": "meta",
6
+ "heading": "## Review 元信息",
7
+ "required": true
8
+ },
9
+ {
10
+ "id": "findings",
11
+ "heading": "## 1. 发现列表",
12
+ "required": true
13
+ },
14
+ {
15
+ "id": "improvements",
16
+ "heading": "## 2. review 流程改进项",
17
+ "required": true
18
+ },
19
+ {
20
+ "id": "fixed",
21
+ "heading": "## 3. 已运行时修复项",
22
+ "required": false
23
+ },
24
+ {
25
+ "id": "feedback",
26
+ "heading": "## 4. 回流确认",
27
+ "required": true
28
+ }
29
+ ],
30
+ "placeholders": [
31
+ "{标题}",
32
+ "{前置方案 review 文档路径}",
33
+ "{前置实现 review 文档路径}",
34
+ "{前置 checklist 文档路径}",
35
+ "{YYYY-MM-DD}",
36
+ "{用户报告",
37
+ "{问题标题}",
38
+ "{N}",
39
+ "{hash}",
40
+ "{日期}",
41
+ "{提交信息}"
42
+ ],
43
+ "forbidden_terms": [ "Phase",
44
+ "阶段",
45
+ "步骤"
46
+ ]
47
+ }
@@ -0,0 +1,37 @@
1
+ # {标题}
2
+
3
+ ## Review 元信息
4
+
5
+ - **Review 对象**: {被评审的 spec / 设计 / 方案}
6
+ - **对比方案**: {方案 A vs 方案 B(可选)}
7
+ - **Review 时间**: {YYYY-MM-DD}
8
+ - **Review 类型**: {架构决策 / 方案选型 / 合规检查}
9
+ - **前置阅读**: {关联的 plan / spec / handoff}
10
+
11
+ ---
12
+
13
+ ## 1. 问题复现
14
+
15
+ 为什么需要这次评审?
16
+
17
+ ---
18
+
19
+ ## 2. 方案对比(如有多个方案)
20
+
21
+ ### 2.1 方案 A
22
+
23
+ ### 2.2 方案 B
24
+
25
+ ---
26
+
27
+ ## 3. 决策结论
28
+
29
+ ---
30
+
31
+ ## 4. 影响评估
32
+
33
+ ### 4.1 受影响文件
34
+
35
+ ### 4.2 数据流影响
36
+
37
+ ### 4.3 回滚风险
@@ -0,0 +1,42 @@
1
+ {
2
+ "template": "review-template.md",
3
+ "sections": [
4
+ {
5
+ "id": "meta",
6
+ "heading": "## Review 元信息",
7
+ "required": true
8
+ },
9
+ {
10
+ "id": "problem",
11
+ "heading": "## 1. 问题复现",
12
+ "required": true
13
+ },
14
+ {
15
+ "id": "compare",
16
+ "heading": "## 2. 方案对比",
17
+ "required": false
18
+ },
19
+ {
20
+ "id": "conclusion",
21
+ "heading": "## 3. 决策结论",
22
+ "required": true
23
+ },
24
+ {
25
+ "id": "impact",
26
+ "heading": "## 4. 影响评估",
27
+ "required": true
28
+ }
29
+ ],
30
+ "placeholders": [
31
+ "{标题}",
32
+ "{被评审的 spec",
33
+ "{方案 A vs 方案 B",
34
+ "{YYYY-MM-DD}",
35
+ "{架构决策",
36
+ "{关联的 plan"
37
+ ],
38
+ "forbidden_terms": [ "Phase",
39
+ "阶段",
40
+ "步骤"
41
+ ]
42
+ }
@@ -0,0 +1,73 @@
1
+ # {项目名} 运行时报告 — {subsystem}
2
+
3
+ > `{subsystem}` 子系统运行时异常报告。由对应子系统自动追加。
4
+ > 属于 `{{projectName}}-runtime-report/` 体系,与静态 Reports 双向联动。
5
+
6
+ ## 报告元信息
7
+
8
+ - **子系统**: `{subsystem}`
9
+ - **来源**: `{写入函数或模块}`
10
+ - **首次生成**: {YYYY-MM-DD}
11
+ - **触发方式**: {触发条件描述}
12
+
13
+ ---
14
+
15
+ ## 1. 发现列表
16
+
17
+ > 尚无运行时发现。对应异常触发后将自动填充。
18
+
19
+ ---
20
+
21
+ ## 2. 发现条目格式
22
+
23
+ (以下为 `appendRuntimeFinding()` 等自动追加的条目格式,仅供参考)
24
+
25
+ ### 发现: {简短描述}
26
+
27
+ **时间**:{ISO 8601 时间戳}
28
+ **来源**:`{proxy | route | 其他}`
29
+ **错误**:{错误信息}
30
+
31
+ **合约断裂点**(如有):
32
+
33
+ - 期望:`{期望行为}`
34
+ - 实际:`{实际行为}`
35
+
36
+ **请求信息**:
37
+
38
+ - Method: {GET | POST | PUT | DELETE}
39
+ - Path: {请求路径}
40
+
41
+ **堆栈**:
42
+
43
+ ```
44
+ {stack trace 前 5 行}
45
+ ```
46
+
47
+ ---
48
+
49
+ ## 3. 统计数据
50
+
51
+ | 指标 | 值 |
52
+ |------|:--:|
53
+ | 发现总数 | {n} |
54
+ | 去重后独立发现 | {n} |
55
+ | 已关联 Report Issue | {n} |
56
+ | 已修复(运行时验证) | {n} |
57
+
58
+ ---
59
+
60
+ ## 4. 关联 Report Issue
61
+
62
+ > 每条发现经人工 triage 后可关联到 `combined-report.md` 中的 Issue。
63
+
64
+ | 发现 | Report Issue | 状态 |
65
+ |------|-------------|:----:|
66
+ | {发现描述} | `RPT-{id}` | ✅ 已验证 / ❌ 回退 |
67
+
68
+ ---
69
+
70
+ ## 5. 回流确认
71
+
72
+ - [ ] 重大发现已写入 `combined-report.md`
73
+ - [ ] 修复项已记录 AuditLog
@@ -0,0 +1,48 @@
1
+ {
2
+ "template": "runtime-report-template.md",
3
+ "sections": [
4
+ {
5
+ "id": "meta",
6
+ "heading": "## 报告元信息",
7
+ "required": true
8
+ },
9
+ {
10
+ "id": "findings",
11
+ "heading": "## 1. 发现列表",
12
+ "required": true
13
+ },
14
+ {
15
+ "id": "format",
16
+ "heading": "## 2. 发现条目格式",
17
+ "required": false
18
+ },
19
+ {
20
+ "id": "stats",
21
+ "heading": "## 3. 统计数据",
22
+ "required": true
23
+ },
24
+ {
25
+ "id": "linked",
26
+ "heading": "## 4. 关联 Report Issue",
27
+ "required": false
28
+ },
29
+ {
30
+ "id": "feedback",
31
+ "heading": "## 5. 回流确认",
32
+ "required": true
33
+ }
34
+ ],
35
+ "placeholders": [
36
+ "{项目名}",
37
+ "{subsystem}",
38
+ "{写入函数或模块}",
39
+ "{YYYY-MM-DD}",
40
+ "{触发条件描述}",
41
+ "{n}",
42
+ "{发现描述}"
43
+ ],
44
+ "forbidden_terms": [ "Phase",
45
+ "阶段",
46
+ "步骤"
47
+ ]
48
+ }
@@ -0,0 +1,166 @@
1
+ # {需求名}-plan-v{版本号}
2
+
3
+ > 精简版 Plan 模板:适用于单一聚焦改动(配置收敛、重构、修复等)。Tasks 合并于 Plan 体,无需独立 spec 文件。
4
+
5
+ **创建时间**: {ISO 时间戳}
6
+ **主导 AI**: {AI 助手标识}
7
+
8
+ ---
9
+
10
+ ## 一、Plan 概述
11
+
12
+ - **现状**: 一句话描述当前问题
13
+ - **目标**: 一句话描述改后状态
14
+ - **核心原则**: 本次改动遵循的关键约束
15
+
16
+ ---
17
+
18
+ ## 二、变更范围
19
+
20
+ ### 2.1 涉及文件
21
+
22
+ | 文件 | 改动类型 | 说明 |
23
+ |------|---------|------|
24
+ | `path/to/file.ts` | 修改 | 一句话说明 |
25
+
26
+ ### 2.2 关键设计决策
27
+
28
+ 1. xxx
29
+ 2. xxx
30
+
31
+ ---
32
+
33
+ ## 三、Tasks(合并在 Plan 中,无需独立 spec/tasks.md)
34
+
35
+ > 单轮 Plan,Task 扁平排列无需分组。依赖关系见 §4.6 执行 Task 摘要。
36
+
37
+ - [ ] Task 1: {任务描述}
38
+ - [ ] SubTask 1.1: {子任务描述}
39
+ - [ ] Task 2: {任务描述}
40
+
41
+ ---
42
+
43
+ ## 四、Handoff
44
+
45
+ > 与独立 `handoff-single-round-template.md` 结构一致。
46
+
47
+ ### 4.1 交接前状态
48
+
49
+ {描述当前数据/文件分布、系统现状}
50
+
51
+ ### 4.2 交接后状态(目标)
52
+
53
+ {描述目标布局、变更完成后的系统状态}
54
+
55
+ ### 4.3 改动清单
56
+
57
+ | # | 文件 | 操作 | 内容 |
58
+ |---|------|------|------|
59
+ | 1 | `{文件路径}` | 新建/修改/删除 | 一句话描述 |
60
+
61
+ ### 4.4 回滚方案
62
+
63
+ ```bash
64
+ git reset --hard <commit>
65
+ ```
66
+
67
+ ### 4.5 执行前置检查
68
+
69
+ - [ ] {检查项1}
70
+ - [ ] {检查项2}
71
+ - [ ] `npx tsc --noEmit` 当前无错误(或已知错误与本变更无关)
72
+
73
+ ### 4.6 执行 Task 摘要
74
+
75
+ ```text
76
+ {依赖图 — ASCII 图,│ ├ ▼ 表达依赖关系}
77
+
78
+ Step 1 ── {描述}
79
+
80
+
81
+ Step 2 ── {描述}
82
+ ```
83
+
84
+ ### 4.7 关键风险点
85
+
86
+ | 风险 | 影响 | 缓解 |
87
+ |------|------|------|
88
+ | {风险描述} | {影响说明} | {缓解措施} |
89
+
90
+ ### 4.8 恢复上下文审计查询(新 AI Session 首次启动必读)
91
+
92
+ > **给后续 AI 助手的说明**:以下每个 `query_audit_logs(...)` 都是 MCP 工具调用,AI 助手在自己的对话中**直接复制粘贴这些参数调用工具即可**,不需要写 SQL。共 {N} 条审计记录可恢复完整开发上下文。
93
+
94
+ #### 总体一键恢复
95
+
96
+ ```text
97
+ query_audit_logs({ keyword: "{汇总关键词}" })
98
+ ```
99
+ → 预期返回 {N} 条记录
100
+
101
+ #### 逐任务/逐文件审计查询
102
+
103
+ ```text
104
+ query_audit_logs({ targetId: "{文件路径1}" })
105
+ → 预期返回 {ACTION_1}: {描述}
106
+
107
+ query_audit_logs({ targetId: "{文件路径2}" })
108
+ → 预期返回 {ACTION_2}: {描述}
109
+
110
+ query_audit_logs({ keyword: "{ACTION_3}" })
111
+ → 预期返回 {N} 条: {描述}
112
+ ```
113
+
114
+ #### SQL 管理员验证
115
+
116
+ ```sql
117
+ SELECT action, "targetType", "targetId", reason, "createdAt"
118
+ FROM "AuditLog"
119
+ WHERE action IN (
120
+ '{ACTION_1}',
121
+ '{ACTION_2}',
122
+ '{ACTION_3}'
123
+ )
124
+ ORDER BY "createdAt" DESC;
125
+ ```
126
+
127
+ #### 恢复判定标准
128
+
129
+ - action 命中数 ≥ {N}
130
+ - grep 验证命令:
131
+
132
+ ```bash
133
+ grep -R "{关键字}" .qoder/
134
+ ```
135
+
136
+ ### 4.9 后置确认
137
+
138
+ - [ ] `npx tsc --noEmit` 通过
139
+ - [ ] {确认项2}
140
+ - [ ] {确认项3}
141
+
142
+ ### 4.10 脱敏要求
143
+
144
+ Handoff 文档中 **禁止出现** 以下硬编码值:
145
+ - 数据库密码(`POSTGRES_PASSWORD`)
146
+ - Chroma auth token(`CHROMA_AUTH_TOKEN`)
147
+ - JWT 密钥(`JWT_SECRET`)
148
+ - API Key(`OPENAI_API_KEY_*`、`LLM_API_KEY` 等)
149
+
150
+ 所有凭据值应通过 `${ENV_VAR}` 引用,并标注值见 `.env.development`。
151
+
152
+ ---
153
+
154
+ ## 五、验收标准
155
+
156
+ - [ ] 标准1
157
+ - [ ] 标准2
158
+
159
+ ---
160
+
161
+ ## 六、关联
162
+
163
+ | 类型 | 路径 |
164
+ |------|------|
165
+ | Handoff | 见本文第四部分 |
166
+ | Review | `.qoder/reviews/{name}-review-v{版本}.md` |
@@ -0,0 +1,109 @@
1
+ {
2
+ "template": "simple-plan-template.md",
3
+ "sections": [
4
+ {
5
+ "id": "overview",
6
+ "heading": "## 一、Plan 概述",
7
+ "required": true
8
+ },
9
+ {
10
+ "id": "changes",
11
+ "heading": "## 二、变更范围",
12
+ "required": true
13
+ },
14
+ {
15
+ "id": "tasks",
16
+ "heading": "## 三、Tasks",
17
+ "required": true
18
+ },
19
+ {
20
+ "id": "handoff",
21
+ "heading": "## 四、Handoff",
22
+ "required": true,
23
+ "subsections": [
24
+ {
25
+ "id": "4.1",
26
+ "heading": "### 4.1 交接前状态"
27
+ },
28
+ {
29
+ "id": "4.2",
30
+ "heading": "### 4.2 交接后状态(目标)"
31
+ },
32
+ {
33
+ "id": "4.3",
34
+ "heading": "### 4.3 改动清单"
35
+ },
36
+ {
37
+ "id": "4.4",
38
+ "heading": "### 4.4 回滚方案"
39
+ },
40
+ {
41
+ "id": "4.5",
42
+ "heading": "### 4.5 执行前置检查"
43
+ },
44
+ {
45
+ "id": "4.6",
46
+ "heading": "### 4.6 执行 Task 摘要"
47
+ },
48
+ {
49
+ "id": "4.7",
50
+ "heading": "### 4.7 关键风险点"
51
+ },
52
+ {
53
+ "id": "4.8",
54
+ "heading": "### 4.8 恢复上下文审计查询",
55
+ "subsubsections": [
56
+ "#### 总体一键恢复",
57
+ "#### 逐任务/逐文件审计查询",
58
+ "#### SQL 管理员验证",
59
+ "#### 恢复判定标准"
60
+ ]
61
+ },
62
+ {
63
+ "id": "4.9",
64
+ "heading": "### 4.9 后置确认"
65
+ },
66
+ {
67
+ "id": "4.10",
68
+ "heading": "### 4.10 脱敏要求"
69
+ }
70
+ ]
71
+ },
72
+ {
73
+ "id": "acceptance",
74
+ "heading": "## 五、验收标准",
75
+ "required": true
76
+ },
77
+ {
78
+ "id": "references",
79
+ "heading": "## 六、关联",
80
+ "required": true
81
+ }
82
+ ],
83
+ "placeholders": [
84
+ "{需求名}",
85
+ "{版本号}",
86
+ "{ISO 时间戳}",
87
+ "{AI 助手标识}",
88
+ "{文件路径}",
89
+ "{新建/修改/删除}",
90
+ "{检查项1}",
91
+ "{检查项2}",
92
+ "{描述}",
93
+ "{风险描述}",
94
+ "{影响说明}",
95
+ "{缓解措施}",
96
+ "{汇总关键词}",
97
+ "{N}",
98
+ "{关键字}",
99
+ "{ACTION_1}",
100
+ "{ACTION_2}",
101
+ "{ACTION_3}"
102
+ ],
103
+ "forbidden_terms": [ "Phase",
104
+ "Round",
105
+ "轮次",
106
+ "阶段",
107
+ "步骤"
108
+ ]
109
+ }
@@ -0,0 +1,22 @@
1
+ # {功能名称} Spec
2
+
3
+ ## Why
4
+
5
+ 为什么需要这个变更。
6
+
7
+ ## What Changes
8
+
9
+ 变更内容。
10
+
11
+ ## Impact
12
+
13
+ 影响范围。
14
+
15
+ ## ADDED Requirements
16
+
17
+ ### Requirement: {需求名称}
18
+
19
+ #### Scenario: {场景名称}
20
+
21
+ - **WHEN** {条件}
22
+ - **THEN** {结果}
@@ -0,0 +1,41 @@
1
+ {
2
+ "template": "spec-template.md",
3
+ "sections": [
4
+ {
5
+ "id": "why",
6
+ "heading": "## Why",
7
+ "required": true
8
+ },
9
+ {
10
+ "id": "what",
11
+ "heading": "## What Changes",
12
+ "required": true
13
+ },
14
+ {
15
+ "id": "impact",
16
+ "heading": "## Impact",
17
+ "required": true
18
+ },
19
+ {
20
+ "id": "boundaries",
21
+ "heading": "## Boundaries",
22
+ "required": false
23
+ },
24
+ {
25
+ "id": "requirements",
26
+ "heading": "## Requirements",
27
+ "required": true
28
+ }
29
+ ],
30
+ "placeholders": [
31
+ "{功能名称}",
32
+ "{描述}"
33
+ ],
34
+ "forbidden_terms": [
35
+ "Phase",
36
+ "Step",
37
+ "Task",
38
+ "阶段",
39
+ "步骤"
40
+ ]
41
+ }
@@ -0,0 +1,96 @@
1
+ # {需求域名}-{核心内容}-plan-v{版本号}
2
+
3
+ > **Plan/Spec 边界提醒**:Plan 回答"改什么、为什么改、改哪里"——写到让 Review 能判断方向对不对、有没有遗漏维度的程度(文件路径 + Task 验收标准 + 架构维度全覆盖)。**不要**在 Plan 中写完整 TS 类型定义、WHEN-THEN 场景、精确函数签名——那是 Spec 的职责。详见 [《ADD开发工作路径与文档协同规范》§8.1.1]({{projectRoot}}/{{docsDir}}/knowledge/01-架构/《ADD开发工作路径与文档协同规范》.md)。
4
+
5
+ ## PLAN 元信息
6
+
7
+ - **Plan 名称**: {英文名}-{序号}
8
+ - **启动时间**: {ISO 时间戳}
9
+ - **主导 AI**: {AI 助手标识}
10
+ - **关联文档**:
11
+ - ADD Route: `.qoder/plans/{YYYY-MM}/{DD}/{需求域名}-{核心内容}-add-route-v{版本}.md`
12
+ - Handoff: `.qoder/plans/{YYYY-MM}/{DD}/{需求域名}-{核心内容}-handoff-v{版本}.md`
13
+ - Review: `.qoder/reviews/{需求域名}-review-v{版本}.md`
14
+ - **ADD-7 审计策略**:
15
+
16
+ | 文件 | targetType | action | beforeState | afterState | 状态 |
17
+ |-----|-----------|--------|------------|-----------|------|
18
+ | path/to/file.ts | COMPONENT | COMPONENT_CREATED | 描述改前状态 | 描述改后状态 | 待实施 |
19
+
20
+ ---
21
+
22
+ ## 一、背景与目标
23
+
24
+ ### 1.1 问题现状
25
+
26
+ ### 1.2 目标
27
+
28
+ ---
29
+
30
+ ## 二、方案选型(如有多个候选方案)
31
+
32
+ ### 2.1 候选方案对比
33
+
34
+ | 方案 | 因素1 | 因素2 | 因素3 | 结论 |
35
+ |------|-------|-------|-------|------|
36
+ | A: xxx | | | | |
37
+ | B: xxx | | | | |
38
+
39
+ ### 2.2 选型理由
40
+
41
+ ---
42
+
43
+ ## 三、架构设计
44
+
45
+ ### 3.1 数据流转(文件级,标注关键行号与回退路径)
46
+
47
+ ```
48
+ {自上而下的数据流转 ASCII 图,│ ├ ▼ 表达流向,标注文件路径与行号}
49
+ {必须包含完整的回退链:每一步失败后的降级路径}
50
+ ```
51
+
52
+ ### 3.2 {架构图表 / 拓扑 / 组件关系(可选)}
53
+
54
+ ### 3.3 {数据模型变更(如有)}
55
+
56
+ ---
57
+
58
+ ## 四、实施 Task + 依赖图
59
+
60
+ ```
61
+ Task 1 ──┐
62
+ │ 可并行
63
+ Task 2 ──┘
64
+
65
+
66
+ Task 3 ──┐
67
+ Task 4 ──┤ 可并行
68
+ Task 5 ──┘
69
+
70
+
71
+ Task 6 (编译/测试)
72
+ ```
73
+
74
+ ### Step 0: 文档先行
75
+
76
+ ### Step N: ...
77
+
78
+ ---
79
+
80
+ ## 五、验收标准
81
+
82
+ - [ ] 标准1
83
+ - [ ] 标准2
84
+
85
+ ---
86
+
87
+ ## 六、关联文档
88
+
89
+ | 文档 | 路径 |
90
+ |------|------|
91
+ | ADD Route | `.qoder/plans/...` |
92
+ | Handoff | `.qoder/plans/...` |
93
+ | Review | `.qoder/reviews/...` |
94
+ | Spec | `.qoder/specs/{name}/spec.md` |
95
+ | Tasks | `.qoder/specs/{name}/tasks.md` |
96
+ | Checklist | `.qoder/specs/{name}/checklist.md` |