@boyingliu01/xp-gate 0.38.76 → 0.38.78

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 (111) hide show
  1. package/lib/__tests__/gate2-verdict.test.js +58 -1
  2. package/lib/__tests__/mirror-sync.test.js +387 -5
  3. package/lib/gate-runner.js +88 -9
  4. package/lib/mattpocock-license-verdict.json +1 -1
  5. package/lib/mirror-sync.js +202 -15
  6. package/package.json +1 -1
  7. package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
  8. package/plugins/claude-code/skills/delphi-review/AGENTS.md +1 -1
  9. package/plugins/claude-code/skills/sprint-flow/AGENTS.md +1 -1
  10. package/plugins/claude-code/skills/sprint-flow/references/phase-2-design.md +62 -2
  11. package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +1 -1
  12. package/plugins/dsh/package.json +1 -1
  13. package/plugins/dsh/skills/delphi-review/AGENTS.md +1 -1
  14. package/plugins/dsh/skills/sprint-flow/AGENTS.md +1 -1
  15. package/plugins/dsh/skills/sprint-flow/references/phase-2-design.md +62 -2
  16. package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +1 -1
  17. package/plugins/opencode/package.json +1 -1
  18. package/plugins/opencode/skills/delphi-review/AGENTS.md +1 -1
  19. package/plugins/opencode/skills/sprint-flow/AGENTS.md +1 -1
  20. package/plugins/opencode/skills/sprint-flow/references/phase-2-design.md +62 -2
  21. package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +1 -1
  22. package/plugins/qoder/plugin.json +1 -1
  23. package/plugins/qoder/skills/delphi-review/AGENTS.md +1 -1
  24. package/plugins/qoder/skills/sprint-flow/AGENTS.md +1 -1
  25. package/plugins/qoder/skills/sprint-flow/references/phase-2-design.md +62 -2
  26. package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +1 -1
  27. package/scripts/generate-mirrors.cjs +10 -0
  28. package/skills/delphi-review/AGENTS.md +1 -1
  29. package/skills/sprint-flow/AGENTS.md +1 -1
  30. package/skills/sprint-flow/references/phase-2-design.md +62 -2
  31. package/skills/test-specification-alignment/AGENTS.md +1 -1
  32. package/mock-policy/__tests__/config.test.ts +0 -292
  33. package/mock-policy/__tests__/gate-m3.test.ts +0 -379
  34. package/mock-policy/__tests__/integration.test.ts +0 -600
  35. package/mock-policy/__tests__/mock-decision-engine.test.ts +0 -231
  36. package/mock-policy/__tests__/schema.test.ts +0 -239
  37. package/mock-policy/__tests__/scope-scanner.test.ts +0 -541
  38. package/mutation/__tests__/detect-ai-test.test.ts +0 -152
  39. package/mutation/__tests__/gate-m-survivors.test.ts +0 -167
  40. package/mutation/__tests__/gate-m.test.ts +0 -246
  41. package/mutation/__tests__/go-mutant-runner.test.ts +0 -288
  42. package/mutation/__tests__/gremlins-runner.test.ts +0 -167
  43. package/mutation/__tests__/init-baseline.test.ts +0 -347
  44. package/mutation/__tests__/mutation-mirror.test.ts +0 -49
  45. package/mutation/__tests__/mutmut-runner.test.ts +0 -1049
  46. package/mutation/__tests__/pitest-gradle-availability.test.ts +0 -74
  47. package/mutation/__tests__/pitest-runner.test.ts +0 -574
  48. package/mutation/__tests__/runners-index.test.ts +0 -162
  49. package/mutation/__tests__/stryker-runner.test.ts +0 -455
  50. package/mutation/__tests__/test-filter-parity.test.ts +0 -40
  51. package/mutation/__tests__/update-baseline.test.ts +0 -395
  52. package/principles/__tests__/adapter-metrics.test.ts +0 -292
  53. package/principles/__tests__/analyze-read-failure.test.ts +0 -70
  54. package/principles/__tests__/analyzer.test.ts +0 -367
  55. package/principles/__tests__/baseline-entry-total-warnings.test.ts +0 -76
  56. package/principles/__tests__/baseline-prune-timeout.test.ts +0 -71
  57. package/principles/__tests__/baseline-prune.test.ts +0 -399
  58. package/principles/__tests__/baseline-storage.test.ts +0 -188
  59. package/principles/__tests__/baseline.test.ts +0 -330
  60. package/principles/__tests__/boy-scout-init-baseline.test.ts +0 -167
  61. package/principles/__tests__/boy-scout-integration.test.ts +0 -355
  62. package/principles/__tests__/boy-scout.test.ts +0 -893
  63. package/principles/__tests__/cli-files-separators.test.ts +0 -69
  64. package/principles/__tests__/config-arch-group.test.ts +0 -106
  65. package/principles/__tests__/config-enforcement.test.ts +0 -470
  66. package/principles/__tests__/config-git-timeout.test.ts +0 -66
  67. package/principles/__tests__/config-merge-warnings.test.ts +0 -148
  68. package/principles/__tests__/config.test.ts +0 -78
  69. package/principles/__tests__/direct-execution.test.ts +0 -187
  70. package/principles/__tests__/index.test.ts +0 -94
  71. package/principles/__tests__/issue-587-java-member-count.test.ts +0 -279
  72. package/principles/__tests__/issue-588-lsp-java-false-positives.test.ts +0 -213
  73. package/principles/__tests__/lint-baseline.test.ts +0 -314
  74. package/principles/__tests__/many-exports-reexport.test.ts +0 -40
  75. package/principles/__tests__/reporter.test.ts +0 -660
  76. package/principles/__tests__/types.test.ts +0 -103
  77. package/principles/__tests__/warnings-baseline-budgets.test.ts +0 -74
  78. package/principles/adapters/__tests__/base.test.ts +0 -95
  79. package/principles/adapters/__tests__/cpp-code-block.test.ts +0 -123
  80. package/principles/adapters/__tests__/cpp-scanner-equivalence.test.ts +0 -67
  81. package/principles/adapters/__tests__/cpp.test.ts +0 -290
  82. package/principles/adapters/__tests__/dart.test.ts +0 -84
  83. package/principles/adapters/__tests__/go.test.ts +0 -68
  84. package/principles/adapters/__tests__/java.test.ts +0 -385
  85. package/principles/adapters/__tests__/kotlin.test.ts +0 -76
  86. package/principles/adapters/__tests__/objectivec.test.ts +0 -453
  87. package/principles/adapters/__tests__/python.test.ts +0 -84
  88. package/principles/adapters/__tests__/swift.test.ts +0 -68
  89. package/principles/adapters/__tests__/typescript-block-comment-lines.test.ts +0 -53
  90. package/principles/adapters/__tests__/typescript-masking.test.ts +0 -96
  91. package/principles/adapters/__tests__/typescript.test.ts +0 -116
  92. package/principles/rules/__tests__/clean-code/code-duplication.test.ts +0 -85
  93. package/principles/rules/__tests__/clean-code/deep-nesting.test.ts +0 -73
  94. package/principles/rules/__tests__/clean-code/god-class.test.ts +0 -109
  95. package/principles/rules/__tests__/clean-code/large-file.test.ts +0 -73
  96. package/principles/rules/__tests__/clean-code/long-function.test.ts +0 -81
  97. package/principles/rules/__tests__/clean-code/magic-numbers.test.ts +0 -68
  98. package/principles/rules/__tests__/clean-code/many-exports.test.ts +0 -123
  99. package/principles/rules/__tests__/clean-code/missing-error-handling.test.ts +0 -171
  100. package/principles/rules/__tests__/clean-code/too-many-params.test.ts +0 -58
  101. package/principles/rules/__tests__/clean-code/unused-imports.test.ts +0 -107
  102. package/principles/rules/__tests__/index.test.ts +0 -49
  103. package/principles/rules/__tests__/solid/dip.test.ts +0 -119
  104. package/principles/rules/__tests__/solid/isp.test.ts +0 -58
  105. package/principles/rules/__tests__/solid/issue-588-lsp-base-contract.test.ts +0 -252
  106. package/principles/rules/__tests__/solid/lsp.test.ts +0 -186
  107. package/principles/rules/__tests__/solid/ocp.test.ts +0 -67
  108. package/principles/rules/__tests__/solid/srp.test.ts +0 -87
  109. package/principles/rules/arch/__tests__/dependency.test.ts +0 -180
  110. package/principles/rules/arch/__tests__/naming.test.ts +0 -133
  111. package/principles/rules/arch/__tests__/shared.test.ts +0 -113
@@ -51,7 +51,7 @@ skill(name="grill-with-docs", user_message="[需求描述]")
51
51
  grill-with-docs 执行:
52
52
  1. **逐个追问决策树** — 每题附推荐答案;事实自行探查,决策留给用户
53
53
  2. **同步维护 CONTEXT.md** — 项目上下文沉淀(`domain-modeling` 内置)
54
- 3. **同步维护 ADR** — `docs/adr/ADR-NNNN-*.md` 架构决策记录
54
+ 3. **同步维护 ADR** — 架构决策记录,路径与命名以 `skills/domain-modeling/ADR-FORMAT.md` 为准(`docs/adr/{NNNN}-{kebab-case-title}.md`)
55
55
  4. **达成共享理解** — 需求边界、用户场景、验收标准清晰化
56
56
 
57
57
  ### Step 2: R1 需求评审(#368 恢复的第一点评审)
@@ -131,6 +131,66 @@ orchestrator 基于访谈记录 + CONTEXT.md + R1 评审结论生成设计文档
131
131
  - 收到用户 APPROVED 后,自动进入 Part B
132
132
  - 如果用户未 APPROVED,BLOCK 并等待
133
133
 
134
+ ### Step 4b: ADR 门 — 每个 sprint 都必须交付一条记录
135
+
136
+ > **为什么这一步存在**:`docs/adr/` 曾长期只有 3 份记录,而 `grill-with-docs` 有能力写
137
+ > ADR、文档也把 ADR 列在"输出"里——但**没有任何条件要求它发生**。于是它没有发生。
138
+ > 这正是 ADR-0003 记录的缺陷形态:**声明了,但没执行**。
139
+ > 清单里的一项只是建议;**完成条件**才是保证。
140
+
141
+ **这一步不要求你"判断本次 sprint 是否触碰架构"**——那种判断没有产物、无法审计,
142
+ 执行者会不自觉地答"没有",于是门形同不存在。改为:**任何 sprint 都必须写出一个文件**,
143
+ 写的是哪个由你决定,但"没写"不是选项。
144
+
145
+ **产物**:`.sprint-state/phase-outputs/phase-2-adr.json`
146
+
147
+ ```json
148
+ {
149
+ "decision": "recorded",
150
+ "adr": "docs/adr/0007-switch-to-riverpod.md",
151
+ "reason": "引入新的状态管理方案替代 provider,属于难以回退的技术选型变更;ADR 记录了被否决的选项 B/C 及理由"
152
+ }
153
+ ```
154
+
155
+ 或
156
+
157
+ ```json
158
+ {
159
+ "decision": "not_needed",
160
+ "reason": "只修改 src/gate-12 内部的条件判断,未新增或删除模块边界,未改变依赖方向,未引入或替换技术选型"
161
+ }
162
+ ```
163
+
164
+ `decision` 只允许这两个值。`reason` 在两种情况下都必填:`recorded` 时说明这条决策
165
+ **为什么值得记**,`not_needed` 时说明**凭什么判定不需要**。
166
+
167
+ **若有 ADR**:路径必须真实存在,命名遵循 `skills/domain-modeling/ADR-FORMAT.md`
168
+ (`docs/adr/{NNNN}-{kebab-case-title}.md`,`{NNNN}` 为零填充递增序号)。
169
+ 内容必须包含**决策**与**被否决的备选方案及理由**——后者是未来读者唯一无法自行重建的
170
+ 部分,也是 ADR 存在的全部价值;只写结论的 ADR 等于没有。
171
+
172
+ **哪些改动通常生成 ADR**(用于提高 `recorded` 的比例,不是豁免清单):
173
+
174
+ | 信号 | 例子 |
175
+ |---|---|
176
+ | 新增或取消模块、层边界 | 拆包、合并包、新增目录层级 |
177
+ | 改变依赖方向 | A 依赖 B 改为 B 依赖 A |
178
+ | 引入或替换关键技术选型 | 换 ORM、换构建工具、换通信协议 |
179
+ | 做出**难以回退**的决策 | 数据模型、公开 API 形状、存储格式 |
180
+ | 出现被否决的备选方案且有理由 | 选了 A 而不是 B,B 更好为什么不用 |
181
+
182
+ > 与 AGENTS.md 的 SKIP 规则同源:**"没有决策要记"与"忘了记决策"必须可区分**。
183
+ > 前者是一份带理由的 JSON,后者是该文件不存在。差别在产物上,不在措辞上。
184
+
185
+ **门禁行为**(四条都由脚本判定,不看叙述):
186
+
187
+ 1. `.sprint-state/phase-outputs/phase-2-adr.json` 不存在 → BLOCK,不可进入 Part B。
188
+ 2. `decision` 不是 `recorded` / `not_needed` 之一 → BLOCK。
189
+ 3. `reason` 为空或短于 20 字符 → BLOCK(`无`、`n/a`、`skip` 这类不算理由)。
190
+ 4. `decision` 为 `recorded` 但 `adr` 指向的文件不存在 → BLOCK。
191
+
192
+ > 第 1 条是这一步的全部要点:**门检查的是产物是否存在,不是你声称自己想过**。
193
+
134
194
  ### 暂停点
135
195
 
136
196
  | 暂停点 | 触发条件 | 用户操作 | 自动恢复条件 |
@@ -141,7 +201,7 @@ orchestrator 基于访谈记录 + CONTEXT.md + R1 评审结论生成设计文档
141
201
  ### 输出
142
202
 
143
203
  - CONTEXT.md(项目上下文沉淀)
144
- - ADR 文件(`docs/adr/ADR-NNNN-*.md`)
204
+ - ADR 文件(`docs/adr/{NNNN}-{kebab-case-title}.md`,Step 4b 的产出;若豁免则记录理由)
145
205
  - requirements-reviewed.json(`.sprint-state/phase-outputs/`)
146
206
  - Design Document(`docs/plans/YYYY-MM-DD-<topic>-design.md`)
147
207
  - 进入 Part B 自动执行(使用设计文档作为输入)
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.76.0
6
+ **Version:** 0.38.78.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xp-gate",
3
- "version": "0.38.76",
3
+ "version": "0.38.78",
4
4
  "displayName": "XP-Gate",
5
5
  "description": "Extreme Programming quality gates + AI workflow skills for Qoder. Includes 12 pre-commit gates (Gate 0-11), 8 pre-push gates, Sprint Flow (6 phases), and Delphi multi-expert review (>=90% consensus).",
6
6
  "author": {
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.76.0
6
+ **Version:** 0.38.78.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, exactly 3 experts with distinct executable model IDs). Supports design, requirements, and code-walkthrough modes.
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.76.0
6
+ **Version:** 0.38.78.0
7
7
 
8
8
  ## OVERVIEW
9
9
  **6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration; each REQ starts from a clean context instead of accumulating one across REQs). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
@@ -51,7 +51,7 @@ skill(name="grill-with-docs", user_message="[需求描述]")
51
51
  grill-with-docs 执行:
52
52
  1. **逐个追问决策树** — 每题附推荐答案;事实自行探查,决策留给用户
53
53
  2. **同步维护 CONTEXT.md** — 项目上下文沉淀(`domain-modeling` 内置)
54
- 3. **同步维护 ADR** — `docs/adr/ADR-NNNN-*.md` 架构决策记录
54
+ 3. **同步维护 ADR** — 架构决策记录,路径与命名以 `skills/domain-modeling/ADR-FORMAT.md` 为准(`docs/adr/{NNNN}-{kebab-case-title}.md`)
55
55
  4. **达成共享理解** — 需求边界、用户场景、验收标准清晰化
56
56
 
57
57
  ### Step 2: R1 需求评审(#368 恢复的第一点评审)
@@ -131,6 +131,66 @@ orchestrator 基于访谈记录 + CONTEXT.md + R1 评审结论生成设计文档
131
131
  - 收到用户 APPROVED 后,自动进入 Part B
132
132
  - 如果用户未 APPROVED,BLOCK 并等待
133
133
 
134
+ ### Step 4b: ADR 门 — 每个 sprint 都必须交付一条记录
135
+
136
+ > **为什么这一步存在**:`docs/adr/` 曾长期只有 3 份记录,而 `grill-with-docs` 有能力写
137
+ > ADR、文档也把 ADR 列在"输出"里——但**没有任何条件要求它发生**。于是它没有发生。
138
+ > 这正是 ADR-0003 记录的缺陷形态:**声明了,但没执行**。
139
+ > 清单里的一项只是建议;**完成条件**才是保证。
140
+
141
+ **这一步不要求你"判断本次 sprint 是否触碰架构"**——那种判断没有产物、无法审计,
142
+ 执行者会不自觉地答"没有",于是门形同不存在。改为:**任何 sprint 都必须写出一个文件**,
143
+ 写的是哪个由你决定,但"没写"不是选项。
144
+
145
+ **产物**:`.sprint-state/phase-outputs/phase-2-adr.json`
146
+
147
+ ```json
148
+ {
149
+ "decision": "recorded",
150
+ "adr": "docs/adr/0007-switch-to-riverpod.md",
151
+ "reason": "引入新的状态管理方案替代 provider,属于难以回退的技术选型变更;ADR 记录了被否决的选项 B/C 及理由"
152
+ }
153
+ ```
154
+
155
+ 或
156
+
157
+ ```json
158
+ {
159
+ "decision": "not_needed",
160
+ "reason": "只修改 src/gate-12 内部的条件判断,未新增或删除模块边界,未改变依赖方向,未引入或替换技术选型"
161
+ }
162
+ ```
163
+
164
+ `decision` 只允许这两个值。`reason` 在两种情况下都必填:`recorded` 时说明这条决策
165
+ **为什么值得记**,`not_needed` 时说明**凭什么判定不需要**。
166
+
167
+ **若有 ADR**:路径必须真实存在,命名遵循 `skills/domain-modeling/ADR-FORMAT.md`
168
+ (`docs/adr/{NNNN}-{kebab-case-title}.md`,`{NNNN}` 为零填充递增序号)。
169
+ 内容必须包含**决策**与**被否决的备选方案及理由**——后者是未来读者唯一无法自行重建的
170
+ 部分,也是 ADR 存在的全部价值;只写结论的 ADR 等于没有。
171
+
172
+ **哪些改动通常生成 ADR**(用于提高 `recorded` 的比例,不是豁免清单):
173
+
174
+ | 信号 | 例子 |
175
+ |---|---|
176
+ | 新增或取消模块、层边界 | 拆包、合并包、新增目录层级 |
177
+ | 改变依赖方向 | A 依赖 B 改为 B 依赖 A |
178
+ | 引入或替换关键技术选型 | 换 ORM、换构建工具、换通信协议 |
179
+ | 做出**难以回退**的决策 | 数据模型、公开 API 形状、存储格式 |
180
+ | 出现被否决的备选方案且有理由 | 选了 A 而不是 B,B 更好为什么不用 |
181
+
182
+ > 与 AGENTS.md 的 SKIP 规则同源:**"没有决策要记"与"忘了记决策"必须可区分**。
183
+ > 前者是一份带理由的 JSON,后者是该文件不存在。差别在产物上,不在措辞上。
184
+
185
+ **门禁行为**(四条都由脚本判定,不看叙述):
186
+
187
+ 1. `.sprint-state/phase-outputs/phase-2-adr.json` 不存在 → BLOCK,不可进入 Part B。
188
+ 2. `decision` 不是 `recorded` / `not_needed` 之一 → BLOCK。
189
+ 3. `reason` 为空或短于 20 字符 → BLOCK(`无`、`n/a`、`skip` 这类不算理由)。
190
+ 4. `decision` 为 `recorded` 但 `adr` 指向的文件不存在 → BLOCK。
191
+
192
+ > 第 1 条是这一步的全部要点:**门检查的是产物是否存在,不是你声称自己想过**。
193
+
134
194
  ### 暂停点
135
195
 
136
196
  | 暂停点 | 触发条件 | 用户操作 | 自动恢复条件 |
@@ -141,7 +201,7 @@ orchestrator 基于访谈记录 + CONTEXT.md + R1 评审结论生成设计文档
141
201
  ### 输出
142
202
 
143
203
  - CONTEXT.md(项目上下文沉淀)
144
- - ADR 文件(`docs/adr/ADR-NNNN-*.md`)
204
+ - ADR 文件(`docs/adr/{NNNN}-{kebab-case-title}.md`,Step 4b 的产出;若豁免则记录理由)
145
205
  - requirements-reviewed.json(`.sprint-state/phase-outputs/`)
146
206
  - Design Document(`docs/plans/YYYY-MM-DD-<topic>-design.md`)
147
207
  - 进入 Part B 自动执行(使用设计文档作为输入)
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.76.0
6
+ **Version:** 0.38.78.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
@@ -62,6 +62,16 @@ const GENERATED_TREES = Object.freeze([
62
62
  { mirror: 'hooks/lib', canonical: path.join(REPO_ROOT, 'githooks', 'lib'), sync: 'hooks' },
63
63
  { mirror: 'build-integrity', canonical: path.join(REPO_ROOT, 'src', 'build-integrity'), sync: 'module' },
64
64
  { mirror: 'skills', canonical: path.join(REPO_ROOT, 'skills'), sync: 'skills' },
65
+ // These two shipped in the package's `files[]` and were maintained by hand: no
66
+ // generator knew about them, so they were the last mirror pairs whose "edit the
67
+ // right copy" depended on memory. Same shape as build-integrity, so `module`.
68
+ { mirror: 'mutation', canonical: path.join(REPO_ROOT, 'src', 'mutation'), sync: 'module' },
69
+ { mirror: 'mock-policy', canonical: path.join(REPO_ROOT, 'src', 'mock-policy'), sync: 'module' },
70
+ // P1-E step 4. Long deferred because it was edited in place by another
71
+ // workstream; that work has landed. `sync-package-content.js` already produced
72
+ // this tree at prepack, so adding it here changes nothing about what ships --
73
+ // only whether the tree is generated on demand and therefore safe to untrack.
74
+ { mirror: 'principles', canonical: path.join(REPO_ROOT, 'src', 'principles'), sync: 'module' },
65
75
  ]);
66
76
 
67
77
  function quiet(argv) {
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.76.0
6
+ **Version:** 0.38.78.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, exactly 3 experts with distinct executable model IDs). Supports design, requirements, and code-walkthrough modes.
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.76.0
6
+ **Version:** 0.38.78.0
7
7
 
8
8
  ## OVERVIEW
9
9
  **6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration; each REQ starts from a clean context instead of accumulating one across REQs). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
@@ -51,7 +51,7 @@ skill(name="grill-with-docs", user_message="[需求描述]")
51
51
  grill-with-docs 执行:
52
52
  1. **逐个追问决策树** — 每题附推荐答案;事实自行探查,决策留给用户
53
53
  2. **同步维护 CONTEXT.md** — 项目上下文沉淀(`domain-modeling` 内置)
54
- 3. **同步维护 ADR** — `docs/adr/ADR-NNNN-*.md` 架构决策记录
54
+ 3. **同步维护 ADR** — 架构决策记录,路径与命名以 `skills/domain-modeling/ADR-FORMAT.md` 为准(`docs/adr/{NNNN}-{kebab-case-title}.md`)
55
55
  4. **达成共享理解** — 需求边界、用户场景、验收标准清晰化
56
56
 
57
57
  ### Step 2: R1 需求评审(#368 恢复的第一点评审)
@@ -131,6 +131,66 @@ orchestrator 基于访谈记录 + CONTEXT.md + R1 评审结论生成设计文档
131
131
  - 收到用户 APPROVED 后,自动进入 Part B
132
132
  - 如果用户未 APPROVED,BLOCK 并等待
133
133
 
134
+ ### Step 4b: ADR 门 — 每个 sprint 都必须交付一条记录
135
+
136
+ > **为什么这一步存在**:`docs/adr/` 曾长期只有 3 份记录,而 `grill-with-docs` 有能力写
137
+ > ADR、文档也把 ADR 列在"输出"里——但**没有任何条件要求它发生**。于是它没有发生。
138
+ > 这正是 ADR-0003 记录的缺陷形态:**声明了,但没执行**。
139
+ > 清单里的一项只是建议;**完成条件**才是保证。
140
+
141
+ **这一步不要求你"判断本次 sprint 是否触碰架构"**——那种判断没有产物、无法审计,
142
+ 执行者会不自觉地答"没有",于是门形同不存在。改为:**任何 sprint 都必须写出一个文件**,
143
+ 写的是哪个由你决定,但"没写"不是选项。
144
+
145
+ **产物**:`.sprint-state/phase-outputs/phase-2-adr.json`
146
+
147
+ ```json
148
+ {
149
+ "decision": "recorded",
150
+ "adr": "docs/adr/0007-switch-to-riverpod.md",
151
+ "reason": "引入新的状态管理方案替代 provider,属于难以回退的技术选型变更;ADR 记录了被否决的选项 B/C 及理由"
152
+ }
153
+ ```
154
+
155
+ 或
156
+
157
+ ```json
158
+ {
159
+ "decision": "not_needed",
160
+ "reason": "只修改 src/gate-12 内部的条件判断,未新增或删除模块边界,未改变依赖方向,未引入或替换技术选型"
161
+ }
162
+ ```
163
+
164
+ `decision` 只允许这两个值。`reason` 在两种情况下都必填:`recorded` 时说明这条决策
165
+ **为什么值得记**,`not_needed` 时说明**凭什么判定不需要**。
166
+
167
+ **若有 ADR**:路径必须真实存在,命名遵循 `skills/domain-modeling/ADR-FORMAT.md`
168
+ (`docs/adr/{NNNN}-{kebab-case-title}.md`,`{NNNN}` 为零填充递增序号)。
169
+ 内容必须包含**决策**与**被否决的备选方案及理由**——后者是未来读者唯一无法自行重建的
170
+ 部分,也是 ADR 存在的全部价值;只写结论的 ADR 等于没有。
171
+
172
+ **哪些改动通常生成 ADR**(用于提高 `recorded` 的比例,不是豁免清单):
173
+
174
+ | 信号 | 例子 |
175
+ |---|---|
176
+ | 新增或取消模块、层边界 | 拆包、合并包、新增目录层级 |
177
+ | 改变依赖方向 | A 依赖 B 改为 B 依赖 A |
178
+ | 引入或替换关键技术选型 | 换 ORM、换构建工具、换通信协议 |
179
+ | 做出**难以回退**的决策 | 数据模型、公开 API 形状、存储格式 |
180
+ | 出现被否决的备选方案且有理由 | 选了 A 而不是 B,B 更好为什么不用 |
181
+
182
+ > 与 AGENTS.md 的 SKIP 规则同源:**"没有决策要记"与"忘了记决策"必须可区分**。
183
+ > 前者是一份带理由的 JSON,后者是该文件不存在。差别在产物上,不在措辞上。
184
+
185
+ **门禁行为**(四条都由脚本判定,不看叙述):
186
+
187
+ 1. `.sprint-state/phase-outputs/phase-2-adr.json` 不存在 → BLOCK,不可进入 Part B。
188
+ 2. `decision` 不是 `recorded` / `not_needed` 之一 → BLOCK。
189
+ 3. `reason` 为空或短于 20 字符 → BLOCK(`无`、`n/a`、`skip` 这类不算理由)。
190
+ 4. `decision` 为 `recorded` 但 `adr` 指向的文件不存在 → BLOCK。
191
+
192
+ > 第 1 条是这一步的全部要点:**门检查的是产物是否存在,不是你声称自己想过**。
193
+
134
194
  ### 暂停点
135
195
 
136
196
  | 暂停点 | 触发条件 | 用户操作 | 自动恢复条件 |
@@ -141,7 +201,7 @@ orchestrator 基于访谈记录 + CONTEXT.md + R1 评审结论生成设计文档
141
201
  ### 输出
142
202
 
143
203
  - CONTEXT.md(项目上下文沉淀)
144
- - ADR 文件(`docs/adr/ADR-NNNN-*.md`)
204
+ - ADR 文件(`docs/adr/{NNNN}-{kebab-case-title}.md`,Step 4b 的产出;若豁免则记录理由)
145
205
  - requirements-reviewed.json(`.sprint-state/phase-outputs/`)
146
206
  - Design Document(`docs/plans/YYYY-MM-DD-<topic>-design.md`)
147
207
  - 进入 Part B 自动执行(使用设计文档作为输入)
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.76.0
6
+ **Version:** 0.38.78.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
@@ -1,292 +0,0 @@
1
- /**
2
- * @test config.ts - Mock Policy config loader
3
- * @intent Verify config loads and validates correctly from .mockpolicyrc and .xp-gate/mock-policy.yaml
4
- * @covers mock-policy-config-loader
5
- */
6
-
7
- import { describe, it, expect, vi, beforeEach } from 'vitest';
8
-
9
- // Shared mock state — each test sets these before re-importing the module
10
- let mockExistsSync: (path: string) => boolean;
11
- let mockReadFile: (path: string) => Promise<string>;
12
-
13
- vi.mock('fs', () => ({
14
- existsSync: vi.fn((path: string) => mockExistsSync(path)),
15
- }));
16
-
17
- vi.mock('fs/promises', () => ({
18
- readFile: vi.fn((path: string) => mockReadFile(path)),
19
- }));
20
-
21
- const MOCK_DEFAULT_CONFIG = {
22
- version: 1 as const,
23
- layers: {
24
- unit: {
25
- mockPolicy: 'lenient' as const,
26
- requireRealForImplemented: false,
27
- allowExternalMock: true,
28
- requirePendingRemoval: false,
29
- maxMockDensity: 100,
30
- },
31
- integration: {
32
- mockPolicy: 'strict' as const,
33
- requireRealForImplemented: true,
34
- allowExternalMock: true,
35
- requirePendingRemoval: true,
36
- maxMockDensity: 30,
37
- },
38
- e2e: {
39
- mockPolicy: 'strict' as const,
40
- requireRealForImplemented: true,
41
- allowExternalMock: false,
42
- requirePendingRemoval: false,
43
- maxMockDensity: 0,
44
- },
45
- },
46
- projectBoundary: ['src/**'],
47
- severity: 'warning' as const,
48
- };
49
-
50
- describe('loadMockPolicyConfig', () => {
51
- let loadMockPolicyConfig: typeof import('../config').loadMockPolicyConfig;
52
- let DEFAULT_CONFIG: typeof import('../config').DEFAULT_CONFIG;
53
-
54
- beforeEach(async () => {
55
- // Default: no config files exist
56
- mockExistsSync = () => false;
57
- mockReadFile = () => Promise.reject(new Error('ENOENT'));
58
-
59
- // Re-import after mock state is set
60
- vi.resetModules();
61
- const mod = await import('../config');
62
- loadMockPolicyConfig = mod.loadMockPolicyConfig;
63
- DEFAULT_CONFIG = mod.DEFAULT_CONFIG;
64
- });
65
-
66
- describe('DEFAULT_CONFIG', () => {
67
- it('should have correct default values', () => {
68
- expect(DEFAULT_CONFIG).toEqual(MOCK_DEFAULT_CONFIG);
69
- });
70
-
71
- it('should have lenient unit policy', () => {
72
- expect(DEFAULT_CONFIG.layers.unit.mockPolicy).toBe('lenient');
73
- expect(DEFAULT_CONFIG.layers.unit.allowExternalMock).toBe(true);
74
- });
75
-
76
- it('should have strict integration policy', () => {
77
- expect(DEFAULT_CONFIG.layers.integration.mockPolicy).toBe('strict');
78
- expect(DEFAULT_CONFIG.layers.integration.requirePendingRemoval).toBe(true);
79
- expect(DEFAULT_CONFIG.layers.integration.maxMockDensity).toBe(30);
80
- });
81
-
82
- it('should have strict e2e policy forbidding external mocks', () => {
83
- expect(DEFAULT_CONFIG.layers.e2e.allowExternalMock).toBe(false);
84
- expect(DEFAULT_CONFIG.layers.e2e.maxMockDensity).toBe(0);
85
- });
86
-
87
- it('should have projectBoundary and warning severity', () => {
88
- expect(DEFAULT_CONFIG.projectBoundary).toEqual(['src/**']);
89
- expect(DEFAULT_CONFIG.severity).toBe('warning');
90
- });
91
- });
92
-
93
- describe('no config files exist', () => {
94
- it('should return default config when no files found', async () => {
95
- const config = await loadMockPolicyConfig('/fake/project');
96
- expect(config).toEqual(DEFAULT_CONFIG);
97
- });
98
- });
99
-
100
- describe('JSON config (.mockpolicyrc)', () => {
101
- it('should merge partial JSON config with defaults', async () => {
102
- mockExistsSync = (path: string) => path.endsWith('.mockpolicyrc');
103
- mockReadFile = (path: string) => {
104
- if (path.endsWith('.mockpolicyrc')) {
105
- return Promise.resolve(JSON.stringify({
106
- severity: 'error',
107
- layers: {
108
- unit: { mockPolicy: 'strict', maxMockDensity: 50 },
109
- },
110
- }));
111
- }
112
- return Promise.reject(new Error('file not found'));
113
- };
114
-
115
- vi.resetModules();
116
- const mod = await import('../config');
117
- loadMockPolicyConfig = mod.loadMockPolicyConfig;
118
-
119
- const config = await loadMockPolicyConfig('/fake/project');
120
-
121
- expect(config.severity).toBe('error');
122
- expect(config.layers.unit.mockPolicy).toBe('strict');
123
- expect(config.layers.unit.maxMockDensity).toBe(50);
124
- // Defaults preserved for non-overridden fields
125
- expect(config.layers.unit.requireRealForImplemented).toBe(false);
126
- expect(config.layers.unit.allowExternalMock).toBe(true);
127
- expect(config.layers.integration).toEqual(MOCK_DEFAULT_CONFIG.layers.integration);
128
- expect(config.layers.e2e).toEqual(MOCK_DEFAULT_CONFIG.layers.e2e);
129
- expect(config.projectBoundary).toEqual(MOCK_DEFAULT_CONFIG.projectBoundary);
130
- });
131
-
132
- it('should load full JSON config correctly', async () => {
133
- const fullConfig = {
134
- version: 1,
135
- layers: {
136
- unit: {
137
- mockPolicy: 'strict' as const,
138
- requireRealForImplemented: true,
139
- allowExternalMock: false,
140
- requirePendingRemoval: true,
141
- maxMockDensity: 80,
142
- },
143
- integration: {
144
- mockPolicy: 'strict' as const,
145
- requireRealForImplemented: true,
146
- allowExternalMock: false,
147
- requirePendingRemoval: true,
148
- maxMockDensity: 20,
149
- },
150
- e2e: {
151
- mockPolicy: 'strict' as const,
152
- requireRealForImplemented: true,
153
- allowExternalMock: false,
154
- requirePendingRemoval: true,
155
- maxMockDensity: 5,
156
- },
157
- },
158
- projectBoundary: ['src/**', '!src/external/**'],
159
- severity: 'error' as const,
160
- };
161
-
162
- mockExistsSync = (path: string) => path.endsWith('.mockpolicyrc');
163
- mockReadFile = (path: string) => {
164
- if (path.endsWith('.mockpolicyrc')) {
165
- return Promise.resolve(JSON.stringify(fullConfig));
166
- }
167
- return Promise.reject(new Error('file not found'));
168
- };
169
-
170
- vi.resetModules();
171
- const mod = await import('../config');
172
- loadMockPolicyConfig = mod.loadMockPolicyConfig;
173
-
174
- const config = await loadMockPolicyConfig('/fake/project');
175
-
176
- expect(config.layers.unit.maxMockDensity).toBe(80);
177
- expect(config.layers.integration.mockPolicy).toBe('strict');
178
- expect(config.layers.e2e.maxMockDensity).toBe(5);
179
- expect(config.projectBoundary).toEqual(['src/**', '!src/external/**']);
180
- expect(config.severity).toBe('error');
181
- });
182
- });
183
-
184
- describe('YAML config (.xp-gate/mock-policy.yaml)', () => {
185
- it('should load YAML config as fallback', async () => {
186
- mockExistsSync = (path: string) => path.endsWith('mock-policy.yaml');
187
- mockReadFile = (path: string) => {
188
- if (path.endsWith('mock-policy.yaml')) {
189
- return Promise.resolve(`
190
- version: 1
191
- severity: error
192
- layers:
193
- unit:
194
- mockPolicy: strict
195
- maxMockDensity: 60
196
- projectBoundary:
197
- - src/**
198
- `);
199
- }
200
- return Promise.reject(new Error('file not found'));
201
- };
202
-
203
- vi.resetModules();
204
- const mod = await import('../config');
205
- loadMockPolicyConfig = mod.loadMockPolicyConfig;
206
-
207
- const config = await loadMockPolicyConfig('/fake/project');
208
-
209
- expect(config.severity).toBe('error');
210
- expect(config.layers.unit.mockPolicy).toBe('strict');
211
- expect(config.layers.unit.maxMockDensity).toBe(60);
212
- expect(config.projectBoundary).toEqual(['src/**']);
213
- });
214
-
215
- it('should prefer JSON over YAML when both exist', async () => {
216
- mockExistsSync = (path: string) =>
217
- path.endsWith('.mockpolicyrc') || path.endsWith('mock-policy.yaml');
218
- mockReadFile = (path: string) => {
219
- if (path.endsWith('.mockpolicyrc')) {
220
- return Promise.resolve(JSON.stringify({ severity: 'error' }));
221
- }
222
- if (path.endsWith('mock-policy.yaml')) {
223
- return Promise.resolve('severity: warning');
224
- }
225
- return Promise.reject(new Error('file not found'));
226
- };
227
-
228
- vi.resetModules();
229
- const mod = await import('../config');
230
- loadMockPolicyConfig = mod.loadMockPolicyConfig;
231
-
232
- const config = await loadMockPolicyConfig('/fake/project');
233
-
234
- // JSON has higher priority
235
- expect(config.severity).toBe('error');
236
- });
237
- });
238
-
239
- describe('validation', () => {
240
- it('should throw on invalid version', async () => {
241
- mockExistsSync = (path: string) => path.endsWith('.mockpolicyrc');
242
- mockReadFile = () =>
243
- Promise.resolve(JSON.stringify({ version: 999 }));
244
-
245
- vi.resetModules();
246
- const mod = await import('../config');
247
- loadMockPolicyConfig = mod.loadMockPolicyConfig;
248
-
249
- await expect(loadMockPolicyConfig('/fake/project')).rejects.toThrow();
250
- });
251
-
252
- it('should throw on invalid mockPolicy value', async () => {
253
- mockExistsSync = (path: string) => path.endsWith('.mockpolicyrc');
254
- mockReadFile = () =>
255
- Promise.resolve(
256
- JSON.stringify({
257
- layers: { unit: { mockPolicy: 'invalid' } },
258
- }),
259
- );
260
-
261
- vi.resetModules();
262
- const mod = await import('../config');
263
- loadMockPolicyConfig = mod.loadMockPolicyConfig;
264
-
265
- await expect(loadMockPolicyConfig('/fake/project')).rejects.toThrow();
266
- });
267
-
268
- it('should throw on empty projectBoundary', async () => {
269
- mockExistsSync = (path: string) => path.endsWith('.mockpolicyrc');
270
- mockReadFile = () =>
271
- Promise.resolve(JSON.stringify({ projectBoundary: [] }));
272
-
273
- vi.resetModules();
274
- const mod = await import('../config');
275
- loadMockPolicyConfig = mod.loadMockPolicyConfig;
276
-
277
- await expect(loadMockPolicyConfig('/fake/project')).rejects.toThrow();
278
- });
279
-
280
- it('should throw on invalid severity', async () => {
281
- mockExistsSync = (path: string) => path.endsWith('.mockpolicyrc');
282
- mockReadFile = () =>
283
- Promise.resolve(JSON.stringify({ severity: 'critical' }));
284
-
285
- vi.resetModules();
286
- const mod = await import('../config');
287
- loadMockPolicyConfig = mod.loadMockPolicyConfig;
288
-
289
- await expect(loadMockPolicyConfig('/fake/project')).rejects.toThrow();
290
- });
291
- });
292
- });