@boyingliu01/xp-gate 0.19.1 → 0.19.3

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 (87) hide show
  1. package/gate-10.sh +105 -0
  2. package/hooks/pre-commit +24 -5
  3. package/lib/__tests__/npm-package.test.js +25 -0
  4. package/lib/mattpocock-license-verdict.json +1 -1
  5. package/mock-policy/AGENTS.md +3 -3
  6. package/mutation/AGENTS.md +3 -3
  7. package/package.json +2 -1
  8. package/plugins/claude-code/.claude-plugin/plugin.json +2 -2
  9. package/plugins/claude-code/skills/delphi-review/AGENTS.md +3 -3
  10. package/plugins/claude-code/skills/sprint-flow/AGENTS.md +3 -3
  11. package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +3 -3
  12. package/plugins/dsh/package.json +1 -1
  13. package/plugins/dsh/skills/delphi-review/AGENTS.md +3 -3
  14. package/plugins/dsh/skills/sprint-flow/AGENTS.md +3 -3
  15. package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +3 -3
  16. package/plugins/opencode/package.json +1 -1
  17. package/plugins/opencode/skills/delphi-review/AGENTS.md +3 -3
  18. package/plugins/opencode/skills/sprint-flow/AGENTS.md +3 -3
  19. package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +3 -3
  20. package/plugins/qoder/plugin.json +2 -2
  21. package/plugins/qoder/skills/admin-template-guidelines/SKILL.md +6 -797
  22. package/plugins/qoder/skills/admin-template-guidelines/references/rule-1.md +91 -0
  23. package/plugins/qoder/skills/admin-template-guidelines/references/rule-2.md +155 -0
  24. package/plugins/qoder/skills/admin-template-guidelines/references/rule-3.md +70 -0
  25. package/plugins/qoder/skills/admin-template-guidelines/references/rule-4.md +154 -0
  26. package/plugins/qoder/skills/admin-template-guidelines/references/rule-5.md +126 -0
  27. package/plugins/qoder/skills/admin-template-guidelines/references/rule-6.md +180 -0
  28. package/plugins/qoder/skills/batch-grill-me/SKILL.md +15 -0
  29. package/plugins/qoder/skills/clipboard-vision/describe-clipboard.ps1 +115 -0
  30. package/plugins/qoder/skills/clipboard-vision/describe-clipboard.sh +161 -0
  31. package/plugins/qoder/skills/delphi-review/.delphi-config.json.example +61 -28
  32. package/plugins/qoder/skills/delphi-review/AGENTS.md +3 -3
  33. package/plugins/qoder/skills/delphi-review/INSTALL.md +97 -98
  34. package/plugins/qoder/skills/delphi-review/SKILL.md +77 -54
  35. package/plugins/qoder/skills/delphi-review/hooks.md +19 -0
  36. package/plugins/qoder/skills/delphi-review/opencode.json.delphi.example +6 -10
  37. package/plugins/qoder/skills/delphi-review/references/orchestrator-dispatch.md +64 -0
  38. package/plugins/qoder/skills/delphi-review/references/requirements.md +402 -0
  39. package/plugins/qoder/skills/delphi-review/references/round-templates.md +134 -0
  40. package/plugins/qoder/skills/delphi-review/scripts/verify-consensus.sh +43 -0
  41. package/plugins/qoder/skills/delphi-review/tools.md +29 -0
  42. package/plugins/qoder/skills/domain-modeling/ADR-FORMAT.md +64 -0
  43. package/plugins/qoder/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
  44. package/plugins/qoder/skills/domain-modeling/SKILL.md +74 -0
  45. package/plugins/qoder/skills/grill-with-docs/SKILL.md +7 -0
  46. package/plugins/qoder/skills/grilling/SKILL.md +12 -0
  47. package/plugins/qoder/skills/ralph-loop/SKILL.md +87 -428
  48. package/plugins/qoder/skills/ralph-loop/references/components.md +113 -0
  49. package/plugins/qoder/skills/ralph-loop/references/workflow-details.md +99 -0
  50. package/plugins/qoder/skills/sprint-flow/AGENTS.md +4 -4
  51. package/plugins/qoder/skills/sprint-flow/SKILL.md +255 -454
  52. package/plugins/qoder/skills/sprint-flow/__tests__/sprint-flow.test.cjs +457 -0
  53. package/plugins/qoder/skills/sprint-flow/hooks.md +18 -0
  54. package/plugins/qoder/skills/sprint-flow/references/components/memory.md +1 -1
  55. package/plugins/qoder/skills/sprint-flow/references/components/middleware.md +1 -1
  56. package/plugins/qoder/skills/sprint-flow/references/components/skill-invocations.md +21 -20
  57. package/plugins/qoder/skills/sprint-flow/references/components/tool-descriptions.md +22 -23
  58. package/plugins/qoder/skills/sprint-flow/references/force-levels.md +0 -1
  59. package/plugins/qoder/skills/sprint-flow/references/orchestration-rules.md +34 -27
  60. package/plugins/qoder/skills/sprint-flow/references/phase-1-prep.md +1 -1
  61. package/plugins/qoder/skills/sprint-flow/references/phase-2-design.md +157 -120
  62. package/plugins/qoder/skills/sprint-flow/references/phase-3-build.md +203 -2
  63. package/plugins/qoder/skills/sprint-flow/references/phase-4-verify.md +107 -34
  64. package/plugins/qoder/skills/sprint-flow/references/phase-5-ship.md +194 -12
  65. package/plugins/qoder/skills/sprint-flow/references/phase-6-close.md +139 -7
  66. package/plugins/qoder/skills/sprint-flow/references/phase-overview.md +486 -0
  67. package/plugins/qoder/skills/sprint-flow/scripts/verify-sprint-state.sh +38 -0
  68. package/plugins/qoder/skills/sprint-flow/tools.md +29 -0
  69. package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +3 -3
  70. package/plugins/qoder/skills/test-specification-alignment/SKILL.md +104 -601
  71. package/plugins/qoder/skills/to-issues/SKILL.md +1 -1
  72. package/principles/AGENTS.md +3 -3
  73. package/skills/delphi-review/AGENTS.md +3 -3
  74. package/skills/sprint-flow/AGENTS.md +3 -3
  75. package/skills/test-specification-alignment/AGENTS.md +3 -3
  76. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/SKILL.md +0 -47
  77. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +0 -65
  78. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +0 -185
  79. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +0 -138
  80. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision.test.cjs +0 -273
  81. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/scripts/clipboard-vision.ps1 +0 -86
  82. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/scripts/clipboard-vision.sh +0 -137
  83. package/plugins/qoder/skills/ralph-loop/references/components/memory.md +0 -55
  84. package/plugins/qoder/skills/ralph-loop/references/components/middleware.md +0 -54
  85. package/plugins/qoder/skills/ralph-loop/references/components/skill-invocations.md +0 -39
  86. package/plugins/qoder/skills/ralph-loop/references/components/system-prompt.md +0 -24
  87. package/plugins/qoder/skills/ralph-loop/references/components/tool-descriptions.md +0 -32
@@ -6,7 +6,7 @@
6
6
 
7
7
  **摘要**: TDD 执行, 多 Agent 并行加速, 盲评验证, Gate 1 验证通过。
8
8
 
9
- **关键链路**: DELPHI-GATE → parallel-dispatch/ralph-loop → TDD → freeze → blind-review → unfreeze → verification → cost monitor
9
+ **关键链路**: BUILD-ENTRY-CONTRACT → DELPHI-GATE → parallel-dispatch/ralph-loop → TDD → blind-review (read-only subagent) → verification → cost monitor
10
10
 
11
11
  **输出**: MVP v1
12
12
 
@@ -22,6 +22,27 @@
22
22
 
23
23
  ---
24
24
 
25
+ ## BUILD Entry Contract Check (MANDATORY — v0.18.0+, 程序化)
26
+
27
+ **Purpose**: Validate `slices-manifest.json` schema and slice↔REQ cross-artifact consistency before entering BUILD.
28
+
29
+ **Execution**: `phase-transition 3 in_progress` 时程序化校验:
30
+
31
+ ```
32
+ 1. slices-manifest.json 存在且 schema 合法
33
+ 2. manifest 每个 slice 引用的 REQ 必须存在于 specification.yaml
34
+ 3. 不合法 → BLOCK
35
+ ```
36
+
37
+ **GATE CHECK**:
38
+ ```
39
+ [BUILD-ENTRY] slices-manifest.json exists ✓
40
+ [BUILD-ENTRY] manifest schema valid ✓
41
+ [BUILD-ENTRY] slice↔REQ consistency ✓ # 每个 slice 的 REQ 引用在 specification.yaml 中存在
42
+ ```
43
+
44
+ **IF GATE FAILS**: BLOCK — 返回 Phase 2/6 修复 manifest 或 specification.yaml。
45
+
25
46
  ---
26
47
 
27
48
  ## Uncommitted Changes Gate
@@ -81,6 +102,186 @@ SKIP_UNCOMMITTED_GATE=1
81
102
 
82
103
  ---
83
104
 
105
+ ## TDD-GATE: Pre-Implementation TDD Check (MANDATORY — v0.14.0+)
106
+
107
+ **Purpose**: Enforce RED → GREEN → REFACTOR discipline at BUILD entry before any delegation.
108
+
109
+ **Execution**: Before dispatching to ralph-loop or parallel agents, the orchestrator MUST verify for each REQ:
110
+
111
+ ### Gate Logic
112
+
113
+ ```
114
+ FOR each REQ in slices-manifest.json:
115
+ IF test file exists for this REQ:
116
+ IF test passes (GREEN state) AND no implementation exists:
117
+ → BLOCK: TDD bypass detected. Test is passing before implementation.
118
+ ELSE IF test fails (RED state):
119
+ → ALLOW: Proceed to implementation (GREEN phase).
120
+ ELSE (no test file exists):
121
+ → ALLOW: Mark REQ as [TDD-RED]. ralph-loop creates the test as step 0.
122
+ ```
123
+
124
+ ### Todo Prefix Convention
125
+
126
+ Each todo item MUST carry a TDD phase prefix in the content field:
127
+ - `[TDD-RED]`: Write failing test first. No implementation yet.
128
+ - `[TDD-GREEN]`: Write minimal implementation to make test pass.
129
+ - `[TDD-REFACTOR]`: Refactor while keeping tests green.
130
+
131
+ The priority field (high/medium/low) is separate and unchanged.
132
+
133
+ Example:
134
+ ```
135
+ "[TDD-RED] src/lib/auth.ts: Add validateToken() test for expired tokens - expect test to fail"
136
+ "[TDD-GREEN] src/lib/auth.ts: Implement validateToken() to pass test - expect test passes"
137
+ "[TDD-REFACTOR] src/lib/auth.ts: Extract token parsing into parseToken() helper - expect tests stay green"
138
+ ```
139
+
140
+ ### Deadlock Prevention
141
+
142
+ The TDD-GATE is a PRE-RALPH-LOOP check, NOT a replacement for ralph-loop's internal TDD:
143
+ - If no test exists → ralph-loop IS allowed to proceed (creates test as step 0)
144
+ - If test exists and is GREEN without implementation → BLOCK (TDD bypass)
145
+ - The gate verifies TDD DISCIPLINE was followed, not that TDD was skipped
146
+
147
+ ### Limitation
148
+
149
+ This enforcement is instructional (LLM follows SKILL.md instructions), not programmatic. For stronger enforcement, consider a future automated pre-commit hook that checks git staging order (test file must be staged before source file).
150
+
151
+ ### Log Format (`.sprint-state/tdd-gate-log.json`)
152
+
153
+ ```json
154
+ {
155
+ "checked": true,
156
+ "blocked": false,
157
+ "skipped": false,
158
+ "reqs_checked": 4,
159
+ "reqs_blocked": 0,
160
+ "timestamp": "2026-07-09T00:00:00Z"
161
+ }
162
+ ```
163
+
164
+ **Log location**: `.sprint-state/tdd-gate-log.json` — written on every gate execution for audit trail.
165
+
166
+ ---
167
+
168
+ ## In-Session Verification (MANDATORY — v0.14.31+)
169
+
170
+ **Purpose**: Ensure every implementation change is immediately verified and recorded, enabling Better Loop Harness (and other observability tools) to capture normalized change→validation event pairs.
171
+
172
+ **Problem it solves**: Without explicit in-session verification, Agents may edit files and move on without running tests or linters. This creates unverified changes that are invisible to post-hoc review tools, breaking the traceability chain between "what changed" and "was it validated".
173
+
174
+ ### Mandatory Verification Protocol
175
+
176
+ After **every** implementation change (file edit, refactor, new feature, bug fix), the Agent MUST execute the following sequence BEFORE claiming the change is complete:
177
+
178
+ 1. **Run tests**: `npm test` or `npx vitest run` (or project-specific test command)
179
+ 2. **Run linter**: `npm run lint` or `npx eslint .` (or project-specific lint command)
180
+ 3. **Type-check** (TypeScript projects): `npx tsc --noEmit`
181
+ 4. **Record the result**: Append a structured verification event (see format below)
182
+
183
+ ### Verification Event Format
184
+
185
+ Each verification event MUST be recorded as a structured JSON object. Agents should output this to stdout or append to `.sprint-state/phase-outputs/verification-events.jsonl`:
186
+
187
+ ```json
188
+ {
189
+ "timestamp": "2026-07-22T10:30:00Z",
190
+ "change": {
191
+ "type": "edit|refactor|feature|bugfix",
192
+ "files": ["src/lib/auth.ts", "src/lib/auth.test.ts"],
193
+ "description": "Implement validateToken() for expired token handling"
194
+ },
195
+ "verification": {
196
+ "tests": { "command": "npx vitest run src/lib/auth.test.ts", "status": "pass|fail", "summary": "4 passed, 0 failed" },
197
+ "lint": { "command": "npm run lint", "status": "pass|fail|warn", "summary": "0 errors, 2 warnings" },
198
+ "typecheck": { "command": "npx tsc --noEmit", "status": "pass|fail|skip", "summary": "No type errors" }
199
+ },
200
+ "outcome": "verified|failed|partial",
201
+ "req": "REQ-003"
202
+ }
203
+ ```
204
+
205
+ ### Integration with ralph-loop
206
+
207
+ When using ralph-loop mode (default BUILD strategy), each REQ iteration MUST include verification as the final step before marking the REQ complete:
208
+
209
+ ```
210
+ ralph-loop iteration:
211
+ 1. [TDD-RED] Write failing test
212
+ 2. [TDD-GREEN] Implement minimal code to pass
213
+ 3. [TDD-REFACTOR] Clean up while keeping tests green
214
+ 4. [VERIFY] Run tests + lint + typecheck ← MANDATORY
215
+ 5. [RECORD] Append verification event ← MANDATORY
216
+ 6. Mark REQ complete and continue to next
217
+ ```
218
+
219
+ ### Anti-Patterns
220
+
221
+ | ❌ Error | ✅ Correct |
222
+ |----------|----------|
223
+ | Edit file → claim done → move to next task | Edit file → run tests + lint → record result → claim done |
224
+ | "Tests should pass" (assertion without evidence) | "Tests passed: 4 passed, 0 failed (npx vitest run)" |
225
+ | Run tests only at end of entire BUILD phase | Run tests after every individual change/REQ |
226
+ | Skip type-check because "I didn't touch types" | Always run `tsc --noEmit` on TypeScript projects |
227
+
228
+ ### Harness Integration
229
+
230
+ Better Loop Harness captures change and verification events by inspecting session history. The structured verification events above serve as the canonical signal that:
231
+ - A change occurred (the `change` field)
232
+ - The change was validated (the `verification` field)
233
+ - The outcome is attributable (the `outcome` field ties result to specific change)
234
+
235
+ Without these events, the Harness can only infer changes from file diffs and has no verification signal, resulting in lower "改动验证" (Change Verification) dimension scores.
236
+
237
+ ---
238
+
239
+ ## Blind Review — Read-Only Subagent Convention (v0.18.0+, 证据型标准步骤)
240
+
241
+ **Purpose**: Code review by an isolated subagent with read-only tool access. Replaces the former `freeze/unfreeze` mechanism.
242
+
243
+ **Convention**: The blind-review reviewer runs as a Task subagent with restricted tools:
244
+
245
+ ```
246
+ tools: [Read, Grep, Glob] # 只读 — 禁止 Write/Edit/Bash 写操作
247
+ ```
248
+
249
+ **Execution**:
250
+ 1. Orchestrator dispatches a Task subagent with `tools: [Read, Grep, Glob]`
251
+ 2. Subagent reviews all changed files (from `git diff` or slices-manifest scope)
252
+ 3. Subagent outputs review findings (issues, suggestions, risks)
253
+ 4. Orchestrator records findings to `.sprint-state/phase-outputs/blind-review-report.md`
254
+
255
+ **Classification**: 证据型标准步骤(非 HARD-GATE)— 执行并留存评审记录,不设程序化阻断。Worktree 本身已是隔离边界。
256
+
257
+ **Anti-Pattern**: Reviewer subagent MUST NOT have Write, Edit, or Bash permissions. This ensures the review is truly read-only and cannot accidentally modify code under review.
258
+
259
+ ---
260
+
261
+ ## Learnings Capture (v0.18.0+, 原生)
262
+
263
+ **Purpose**: Record patterns and lessons learned during BUILD for future sprints.
264
+
265
+ **Execution**: ralph-loop 迭代中或 BUILD 完成后,将有价值的模式/教训写入:
266
+
267
+ ```
268
+ .sprint-history/learnings.md
269
+ ```
270
+
271
+ **Format**:
272
+ ```markdown
273
+ ## [YYYY-MM-DD] Sprint <id> — BUILD Learnings
274
+
275
+ ### Pattern: <title>
276
+ - **Context**: <when this applies>
277
+ - **Insight**: <what was learned>
278
+ - **Action**: <how to apply in future>
279
+ ```
280
+
281
+ **Note**: 替代原 `gstack/learn` 调用,纯原生文件写入,零外部依赖。
282
+
283
+ ---
284
+
84
285
  ## TDD 强制执行
85
286
 
86
287
  ### Gate 5a-BLOCK: 新增文件测试强制
@@ -115,7 +316,7 @@ SKIP_GATE_5A_BLOCK=1 git commit -m "message"
115
316
  | ralph-loop (per REQ) | TDD + verification per requirement | 5-15 min | 30 min/REQ | Mark REQ as `timeout`, continue next REQ |
116
317
  | parallel dispatch | Multi-agent parallel build | 10-30 min | 45 min | Collect partial results, continue |
117
318
  | TDD cycle (per unit) | RED → GREEN → REFACTOR | 2-5 min | 10 min | Skip unit, log failure |
118
- | freeze + blind-review | Code review in isolation | 5-10 min | 20 min | WARNING, continue |
319
+ | blind-review (read-only subagent) | Code review via read-only subagent | 5-10 min | 20 min | WARNING, continue |
119
320
  | verification | Test suite + coverage check | 2-5 min | 15 min | Retry once, then BLOCK |
120
321
  | cost monitor | Token cost accounting | <1s | 5s | Skip, log warning |
121
322
  | Phase 3/6 total (lightweight) | ≤3 REQs | 15-30 min | 45 min | — |
@@ -1,15 +1,15 @@
1
- # Phase 4/6: VERIFY(验证 — 代码走查 + QA + 反馈获取)
1
+ # Phase 4/6: VERIFY(验证 — 代码走查 + 测试对齐 + 反馈获取)
2
2
 
3
3
  **执行时机**: Phase 3/6 BUILD 完成后、Phase 5/6 SHIP 之前。
4
4
  **对应旧模型**: Phase 3 REVIEW + Phase 4 FEEDBACK
5
5
 
6
6
  ## 目标
7
7
 
8
- 多专家代码走查、测试对齐、浏览器测试、反馈捕获。确保 MVP 符合 specification 并记录经验教训。
8
+ 多专家代码走查、测试对齐(#367 程序化 HARD-GATE)、浏览器验证(Layer 4 可选链)、反馈捕获。确保 MVP 符合 specification 并记录经验教训。
9
9
 
10
10
  **执行者**: orchestrator 直接执行 Part A(非 subagent dispatch — Issue #249)。
11
11
 
12
- Web 前端项目额外增加:系统化 QA、视觉审计、性能基线。
12
+ Web 前端项目额外增加:原生 UI 审查 + 可选增强。
13
13
 
14
14
  ---
15
15
 
@@ -17,20 +17,27 @@ Web 前端项目额外增加:系统化 QA、视觉审计、性能基线。
17
17
 
18
18
  ### 调用 Skills
19
19
 
20
- **所有项目**:
21
- - `delphi-review --mode code-walkthrough` — 三个 Qoder Custom Agent 匿名代码走查(模型不受 provider、vendor 或国籍限制,≥90% consensus)
22
- - `test-specification-alignment` — 测试与 Spec 对齐验证
23
- - `browse` (gstack) — 浏览器自动化测试
20
+ **所有项目(原生 HARD-GATE 链)**:
21
+ - `delphi-review --mode code-walkthrough` — 三位专家匿名代码走查,验证三个 distinct requested_model 并聚合 ≥90% consensus
22
+ - `test-specification-alignment` — 测试与 Spec 对齐验证(#367 程序化 HARD-GATE)
23
+ - `xp-gate check --all` — 全量质量门禁(Gate 0–9,含安全审计)
24
+
25
+ **浏览器验证 — Layer 4 可选链**:
26
+ ```
27
+ OPTIONAL: 若检测到 gstack browse 已安装 → 使用 gstack browse 进行浏览器自动化测试
28
+ ELSE IF 平台支持 browser-use MCP → 使用 browser-use MCP
29
+ ELSE → SKIP 并记录 "[sprint-flow] 浏览器验证 SKIP(无可用浏览器工具)"
30
+ ```
24
31
 
25
32
  **Web 前端项目额外注入** (`--type web-nextjs` / `web-react` / `web-vue`):
26
- - `qa` (gstack) — 三层 QA(Quick/Standard/Exhaustive)系统化测试
27
- - `design-review` (gstack) — 线上 UI 视觉审计(间距、层级、AI slop 检测)
28
- - `benchmark` (gstack) — Core Web Vitals 性能基线
33
+ - `xp-gate ui-review`(原生)— UI 视觉审查(间距、层级、一致性)
34
+ - OPTIONAL: 若检测到 gstack `qa` 已安装 → 三层 QA 系统化测试;未安装则 SKIP
35
+ - OPTIONAL: 若检测到 gstack `design-review` 已安装 → 视觉审计增强;未安装则 SKIP
36
+ - OPTIONAL: 若检测到 gstack `benchmark` 已安装 → Core Web Vitals 基线;未安装则 SKIP
29
37
 
30
38
  **Mobile 项目额外注入** (`--type mobile-flutter` / `mobile-react-native`):
31
39
  - `flutter-test` — Flutter 单元测试 + widget 测试 (Flutter only)
32
40
  - Detox E2E — React Native 端到端测试 (RN only)
33
- - `flutter-review` (user) — Flutter 代码审查 (Flutter only)
34
41
 
35
42
  **Backend 项目额外注入** (`--type backend-go` / `backend-springboot` / `backend-django`):
36
43
  - API Testing — 后端 API 自动化测试
@@ -43,14 +50,15 @@ Web 前端项目额外增加:系统化 QA、视觉审计、性能基线。
43
50
  skill(name="delphi-review", user_message="--mode code-walkthrough")
44
51
  ```
45
52
 
46
- - architecture、technical、feasibility 三个 Custom Agent 匿名独立评审
47
- - Round 1 验证三份成功结果及三个 distinct trimmed `requested_model`
48
- - 后续轮次保持三个 Agent,最多执行到 Round 5
49
- - 三份结果聚合 ≥90% 共识 + APPROVED 才通过;任一执行失败都阻断
53
+ - architecture、technical、feasibility 三位专家匿名独立评审,模型 ID 必须 distinct
54
+ - Round 1: 三位专家独立执行,输出 `result_type=delphi_expert_result`
55
+ - 验证三份成功结果和三个 distinct requested_model 后再聚合
56
+ - 后续轮次最多到 Round 5,≥90% 共识 + APPROVED 才通过
57
+ - 任一失败或模型重复都阻断,不降级为少数专家
50
58
 
51
59
  **如果 REQUEST_CHANGES**: 暂停等待用户处理 → 修复后重新评审。**如果 APPROVED**: 写入 `.code-walkthrough-result.json`(1 小时有效期)→ 进入 Step 2。
52
60
 
53
- #### Step 2: 调用 test-specification-alignment
61
+ #### Step 2: 调用 test-specification-alignment(#367 程序化 HARD-GATE)
54
62
 
55
63
  ```
56
64
  skill(name="test-specification-alignment", user_message="--spec specification.yaml --tests mvp-v1/tests")
@@ -58,18 +66,61 @@ skill(name="test-specification-alignment", user_message="--spec specification.ya
58
66
 
59
67
  Phase 1: 验证对齐(可修改测试) → Phase 2: 执行测试(禁止修改测试)
60
68
 
69
+ **#367 修复 — 程序化 HARD-GATE**:
70
+
71
+ test-specification-alignment 执行后**必须**输出 `.sprint-state/phase-outputs/test-alignment-report.json`:
72
+
73
+ ```json
74
+ {
75
+ "alignment_status": "PASS | FAIL",
76
+ "head_commit": "<git rev-parse HEAD>",
77
+ "spec_hash": "<SHA-256 of specification.yaml>",
78
+ "req_test_mapping": {},
79
+ "ac_assertion_mapping": {},
80
+ "timestamp": "<ISO 8601>"
81
+ }
82
+ ```
83
+
84
+ **`phase-transition 4 completed` 程序化校验**:
85
+ - 文件缺失 → BLOCK
86
+ - `alignment_status` 非 PASS → BLOCK
87
+ - `head_commit` 与当前 HEAD 不符 → BLOCK(防陈旧绑定)
88
+ - `spec_hash` 与当前 specification.yaml 不符 → BLOCK(防陈旧绑定)
89
+
90
+ **--skip-evidence 逃生口护栏**:
91
+ - `--skip-evidence` 必须同时提供 `--reason "<text>"`
92
+ - 每次使用写入 audit.jsonl(`event: evidence_skipped, reason, phase`)
93
+ - `xp-gate retro` 报告设曝光区块
94
+ - 单 sprint 使用 >2 次 → 告警
95
+
96
+ #### Step 2.5: 质量门禁全量验证
97
+
98
+ ```
99
+ npx xp-gate check --all
100
+ ```
101
+
102
+ 运行所有可用的质量门禁(Gate 0–9,含安全审计 Gate 7/8/9)并输出汇总报告。任何 BLOCK 状态 → 回退 Phase 3/6 修复。
103
+
104
+ > 此步骤自动调用各独立门禁(lint、复杂度、principles、架构、安全扫描等),无需手动逐个执行。替代原 `cso` 外部 skill 调用。
105
+
61
106
  #### Step 2.5-2.10: 项目类型特定验证(Web/Mobile/Backend)
62
107
 
63
- - **Web**: qa → design-review → benchmark
108
+ - **Web**: `xp-gate ui-review`(原生)→ OPTIONAL gstack qa/design-review/benchmark(如已安装)
64
109
  - **Mobile**: flutter-test / detox E2E
65
110
  - **Backend**: API automation tests
66
111
 
67
- #### Step 3: 调用 browse skill
112
+ #### Step 3: 浏览器验证(Layer 4 可选链)
68
113
 
69
114
  ```
70
- skill(name="browse", user_message="--url [URL] --test-ui")
115
+ OPTIONAL: 若检测到 gstack browse 已安装:
116
+ skill(name="browse", user_message="--url [URL] --test-ui")
117
+ ELSE IF 平台支持 browser-use MCP:
118
+ 使用 browser-use MCP 进行浏览器验证
119
+ ELSE:
120
+ SKIP 并记录 "[sprint-flow] 浏览器验证 SKIP(无可用浏览器工具)"
71
121
  ```
72
- 默认: `localhost:3000`。发现问题 → 回退 Phase 3/6 修复。
122
+
123
+ 默认 URL: `localhost:3000`。发现问题 → 回退 Phase 3/6 修复。
73
124
 
74
125
  #### Step 4: 保存 Review Report
75
126
 
@@ -81,13 +132,14 @@ skill(name="browse", user_message="--url [URL] --test-ui")
81
132
  |--------|---------|---------|
82
133
  | delphi code-walkthrough REQUEST_CHANGES | Critical Issues 未修复 | 用户修复 → 重新评审 |
83
134
  | test-alignment 失败 | 自动回退 Phase 3/6(不暂停) | 自动迭代 |
84
- | browse 发现问题 | 自动回退 Phase 3/6(不暂停) | 自动迭代 |
135
+ | 浏览器验证发现问题 | 自动回退 Phase 3/6(不暂停) | 自动迭代 |
85
136
 
86
137
  ### 输出
87
138
 
88
139
  - `.code-walkthrough-result.json`(pre-push hook 验证)
140
+ - `.sprint-state/phase-outputs/test-alignment-report.json`(#367 程序化 HARD-GATE 证据)
89
141
  - Review Report (`review-report.md`)
90
- - Web 前端附加: QA report + design-review report + benchmark baseline
142
+ - Web 前端附加: ui-review report + OPTIONAL QA/design-review/benchmark reports
91
143
  - 验证通过的 MVP
92
144
 
93
145
  ---
@@ -96,28 +148,49 @@ skill(name="browse", user_message="--url [URL] --test-ui")
96
148
 
97
149
  ### 调用 Skills
98
150
 
99
- - `learn` (gstack) — 模式记录(个人级)
100
- - `retro` (gstack) — 周工程回顾:提交历史、工作模式、代码质量趋势(团队级)
101
- - `systematic-debugging` (superpowers) _(可选)_ — 根因调试:反馈中的 bug 做根因分析
151
+ **原生**:
152
+ - `learnings.md` 写入 — 模式记录(替代原 gstack `learn`)
153
+ - `xp-gate retro` — 工程回顾:提交历史、工作模式、代码质量趋势、返工率区块
154
+
155
+ **可选(Layer 4)**:
156
+ - OPTIONAL: 若检测到 `systematic-debugging` skill 已安装 → 根因调试(保留"无根因不修复"纪律);未安装则使用"根因分析后方可修复"文本纪律
102
157
 
103
158
  ### 执行步骤
104
159
 
105
- #### Step 1: 调用 learn skill
106
- ```
107
- skill(name="learn", user_message="[Emergent Issues 内容 + Sprint 总结]")
160
+ #### Step 1: Learnings 写入(原生)
161
+
162
+ 将 Sprint 中发现的模式/教训写入 `.sprint-history/learnings.md`:
163
+
164
+ ```markdown
165
+ ## [YYYY-MM-DD] Sprint <id> — VERIFY Learnings
166
+
167
+ ### Pattern: <title>
168
+ - **Context**: <when this applies>
169
+ - **Insight**: <what was learned>
170
+ - **Action**: <how to apply in future>
108
171
  ```
109
172
 
110
- #### Step 2: 工程回顾 — 调用 retro
173
+ #### Step 2: 工程回顾 — xp-gate retro(原生)
174
+
111
175
  ```
112
- skill(name="retro")
176
+ npx xp-gate retro
113
177
  ```
114
- - 提交历史分析、代码质量趋势、团队贡献分解、改进建议
115
178
 
116
- #### Step 3: 根因调试(可选)
179
+ - 提交历史分析、代码质量趋势、改进建议
180
+ - 含 #369 返工率趋势区块
181
+ - 含 --skip-evidence 使用曝光区块
182
+
183
+ #### Step 3: 根因调试(可选 — Layer 4)
184
+
117
185
  **IF Phase 6/6 CLOSE 发现 bug 或 Part A 验证失败**:
186
+
118
187
  ```
119
- skill(name="systematic-debugging", user_message="[具体 bug 描述]")
188
+ OPTIONAL: 若检测到 systematic-debugging skill 已安装:
189
+ skill(name="systematic-debugging", user_message="[具体 bug 描述]")
190
+ ELSE:
191
+ 遵循"无根因不修复"文本纪律 — 先分析根因,确认后再修复
120
192
  ```
193
+
121
194
  Iron Law: 无调查 → 不修复
122
195
 
123
196
  #### Step 4: 转化 Emergent Issues 为 Sprint 2 Pain Document
@@ -147,6 +220,6 @@ Iron Law: 无调查 → 不修复
147
220
  ### 输出
148
221
 
149
222
  - Feedback Log (`feedback-log.md`)
150
- - Retro Report(retro 输出)
223
+ - Retro Report(`xp-gate retro` 输出)
151
224
  - Sprint 2 Pain Document (`sprint2-pain.md`) — 如果有 emergent issues
152
225
  - 进入 Phase 5/6 SHIP 自动执行