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.
- package/README.md +50 -0
- package/bin/add-coder.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +576 -0
- package/package.json +64 -0
- package/templates/adapters/claude/hooks/doc-format-guard.sh +17 -0
- package/templates/adapters/claude/hooks/notification.sh +9 -0
- package/templates/adapters/claude/hooks/permission-gate.sh +18 -0
- package/templates/adapters/claude/hooks/post-tool-failure.sh +10 -0
- package/templates/adapters/claude/hooks/post-tool-use.sh +18 -0
- package/templates/adapters/claude/hooks/pre-compact.sh +14 -0
- package/templates/adapters/claude/hooks/pre-tool-use.sh +28 -0
- package/templates/adapters/claude/hooks/prompt-submit.sh +16 -0
- package/templates/adapters/claude/hooks/review-checklist.sh +10 -0
- package/templates/adapters/claude/hooks/session-start.sh +23 -0
- package/templates/adapters/claude/hooks/stop-check.sh +10 -0
- package/templates/adapters/claude/hooks/subagent-guard.sh +15 -0
- package/templates/adapters/claude/mcp.json +13 -0
- package/templates/adapters/claude/settings.json +125 -0
- package/templates/adapters/qoder/hooks/doc-format-guard.sh +164 -0
- package/templates/adapters/qoder/hooks/lib/context-inject.sh +96 -0
- package/templates/adapters/qoder/hooks/lib/state-detect.sh +104 -0
- package/templates/adapters/qoder/hooks/lib/vocabulary.sh +49 -0
- package/templates/adapters/qoder/hooks/notification.sh +22 -0
- package/templates/adapters/qoder/hooks/permission-gate.sh +8 -0
- package/templates/adapters/qoder/hooks/post-tool-failure.sh +8 -0
- package/templates/adapters/qoder/hooks/post-tool-use.sh +20 -0
- package/templates/adapters/qoder/hooks/pre-compact.sh +12 -0
- package/templates/adapters/qoder/hooks/pre-tool-use.sh +77 -0
- package/templates/adapters/qoder/hooks/prompt-submit.sh +72 -0
- package/templates/adapters/qoder/hooks/review-checklist.sh +157 -0
- package/templates/adapters/qoder/hooks/session-start.sh +16 -0
- package/templates/adapters/qoder/hooks/stop-check.sh +71 -0
- package/templates/adapters/qoder/hooks/subagent-guard.sh +11 -0
- package/templates/adapters/qoder/mcp.json +13 -0
- package/templates/adapters/qoder/settings.json +125 -0
- package/templates/adapters/qoder/sync-policy.json +18 -0
- package/templates/adapters/vscode/extensions.json +5 -0
- package/templates/adapters/vscode/launch.json +16 -0
- package/templates/adapters/vscode/settings.json +16 -0
- package/templates/adapters/vscode/tasks.json +38 -0
- package/templates/core/agents/add-flow-guardian.md +276 -0
- package/templates/core/agents/add-orchestrator.md +217 -0
- package/templates/core/plans/2026-07/08/farm-agent-add-coder-npm-package-add-route-v1.md +323 -0
- package/templates/core/plans/2026-07/08/farm-agent-add-coder-npm-package-handoff-v1.md +678 -0
- package/templates/core/plans/2026-07/08/farm-agent-add-coder-npm-package-plan-v1.md +785 -0
- package/templates/core/prisma/add.prisma +34 -0
- package/templates/core/reports/REPORT-WORKFLOW.md +250 -0
- package/templates/core/reports/boundary-runtime-report.md +134 -0
- package/templates/core/reports/code-review-combined-report.md +227 -0
- package/templates/core/reports/code-review-fix-verification-report.md +505 -0
- package/templates/core/reports/code-review-suggestions.md +66 -0
- package/templates/core/reports/index.md +57 -0
- package/templates/core/reports/runtime-report/gateway.md +741 -0
- package/templates/core/rules/project_rules.md +905 -0
- package/templates/core/rules/theory-practice-map.toml +105 -0
- package/templates/core/scripts/mcp-server.ts +3492 -0
- package/templates/core/skills/add-paradigm/SKILL.md +1086 -0
- package/templates/core/skills/session-init/SKILL.md +215 -0
- package/templates/core/specs/farm-agent-add-coder-npm-package/checklist.md +125 -0
- package/templates/core/specs/farm-agent-add-coder-npm-package/spec.md +343 -0
- package/templates/core/specs/farm-agent-add-coder-npm-package/tasks.md +203 -0
- 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
- package/templates/core/templates/TERMINOLOGY.md +81 -0
- package/templates/core/templates/add-route-template-heavyweight.md +288 -0
- package/templates/core/templates/add-route-template.md +242 -0
- package/templates/core/templates/add-route-template.schema.json +35 -0
- package/templates/core/templates/checklist-template.md +72 -0
- package/templates/core/templates/checklist-template.schema.json +20 -0
- package/templates/core/templates/fix-verification-template.md +132 -0
- package/templates/core/templates/fix-verification-template.schema.json +54 -0
- package/templates/core/templates/handoff-multi-round-template.md +295 -0
- package/templates/core/templates/handoff-multi-round.schema.json +48 -0
- package/templates/core/templates/handoff-single-round-template.md +145 -0
- package/templates/core/templates/handoff-single-round.schema.json +92 -0
- package/templates/core/templates/index.md +60 -0
- package/templates/core/templates/report-template.md +126 -0
- package/templates/core/templates/report-template.schema.json +69 -0
- package/templates/core/templates/review-implementation-template.md +66 -0
- package/templates/core/templates/review-implementation-template.schema.json +58 -0
- package/templates/core/templates/review-runtime-template.md +73 -0
- package/templates/core/templates/review-runtime-template.schema.json +47 -0
- package/templates/core/templates/review-template.md +37 -0
- package/templates/core/templates/review-template.schema.json +42 -0
- package/templates/core/templates/runtime-report-template.md +73 -0
- package/templates/core/templates/runtime-report-template.schema.json +48 -0
- package/templates/core/templates/simple-plan-template.md +166 -0
- package/templates/core/templates/simple-plan-template.schema.json +109 -0
- package/templates/core/templates/spec-template.md +22 -0
- package/templates/core/templates/spec-template.schema.json +41 -0
- package/templates/core/templates/standard-plan-template.md +96 -0
- package/templates/core/templates/standard-plan-template.schema.json +73 -0
- package/templates/core/templates/tasks-template.md +54 -0
- package/templates/core/templates/tasks-template.schema.json +43 -0
- package/templates/core/tools/README.md +361 -0
- package/templates/core/vocabulary/add-governance-vocabulary.md +370 -0
- package/templates/shared/hooks-lib/common.sh +22 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# {项目名} — {变更描述} 交接手册
|
|
2
|
+
|
|
3
|
+
> **适用场景**:单轮变更——Plan 内只有 1 个轮次级闭包,所有文件在一次闭包内完成,无跨轮文件边界问题。如简单 Bug 修复、单文件改动。
|
|
4
|
+
>
|
|
5
|
+
> **注意**:如果涉及多个独立文件边界(如类型定义 + 调用方修复),即使"用户能用"也需要拆为多轮,应使用 `handoff-multi-round-template.md`。
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. 交接前状态
|
|
10
|
+
|
|
11
|
+
{描述当前数据/文件分布、系统现状}
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 2. 交接后状态(目标)
|
|
16
|
+
|
|
17
|
+
{描述目标布局、变更完成后的系统状态}
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 3. 改动清单
|
|
22
|
+
|
|
23
|
+
| # | 文件 | 操作 | 内容 |
|
|
24
|
+
|---|------|------|------|
|
|
25
|
+
| 1 | `{文件路径}` | {新建/修改/删除} | {一句话描述改了什么} |
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 4. 回滚方案
|
|
30
|
+
|
|
31
|
+
### 代码回滚
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
git reset --hard <commit>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 数据回滚
|
|
38
|
+
|
|
39
|
+
{如有数据迁移,描述回滚操作}
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 5. 执行前置检查
|
|
44
|
+
|
|
45
|
+
- [ ] {检查项1}
|
|
46
|
+
- [ ] {检查项2}
|
|
47
|
+
- [ ] `npx tsc --noEmit` + `eslint` 当前无 error
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 6. 执行 Task 摘要
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
{依赖图 — ASCII 图,│ ├ ▼ 表达依赖关系}
|
|
55
|
+
|
|
56
|
+
Step 1 ── {描述}
|
|
57
|
+
│
|
|
58
|
+
▼
|
|
59
|
+
Step 2 ── {描述}
|
|
60
|
+
│
|
|
61
|
+
├──────────────┐
|
|
62
|
+
▼ ▼
|
|
63
|
+
Step 3 ── {描述} Step 4 ── {描述}
|
|
64
|
+
│ │
|
|
65
|
+
└──────┬───────┘
|
|
66
|
+
▼
|
|
67
|
+
Step 5 ── {描述}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 7. 关键风险点
|
|
73
|
+
|
|
74
|
+
| 风险 | 影响 | 缓解 |
|
|
75
|
+
|------|------|------|
|
|
76
|
+
| {风险描述} | {影响说明} | {缓解措施} |
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## 8. 恢复上下文审计查询(新 AI Session 首次启动必读)
|
|
81
|
+
|
|
82
|
+
> **给后续 AI 助手的说明**:以下每个 `query_audit_logs(...)` 都是 MCP 工具调用,AI 助手在自己的对话中**直接复制粘贴这些参数调用工具即可**,不需要写 SQL。共 {N} 条审计记录可恢复完整开发上下文。
|
|
83
|
+
|
|
84
|
+
### 总体一键恢复
|
|
85
|
+
|
|
86
|
+
```text
|
|
87
|
+
query_audit_logs({ keyword: "{汇总关键词}" })
|
|
88
|
+
```
|
|
89
|
+
→ 预期返回 {N} 条记录
|
|
90
|
+
|
|
91
|
+
### 逐任务/逐文件审计查询
|
|
92
|
+
|
|
93
|
+
```text
|
|
94
|
+
query_audit_logs({ targetId: "{文件路径1}" })
|
|
95
|
+
→ 预期返回 {ACTION_1}: {描述}
|
|
96
|
+
|
|
97
|
+
query_audit_logs({ targetId: "{文件路径2}" })
|
|
98
|
+
→ 预期返回 {ACTION_2}: {描述}
|
|
99
|
+
|
|
100
|
+
query_audit_logs({ keyword: "{ACTION_3}" })
|
|
101
|
+
→ 预期返回 {N} 条: {描述}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### SQL 管理员验证
|
|
105
|
+
|
|
106
|
+
```sql
|
|
107
|
+
SELECT action, "targetType", "targetId", reason, "createdAt"
|
|
108
|
+
FROM "AuditLog"
|
|
109
|
+
WHERE action IN (
|
|
110
|
+
'{ACTION_1}',
|
|
111
|
+
'{ACTION_2}',
|
|
112
|
+
'{ACTION_3}'
|
|
113
|
+
)
|
|
114
|
+
ORDER BY "createdAt" DESC;
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### 恢复判定标准
|
|
118
|
+
|
|
119
|
+
- action 命中数 ≥ {N}
|
|
120
|
+
- grep 验证命令:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
grep -R "{关键字}" .qoder/specs/
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## 9. 后置确认
|
|
129
|
+
|
|
130
|
+
- [ ] `npx tsc --noEmit` + `eslint` 通过
|
|
131
|
+
- [ ] 所有文件改动已记录 ADD-7 审计(`query_audit_logs` 可回查)
|
|
132
|
+
- [ ] {确认项3}
|
|
133
|
+
- [ ] {确认项4}
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
### 脱敏要求
|
|
138
|
+
|
|
139
|
+
Handoff 文档中 **禁止出现** 以下类型的硬编码值:
|
|
140
|
+
- 数据库密码(`POSTGRES_PASSWORD`)
|
|
141
|
+
- Chroma auth token(`CHROMA_AUTH_TOKEN`)
|
|
142
|
+
- JWT 密钥(`JWT_SECRET`)
|
|
143
|
+
- API Key(`OPENAI_API_KEY_*`)
|
|
144
|
+
|
|
145
|
+
所有凭据值应通过 `${ENV_VAR}` 引用,并标注"值见 `.env.development` / `.env.production`"。
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
{
|
|
2
|
+
"template": "handoff-single-round-template.md",
|
|
3
|
+
"sections": [
|
|
4
|
+
{
|
|
5
|
+
"id": "1.prestate",
|
|
6
|
+
"heading": "## 1. 交接前状态",
|
|
7
|
+
"required": true
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"id": "2.poststate",
|
|
11
|
+
"heading": "## 2. 交接后状态(目标)",
|
|
12
|
+
"required": true
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"id": "3.changes",
|
|
16
|
+
"heading": "## 3. 改动清单",
|
|
17
|
+
"required": true
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"id": "4.rollback",
|
|
21
|
+
"heading": "## 4. 回滚方案",
|
|
22
|
+
"required": true
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"id": "5.precheck",
|
|
26
|
+
"heading": "## 5. 执行前置检查",
|
|
27
|
+
"required": true
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"id": "6.steps",
|
|
31
|
+
"heading": "## 6. 执行步骤摘要",
|
|
32
|
+
"required": true
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"id": "7.risks",
|
|
36
|
+
"heading": "## 7. 关键风险点",
|
|
37
|
+
"required": true
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"id": "8.audit",
|
|
41
|
+
"heading": "## 8. 恢复上下文审计查询",
|
|
42
|
+
"required": true,
|
|
43
|
+
"subsections": [
|
|
44
|
+
{
|
|
45
|
+
"id": "8.1",
|
|
46
|
+
"heading": "### 总体一键恢复"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"id": "8.2",
|
|
50
|
+
"heading": "### 逐任务/逐文件审计查询"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"id": "8.3",
|
|
54
|
+
"heading": "### SQL 管理员验证"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"id": "8.4",
|
|
58
|
+
"heading": "### 恢复判定标准"
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"id": "9.confirm",
|
|
64
|
+
"heading": "## 9. 后置确认",
|
|
65
|
+
"required": true
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"id": "desensitize",
|
|
69
|
+
"heading": "### 脱敏要求",
|
|
70
|
+
"required": true
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
"placeholders": [
|
|
74
|
+
"{项目名}",
|
|
75
|
+
"{变更描述}",
|
|
76
|
+
"{文件路径}",
|
|
77
|
+
"{新建/修改/删除}",
|
|
78
|
+
"{检查项1}",
|
|
79
|
+
"{检查项2}",
|
|
80
|
+
"{N}",
|
|
81
|
+
"{汇总关键词}",
|
|
82
|
+
"{关键字}",
|
|
83
|
+
"{ACTION_1}",
|
|
84
|
+
"{ACTION_2}",
|
|
85
|
+
"{ACTION_3}"
|
|
86
|
+
],
|
|
87
|
+
"forbidden_terms": [
|
|
88
|
+
"Phase",
|
|
89
|
+
"Round",
|
|
90
|
+
"轮次"
|
|
91
|
+
]
|
|
92
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# ADD 模板索引
|
|
2
|
+
|
|
3
|
+
> 选模板看选型指南,查 schema 看下方索引表。
|
|
4
|
+
|
|
5
|
+
## 选型指南
|
|
6
|
+
|
|
7
|
+
**我要做…** | **用这个模板** | **为什么**
|
|
8
|
+
--|--|--
|
|
9
|
+
| 新建开发任务(需要架构设计) | `standard-plan-template.md` | 含方案选型、架构设计、依赖图,适合复杂改动(**默认**)
|
|
10
|
+
| 新建开发任务(简单修复) | `simple-plan-template.md` | 内联 Handoff,无需独立 spec 文件(仅小修改/用户主动提)
|
|
11
|
+
| 定义功能需求 | `spec-template.md` | Why/What/Impact/Requirements
|
|
12
|
+
| 拆分执行任务 | `tasks-template.md` | Task 扁平排列
|
|
13
|
+
| 写验收清单 | `checklist-template.md` | [T]/[E]/[H]/[R] 分类
|
|
14
|
+
| 生成执行路线图 | `add-route-template.md` | 轻量项目
|
|
15
|
+
| 生成执行路线图(重型) | `add-route-template-heavyweight.md` | 后端/多层管线项目
|
|
16
|
+
| 写交接文档(单轮) | `handoff-single-round-template.md` | Bug 修复、API 改动
|
|
17
|
+
| 写交接文档(多轮) | `handoff-multi-round-template.md` | 管线演进、架构重构
|
|
18
|
+
| 方案评审 | `review-template.md` | 问题复现 → 方案对比 → 决策
|
|
19
|
+
| 实现评审 | `review-implementation-template.md` | 跨仓库契约、框架兼容性
|
|
20
|
+
| 运行时评审 | `review-runtime-template.md` | 发现列表、流程改进
|
|
21
|
+
| 写代码审查报告 | `report-template.md` | Issue 总览、分类统计
|
|
22
|
+
| 写运行时异常报告 | `runtime-report-template.md` | 发现列表、关联 Issue
|
|
23
|
+
| 写修复验证报告 | `fix-verification-template.md` | 逐条对照、修复趋势
|
|
24
|
+
|
|
25
|
+
## 模板→Schema 索引
|
|
26
|
+
|
|
27
|
+
| 模板 | Schema |
|
|
28
|
+
|------|------|
|
|
29
|
+
| `standard-plan-template.md` | `standard-plan-template.schema.json` |
|
|
30
|
+
| `simple-plan-template.md` | `simple-plan-template.schema.json` |
|
|
31
|
+
| `spec-template.md` | `spec-template.schema.json` |
|
|
32
|
+
| `tasks-template.md` | `tasks-template.schema.json` |
|
|
33
|
+
| `checklist-template.md` | `checklist-template.schema.json` |
|
|
34
|
+
| `handoff-single-round-template.md` | `handoff-single-round.schema.json` |
|
|
35
|
+
| `handoff-multi-round-template.md` | `handoff-multi-round.schema.json` |
|
|
36
|
+
| `add-route-template.md` | `add-route-template.schema.json` |
|
|
37
|
+
| `add-route-template-heavyweight.md` | `add-route-template.schema.json` |
|
|
38
|
+
| `review-template.md` | `review-template.schema.json` |
|
|
39
|
+
| `review-implementation-template.md` | `review-implementation-template.schema.json` |
|
|
40
|
+
| `review-runtime-template.md` | `review-runtime-template.schema.json` |
|
|
41
|
+
| `report-template.md` | `report-template.schema.json` |
|
|
42
|
+
| `runtime-report-template.md` | `runtime-report-template.schema.json` |
|
|
43
|
+
| `fix-verification-template.md` | `fix-verification-template.schema.json` |
|
|
44
|
+
|
|
45
|
+
## 守卫流程
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
doc-format-guard.sh → 读上表匹配 schema → 读 schema.json
|
|
49
|
+
→ 缺 required section → exit 2
|
|
50
|
+
→ 含未替换占位符 → exit 2
|
|
51
|
+
→ 含禁止词 → warning
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## 标题层级
|
|
55
|
+
|
|
56
|
+
| 层级 | 标记 |
|
|
57
|
+
|:--:|------|
|
|
58
|
+
| 1 | `##` |
|
|
59
|
+
| 2 | `###` |
|
|
60
|
+
| 3 | `####` |
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# {项目名称} 代码审查报告
|
|
2
|
+
|
|
3
|
+
> 生成时间:{YYYY-MM-DD}
|
|
4
|
+
> 来源:{触发方式: 全量扫描 / 增量审查 / 运行时反馈 / 人工 review}
|
|
5
|
+
> 关联文档:[边界划分](../reports/boundary-runtime-report.md) | [工作流](../reports/REPORT-WORKFLOW.md)
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Issue 总览
|
|
10
|
+
|
|
11
|
+
| ID | 分类 | 严重度 | 文件 | 状态 | 运行时验证 |
|
|
12
|
+
|----|------|--------|------|:----:|:----------:|
|
|
13
|
+
| RPT-{YYYYMMDD}-01 | {分类} | {P0-P3} | [`{file}`](file://{path}#L{line}) | ❌ | — |
|
|
14
|
+
| RPT-{YYYYMMDD}-02 | {分类} | {P0-P3} | [`{file}`](file://{path}#L{line}) | ✅ | ✅ 已验证 |
|
|
15
|
+
|
|
16
|
+
> 状态:✅ 已修复 / ⚠️ 部分修复 / ❌ 仍存在
|
|
17
|
+
> 运行时验证:✅ 已验证 / ❌ 回退 / — 未关联运行时
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 分类统计
|
|
22
|
+
|
|
23
|
+
| 分类 | P0 | P1 | P2 | P3 | 合计 |
|
|
24
|
+
|------|:--:|:--:|:--:|:--:|:----:|
|
|
25
|
+
| 安全风险 | 0 | 0 | 0 | 0 | 0 |
|
|
26
|
+
| 代码重复 / 架构 | 0 | 0 | 0 | 0 | 0 |
|
|
27
|
+
| 健壮性 / 边界 | 0 | 0 | 0 | 0 | 0 |
|
|
28
|
+
| 代码整洁 | 0 | 0 | 0 | 0 | 0 |
|
|
29
|
+
| 基础设施 / 运维 | 0 | 0 | 0 | 0 | 0 |
|
|
30
|
+
| **合计** | **0** | **0** | **0** | **0** | **0** |
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 一、安全风险
|
|
35
|
+
|
|
36
|
+
### RPT-{YYYYMMDD}-{seq}: {问题标题}
|
|
37
|
+
|
|
38
|
+
- **文件**: [`{file}:{line}`](file://{path}#L{line})
|
|
39
|
+
- **严重度**: {P0/P1/P2/P3}
|
|
40
|
+
- **分类**: 安全风险
|
|
41
|
+
- **状态**: ❌ 仍存在
|
|
42
|
+
- **运行时网关关联**: `{{projectName}}-runtime-report/gateway.md#L{line}` (Gateway 运行时发现 {n} 次)
|
|
43
|
+
|
|
44
|
+
**现象**:
|
|
45
|
+
|
|
46
|
+
{描述问题的具体表现}
|
|
47
|
+
|
|
48
|
+
**根因**:
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
// {file}:{line}
|
|
52
|
+
{问题代码片段}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**影响**:
|
|
56
|
+
|
|
57
|
+
1. {影响1}
|
|
58
|
+
2. {影响2}
|
|
59
|
+
|
|
60
|
+
**建议**:
|
|
61
|
+
|
|
62
|
+
{修复方案}
|
|
63
|
+
|
|
64
|
+
**验证方式**:
|
|
65
|
+
|
|
66
|
+
- [ ] {验证操作1}
|
|
67
|
+
- [ ] {验证操作2}
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 二、代码重复 / 架构问题
|
|
72
|
+
|
|
73
|
+
<!-- 同上格式,每个 Issue 一条 -->
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## 三、健壮性 / 边界条件
|
|
78
|
+
|
|
79
|
+
<!-- 同上格式,每个 Issue 一条 -->
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 四、代码整洁
|
|
84
|
+
|
|
85
|
+
<!-- 同上格式,每个 Issue 一条 -->
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 五、基础设施 / 运维
|
|
90
|
+
|
|
91
|
+
<!-- 同上格式,每个 Issue 一条 -->
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## 修复优先级
|
|
96
|
+
|
|
97
|
+
| 优先级 | Issue | 说明 |
|
|
98
|
+
|--------|-------|------|
|
|
99
|
+
| P0 立即 | {ID列表} | 安全风险,影响生产 |
|
|
100
|
+
| P1 尽快 | {ID列表} | 健壮性,可能导致故障 |
|
|
101
|
+
| P2 计划 | {ID列表} | 架构问题,技术债务 |
|
|
102
|
+
| P3 债务 | {ID列表} | 代码整洁,长期优化 |
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## 修复趋势
|
|
107
|
+
|
|
108
|
+
| 维度 | 上次 | 本次 | 变化 |
|
|
109
|
+
|------|:----:|:----:|:----:|
|
|
110
|
+
| 安全 | {n} | {n} | {+n/-n} |
|
|
111
|
+
| 架构 | {n} | {n} | {+n/-n} |
|
|
112
|
+
| 健壮性 | {n} | {n} | {+n/-n} |
|
|
113
|
+
| 整洁 | {n} | {n} | {+n/-n} |
|
|
114
|
+
| 运维 | {n} | {n} | {+n/-n} |
|
|
115
|
+
| **合计** | **{n}** | **{n}** | **{+n/-n}** |
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## 运行时反馈
|
|
120
|
+
|
|
121
|
+
> 以下 Issue 来自 Gateway 运行时自动捕获,已进行人工 triage。
|
|
122
|
+
|
|
123
|
+
| Issue | 运行时来源 | 首次发生 | 次数 | Triage 结果 |
|
|
124
|
+
|-------|-----------|---------|:----:|------------|
|
|
125
|
+
| {ID} | `{{projectName}}-runtime-report/gateway.md` | {ts} | {n} | 确认为 Bug → P1 |
|
|
126
|
+
| {ID} | `{{projectName}}-runtime-report/gateway.md` | {ts} | {n} | 环境问题 → 关闭 |
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"template": "report-template.md",
|
|
3
|
+
"sections": [
|
|
4
|
+
{
|
|
5
|
+
"id": "overview",
|
|
6
|
+
"heading": "## Issue 总览",
|
|
7
|
+
"required": true
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"id": "stats",
|
|
11
|
+
"heading": "## 分类统计",
|
|
12
|
+
"required": true
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"id": "security",
|
|
16
|
+
"heading": "## 一、安全风险",
|
|
17
|
+
"required": true
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"id": "duplication",
|
|
21
|
+
"heading": "## 二、代码重复",
|
|
22
|
+
"required": true
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"id": "robustness",
|
|
26
|
+
"heading": "## 三、健壮性",
|
|
27
|
+
"required": true
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"id": "cleanliness",
|
|
31
|
+
"heading": "## 四、代码整洁",
|
|
32
|
+
"required": true
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"id": "infra",
|
|
36
|
+
"heading": "## 五、基础设施",
|
|
37
|
+
"required": true
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"id": "priority",
|
|
41
|
+
"heading": "## 修复优先级",
|
|
42
|
+
"required": true
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"id": "trend",
|
|
46
|
+
"heading": "## 修复趋势",
|
|
47
|
+
"required": false
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"id": "runtime",
|
|
51
|
+
"heading": "## 运行时反馈",
|
|
52
|
+
"required": false
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
"placeholders": [
|
|
56
|
+
"{项目名称}",
|
|
57
|
+
"{YYYY-MM-DD}",
|
|
58
|
+
"{触发方式",
|
|
59
|
+
"{P0-P3}",
|
|
60
|
+
"{n}",
|
|
61
|
+
"{ID列表}",
|
|
62
|
+
"{ID}",
|
|
63
|
+
"{ts}"
|
|
64
|
+
],
|
|
65
|
+
"forbidden_terms": [ "Phase",
|
|
66
|
+
"阶段",
|
|
67
|
+
"步骤"
|
|
68
|
+
]
|
|
69
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# {标题}
|
|
2
|
+
|
|
3
|
+
## Review 元信息
|
|
4
|
+
|
|
5
|
+
- **Review 对象**: {被评审的代码变更 / 跨仓库集成}
|
|
6
|
+
- **关联方案 review**: {前置方案 review 文档路径}
|
|
7
|
+
- **Review 时间**: {YYYY-MM-DD}
|
|
8
|
+
- **Review 类型**: 实现 review(ADD 0.1.2)
|
|
9
|
+
- **前置阅读**: {关联的 plan / spec / checklist}
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 1. 跨仓库格式契约
|
|
14
|
+
|
|
15
|
+
列出所有跨系统 API,逐对验证请求/响应格式:
|
|
16
|
+
|
|
17
|
+
| API | 发送方 | 期望类型 | 接收方 | 实际类型 | 匹配? |
|
|
18
|
+
|-----|--------|---------|--------|---------|:---:|
|
|
19
|
+
| {端点1} | {客户端文件:行} | {格式} | {服务端文件:行} | {格式} | ✅/❌ |
|
|
20
|
+
|
|
21
|
+
- [ ] 所有字段名和嵌套结构一致(如 `data.messages[].role`)
|
|
22
|
+
- [ ] 响应 Content-Type 匹配客户端解析器(JSON vs `text/event-stream` vs NDJSON)
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 2. 框架版本兼容性
|
|
27
|
+
|
|
28
|
+
- [ ] `cat package.json | jq .dependencies.next` 确认主版本号
|
|
29
|
+
- [ ] 查该版本的 breaking changes
|
|
30
|
+
- [ ] 编译产物 mtime 晚于源码(如 `.next/server/middleware.js` ≥ `src/proxy.ts`)
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 3. 数据模型约束
|
|
35
|
+
|
|
36
|
+
- [ ] Prisma `create()` / `update()` 的外键字段对应表中有记录
|
|
37
|
+
- [ ] `@unique` 字段无重复插入风险
|
|
38
|
+
- [ ] 非外键但语义上引用其他表的字段(如 `userId: "system"`)是真实存在的 ID
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 4. 环境变量加载链
|
|
43
|
+
|
|
44
|
+
- [ ] 列出 `npm run` 命令 → `--mode` → `.env.*` → 每个变量的实际值
|
|
45
|
+
- [ ] 三套环境(dev/local/prod)指向正确后端地址
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 5. 多 API 场景匹配
|
|
50
|
+
|
|
51
|
+
- [ ] 模块导出多个功能相似函数时,确认调用方选的是场景匹配的
|
|
52
|
+
- [ ] 检查:chat/SSE 场景不能用同步版 API,批处理场景不能用流式版 API
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 6. E2E 逐端点 curl
|
|
57
|
+
|
|
58
|
+
- [ ] 用有效凭证对每个端点 curl,检查 HTTP 状态码 + 响应 body 格式
|
|
59
|
+
- [ ] OPTIONS 预检返回正确的 CORS 头
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## 7. 关联 Checklist
|
|
64
|
+
|
|
65
|
+
- 本 review 的检查项与 `{checklist 文档路径}` 的"跨项目联调检查"章节一一对应
|
|
66
|
+
- [ ] checklist 全部通过后,流转至运行时验证
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"template": "review-implementation-template.md",
|
|
3
|
+
"sections": [
|
|
4
|
+
{
|
|
5
|
+
"id": "meta",
|
|
6
|
+
"heading": "## Review 元信息",
|
|
7
|
+
"required": true
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"id": "contract",
|
|
11
|
+
"heading": "## 1. 跨仓库格式契约",
|
|
12
|
+
"required": true
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"id": "framework",
|
|
16
|
+
"heading": "## 2. 框架版本兼容性",
|
|
17
|
+
"required": true
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"id": "datamodel",
|
|
21
|
+
"heading": "## 3. 数据模型约束",
|
|
22
|
+
"required": true
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"id": "env",
|
|
26
|
+
"heading": "## 4. 环境变量加载链",
|
|
27
|
+
"required": true
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"id": "api",
|
|
31
|
+
"heading": "## 5. 多 API 场景匹配",
|
|
32
|
+
"required": true
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"id": "e2e",
|
|
36
|
+
"heading": "## 6. E2E 逐端点 curl",
|
|
37
|
+
"required": true
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"id": "checklist",
|
|
41
|
+
"heading": "## 7. 关联 Checklist",
|
|
42
|
+
"required": true
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"placeholders": [
|
|
46
|
+
"{标题}",
|
|
47
|
+
"{被评审的代码变更",
|
|
48
|
+
"{前置方案 review 文档路径}",
|
|
49
|
+
"{YYYY-MM-DD}",
|
|
50
|
+
"{关联的 plan",
|
|
51
|
+
"{端点1}",
|
|
52
|
+
"{checklist 文档路径}"
|
|
53
|
+
],
|
|
54
|
+
"forbidden_terms": [ "Phase",
|
|
55
|
+
"阶段",
|
|
56
|
+
"步骤"
|
|
57
|
+
]
|
|
58
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# {标题}
|
|
2
|
+
|
|
3
|
+
> 运行时验证纠偏文档。在 checklist 通过、代码部署后,通过用户反馈或运行时日志发现的遗漏问题。
|
|
4
|
+
|
|
5
|
+
## Review 元信息
|
|
6
|
+
|
|
7
|
+
- **关联方案 review**: {前置方案 review 文档路径}
|
|
8
|
+
- **关联实现 review**: {前置实现 review 文档路径}
|
|
9
|
+
- **关联 checklist**: {前置 checklist 文档路径}
|
|
10
|
+
- **Review 时间**: {YYYY-MM-DD}
|
|
11
|
+
- **触发方式**: {用户报告 / 运行时日志 / E2E 测试}
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 1. 发现列表
|
|
16
|
+
|
|
17
|
+
> 序号延续前置 review 的最后一条发现编号。
|
|
18
|
+
|
|
19
|
+
### 发现 #N: {问题标题}
|
|
20
|
+
|
|
21
|
+
**现象**:
|
|
22
|
+
|
|
23
|
+
{用户报告或日志中的错误信息}
|
|
24
|
+
|
|
25
|
+
**根因(git 追溯)**:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
commit {hash} ({日期}, "{提交信息}")
|
|
29
|
+
- {变更内容}
|
|
30
|
+
- {出错的具体代码}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**后果链**:
|
|
34
|
+
|
|
35
|
+
1. {操作1}
|
|
36
|
+
2. {操作2}
|
|
37
|
+
3. {最终用户可见的影响}
|
|
38
|
+
|
|
39
|
+
**修复方向**:{修复方案描述}
|
|
40
|
+
|
|
41
|
+
#### 为何前置 review 遗漏
|
|
42
|
+
|
|
43
|
+
{分析前置 review 未捕获此问题的结构性原因}
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
### 发现 #N+1: {问题标题}
|
|
48
|
+
|
|
49
|
+
{同上结构}
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 2. review 流程改进项
|
|
54
|
+
|
|
55
|
+
| 检查项 | 具体操作 | 触发时机 |
|
|
56
|
+
|--------|---------|---------|
|
|
57
|
+
| {改进项1} | {操作描述} | {时机} |
|
|
58
|
+
| {改进项2} | {操作描述} | {时机} |
|
|
59
|
+
|
|
60
|
+
> 上述改进项应回流至 `review-implementation-template.md` 或 `checklist-template.md`,确保下次项目自动继承。
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 3. 已运行时修复项
|
|
65
|
+
|
|
66
|
+
{已完成的临时修复方案编号列表}
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 4. 回流确认
|
|
71
|
+
|
|
72
|
+
- [ ] 流程改进项已写入对应模板(`review-implementation-template.md` / `checklist-template.md`)
|
|
73
|
+
- [ ] 修复项已记录审计日志(`record_dev_operation`)
|