@boyingliu01/xp-gate 0.5.3 → 0.6.1
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/bin/xp-gate.js +125 -0
- package/hooks/pre-push +11 -2
- package/lib/__tests__/audit-log.test.ts +107 -0
- package/lib/__tests__/gate-audit.test.ts +258 -0
- package/lib/__tests__/ui-detector.test.ts +112 -1
- package/lib/__tests__/ui-review.test.ts +119 -0
- package/lib/gate-audit.ts +263 -0
- package/lib/install-skill.js +1 -15
- package/lib/rollback.js +1 -16
- package/lib/shared-utils.js +25 -0
- package/lib/ui-detector.ts +5 -5
- package/lib/ui-review.ts +58 -53
- package/package.json +1 -1
- package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
- package/skills/delphi-review/SKILL.md +112 -29
- package/skills/ralph-loop/SKILL.md +179 -8
- package/skills/sprint-flow/SKILL.md +412 -24
- package/skills/sprint-flow/templates/sprint-progress-template.md +151 -0
- package/skills/test-specification-alignment/SKILL.md +98 -1
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: delphi-review
|
|
3
|
-
description: "
|
|
3
|
+
description: "Use when asked to review a design, plan, or architecture; before implementation starts; or when multi-expert consensus is needed. Triggers: 'review this design', '评审这个需求', 'design review', '多专家评审', 'consensus review', 'code walkthrough', 'push review', 'architecture review', 'PR review', or any request for multi-expert evaluation of requirements, design docs, or PRs."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Delphi Consensus Review
|
|
7
7
|
|
|
8
|
+
## Scope
|
|
9
|
+
|
|
10
|
+
**In Scope:**
|
|
11
|
+
- Multi-round anonymous expert consensus review (design + code-walkthrough modes)
|
|
12
|
+
- 2-3 experts from different providers with statistical consensus (>= 91%)
|
|
13
|
+
- Structured verdict: APPROVED / PASS_WITH_CAVEATS / REQUEST_CHANGES
|
|
14
|
+
- Domestic models only (no Anthropic/OpenAI/Google)
|
|
15
|
+
|
|
16
|
+
**Out of Scope:**
|
|
17
|
+
- Does NOT implement code changes (review only, implementation is separate)
|
|
18
|
+
- Does NOT replace testing or CI/CD verification
|
|
19
|
+
- Does NOT handle deployment or release decisions
|
|
20
|
+
|
|
8
21
|
## 核心原则
|
|
9
22
|
|
|
10
23
|
**Delphi 方法只有一个目的:得到所有专家一致认可的可行方案。**
|
|
@@ -14,7 +27,7 @@ description: "Delphi consensus review: multi-round anonymous expert review until
|
|
|
14
27
|
1. **匿名性** — Round 1 专家互不知道对方意见
|
|
15
28
|
2. **迭代** — 多轮直到共识,不是固定轮数
|
|
16
29
|
3. **受控反馈** — 每轮看到其他专家意见
|
|
17
|
-
4. **统计共识** — >=
|
|
30
|
+
4. **统计共识** — >=91% 一致才算共识
|
|
18
31
|
|
|
19
32
|
### 质量优先
|
|
20
33
|
|
|
@@ -82,24 +95,24 @@ description: "Delphi consensus review: multi-round anonymous expert review until
|
|
|
82
95
|
|
|
83
96
|
| 阈值 | 说明 |
|
|
84
97
|
|------|------|
|
|
85
|
-
| **>=
|
|
98
|
+
| **>=91%** | 推荐默认 |
|
|
86
99
|
| 100% | 完全一致(更严格) |
|
|
87
100
|
|
|
88
101
|
---
|
|
89
102
|
|
|
90
|
-
##
|
|
103
|
+
## Delphi 评审执行过程
|
|
91
104
|
|
|
92
105
|
```
|
|
93
106
|
Phase 0: 准备 → Round 1: 匿名独立评审 → 共识检查
|
|
94
107
|
│
|
|
95
|
-
├─ 一致 + >=
|
|
108
|
+
├─ 一致 + >=91% + APPROVED → ✅ 完成
|
|
96
109
|
│
|
|
97
|
-
└─ 不一致 或 <
|
|
110
|
+
└─ 不一致 或 <91% 或 REQUEST_CHANGES
|
|
98
111
|
│
|
|
99
112
|
▼
|
|
100
113
|
Round 2: 交换意见 → 共识检查
|
|
101
114
|
│
|
|
102
|
-
├─ 一致 + >=
|
|
115
|
+
├─ 一致 + >=91% + APPROVED → ✅ 完成
|
|
103
116
|
│
|
|
104
117
|
└─ 仍分歧 或 REQUEST_CHANGES
|
|
105
118
|
│
|
|
@@ -202,14 +215,96 @@ Phase 0: 准备 → Round 1: 匿名独立评审 → 共识检查
|
|
|
202
215
|
|
|
203
216
|
---
|
|
204
217
|
|
|
218
|
+
## Triggers
|
|
219
|
+
|
|
220
|
+
This skill activates on any request for multi-expert review. Common triggers:
|
|
221
|
+
|
|
222
|
+
**English:**
|
|
223
|
+
- "review this design"
|
|
224
|
+
- "design review"
|
|
225
|
+
- "architecture review"
|
|
226
|
+
- "consensus review"
|
|
227
|
+
- "code walkthrough"
|
|
228
|
+
- "push review"
|
|
229
|
+
- "multi-expert review"
|
|
230
|
+
- "PR review"
|
|
231
|
+
|
|
232
|
+
**Chinese:**
|
|
233
|
+
- "评审这个需求"
|
|
234
|
+
- "多专家评审"
|
|
235
|
+
- "设计评审"
|
|
236
|
+
- "架构评审"
|
|
237
|
+
- "代码走查"
|
|
238
|
+
|
|
239
|
+
**Related commands:**
|
|
240
|
+
- `/delphi-review` - Design review mode
|
|
241
|
+
- `/delphi-review --mode code-walkthrough` - Pre-push code walkthrough
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Workflow Steps
|
|
246
|
+
|
|
247
|
+
1. **Determine mode** - Design review (default) or code-walkthrough (--mode code-walkthrough)
|
|
248
|
+
2. **Dispatch anonymous experts** - 2-3 experts from ≥2 different domestic model providers
|
|
249
|
+
3. **Collect Round 1 independent reviews** - Anonymous, no cross-expert bias
|
|
250
|
+
4. **Synthesize feedback** - Measure consensus, identify disagreements
|
|
251
|
+
5. **Run Round 2+ until consensus** - Exchange opinions, iterate until ≥91% agreement
|
|
252
|
+
6. **Block on unresolved Critical/Major** - Zero-tolerance: all Critical/Major must be resolved
|
|
253
|
+
7. **Emit verdict** - APPROVED (with specification.yaml) or REQUEST_CHANGES (fix + re-review)
|
|
254
|
+
|
|
255
|
+
**Consensus threshold:** ≥91% (project standard for Delphi review approval)
|
|
256
|
+
**Model policy:** Domestic models only (DeepSeek, Qwen, Kimi, GLM, MiniMax). Foreign models (Anthropic/OpenAI/Google) forbidden.
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## Scope
|
|
261
|
+
|
|
262
|
+
**IN Scope:**
|
|
263
|
+
- Design document review (requirements, architecture, PRDs)
|
|
264
|
+
- Pre-implementation planning review
|
|
265
|
+
- Code walkthrough (git push validation, max 20 files/500 LOC)
|
|
266
|
+
- Multi-expert consensus building
|
|
267
|
+
- Specification extraction (design → specification.yaml)
|
|
268
|
+
|
|
269
|
+
**OUT Scope:**
|
|
270
|
+
- Single-expert review (use `/review` instead)
|
|
271
|
+
- Post-implementation review (use `/requesting-code-review`)
|
|
272
|
+
- Security audit (use `/security-research` or `/cso`)
|
|
273
|
+
- Performance benchmarking (use `/benchmark`)
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## Examples
|
|
278
|
+
|
|
279
|
+
**Example 1: Design review**
|
|
280
|
+
```bash
|
|
281
|
+
/delphi-review
|
|
282
|
+
```
|
|
283
|
+
→ 3 experts review design doc → consensus report + specification.yaml
|
|
284
|
+
|
|
285
|
+
**Example 2: Code walkthrough**
|
|
286
|
+
```bash
|
|
287
|
+
/delphi-review --mode code-walkthrough
|
|
288
|
+
```
|
|
289
|
+
→ Pre-push validation → .code-walkthrough-result.json
|
|
290
|
+
|
|
291
|
+
**Example 3: Chinese trigger**
|
|
292
|
+
```
|
|
293
|
+
User: 评审这个需求文档
|
|
294
|
+
→ Auto-detects delphi-review trigger → dispatches experts
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
205
299
|
## Output Format (MANDATORY)
|
|
206
|
-
|
|
300
|
+
|
|
301
|
+
Every review round output MUST follow this exact JSON structure for design mode:
|
|
207
302
|
|
|
208
303
|
```json
|
|
209
304
|
{
|
|
210
305
|
"expert_id": "A|B|C",
|
|
211
306
|
"round": 1,
|
|
212
|
-
"mode": "design
|
|
307
|
+
"mode": "design",
|
|
213
308
|
"verdict": "APPROVED|REQUEST_CHANGES|REJECTED",
|
|
214
309
|
"confidence": 9,
|
|
215
310
|
"critical_issues": ["..."],
|
|
@@ -218,11 +313,14 @@ Every review round output MUST follow this exact JSON structure:
|
|
|
218
313
|
"consensus_report": {
|
|
219
314
|
"agreed_items": ["..."],
|
|
220
315
|
"disagreed_items": ["..."],
|
|
221
|
-
"final_verdict": "APPROVED|REQUEST_CHANGES"
|
|
316
|
+
"final_verdict": "APPROVED|REQUEST_CHANGES",
|
|
317
|
+
"consensus_ratio": 0.95
|
|
222
318
|
}
|
|
223
319
|
}
|
|
224
320
|
```
|
|
225
321
|
|
|
322
|
+
**For code-walkthrough mode**, output follows `.code-walkthrough-result.json` schema (see `references/code-walkthrough.md`).
|
|
323
|
+
|
|
226
324
|
**Anti-patterns mapping to assertions:**
|
|
227
325
|
- `Round 1 → 生成报告 → "评审完成"` → Output MUST NOT have `verdict: APPROVED` if `critical_issues` exist.
|
|
228
326
|
- `只处理 Critical,忽略 Major` → Output MUST include `major_concerns` array, even if empty.
|
|
@@ -242,7 +340,7 @@ Every review round output MUST follow this exact JSON structure:
|
|
|
242
340
|
- [ ] Round 2+ 完成(交换意见 / 最终立场)
|
|
243
341
|
|
|
244
342
|
**CRITICAL — 共识验证:**
|
|
245
|
-
- [ ] 问题共识比例 >=
|
|
343
|
+
- [ ] 问题共识比例 >=91%
|
|
246
344
|
- [ ] 所有 Critical Issues 已解决
|
|
247
345
|
- [ ] 所有 Major Concerns 已处理
|
|
248
346
|
|
|
@@ -324,7 +422,7 @@ Every review round output MUST follow this exact JSON structure:
|
|
|
324
422
|
| 只处理 Critical,忽略 Major | 零容忍:Critical/Major 全部必须处理,不可跳过或降级 |
|
|
325
423
|
| 单专家自评 | 至少 2 位不同 provider 的专家 |
|
|
326
424
|
| 用户说"时间紧急"就跳过 | 评审是投资不是开销,跳过后期返工成本更高 |
|
|
327
|
-
| "专家几乎一致"就通过 | "几乎" = 不一致,继续到 >=
|
|
425
|
+
| "专家几乎一致"就通过 | "几乎" = 不一致,继续到 >=91% |
|
|
328
426
|
| 使用 Anthropic/GPT/Gemini 等国外昂贵模型 | 必须使用国产开源模型(DeepSeek, Qwen, Kimi, GLM, MiniMax) |
|
|
329
427
|
| 三个专家使用同一厂家模型 | 必须来自至少 2 家不同厂家 |
|
|
330
428
|
|
|
@@ -339,7 +437,7 @@ Every review round output MUST follow this exact JSON structure:
|
|
|
339
437
|
| "这只是小变更" | 所有变更都需要评审 |
|
|
340
438
|
| "Round 1 就够了" | 不够,必须多轮直到共识 |
|
|
341
439
|
| "生成报告就完成了" | APPROVED 才算完成 |
|
|
342
|
-
| "2/3 同意就是共识" | 还要检查问题共识比例 >=
|
|
440
|
+
| "2/3 同意就是共识" | 还要检查问题共识比例 >=91% |
|
|
343
441
|
|
|
344
442
|
---
|
|
345
443
|
|
|
@@ -347,25 +445,10 @@ Every review round output MUST follow this exact JSON structure:
|
|
|
347
445
|
|
|
348
446
|
**Delphi 评审完成的唯一标准:**
|
|
349
447
|
1. ✅ 所有专家裁决 APPROVED
|
|
350
|
-
2. ✅ 问题共识 >=
|
|
448
|
+
2. ✅ 问题共识 >=91%
|
|
351
449
|
3. ✅ 所有 Critical Issues 已修复验证
|
|
352
450
|
4. ✅ 所有 Major Concerns 已处理
|
|
353
451
|
5. ✅ 共识报告已生成
|
|
354
452
|
6. ✅ 用户已确认
|
|
355
453
|
|
|
356
454
|
**缺少任何一项 = 未完成**
|
|
357
|
-
## Output Format (MANDATORY)
|
|
358
|
-
Every delphi review round MUST output valid JSON:
|
|
359
|
-
```json
|
|
360
|
-
{
|
|
361
|
-
"skill_name": "delphi-review",
|
|
362
|
-
"mode": "design|code-walkthrough",
|
|
363
|
-
"phase": "Round 1|Round 2|Round 3|Consensus",
|
|
364
|
-
"expert_id": "A|B|C",
|
|
365
|
-
"verdict": "APPROVED|REQUEST_CHANGES|REJECTED",
|
|
366
|
-
"confidence": 8,
|
|
367
|
-
"issues": [{"id": "string", "severity": "critical|major|minor", "description": "string"}],
|
|
368
|
-
"consensus_report": {"status": "pending|consensus|disagreement"}
|
|
369
|
-
}
|
|
370
|
-
```
|
|
371
|
-
**Eval assertions check for:** `verdict` enum values, `confidence` range, `issues` structure, `consensus_report.status`.
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ralph-loop
|
|
3
|
-
description:
|
|
4
|
-
Default Phase 2 BUILD mode for Sprint-Flow. Processes ONE REQ at a time from
|
|
5
|
-
specification.yaml with clean isolated context per subagent dispatch, persists
|
|
6
|
-
memory via git history + classified learnings, runs full regression tests on each
|
|
7
|
-
REQ, and only commits on verification pass. Designed to reduce token consumption
|
|
8
|
-
from linear context accumulation to per-REQ fixed budgets (40-67% savings).
|
|
9
|
-
Token-constraint is the default — every Phase 2 uses this mode automatically.
|
|
10
|
-
Use `--mode parallel` to opt into the legacy all-at-once mode if needed.
|
|
3
|
+
description: Use when executing Sprint-Flow Phase 2 BUILD, processing one REQ, building the next requirement, iterating with clean context, or requiring full regression per requirement.
|
|
11
4
|
maturity: stable
|
|
12
5
|
---
|
|
13
6
|
|
|
@@ -25,6 +18,25 @@ maturity: stable
|
|
|
25
18
|
| **浓缩型分类学习** | permanent(架构级)+ contextual(最近 3 条)双层 learnings |
|
|
26
19
|
| **AGENTS.md 统一更新** | orchestrator 统一写,subagent 不直接修改 — 无竞态 |
|
|
27
20
|
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Triggers
|
|
24
|
+
|
|
25
|
+
**关键词触发**:ralph-loop, process one REQ, build next requirement, Phase 2 BUILD, iterate REQ, isolated REQ build, clean context, full regression
|
|
26
|
+
|
|
27
|
+
**使用场景**:
|
|
28
|
+
- 执行 Sprint-Flow Phase 2 BUILD 阶段
|
|
29
|
+
- 从 specification.yaml 读取需求逐个实现
|
|
30
|
+
- 需要控制每个 REQ 的 token 预算
|
|
31
|
+
- 防止上下文污染(前一个 REQ 的实现细节影响后一个 REQ)
|
|
32
|
+
- 需要全量回归测试保证不引入回归
|
|
33
|
+
- 需要持久化 learnings 供后续 REQ 参考
|
|
34
|
+
|
|
35
|
+
**何时不使用**:
|
|
36
|
+
- 需求数量极少(1-2 个)且相互独立,可以并行
|
|
37
|
+
- 紧急热修复,不需要完整 Sprint Flow
|
|
38
|
+
- 明确使用 `--mode parallel` 切换到并行模式
|
|
39
|
+
|
|
28
40
|
## 作为 Phase 2 默认行为
|
|
29
41
|
|
|
30
42
|
Ralph Loop 是 Sprint-Flow **Phase 2 BUILD 的默认模式**:
|
|
@@ -297,6 +309,165 @@ Phase 0, 1, 3-6 行为完全不变。
|
|
|
297
309
|
|
|
298
310
|
---
|
|
299
311
|
|
|
312
|
+
## Workflow Steps (Mandatory Execution Order)
|
|
313
|
+
|
|
314
|
+
**每个 REQ 必须按以下顺序执行,不得跳过或重排**:
|
|
315
|
+
|
|
316
|
+
1. **Load next READY REQ**
|
|
317
|
+
- 从 specification.yaml 读取下一个依赖已满足的 REQ
|
|
318
|
+
- 检查 priority 和 status (pending 状态)
|
|
319
|
+
- 构建依赖图,确认无循环依赖
|
|
320
|
+
|
|
321
|
+
2. **Create isolated context**
|
|
322
|
+
- 清空前一个 REQ 的对话历史
|
|
323
|
+
- 注入:当前 REQ + AC + permanent learnings + contextual learnings (最近 3 条)
|
|
324
|
+
- 注入:AGENTS.md + git log --oneline -5 + 测试基础设施摘要
|
|
325
|
+
|
|
326
|
+
3. **Dispatch build subagent**
|
|
327
|
+
- 使用 `task(category="unspecified-high", load_skills=["test-driven-development"], timeout=300)`
|
|
328
|
+
- 强制 TDD 流程:RED → GREEN → REFACTOR
|
|
329
|
+
- 强制执行 Mock 边界策略(详见 Mock 边界表)
|
|
330
|
+
|
|
331
|
+
4. **Run full regression tests**
|
|
332
|
+
- L1: typecheck + lint on changed files
|
|
333
|
+
- L1b: 检查测试先行比率 (新增测试行数 / 总新增行数 ≥ 40%)
|
|
334
|
+
- **L2: 全量测试运行**(不只是 @test 当前 REQ 的测试)
|
|
335
|
+
- L3: 检查整体覆盖率 ≥ 80%
|
|
336
|
+
|
|
337
|
+
5. **Fix until green or block**
|
|
338
|
+
- 失败 → retry (max 3 次,每次注入失败摘要)
|
|
339
|
+
- 第 3 次仍失败 → BLOCK → 等待用户决策 (skip/manual/stop/rollback)
|
|
340
|
+
- 通过 → git commit + 标记 done
|
|
341
|
+
|
|
342
|
+
6. **Persist learnings**
|
|
343
|
+
- 分类为 permanent(架构级)或 contextual(临时性)
|
|
344
|
+
- 自动升级条件:被≥2 个 REQ 引用 或 涉及接口/数据结构
|
|
345
|
+
- 调用 `gstack/learn` 总结经验教训
|
|
346
|
+
|
|
347
|
+
7. **Update sprint state**
|
|
348
|
+
- orchestrator 统一更新 AGENTS.md(append `## ralph-loop: [REQ-XXX title]`)
|
|
349
|
+
- 原子写 checkpoint (progress.log)
|
|
350
|
+
- 继续下一个 READY REQ
|
|
351
|
+
|
|
352
|
+
**禁止行为**:
|
|
353
|
+
- ❌ 跳过测试基础设施检查
|
|
354
|
+
- ❌ 只运行部分测试(必须全量回归)
|
|
355
|
+
- ❌ 验证失败仍 commit
|
|
356
|
+
- ❌ 多个 subagent 同时写 AGENTS.md
|
|
357
|
+
- ❌ 修改前一个 REQ 的代码(除非修复回归)
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
## Scope
|
|
362
|
+
|
|
363
|
+
**In Scope**:
|
|
364
|
+
- Phase 2 BUILD 阶段的 REQ 级迭代构建
|
|
365
|
+
- 从 specification.yaml 读取需求并逐个实现
|
|
366
|
+
- 测试先行(TDD)+ 全量回归测试
|
|
367
|
+
- 持久化 learnings 供后续 REQ 参考
|
|
368
|
+
- 依赖排序和循环依赖检测
|
|
369
|
+
- 崩溃恢复(从 checkpoint 继续)
|
|
370
|
+
|
|
371
|
+
**Out of Scope**:
|
|
372
|
+
- Phase 0-1 (THINK/PLAN) 的需求分析和设计
|
|
373
|
+
- Phase 3-6 (REVIEW/USER ACCEPT/FEEDBACK/SHIP) 的后续阶段
|
|
374
|
+
- 并行模式(需显式使用 `--mode parallel` 切换到 `dispatching-parallel-agents`)
|
|
375
|
+
- 紧急热修复(应使用标准 sprint-flow 或手动处理)
|
|
376
|
+
- 非 specification.yaml 定义的需求(临时需求应先纳入 spec 再执行)
|
|
377
|
+
|
|
378
|
+
---
|
|
379
|
+
|
|
380
|
+
## Examples
|
|
381
|
+
|
|
382
|
+
**Example 1: 标准 Sprint Flow 启动**
|
|
383
|
+
```bash
|
|
384
|
+
/sprint-flow "开发用户登录功能,支持 JWT 和 OAuth2" --type web-nextjs
|
|
385
|
+
# → Phase 0-1 完成设计评审后,Phase 2 自动进入 ralph-loop 模式
|
|
386
|
+
# → 按拓扑顺序处理 REQ-001 (User Model) → REQ-002 (Auth Middleware) → REQ-003 (Login API)
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
**Example 2: 单个 REQ 构建**
|
|
390
|
+
```bash
|
|
391
|
+
/ralph-loop
|
|
392
|
+
# → 从 specification.yaml 读取下一个 READY REQ
|
|
393
|
+
# → 创建孤立上下文,dispatch TDD subagent
|
|
394
|
+
# → 全量回归测试通过后 commit
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
**Example 3: 处理阻塞 REQ**
|
|
398
|
+
```
|
|
399
|
+
REQ-005 失败 3 次 → BLOCKED
|
|
400
|
+
→ 用户决策:
|
|
401
|
+
- skip: 跳过此 REQ,继续 REQ-006
|
|
402
|
+
- manual: 手动修复后重新 dispatch
|
|
403
|
+
- stop: 停止整个 ralph-loop,保留已 done commits
|
|
404
|
+
- rollback: git reset 回上一个稳定版本
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
**Example 4: 崩溃恢复**
|
|
408
|
+
```bash
|
|
409
|
+
# 系统崩溃后重新启动
|
|
410
|
+
/ralph-loop --resume
|
|
411
|
+
# → 检测 progress.log → 跳过已 done REQs
|
|
412
|
+
# → 从最后一个 pending REQ 继续,无需重做已完成工作
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
**Example 5: 测试基础设施缺失**
|
|
416
|
+
```
|
|
417
|
+
REQ-001 开始 → 检查 test-utils.ts → 不存在
|
|
418
|
+
→ dispatch "生成测试基础设施" subagent
|
|
419
|
+
→ retry max 2 次 → 仍失败 → BLOCK 或 fallback inline 生成
|
|
420
|
+
→ 基础设施就绪后继续业务代码开发
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
---
|
|
424
|
+
|
|
425
|
+
## Output Contract (Mandatory Checklist)
|
|
426
|
+
|
|
427
|
+
**每个 REQ 完成时必须输出以下结构化检查清单**:
|
|
428
|
+
|
|
429
|
+
```markdown
|
|
430
|
+
## REQ-XXX: [Title] - Execution Summary
|
|
431
|
+
|
|
432
|
+
**Status**: ✅ PASS / ❌ FAIL (retry n/3) / 🚫 BLOCKED
|
|
433
|
+
|
|
434
|
+
**Context Isolation**:
|
|
435
|
+
- [ ] Previous REQ context cleared
|
|
436
|
+
- [ ] Permanent learnings injected (N items)
|
|
437
|
+
- [ ] Contextual learnings injected (≤3 items)
|
|
438
|
+
- [ ] Test infrastructure confirmed ready
|
|
439
|
+
|
|
440
|
+
**TDD Compliance**:
|
|
441
|
+
- [ ] Tests written BEFORE implementation
|
|
442
|
+
- [ ] Test/implementation ratio ≥ 40%
|
|
443
|
+
- [ ] Mock usage justified (if >30% mock density)
|
|
444
|
+
|
|
445
|
+
**Verification Layers**:
|
|
446
|
+
- [ ] L1: typecheck + lint pass
|
|
447
|
+
- [ ] L1b: Test-first ratio check pass
|
|
448
|
+
- [ ] L2: **FULL regression tests** (all tests, not just @test REQ-XXX)
|
|
449
|
+
- [ ] L3: coverage ≥ 80%
|
|
450
|
+
|
|
451
|
+
**Learnings Persisted**:
|
|
452
|
+
- [ ] Permanent: [N items, list key ones]
|
|
453
|
+
- [ ] Contextual: [N items, sliding window]
|
|
454
|
+
- [ ] `gstack/learn` called
|
|
455
|
+
|
|
456
|
+
**State Updated**:
|
|
457
|
+
- [ ] AGENTS.md updated (orchestrator)
|
|
458
|
+
- [ ] progress.log atomically written
|
|
459
|
+
- [ ] Git commit created (if PASS)
|
|
460
|
+
|
|
461
|
+
**Next Step**: [REQ-YYY title / COMPLETE / BLOCKED]
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
**Eval Criteria** (Issue #120, #121):
|
|
465
|
+
- ✅ L2 pass: Structured execution plan visible (checklist format)
|
|
466
|
+
- ✅ L3 pass: All 7 workflow steps followed, full regression tests run
|
|
467
|
+
- ❌ Fail: Missing checklist, partial tests, context pollution
|
|
468
|
+
|
|
469
|
+
---
|
|
470
|
+
|
|
300
471
|
## Anti-Patterns
|
|
301
472
|
|
|
302
473
|
| ❌ 错误 | ✅ 正确 |
|