@boyingliu01/xp-gate 0.18.5 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (254) hide show
  1. package/adapter-common.sh +27 -0
  2. package/adapters/gate-3.sh +0 -0
  3. package/adapters/gate-4.sh +0 -0
  4. package/adapters/gate-7.sh +0 -0
  5. package/adapters/gate-8.sh +0 -0
  6. package/adapters/gate-9.sh +0 -0
  7. package/adapters/powershell.sh +85 -33
  8. package/adapters/typescript.sh +8 -8
  9. package/build-integrity/__tests__/import-resolver.test.ts +22 -0
  10. package/build-integrity/__tests__/orchestrator.test.ts +1 -2
  11. package/build-integrity/gate-10.ts +7 -0
  12. package/gate-12-file-hygiene.sh +230 -0
  13. package/hooks/adapter-common.sh +27 -0
  14. package/hooks/gate-10.sh +105 -0
  15. package/hooks/gate-12-file-hygiene.sh +0 -0
  16. package/hooks/lib/validate-code-walkthrough.cjs +125 -0
  17. package/hooks/pre-commit +130 -33
  18. package/hooks/pre-push +15 -91
  19. package/lib/__tests__/check-version.test.js +67 -46
  20. package/lib/__tests__/doctor.test.js +7 -6
  21. package/lib/__tests__/gate-runner.test.js +267 -0
  22. package/lib/__tests__/init.test.js +32 -0
  23. package/lib/__tests__/npm-package.test.js +13 -0
  24. package/lib/__tests__/phase-transition.test.js +604 -12
  25. package/lib/__tests__/sprint-discovery.test.ts +0 -1
  26. package/lib/__tests__/sprint-status-rework.test.js +100 -1
  27. package/lib/__tests__/update-hooks.test.js +143 -10
  28. package/lib/__tests__/upgrade-exec.test.js +73 -45
  29. package/lib/__tests__/upgrade-skill-sync.test.js +1 -1
  30. package/lib/__tests__/upgrade.test.js +12 -11
  31. package/lib/doctor.js +2 -1
  32. package/lib/gate-runner.js +68 -23
  33. package/lib/init.js +34 -5
  34. package/lib/install-skill.js +1 -0
  35. package/lib/mattpocock-license-verdict.json +1 -1
  36. package/lib/phase-transition.js +203 -23
  37. package/lib/shared-paths.js +2 -0
  38. package/lib/sprint-status.js +15 -4
  39. package/lib/test-alignment.ts +3 -13
  40. package/lib/update-hooks.js +129 -15
  41. package/mock-policy/AGENTS.md +5 -5
  42. package/mock-policy/__tests__/gate-m3.test.ts +0 -5
  43. package/mock-policy/__tests__/scope-scanner.test.ts +8 -2
  44. package/mutation/AGENTS.md +4 -4
  45. package/mutation/__tests__/mutmut-runner.test.ts +443 -2
  46. package/mutation/__tests__/update-baseline.test.ts +0 -2
  47. package/mutation/runners/mutmut-runner.ts +67 -17
  48. package/package.json +9 -3
  49. package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
  50. package/plugins/claude-code/skills/clipboard-vision/SKILL.md +47 -0
  51. package/plugins/claude-code/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
  52. package/plugins/claude-code/skills/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
  53. package/plugins/claude-code/skills/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
  54. package/plugins/claude-code/skills/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
  55. package/plugins/claude-code/skills/clipboard-vision/describe-clipboard.ps1 +115 -0
  56. package/plugins/claude-code/skills/clipboard-vision/describe-clipboard.sh +161 -0
  57. package/plugins/claude-code/skills/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
  58. package/plugins/claude-code/skills/clipboard-vision/scripts/clipboard-vision.sh +137 -0
  59. package/plugins/claude-code/skills/delphi-review/.delphi-config.json.example +24 -27
  60. package/plugins/claude-code/skills/delphi-review/AGENTS.md +13 -12
  61. package/plugins/claude-code/skills/delphi-review/INSTALL.md +15 -17
  62. package/plugins/claude-code/skills/delphi-review/SKILL.md +30 -29
  63. package/plugins/claude-code/skills/delphi-review/opencode.json.delphi.example +6 -10
  64. package/plugins/claude-code/skills/delphi-review/references/code-walkthrough.md +33 -49
  65. package/plugins/claude-code/skills/delphi-review/references/requirements.md +66 -54
  66. package/plugins/claude-code/skills/delphi-review/references/round-templates.md +7 -7
  67. package/plugins/claude-code/skills/sprint-flow/AGENTS.md +5 -5
  68. package/plugins/claude-code/skills/sprint-flow/SKILL.md +4 -4
  69. package/plugins/claude-code/skills/sprint-flow/references/components/skill-invocations.md +2 -2
  70. package/plugins/claude-code/skills/sprint-flow/references/force-levels.md +37 -35
  71. package/plugins/claude-code/skills/sprint-flow/references/orchestration-rules.md +1 -1
  72. package/plugins/claude-code/skills/sprint-flow/references/phase-1-prep.md +1 -1
  73. package/plugins/claude-code/skills/sprint-flow/references/phase-2-design.md +24 -14
  74. package/plugins/claude-code/skills/sprint-flow/references/phase-4-verify.md +6 -6
  75. package/plugins/claude-code/skills/sprint-flow/references/phase-overview.md +2 -2
  76. package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +4 -4
  77. package/plugins/dsh/README.md +25 -0
  78. package/plugins/dsh/cordis.patch.yml +7 -0
  79. package/plugins/dsh/package.json +70 -0
  80. package/plugins/dsh/scripts/prepack.cjs +82 -0
  81. package/plugins/dsh/skills/admin-template-guidelines/SKILL.md +113 -0
  82. package/plugins/dsh/skills/admin-template-guidelines/references/rule-1.md +91 -0
  83. package/plugins/dsh/skills/admin-template-guidelines/references/rule-2.md +155 -0
  84. package/plugins/dsh/skills/admin-template-guidelines/references/rule-3.md +70 -0
  85. package/plugins/dsh/skills/admin-template-guidelines/references/rule-4.md +154 -0
  86. package/plugins/dsh/skills/admin-template-guidelines/references/rule-5.md +126 -0
  87. package/plugins/dsh/skills/admin-template-guidelines/references/rule-6.md +180 -0
  88. package/plugins/dsh/skills/batch-grill-me/SKILL.md +15 -0
  89. package/plugins/dsh/skills/clipboard-vision/SKILL.md +47 -0
  90. package/plugins/dsh/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
  91. package/plugins/dsh/skills/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
  92. package/plugins/dsh/skills/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
  93. package/plugins/dsh/skills/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
  94. package/plugins/dsh/skills/clipboard-vision/describe-clipboard.ps1 +115 -0
  95. package/plugins/dsh/skills/clipboard-vision/describe-clipboard.sh +161 -0
  96. package/plugins/dsh/skills/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
  97. package/plugins/dsh/skills/clipboard-vision/scripts/clipboard-vision.sh +137 -0
  98. package/plugins/dsh/skills/delphi-review/.delphi-config.json.example +70 -0
  99. package/plugins/dsh/skills/delphi-review/AGENTS.md +67 -0
  100. package/plugins/dsh/skills/delphi-review/INSTALL.md +150 -0
  101. package/plugins/dsh/skills/delphi-review/SKILL.md +559 -0
  102. package/plugins/dsh/skills/delphi-review/hooks.md +19 -0
  103. package/plugins/dsh/skills/delphi-review/opencode.json.delphi.example +52 -0
  104. package/plugins/dsh/skills/delphi-review/references/code-walkthrough.md +470 -0
  105. package/plugins/dsh/skills/delphi-review/references/orchestrator-dispatch.md +64 -0
  106. package/plugins/dsh/skills/delphi-review/references/requirements.md +402 -0
  107. package/plugins/dsh/skills/delphi-review/references/round-templates.md +134 -0
  108. package/plugins/dsh/skills/delphi-review/scripts/verify-consensus.sh +43 -0
  109. package/plugins/dsh/skills/delphi-review/tools.md +29 -0
  110. package/plugins/dsh/skills/domain-modeling/ADR-FORMAT.md +64 -0
  111. package/plugins/dsh/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
  112. package/plugins/dsh/skills/domain-modeling/SKILL.md +74 -0
  113. package/plugins/dsh/skills/grill-with-docs/SKILL.md +7 -0
  114. package/plugins/dsh/skills/grilling/SKILL.md +12 -0
  115. package/plugins/dsh/skills/improve-codebase-architecture/SKILL.md +156 -0
  116. package/plugins/dsh/skills/ralph-loop/SKILL.md +198 -0
  117. package/plugins/dsh/skills/ralph-loop/references/components.md +113 -0
  118. package/plugins/dsh/skills/ralph-loop/references/phase-2-build-ralph.md +89 -0
  119. package/plugins/dsh/skills/ralph-loop/references/workflow-details.md +99 -0
  120. package/plugins/dsh/skills/ralph-loop/templates/progress-log.md +36 -0
  121. package/plugins/dsh/skills/sprint-flow/AGENTS.md +103 -0
  122. package/plugins/dsh/skills/sprint-flow/SKILL.md +411 -0
  123. package/plugins/dsh/skills/sprint-flow/__tests__/sprint-flow.test.cjs +457 -0
  124. package/plugins/dsh/skills/sprint-flow/hooks.md +18 -0
  125. package/plugins/dsh/skills/sprint-flow/references/components/memory.md +87 -0
  126. package/plugins/dsh/skills/sprint-flow/references/components/middleware.md +75 -0
  127. package/plugins/dsh/skills/sprint-flow/references/components/skill-invocations.md +105 -0
  128. package/plugins/dsh/skills/sprint-flow/references/components/system-prompt.md +27 -0
  129. package/plugins/dsh/skills/sprint-flow/references/components/tool-descriptions.md +95 -0
  130. package/plugins/dsh/skills/sprint-flow/references/force-levels.md +204 -0
  131. package/plugins/dsh/skills/sprint-flow/references/orchestration-rules.md +236 -0
  132. package/plugins/dsh/skills/sprint-flow/references/phase-1-prep.md +294 -0
  133. package/plugins/dsh/skills/sprint-flow/references/phase-2-design.md +273 -0
  134. package/plugins/dsh/skills/sprint-flow/references/phase-3-build.md +348 -0
  135. package/plugins/dsh/skills/sprint-flow/references/phase-4-verify.md +225 -0
  136. package/plugins/dsh/skills/sprint-flow/references/phase-5-ship.md +222 -0
  137. package/plugins/dsh/skills/sprint-flow/references/phase-6-close.md +266 -0
  138. package/plugins/dsh/skills/sprint-flow/references/phase-overview.md +486 -0
  139. package/plugins/dsh/skills/sprint-flow/scripts/verify-sprint-state.sh +38 -0
  140. package/plugins/dsh/skills/sprint-flow/templates/auto-estimate-learning-log.md +136 -0
  141. package/plugins/dsh/skills/sprint-flow/templates/auto-estimate-output-template.md +110 -0
  142. package/plugins/dsh/skills/sprint-flow/templates/emergent-issues-template.md +120 -0
  143. package/plugins/dsh/skills/sprint-flow/templates/pain-document-template.md +115 -0
  144. package/plugins/dsh/skills/sprint-flow/templates/sprint-progress-template.md +140 -0
  145. package/plugins/dsh/skills/sprint-flow/templates/sprint-summary-template.md +121 -0
  146. package/plugins/dsh/skills/sprint-flow/tools.md +29 -0
  147. package/plugins/dsh/skills/test-driven-development/SKILL.md +371 -0
  148. package/plugins/dsh/skills/test-driven-development/testing-anti-patterns.md +299 -0
  149. package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +56 -0
  150. package/plugins/dsh/skills/test-specification-alignment/SKILL.md +205 -0
  151. package/plugins/dsh/skills/test-specification-alignment/references/alignment-verification-algorithm.md +493 -0
  152. package/plugins/dsh/skills/test-specification-alignment/references/phase2-constraint-enforcement.md +431 -0
  153. package/plugins/dsh/skills/test-specification-alignment/references/specification-format.md +348 -0
  154. package/plugins/dsh/skills/to-issues/SKILL.md +277 -0
  155. package/plugins/dsh/src/command.test.ts +102 -0
  156. package/plugins/dsh/src/command.ts +75 -0
  157. package/plugins/dsh/src/contract.test.ts +62 -0
  158. package/plugins/dsh/src/gate-runner.test.ts +100 -0
  159. package/plugins/dsh/src/gate-runner.ts +58 -0
  160. package/plugins/dsh/src/index.test.ts +97 -0
  161. package/plugins/dsh/src/index.ts +94 -0
  162. package/plugins/dsh/src/skills.test.ts +58 -0
  163. package/plugins/dsh/tsconfig.build.json +13 -0
  164. package/plugins/dsh/tsconfig.json +19 -0
  165. package/plugins/dsh/vitest.config.ts +8 -0
  166. package/plugins/opencode/package.json +1 -1
  167. package/plugins/opencode/scripts/prepack.cjs +1 -0
  168. package/plugins/opencode/skills/clipboard-vision/SKILL.md +47 -0
  169. package/plugins/opencode/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
  170. package/plugins/opencode/skills/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
  171. package/plugins/opencode/skills/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
  172. package/plugins/opencode/skills/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
  173. package/plugins/opencode/skills/clipboard-vision/describe-clipboard.ps1 +115 -0
  174. package/plugins/opencode/skills/clipboard-vision/describe-clipboard.sh +161 -0
  175. package/plugins/opencode/skills/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
  176. package/plugins/opencode/skills/clipboard-vision/scripts/clipboard-vision.sh +137 -0
  177. package/plugins/opencode/skills/delphi-review/.delphi-config.json.example +24 -27
  178. package/plugins/opencode/skills/delphi-review/AGENTS.md +13 -12
  179. package/plugins/opencode/skills/delphi-review/INSTALL.md +15 -17
  180. package/plugins/opencode/skills/delphi-review/SKILL.md +30 -29
  181. package/plugins/opencode/skills/delphi-review/opencode.json.delphi.example +6 -10
  182. package/plugins/opencode/skills/delphi-review/references/code-walkthrough.md +33 -49
  183. package/plugins/opencode/skills/delphi-review/references/requirements.md +66 -54
  184. package/plugins/opencode/skills/delphi-review/references/round-templates.md +7 -7
  185. package/plugins/opencode/skills/sprint-flow/AGENTS.md +5 -5
  186. package/plugins/opencode/skills/sprint-flow/SKILL.md +4 -4
  187. package/plugins/opencode/skills/sprint-flow/references/components/skill-invocations.md +2 -2
  188. package/plugins/opencode/skills/sprint-flow/references/force-levels.md +37 -35
  189. package/plugins/opencode/skills/sprint-flow/references/orchestration-rules.md +1 -1
  190. package/plugins/opencode/skills/sprint-flow/references/phase-1-prep.md +1 -1
  191. package/plugins/opencode/skills/sprint-flow/references/phase-2-design.md +24 -14
  192. package/plugins/opencode/skills/sprint-flow/references/phase-4-verify.md +6 -6
  193. package/plugins/opencode/skills/sprint-flow/references/phase-overview.md +2 -2
  194. package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +4 -4
  195. package/plugins/qoder/plugin.json +1 -1
  196. package/plugins/qoder/skills/clipboard-vision/SKILL.md +47 -0
  197. package/plugins/qoder/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
  198. package/plugins/qoder/skills/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
  199. package/plugins/qoder/skills/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
  200. package/plugins/qoder/skills/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
  201. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/SKILL.md +47 -0
  202. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
  203. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
  204. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
  205. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
  206. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
  207. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/scripts/clipboard-vision.sh +137 -0
  208. package/plugins/qoder/skills/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
  209. package/plugins/qoder/skills/clipboard-vision/scripts/clipboard-vision.sh +137 -0
  210. package/plugins/qoder/skills/delphi-review/.delphi-config.json.example +3 -11
  211. package/plugins/qoder/skills/delphi-review/AGENTS.md +15 -17
  212. package/plugins/qoder/skills/delphi-review/INSTALL.md +12 -12
  213. package/plugins/qoder/skills/delphi-review/SKILL.md +58 -25
  214. package/plugins/qoder/skills/delphi-review/opencode.json.delphi.example +1 -1
  215. package/plugins/qoder/skills/delphi-review/references/code-walkthrough.md +33 -49
  216. package/plugins/qoder/skills/sprint-flow/AGENTS.md +5 -5
  217. package/plugins/qoder/skills/sprint-flow/SKILL.md +2 -2
  218. package/plugins/qoder/skills/sprint-flow/references/force-levels.md +38 -35
  219. package/plugins/qoder/skills/sprint-flow/references/phase-1-prep.md +1 -1
  220. package/plugins/qoder/skills/sprint-flow/references/phase-2-design.md +48 -6
  221. package/plugins/qoder/skills/sprint-flow/references/phase-4-verify.md +5 -6
  222. package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +4 -4
  223. package/principles/AGENTS.md +4 -4
  224. package/scripts/__tests__/sync-package-content.test.js +30 -0
  225. package/scripts/delphi-external-review.cjs +194 -63
  226. package/scripts/sync-package-content.js +9 -2
  227. package/skills/clipboard-vision/SKILL.md +47 -0
  228. package/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
  229. package/skills/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
  230. package/skills/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
  231. package/skills/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
  232. package/skills/clipboard-vision/describe-clipboard.ps1 +115 -0
  233. package/skills/clipboard-vision/describe-clipboard.sh +161 -0
  234. package/skills/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
  235. package/skills/clipboard-vision/scripts/clipboard-vision.sh +137 -0
  236. package/skills/delphi-review/.delphi-config.json.example +24 -27
  237. package/skills/delphi-review/AGENTS.md +13 -12
  238. package/skills/delphi-review/INSTALL.md +15 -17
  239. package/skills/delphi-review/SKILL.md +30 -29
  240. package/skills/delphi-review/opencode.json.delphi.example +6 -10
  241. package/skills/delphi-review/references/code-walkthrough.md +33 -49
  242. package/skills/delphi-review/references/requirements.md +66 -54
  243. package/skills/delphi-review/references/round-templates.md +7 -7
  244. package/skills/sprint-flow/AGENTS.md +5 -5
  245. package/skills/sprint-flow/SKILL.md +4 -4
  246. package/skills/sprint-flow/references/components/skill-invocations.md +2 -2
  247. package/skills/sprint-flow/references/force-levels.md +37 -35
  248. package/skills/sprint-flow/references/orchestration-rules.md +1 -1
  249. package/skills/sprint-flow/references/phase-1-prep.md +1 -1
  250. package/skills/sprint-flow/references/phase-2-design.md +24 -14
  251. package/skills/sprint-flow/references/phase-4-verify.md +6 -6
  252. package/skills/sprint-flow/references/phase-overview.md +2 -2
  253. package/skills/test-specification-alignment/AGENTS.md +4 -4
  254. package/sprint-gate.sh +291 -0
@@ -59,13 +59,15 @@ grill-with-docs 执行:
59
59
  grill 访谈达成共享理解后(或 CONTEXT.md 快速路径下读取已有上下文后)、设计文档生成前,调用需求评审:
60
60
 
61
61
  ```
62
- npx xp-gate delphi-review --mode requirements
62
+ /delphi-review --mode requirements
63
63
  ```
64
64
 
65
- **评审配置**(轻量):
65
+ 这是 Agent skill 调用,不是 `xp-gate` npm CLI 子命令。Skill orchestrator 必须分别调用 per-expert runner 三次,每次保留 `--expert <architecture|technical|feasibility> --mode requirements`,再聚合三份结果;禁止用一个 runner 进程执行全部模型。
66
+
67
+ **评审配置**:
66
68
  - 复用现有 3 专家(architecture/feasibility/technical),`--mode requirements` 切换评审焦点提示词
67
- - 轻量配置:2 专家、1 轮
68
- - lightweight sprint(`change_type == "修改已存在代码"`):跳过 R1,需求评审合并入 R2
69
+ - 所有路径固定使用 3 专家,Round 1 独立执行并验证 distinct model IDs,最多 5 轮
70
+ - force level 只调整上下文深度与迭代预算;所有路径都执行 R1,不减少专家数
69
71
 
70
72
  **评审焦点**:
71
73
  - 用户场景遗漏
@@ -81,8 +83,16 @@ npx xp-gate delphi-review --mode requirements
81
83
  {
82
84
  "verdict": "APPROVED | GAPS_FOUND",
83
85
  "timestamp": "<ISO 8601>",
84
- "requirements_hash": "<SHA-256 of 需求陈述 + CONTEXT.md 内容>",
85
- "experts": 2,
86
+ "requirements_statement": "<被评审的原始需求陈述>",
87
+ "context_file_used": "CONTEXT.md | null",
88
+ "requirements_hash": "<SHA-256 of requirements_statement + context file exact UTF-8 content if used + timestamp YYYY-MM-DD>",
89
+ "head_commit": "<git rev-parse HEAD>",
90
+ "consensus_ratio": 1.0,
91
+ "expert_verdicts": [
92
+ { "role": "architecture", "verdict": "APPROVED", "result_type": "delphi_expert_result", "requested_model": "provider/model-a" },
93
+ { "role": "technical", "verdict": "APPROVED", "result_type": "delphi_expert_result", "requested_model": "provider/model-b" },
94
+ { "role": "feasibility", "verdict": "APPROVED", "result_type": "delphi_expert_result", "requested_model": "provider/model-c" }
95
+ ],
86
96
  "rounds": 1,
87
97
  "gaps": []
88
98
  }
@@ -90,10 +100,10 @@ npx xp-gate delphi-review --mode requirements
90
100
 
91
101
  **GAPS_FOUND 处理**:
92
102
  - 回到 Step 1 补充访谈(或补充 CONTEXT.md 内容)
93
- - 最多 2 轮循环后升级给用户决策
103
+ - 最多 5 轮循环后升级给用户决策
94
104
 
95
105
  **程序化校验**:
96
- - `phase-transition 2 completed` 校验该文件存在、`verdict=APPROVED` 且 `requirements_hash` 匹配当前需求内容
106
+ - `phase-transition 2 completed` 校验 schema-v2 必填字段、`verdict=APPROVED`、三份专家证据、`consensus_ratio`、当前 HEAD,并从需求陈述、可选 context 文件和 timestamp 日期重新计算 `requirements_hash`
97
107
  - 不匹配 → BLOCK(防陈旧绑定)
98
108
 
99
109
  ### Step 3: 原生设计文档生成
@@ -125,7 +135,7 @@ orchestrator 基于访谈记录 + CONTEXT.md + R1 评审结论生成设计文档
125
135
 
126
136
  | 暂停点 | 触发条件 | 用户操作 | 自动恢复条件 |
127
137
  |--------|---------|---------|-------------|
128
- | R1 GAPS_FOUND | 需求评审发现缺口 | 补充访谈/上下文 | 重新 R1 评审(最多 2 轮) |
138
+ | R1 GAPS_FOUND | 需求评审发现缺口 | 补充访谈/上下文 | 重新 R1 评审(最多 5 轮) |
129
139
  | **HARD-GATE** | 设计文档未 APPROVED | 用户审批设计文档 | 设计 APPROVED 后自动进入 Part B |
130
140
 
131
141
  ### 输出
@@ -149,7 +159,7 @@ orchestrator 基于访谈记录 + CONTEXT.md + R1 评审结论生成设计文档
149
159
 
150
160
  IF change_type == "修改已存在代码":
151
161
  → 增量优化路径: SKIP batch-grill-me
152
- → 直接进入 Step 7: lightweight R2 delphi-review (2 专家, 1 轮)
162
+ → 直接进入 Step 7: R2 delphi-review(3 专家,最多 5 轮)
153
163
  ELSE (change_type == "新增功能" 或 未定义):
154
164
  → 标准路径: 继续 Step 6 (batch-grill-me) → Step 7
155
165
  ```
@@ -158,7 +168,7 @@ ELSE (change_type == "新增功能" 或 未定义):
158
168
 
159
169
  | change_type | batch-grill-me | R2 delphi-review |
160
170
  |------------|----------------|------------------|
161
- | `修改已存在代码` | ❌ SKIP | lightweight (2 专家, 1 轮) |
171
+ | `修改已存在代码` | ❌ SKIP | 3 专家,最多 5 轮 |
162
172
  | `新增功能` | ✅ 执行 | 标准 (3 专家) |
163
173
  | `undefined` / 缺失 | ✅ 执行 | 标准 (3 专家) |
164
174
 
@@ -183,12 +193,12 @@ batch-grill-me 替代 autoplan 的 taste_decisions 功能:
183
193
  # 标准路径(3 专家)
184
194
  skill(name="delphi-review", user_message="[设计文档 + batch-grill-me 决策结果]")
185
195
 
186
- # 增量优化路径(2 专家, 1 轮 — 来自 Step 5 路由)
187
- skill(name="delphi-review", user_message="[设计文档]", experts=2, max_rounds=1)
196
+ # 增量优化路径(3 专家,最多 5 轮)
197
+ skill(name="delphi-review", user_message="[设计文档]", experts=3, max_rounds=5)
188
198
  ```
189
199
 
190
200
  - **标准路径**: Round 1: 3 专家匿名独立评审 → Round 2+: 交换意见直到共识
191
- - **增量优化路径**: 2 专家, 1 轮
201
+ - **增量优化路径**: 3 专家,最多 5 轮
192
202
  - ≥90% 共识 + APPROVED 才通过
193
203
  - 输出: APPROVED / REQUEST_CHANGES
194
204
 
@@ -18,7 +18,7 @@ Web 前端项目额外增加:原生 UI 审查 + 可选增强。
18
18
  ### 调用 Skills
19
19
 
20
20
  **所有项目(原生 HARD-GATE 链)**:
21
- - `delphi-review --mode code-walkthrough` — 多专家匿名代码走查(2-3 domestic models, ≥90% consensus)
21
+ - `delphi-review --mode code-walkthrough` — 三位专家匿名代码走查,验证三个 distinct requested_model 并聚合 ≥90% consensus
22
22
  - `test-specification-alignment` — 测试与 Spec 对齐验证(#367 程序化 HARD-GATE)
23
23
  - `xp-gate check --all` — 全量质量门禁(Gate 0–9,含安全审计)
24
24
 
@@ -50,11 +50,11 @@ ELSE → SKIP 并记录 "[sprint-flow] 浏览器验证 SKIP(无可用浏览器
50
50
  skill(name="delphi-review", user_message="--mode code-walkthrough")
51
51
  ```
52
52
 
53
- - 2-3 位国内模型专家匿名独立评审(DeepSeek-v4-pro + Kimi-K2.6 + Qwen3.6-Plus)
54
- - Round 1: 匿名独立评审(防止 anchoring bias)
55
- - Round 2: 交换意见,响应关切
56
- - Round 3: 最终立场(如需)
57
- - ≥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
+ - 任一失败或模型重复都阻断,不降级为少数专家
58
58
 
59
59
  **如果 REQUEST_CHANGES**: 暂停等待用户处理 → 修复后重新评审。**如果 APPROVED**: 写入 `.code-walkthrough-result.json`(1 小时有效期)→ 进入 Step 2。
60
60
 
@@ -36,7 +36,7 @@ Sprint Flow is NOT just a sequential launcher of existing skills. Here's what ma
36
36
 
37
37
  1. **40-67% Token Savings via Ralph Loop**: Phase 3 BUILD default (`ralph-loop`) processes one REQ at a time with clean context, avoiding the linear context accumulation that costs 150K+ tokens in parallel mode.
38
38
 
39
- 2. **HARD-GATE Discipline**: Design must pass Delphi review (≥90% consensus, ≥2 model providers, domestic models only) before Phase 3 BUILD can start. This is enforced both in SKILL.md instructions and via the Claude Code plugin's PreToolUse hook.
39
+ 2. **HARD-GATE Discipline**: Design must pass Delphi review with all three expert roles executed successfully, three distinct requested model IDs verified, and ≥90% aggregate consensus within five rounds before Phase 3 BUILD can start. This is enforced both in SKILL.md instructions and via the Claude Code plugin's PreToolUse hook.
40
40
 
41
41
  3. **Emergent Requirements Acknowledgment**: Based on research showing 78% of failures are invisible to AI (arXiv study), Phase 6 CLOSE includes mandatory manual UAT verification — cannot be automated, skipped, or bypassed.
42
42
 
@@ -155,7 +155,7 @@ Sprint Flow: PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE
155
155
  **快速参考**:
156
156
  - **Step 0: CONTEXT.md 预检 (#322)**: 存在则 SKIP grill 访谈,但 R1 需求评审仍执行(CONTEXT.md 可能陈旧)
157
157
  - **Step 1: grill-with-docs** — `skill(name="grill-with-docs")` — 逐个追问 + CONTEXT.md/ADR 沉淀。**HARD-GATE**: 设计未批准 → 不可进入实现
158
- - **Step 2: R1 需求评审 (#368)** — `npx xp-gate delphi-review --mode requirements` — 轻量 2 专家 1 轮,输出 requirements-reviewed.json(含 requirements_hash 防陈旧绑定)。lightweight sprint 跳过 R1 合并入 R2
158
+ - **Step 2: R1 需求评审 (#368)** — `/delphi-review --mode requirements` Agent skill — 所有路径都由三专家独立执行,验证 distinct model IDs 后聚合 ≥90% 共识,输出 requirements-reviewed.json(含可重新计算的 requirements_hash 与 exact-HEAD 防陈旧绑定)
159
159
  - **Step 3: 原生设计文档生成** — `docs/plans/YYYY-MM-DD-<topic>-design.md`(需求摘要、2-3 方案、推荐、成功标准)
160
160
  - **Step 4: HARD-GATE APPROVAL** — 用户审批设计文档
161
161
  - **Step 5: 路由分叉** — `change_type == "修改已存在代码"` → SKIP batch-grill-me, lightweight R2
@@ -1,9 +1,9 @@
1
1
  # SKILLS/TEST-SPECIFICATION-ALIGNMENT KNOWLEDGE BASE
2
2
 
3
- **Generated:** 2026-07-29
4
- **Commit:** 05d23ae
5
- **Branch:** main
6
- **Version:** 0.18.5.0
3
+ **Generated:** 2026-08-24
4
+ **Commit:** a1a4683
5
+ **Branch:** dsh-plugin
6
+ **Version:** 0.19.0.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
package/sprint-gate.sh ADDED
@@ -0,0 +1,291 @@
1
+ #!/bin/bash
2
+ # sprint-gate.sh — Sprint Flow Validation Gate
3
+ #
4
+ # PURPOSE: Enforce Sprint Flow phase discipline at git hook level.
5
+ # Validates delphi-review approval, sprint state, and specification
6
+ # artifacts before allowing commits and pushes on sprint branches.
7
+ #
8
+ # INTEGRATION: Called from pre-commit (Gate 10) and pre-push (Gate S),
9
+ # or run independently for CI/manual validation.
10
+ #
11
+ # USAGE:
12
+ # sprint-gate.sh --pre-commit # Validate before commit
13
+ # sprint-gate.sh --pre-push # Validate before push
14
+ #
15
+ # MECHANISM:
16
+ # --pre-commit:
17
+ # - If .sprint-state/ missing → SKIP (not a sprint project)
18
+ # - If sprint-state.json missing/invalid → SKIP (non-sprint commit)
19
+ # - If phase >= 1 (PLAN completed) and delphi-reviewed.json missing → DENY
20
+ # - If delphi-reviewed.json exists, verdict must be "APPROVED"
21
+ # - If jq AND node unavailable → WARN but ALLOW (graceful degradation)
22
+ # - If jq unavailable but node available → use Node.js JSON parser fallback
23
+ #
24
+ # --pre-push:
25
+ # - If .sprint-state/ missing → SKIP
26
+ # - If branch doesn't match sprint/* → SKIP
27
+ # - If delphi-reviewed.json missing or verdict != "APPROVED" → DENY
28
+ # - If phase < 2 (BUILD not started) → DENY
29
+ # - If phase >= 2 and specification.yaml missing → DENY
30
+ # - If jq AND node unavailable → DENY (cannot verify verdict)
31
+ #
32
+ # GRACEFUL DEGRADATION:
33
+ # - If .sprint-state/ directory doesn't exist → SKIP (not a sprint project)
34
+ # - If sprint-state.json is missing/invalid → SKIP (non-sprint commit)
35
+ # - JSON parser fallback chain: jq → Node.js → explicit degradation message
36
+ #
37
+ # OUTPUT: JSON to stdout — {"decision":"allow|deny|skip",...}
38
+ # EXIT: 0 = pass/skip, 1 = block
39
+
40
+ set -euo pipefail
41
+
42
+ # --- Argument parsing ---
43
+ MODE=""
44
+ case "${1:-}" in
45
+ --pre-commit) MODE="pre-commit" ;;
46
+ --pre-push) MODE="pre-push" ;;
47
+ *)
48
+ echo '{"decision":"deny","reason":"Usage: sprint-gate.sh --pre-commit | --pre-push"}'
49
+ exit 1
50
+ ;;
51
+ esac
52
+
53
+ # --- Locate repo root and sprint state ---
54
+ REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null)" || {
55
+ echo '{"decision":"skip","reason":"not inside a git repository"}'
56
+ exit 0
57
+ }
58
+
59
+ SPRINT_STATE_DIR="$REPO_ROOT/.sprint-state"
60
+ SPRINT_STATE_JSON="$SPRINT_STATE_DIR/sprint-state.json"
61
+ APPROVED_FILE="$SPRINT_STATE_DIR/delphi-reviewed.json"
62
+
63
+ # If no .sprint-state directory, this isn't a sprint project → SKIP
64
+ if [ ! -d "$SPRINT_STATE_DIR" ]; then
65
+ echo '{"decision":"skip","reason":"not a sprint project"}'
66
+ exit 0
67
+ fi
68
+
69
+ # --- Helper: check tool availability ---
70
+ HAS_JQ=false
71
+ if command -v jq &>/dev/null; then
72
+ HAS_JQ=true
73
+ fi
74
+
75
+ HAS_NODE=false
76
+ if command -v node &>/dev/null; then
77
+ HAS_NODE=true
78
+ fi
79
+
80
+ # JSON_PARSER: "jq" | "node" | "none"
81
+ if $HAS_JQ; then
82
+ JSON_PARSER="jq"
83
+ elif $HAS_NODE; then
84
+ JSON_PARSER="node"
85
+ else
86
+ JSON_PARSER="none"
87
+ fi
88
+
89
+ # --- Helper: validate JSON file ---
90
+ # Returns 0 if valid, 1 if invalid or no parser available
91
+ json_validate() {
92
+ local file="$1"
93
+ if [ ! -f "$file" ]; then
94
+ return 1
95
+ fi
96
+ case "$JSON_PARSER" in
97
+ jq)
98
+ jq empty "$file" 2>/dev/null
99
+ return $?
100
+ ;;
101
+ node)
102
+ node -e "try{JSON.parse(require('fs').readFileSync('$file','utf8'));process.exit(0)}catch(e){process.exit(1)}" 2>/dev/null
103
+ return $?
104
+ ;;
105
+ *)
106
+ return 1
107
+ ;;
108
+ esac
109
+ }
110
+
111
+ # --- Helper: extract JSON field ---
112
+ # Usage: json_extract <file> <jq-filter>
113
+ # jq-filter is a jq expression like '.phase // -1' or '.verdict // ""'
114
+ # Falls back to Node.js when jq is unavailable
115
+ json_extract() {
116
+ local file="$1"
117
+ local filter="$2"
118
+ case "$JSON_PARSER" in
119
+ jq)
120
+ jq -r "$filter" "$file" 2>/dev/null
121
+ return $?
122
+ ;;
123
+ node)
124
+ # Translate simple jq filters to Node.js
125
+ # Supports: .field // default patterns
126
+ local field default_val
127
+ field=$(echo "$filter" | sed 's/^\.//;s/ *\/\/.*$//')
128
+ default_val=$(echo "$filter" | sed -n 's/.*\/\/ *//p')
129
+ node -e "
130
+ try {
131
+ var d=JSON.parse(require('fs').readFileSync('$file','utf8'));
132
+ var v=d['${field}'];
133
+ if(v===undefined||v===null){v=${default_val:-null}}
134
+ process.stdout.write(String(v));
135
+ }catch(e){process.stdout.write('${default_val:-}');process.exit(1)}
136
+ " 2>/dev/null
137
+ return $?
138
+ ;;
139
+ *)
140
+ echo ""
141
+ return 1
142
+ ;;
143
+ esac
144
+ }
145
+
146
+ # --- Helper: read phase from sprint-state.json ---
147
+ # Returns phase number or -1 if unreadable
148
+ read_phase() {
149
+ if [ ! -f "$SPRINT_STATE_JSON" ]; then
150
+ echo "-1"
151
+ return
152
+ fi
153
+ if [ "$JSON_PARSER" = "none" ]; then
154
+ echo "-1"
155
+ return
156
+ fi
157
+ if ! json_validate "$SPRINT_STATE_JSON"; then
158
+ echo "-1"
159
+ return
160
+ fi
161
+ local phase
162
+ phase=$(json_extract "$SPRINT_STATE_JSON" '.phase // -1') || phase="-1"
163
+ echo "$phase"
164
+ }
165
+
166
+ # --- Helper: read delphi verdict ---
167
+ # Returns verdict string or empty if unreadable
168
+ read_verdict() {
169
+ if [ ! -f "$APPROVED_FILE" ]; then
170
+ echo ""
171
+ return
172
+ fi
173
+ if [ "$JSON_PARSER" = "none" ]; then
174
+ echo ""
175
+ return
176
+ fi
177
+ if ! json_validate "$APPROVED_FILE"; then
178
+ echo ""
179
+ return
180
+ fi
181
+ json_extract "$APPROVED_FILE" '.verdict // ""' || echo ""
182
+ }
183
+
184
+ # --- Pre-commit mode ---
185
+ if [ "$MODE" = "pre-commit" ]; then
186
+ PHASE=$(read_phase)
187
+
188
+ # If sprint-state.json is missing or invalid, skip (non-sprint commit)
189
+ if [ "$PHASE" = "-1" ]; then
190
+ if [ ! -f "$SPRINT_STATE_JSON" ]; then
191
+ echo '{"decision":"skip","reason":"sprint-state.json not found, non-sprint commit"}'
192
+ else
193
+ echo '{"decision":"skip","warning":"sprint-state.json is not valid JSON or no JSON parser available (install jq or node), allowing commit"}'
194
+ fi
195
+ exit 0
196
+ fi
197
+
198
+ # Phase >= 1 means PLAN is completed — delphi-review must be APPROVED
199
+ if [ "$PHASE" -ge 1 ] 2>/dev/null; then
200
+ # Check if delphi-reviewed.json exists
201
+ if [ ! -f "$APPROVED_FILE" ]; then
202
+ echo '{"decision":"deny","reason":"delphi-review not APPROVED. Complete Phase 1 before committing code changes."}'
203
+ exit 1
204
+ fi
205
+
206
+ # If no JSON parser available, warn but allow (graceful degradation)
207
+ if [ "$JSON_PARSER" = "none" ]; then
208
+ echo '{"decision":"allow","warning":"neither jq nor node available, cannot verify delphi-review verdict. Install jq or node for full protection."}'
209
+ exit 0
210
+ fi
211
+
212
+ # Validate delphi-reviewed.json is valid JSON
213
+ if ! json_validate "$APPROVED_FILE"; then
214
+ echo '{"decision":"deny","reason":"delphi-reviewed.json is not valid JSON. Re-run: /delphi-review"}'
215
+ exit 1
216
+ fi
217
+
218
+ # Check verdict
219
+ VERDICT=$(read_verdict)
220
+ if [ "$VERDICT" != "APPROVED" ]; then
221
+ echo "{\"decision\":\"deny\",\"reason\":\"delphi-review verdict is '${VERDICT}', not APPROVED. Fix issues and re-run: /delphi-review\"}"
222
+ exit 1
223
+ fi
224
+
225
+ # All checks passed
226
+ echo "{\"decision\":\"allow\",\"message\":\"delphi-review APPROVED, sprint phase ${PHASE} validated\"}"
227
+ exit 0
228
+ fi
229
+
230
+ # Phase < 1 (pre-PLAN) — no delphi enforcement needed
231
+ echo "{\"decision\":\"allow\",\"reason\":\"sprint phase ${PHASE} (pre-PLAN), no delphi enforcement required\"}"
232
+ exit 0
233
+ fi
234
+
235
+ # --- Pre-push mode ---
236
+ if [ "$MODE" = "pre-push" ]; then
237
+ # Only enforce on sprint/* branches
238
+ BRANCH="$(git branch --show-current 2>/dev/null)" || BRANCH=""
239
+ case "$BRANCH" in
240
+ sprint/*) ;; # continue
241
+ *)
242
+ echo "{\"decision\":\"skip\",\"reason\":\"branch '${BRANCH}' does not match sprint/* pattern\"}"
243
+ exit 0
244
+ ;;
245
+ esac
246
+
247
+ # Validate sprint-state.json exists and is readable
248
+ PHASE=$(read_phase)
249
+ if [ "$PHASE" = "-1" ] && [ ! -f "$SPRINT_STATE_JSON" ]; then
250
+ echo "{\"decision\":\"deny\",\"reason\":\"sprint-state.json not found on sprint branch '${BRANCH}'\"}"
251
+ exit 1
252
+ fi
253
+
254
+ # Delphi review must be APPROVED
255
+ if [ ! -f "$APPROVED_FILE" ]; then
256
+ echo '{"decision":"deny","reason":"delphi-reviewed.json not found. Complete Phase 1 delphi-review before pushing."}'
257
+ exit 1
258
+ fi
259
+
260
+ if [ "$JSON_PARSER" = "none" ]; then
261
+ echo '{"decision":"deny","reason":"neither jq nor node available, cannot verify delphi-review verdict. Install jq or node to push from sprint branch."}'
262
+ exit 1
263
+ fi
264
+
265
+ if ! json_validate "$APPROVED_FILE"; then
266
+ echo '{"decision":"deny","reason":"delphi-reviewed.json is not valid JSON. Re-run: /delphi-review"}'
267
+ exit 1
268
+ fi
269
+
270
+ VERDICT=$(read_verdict)
271
+ if [ "$VERDICT" != "APPROVED" ]; then
272
+ echo "{\"decision\":\"deny\",\"reason\":\"delphi-review verdict is '${VERDICT}', not APPROVED. Fix issues and re-run: /delphi-review\"}"
273
+ exit 1
274
+ fi
275
+
276
+ # specification.yaml must exist (Phase 1 PLAN output)
277
+ SPEC_FILE="$REPO_ROOT/specification.yaml"
278
+ if [ ! -f "$SPEC_FILE" ]; then
279
+ # Also check sprint-state output directory
280
+ SPEC_FILE="$SPRINT_STATE_DIR/phase-outputs/specification.yaml"
281
+ if [ ! -f "$SPEC_FILE" ]; then
282
+ echo '{"decision":"deny","reason":"specification.yaml not found. Phase 1 PLAN must produce specification.yaml before pushing."}'
283
+ exit 1
284
+ fi
285
+ fi
286
+
287
+ # All checks passed — comprehensive success output
288
+ SPEC_SIZE=$(wc -c < "$SPEC_FILE" 2>/dev/null | tr -d ' ')
289
+ echo "{\"decision\":\"allow\",\"message\":\"sprint push validated\",\"branch\":\"${BRANCH}\",\"phase\":${PHASE},\"verdict\":\"APPROVED\",\"specification_size_bytes\":${SPEC_SIZE:-0}}"
290
+ exit 0
291
+ fi