@boyingliu01/xp-gate 0.18.4 → 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 (248) hide show
  1. package/adapter-common.sh +27 -0
  2. package/adapters/powershell.sh +85 -33
  3. package/adapters/typescript.sh +8 -8
  4. package/build-integrity/__tests__/import-resolver.test.ts +22 -0
  5. package/build-integrity/__tests__/orchestrator.test.ts +1 -2
  6. package/build-integrity/gate-10.ts +7 -0
  7. package/gate-12-file-hygiene.sh +230 -0
  8. package/hooks/adapter-common.sh +27 -0
  9. package/hooks/gate-10.sh +105 -0
  10. package/hooks/lib/validate-code-walkthrough.cjs +125 -0
  11. package/hooks/pre-commit +130 -33
  12. package/hooks/pre-push +15 -91
  13. package/lib/__tests__/check-version.test.js +67 -46
  14. package/lib/__tests__/doctor.test.js +7 -6
  15. package/lib/__tests__/gate-runner.test.js +267 -0
  16. package/lib/__tests__/init.test.js +32 -0
  17. package/lib/__tests__/npm-package.test.js +13 -0
  18. package/lib/__tests__/phase-transition.test.js +604 -12
  19. package/lib/__tests__/sprint-discovery.test.ts +0 -1
  20. package/lib/__tests__/sprint-status-rework.test.js +100 -1
  21. package/lib/__tests__/update-hooks.test.js +143 -10
  22. package/lib/__tests__/upgrade-exec.test.js +73 -45
  23. package/lib/__tests__/upgrade-skill-sync.test.js +1 -1
  24. package/lib/__tests__/upgrade.test.js +12 -11
  25. package/lib/doctor.js +2 -1
  26. package/lib/gate-runner.js +68 -23
  27. package/lib/init.js +34 -5
  28. package/lib/install-skill.js +1 -0
  29. package/lib/mattpocock-license-verdict.json +1 -1
  30. package/lib/phase-transition.js +203 -23
  31. package/lib/shared-paths.js +2 -0
  32. package/lib/sprint-status.js +15 -4
  33. package/lib/test-alignment.ts +3 -13
  34. package/lib/update-hooks.js +129 -15
  35. package/mock-policy/AGENTS.md +5 -5
  36. package/mock-policy/__tests__/gate-m3.test.ts +0 -5
  37. package/mock-policy/__tests__/scope-scanner.test.ts +8 -2
  38. package/mutation/AGENTS.md +4 -4
  39. package/mutation/__tests__/mutmut-runner.test.ts +443 -2
  40. package/mutation/__tests__/update-baseline.test.ts +0 -2
  41. package/mutation/runners/mutmut-runner.ts +67 -17
  42. package/package.json +9 -3
  43. package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
  44. package/plugins/claude-code/skills/clipboard-vision/SKILL.md +47 -0
  45. package/plugins/claude-code/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
  46. package/plugins/claude-code/skills/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
  47. package/plugins/claude-code/skills/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
  48. package/plugins/claude-code/skills/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
  49. package/plugins/claude-code/skills/clipboard-vision/describe-clipboard.ps1 +115 -0
  50. package/plugins/claude-code/skills/clipboard-vision/describe-clipboard.sh +161 -0
  51. package/plugins/claude-code/skills/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
  52. package/plugins/claude-code/skills/clipboard-vision/scripts/clipboard-vision.sh +137 -0
  53. package/plugins/claude-code/skills/delphi-review/.delphi-config.json.example +24 -27
  54. package/plugins/claude-code/skills/delphi-review/AGENTS.md +13 -12
  55. package/plugins/claude-code/skills/delphi-review/INSTALL.md +15 -17
  56. package/plugins/claude-code/skills/delphi-review/SKILL.md +30 -29
  57. package/plugins/claude-code/skills/delphi-review/opencode.json.delphi.example +6 -10
  58. package/plugins/claude-code/skills/delphi-review/references/code-walkthrough.md +33 -49
  59. package/plugins/claude-code/skills/delphi-review/references/requirements.md +66 -54
  60. package/plugins/claude-code/skills/delphi-review/references/round-templates.md +7 -7
  61. package/plugins/claude-code/skills/sprint-flow/AGENTS.md +5 -5
  62. package/plugins/claude-code/skills/sprint-flow/SKILL.md +4 -4
  63. package/plugins/claude-code/skills/sprint-flow/references/components/skill-invocations.md +2 -2
  64. package/plugins/claude-code/skills/sprint-flow/references/force-levels.md +37 -35
  65. package/plugins/claude-code/skills/sprint-flow/references/orchestration-rules.md +1 -1
  66. package/plugins/claude-code/skills/sprint-flow/references/phase-1-prep.md +1 -1
  67. package/plugins/claude-code/skills/sprint-flow/references/phase-2-design.md +24 -14
  68. package/plugins/claude-code/skills/sprint-flow/references/phase-4-verify.md +6 -6
  69. package/plugins/claude-code/skills/sprint-flow/references/phase-overview.md +2 -2
  70. package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +4 -4
  71. package/plugins/dsh/README.md +25 -0
  72. package/plugins/dsh/cordis.patch.yml +7 -0
  73. package/plugins/dsh/package.json +70 -0
  74. package/plugins/dsh/scripts/prepack.cjs +82 -0
  75. package/plugins/dsh/skills/admin-template-guidelines/SKILL.md +113 -0
  76. package/plugins/dsh/skills/admin-template-guidelines/references/rule-1.md +91 -0
  77. package/plugins/dsh/skills/admin-template-guidelines/references/rule-2.md +155 -0
  78. package/plugins/dsh/skills/admin-template-guidelines/references/rule-3.md +70 -0
  79. package/plugins/dsh/skills/admin-template-guidelines/references/rule-4.md +154 -0
  80. package/plugins/dsh/skills/admin-template-guidelines/references/rule-5.md +126 -0
  81. package/plugins/dsh/skills/admin-template-guidelines/references/rule-6.md +180 -0
  82. package/plugins/dsh/skills/batch-grill-me/SKILL.md +15 -0
  83. package/plugins/dsh/skills/clipboard-vision/SKILL.md +47 -0
  84. package/plugins/dsh/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
  85. package/plugins/dsh/skills/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
  86. package/plugins/dsh/skills/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
  87. package/plugins/dsh/skills/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
  88. package/plugins/dsh/skills/clipboard-vision/describe-clipboard.ps1 +115 -0
  89. package/plugins/dsh/skills/clipboard-vision/describe-clipboard.sh +161 -0
  90. package/plugins/dsh/skills/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
  91. package/plugins/dsh/skills/clipboard-vision/scripts/clipboard-vision.sh +137 -0
  92. package/plugins/dsh/skills/delphi-review/.delphi-config.json.example +70 -0
  93. package/plugins/dsh/skills/delphi-review/AGENTS.md +67 -0
  94. package/plugins/dsh/skills/delphi-review/INSTALL.md +150 -0
  95. package/plugins/dsh/skills/delphi-review/SKILL.md +559 -0
  96. package/plugins/dsh/skills/delphi-review/hooks.md +19 -0
  97. package/plugins/dsh/skills/delphi-review/opencode.json.delphi.example +52 -0
  98. package/plugins/dsh/skills/delphi-review/references/code-walkthrough.md +470 -0
  99. package/plugins/dsh/skills/delphi-review/references/orchestrator-dispatch.md +64 -0
  100. package/plugins/dsh/skills/delphi-review/references/requirements.md +402 -0
  101. package/plugins/dsh/skills/delphi-review/references/round-templates.md +134 -0
  102. package/plugins/dsh/skills/delphi-review/scripts/verify-consensus.sh +43 -0
  103. package/plugins/dsh/skills/delphi-review/tools.md +29 -0
  104. package/plugins/dsh/skills/domain-modeling/ADR-FORMAT.md +64 -0
  105. package/plugins/dsh/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
  106. package/plugins/dsh/skills/domain-modeling/SKILL.md +74 -0
  107. package/plugins/dsh/skills/grill-with-docs/SKILL.md +7 -0
  108. package/plugins/dsh/skills/grilling/SKILL.md +12 -0
  109. package/plugins/dsh/skills/improve-codebase-architecture/SKILL.md +156 -0
  110. package/plugins/dsh/skills/ralph-loop/SKILL.md +198 -0
  111. package/plugins/dsh/skills/ralph-loop/references/components.md +113 -0
  112. package/plugins/dsh/skills/ralph-loop/references/phase-2-build-ralph.md +89 -0
  113. package/plugins/dsh/skills/ralph-loop/references/workflow-details.md +99 -0
  114. package/plugins/dsh/skills/ralph-loop/templates/progress-log.md +36 -0
  115. package/plugins/dsh/skills/sprint-flow/AGENTS.md +103 -0
  116. package/plugins/dsh/skills/sprint-flow/SKILL.md +411 -0
  117. package/plugins/dsh/skills/sprint-flow/__tests__/sprint-flow.test.cjs +457 -0
  118. package/plugins/dsh/skills/sprint-flow/hooks.md +18 -0
  119. package/plugins/dsh/skills/sprint-flow/references/components/memory.md +87 -0
  120. package/plugins/dsh/skills/sprint-flow/references/components/middleware.md +75 -0
  121. package/plugins/dsh/skills/sprint-flow/references/components/skill-invocations.md +105 -0
  122. package/plugins/dsh/skills/sprint-flow/references/components/system-prompt.md +27 -0
  123. package/plugins/dsh/skills/sprint-flow/references/components/tool-descriptions.md +95 -0
  124. package/plugins/dsh/skills/sprint-flow/references/force-levels.md +204 -0
  125. package/plugins/dsh/skills/sprint-flow/references/orchestration-rules.md +236 -0
  126. package/plugins/dsh/skills/sprint-flow/references/phase-1-prep.md +294 -0
  127. package/plugins/dsh/skills/sprint-flow/references/phase-2-design.md +273 -0
  128. package/plugins/dsh/skills/sprint-flow/references/phase-3-build.md +348 -0
  129. package/plugins/dsh/skills/sprint-flow/references/phase-4-verify.md +225 -0
  130. package/plugins/dsh/skills/sprint-flow/references/phase-5-ship.md +222 -0
  131. package/plugins/dsh/skills/sprint-flow/references/phase-6-close.md +266 -0
  132. package/plugins/dsh/skills/sprint-flow/references/phase-overview.md +486 -0
  133. package/plugins/dsh/skills/sprint-flow/scripts/verify-sprint-state.sh +38 -0
  134. package/plugins/dsh/skills/sprint-flow/templates/auto-estimate-learning-log.md +136 -0
  135. package/plugins/dsh/skills/sprint-flow/templates/auto-estimate-output-template.md +110 -0
  136. package/plugins/dsh/skills/sprint-flow/templates/emergent-issues-template.md +120 -0
  137. package/plugins/dsh/skills/sprint-flow/templates/pain-document-template.md +115 -0
  138. package/plugins/dsh/skills/sprint-flow/templates/sprint-progress-template.md +140 -0
  139. package/plugins/dsh/skills/sprint-flow/templates/sprint-summary-template.md +121 -0
  140. package/plugins/dsh/skills/sprint-flow/tools.md +29 -0
  141. package/plugins/dsh/skills/test-driven-development/SKILL.md +371 -0
  142. package/plugins/dsh/skills/test-driven-development/testing-anti-patterns.md +299 -0
  143. package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +56 -0
  144. package/plugins/dsh/skills/test-specification-alignment/SKILL.md +205 -0
  145. package/plugins/dsh/skills/test-specification-alignment/references/alignment-verification-algorithm.md +493 -0
  146. package/plugins/dsh/skills/test-specification-alignment/references/phase2-constraint-enforcement.md +431 -0
  147. package/plugins/dsh/skills/test-specification-alignment/references/specification-format.md +348 -0
  148. package/plugins/dsh/skills/to-issues/SKILL.md +277 -0
  149. package/plugins/dsh/src/command.test.ts +102 -0
  150. package/plugins/dsh/src/command.ts +75 -0
  151. package/plugins/dsh/src/contract.test.ts +62 -0
  152. package/plugins/dsh/src/gate-runner.test.ts +100 -0
  153. package/plugins/dsh/src/gate-runner.ts +58 -0
  154. package/plugins/dsh/src/index.test.ts +97 -0
  155. package/plugins/dsh/src/index.ts +94 -0
  156. package/plugins/dsh/src/skills.test.ts +58 -0
  157. package/plugins/dsh/tsconfig.build.json +13 -0
  158. package/plugins/dsh/tsconfig.json +19 -0
  159. package/plugins/dsh/vitest.config.ts +8 -0
  160. package/plugins/opencode/package.json +1 -1
  161. package/plugins/opencode/scripts/prepack.cjs +1 -0
  162. package/plugins/opencode/skills/clipboard-vision/SKILL.md +47 -0
  163. package/plugins/opencode/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
  164. package/plugins/opencode/skills/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
  165. package/plugins/opencode/skills/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
  166. package/plugins/opencode/skills/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
  167. package/plugins/opencode/skills/clipboard-vision/describe-clipboard.ps1 +115 -0
  168. package/plugins/opencode/skills/clipboard-vision/describe-clipboard.sh +161 -0
  169. package/plugins/opencode/skills/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
  170. package/plugins/opencode/skills/clipboard-vision/scripts/clipboard-vision.sh +137 -0
  171. package/plugins/opencode/skills/delphi-review/.delphi-config.json.example +24 -27
  172. package/plugins/opencode/skills/delphi-review/AGENTS.md +13 -12
  173. package/plugins/opencode/skills/delphi-review/INSTALL.md +15 -17
  174. package/plugins/opencode/skills/delphi-review/SKILL.md +30 -29
  175. package/plugins/opencode/skills/delphi-review/opencode.json.delphi.example +6 -10
  176. package/plugins/opencode/skills/delphi-review/references/code-walkthrough.md +33 -49
  177. package/plugins/opencode/skills/delphi-review/references/requirements.md +66 -54
  178. package/plugins/opencode/skills/delphi-review/references/round-templates.md +7 -7
  179. package/plugins/opencode/skills/sprint-flow/AGENTS.md +5 -5
  180. package/plugins/opencode/skills/sprint-flow/SKILL.md +4 -4
  181. package/plugins/opencode/skills/sprint-flow/references/components/skill-invocations.md +2 -2
  182. package/plugins/opencode/skills/sprint-flow/references/force-levels.md +37 -35
  183. package/plugins/opencode/skills/sprint-flow/references/orchestration-rules.md +1 -1
  184. package/plugins/opencode/skills/sprint-flow/references/phase-1-prep.md +1 -1
  185. package/plugins/opencode/skills/sprint-flow/references/phase-2-design.md +24 -14
  186. package/plugins/opencode/skills/sprint-flow/references/phase-4-verify.md +6 -6
  187. package/plugins/opencode/skills/sprint-flow/references/phase-overview.md +2 -2
  188. package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +4 -4
  189. package/plugins/qoder/plugin.json +1 -1
  190. package/plugins/qoder/skills/clipboard-vision/SKILL.md +47 -0
  191. package/plugins/qoder/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
  192. package/plugins/qoder/skills/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
  193. package/plugins/qoder/skills/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
  194. package/plugins/qoder/skills/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
  195. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/SKILL.md +47 -0
  196. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
  197. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
  198. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
  199. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
  200. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
  201. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/scripts/clipboard-vision.sh +137 -0
  202. package/plugins/qoder/skills/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
  203. package/plugins/qoder/skills/clipboard-vision/scripts/clipboard-vision.sh +137 -0
  204. package/plugins/qoder/skills/delphi-review/.delphi-config.json.example +3 -11
  205. package/plugins/qoder/skills/delphi-review/AGENTS.md +15 -17
  206. package/plugins/qoder/skills/delphi-review/INSTALL.md +12 -12
  207. package/plugins/qoder/skills/delphi-review/SKILL.md +58 -25
  208. package/plugins/qoder/skills/delphi-review/opencode.json.delphi.example +1 -1
  209. package/plugins/qoder/skills/delphi-review/references/code-walkthrough.md +33 -49
  210. package/plugins/qoder/skills/sprint-flow/AGENTS.md +5 -5
  211. package/plugins/qoder/skills/sprint-flow/SKILL.md +2 -2
  212. package/plugins/qoder/skills/sprint-flow/references/force-levels.md +38 -35
  213. package/plugins/qoder/skills/sprint-flow/references/phase-1-prep.md +1 -1
  214. package/plugins/qoder/skills/sprint-flow/references/phase-2-design.md +48 -6
  215. package/plugins/qoder/skills/sprint-flow/references/phase-4-verify.md +5 -6
  216. package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +4 -4
  217. package/principles/AGENTS.md +4 -4
  218. package/scripts/__tests__/sync-package-content.test.js +30 -0
  219. package/scripts/delphi-external-review.cjs +194 -63
  220. package/scripts/sync-package-content.js +9 -2
  221. package/skills/clipboard-vision/SKILL.md +47 -0
  222. package/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
  223. package/skills/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
  224. package/skills/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
  225. package/skills/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
  226. package/skills/clipboard-vision/describe-clipboard.ps1 +115 -0
  227. package/skills/clipboard-vision/describe-clipboard.sh +161 -0
  228. package/skills/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
  229. package/skills/clipboard-vision/scripts/clipboard-vision.sh +137 -0
  230. package/skills/delphi-review/.delphi-config.json.example +24 -27
  231. package/skills/delphi-review/AGENTS.md +13 -12
  232. package/skills/delphi-review/INSTALL.md +15 -17
  233. package/skills/delphi-review/SKILL.md +30 -29
  234. package/skills/delphi-review/opencode.json.delphi.example +6 -10
  235. package/skills/delphi-review/references/code-walkthrough.md +33 -49
  236. package/skills/delphi-review/references/requirements.md +66 -54
  237. package/skills/delphi-review/references/round-templates.md +7 -7
  238. package/skills/sprint-flow/AGENTS.md +5 -5
  239. package/skills/sprint-flow/SKILL.md +4 -4
  240. package/skills/sprint-flow/references/components/skill-invocations.md +2 -2
  241. package/skills/sprint-flow/references/force-levels.md +37 -35
  242. package/skills/sprint-flow/references/orchestration-rules.md +1 -1
  243. package/skills/sprint-flow/references/phase-1-prep.md +1 -1
  244. package/skills/sprint-flow/references/phase-2-design.md +24 -14
  245. package/skills/sprint-flow/references/phase-4-verify.md +6 -6
  246. package/skills/sprint-flow/references/phase-overview.md +2 -2
  247. package/skills/test-specification-alignment/AGENTS.md +4 -4
  248. package/sprint-gate.sh +291 -0
@@ -2,12 +2,13 @@
2
2
 
3
3
  **执行时机**: Phase 2/6 DESIGN 之前,PREP AUTO-ESTIMATE 完成后。
4
4
 
5
- **目的**: 根据需求规模匹配适度评审流程,平衡质量保障与效率。
5
+ **目的**: 根据需求规模调整上下文深度与迭代预算,平衡质量保障与效率。Force level 永远不改变专家数量或批准语义。
6
6
 
7
7
  **核心原则**:
8
8
  - 所有级别**必须经过 Delphi 评审**,不可跳过
9
- - 轻量级采用**简化 Delphi**(2 专家、1 轮),仍需 2/2 批准
10
- - 标准/复杂采用**完整 Delphi**(2-3 专家、多轮)
9
+ - 所有级别都采用 architecture、technical、feasibility 三专家 Delphi;Round 1 独立执行并验证三份成功结果
10
+ - 模型 ID、provider、vendor、gateway 和国籍不受限制;`requested_model` trimmed 后必须 distinct
11
+ - 评审达到 ≥90% 共识,最多 5 轮;失败或无法验证时阻断
11
12
  - 自动升级机制:当出现风险信号时强制升级级别
12
13
 
13
14
  ---
@@ -16,9 +17,9 @@
16
17
 
17
18
  | 级别 | 适用场景 | 专家数 | 最多轮数 | 通过条件 | 预计耗时 |
18
19
  |------|---------|--------|---------|----------|---------|
19
- | **轻量** | 小改动、局部修改、删除代码 | 2 | 1 | 2/2 批准 | 10-20 分钟 |
20
- | **标准** | 常规功能开发、模块重构 | 2 | 2 | 2/2 批准 | 30-60 分钟 |
21
- | **复杂** | 核心模块、跨模块变更、新增架构 | 3 | 3 | 3/3 批准 | 1-2 小时 |
20
+ | **轻量** | 小改动、局部修改、删除代码 | 3 | 1-5 | ≥90% 聚合共识 | 10-20 分钟 |
21
+ | **标准** | 常规功能开发、模块重构 | 3 | 1-5 | ≥90% 聚合共识 | 30-60 分钟 |
22
+ | **复杂** | 核心模块、跨模块变更、新增架构 | 3 | 1-5 | ≥90% 聚合共识 | 1-2 小时 |
22
23
 
23
24
  ---
24
25
 
@@ -26,9 +27,9 @@
26
27
 
27
28
  | 级别 | delphi-review 调用 | 预计 Token 消耗 | 成本说明 |
28
29
  |------|-------------------|--------------|---------|
29
- | **轻量** | 1 次(2 专家、1 轮) | ~8,000 | 简化流程,单轮评审 |
30
- | **标准** | 1-2 次(2 专家、1-2 轮) | ~15,000-25,000 | 可能需要 1 轮反馈 |
31
- | **复杂** | 1-3 次(3 专家、1-3 轮) | ~30,000-60,000 | 多轮深度评审 |
30
+ | **轻量** | 1 次(3 专家、最多 5 轮) | ~8,000 | 简化上下文,仍需完整执行 |
31
+ | **标准** | 1-2 次(3 专家、最多 5 轮) | ~15,000-25,000 | 可能需要反馈轮次 |
32
+ | **复杂** | 1-3 次(3 专家、最多 5 轮) | ~30,000-60,000 | 多轮深度评审 |
32
33
 
33
34
  > **成本计算依据**: 基于实际 Sprint 历史数据,假设每次 delphi-review 调用平均消耗 8,000-10,000 Token(含 3 位专家的输入输出)。
34
35
 
@@ -56,7 +57,7 @@
56
57
  | 触发条件 | 原级别 | 升级至 | 说明 |
57
58
  |---------|--------|--------|------|
58
59
  | Delphi 评审出现 REQUEST_CHANGES | 轻量 | 标准 | 需要第二轮评审 |
59
- | 专家意见分歧(1 票反对) | 轻量/标准 | 复杂 | 需要第 3 专家仲裁 |
60
+ | 专家意见分歧 | 轻量/标准 | 复杂 | 增加上下文深度与后续轮次预算,不增加或替换专家 |
60
61
  | 涉及公共 API 变更 | 轻量 | 标准 | 影响外部调用方 |
61
62
  | 修改文件数 > 5 或 LOC > 200 | 轻量 | 标准 | 改动规模超出轻量范围 |
62
63
  | 存在循环依赖 | 轻量/标准 | 复杂 | 架构风险高 |
@@ -81,10 +82,10 @@ AUTO-ESTIMATE 输出 → Force Levels 执行 → 自动升级机制(如触发
81
82
 
82
83
  | AUTO-ESTIMATE 指标 | 建议级别 | Force Levels 执行 |
83
84
  |-------------------|---------|------------------|
84
- | 引用计数 ≤ 3 + 跨模块 ≤ 1 | 轻量 | 2 专家、1 轮 Delphi |
85
- | 引用计数 4-10 或 跨模块 2 | 标准 | 2 专家、最多 2 轮 Delphi |
86
- | 引用计数 > 10 或 跨模块 ≥ 3 | 复杂 | 3 专家、最多 3 轮 Delphi |
87
- | 存在循环依赖 | 强制复杂 | 3 专家、最多 3 轮 + 架构评审 |
85
+ | 引用计数 ≤ 3 + 跨模块 ≤ 1 | 轻量 | 3 专家、最多 5 轮 Delphi |
86
+ | 引用计数 4-10 或 跨模块 2 | 标准 | 3 专家、最多 5 轮 Delphi |
87
+ | 引用计数 > 10 或 跨模块 ≥ 3 | 复杂 | 3 专家、最多 5 轮 Delphi |
88
+ | 存在循环依赖 | 强制复杂 | 3 专家、最多 5 轮 + 架构评审 |
88
89
 
89
90
  **关键区别**:
90
91
  - AUTO-ESTIMATE: **客观指标分析**(代码结构、引用计数)
@@ -100,15 +101,15 @@ AUTO-ESTIMATE 输出 → Force Levels 执行 → 自动升级机制(如触发
100
101
  |------|------------|-------------|
101
102
  | Phase 2/6 DESIGN 设计评审 | 3 专家、≥90% 共识、生成 specification.yaml | 不适用(设计阶段) |
102
103
  | Phase 3/6 BUILD 入口 | **必须检查** `.sprint-state/delphi-reviewed.json` 中 `verdict=APPROVED` | 轻量/标准/复杂:通过对应强度的 delphi-review 生成该门禁文件 |
103
- | 轻量级评审 | 生成 `delphi-reviewed.json`(2 专家、1 轮、2/2 批准) | 2 专家、1 轮、写入门禁文件 |
104
- | 标准级评审 | 生成 `delphi-reviewed.json`(2 专家、最多 2 轮、2/2 批准) | 2 专家、最多 2 轮、写入门禁文件 |
105
- | 复杂级评审 | 生成 `delphi-reviewed.json`(3 专家、最多 3 轮、3/3 批准) | 3 专家、最多 3 轮、写入门禁文件 |
104
+ | 轻量级评审 | 生成 `delphi-reviewed.json`(3 专家、最多 5 轮、≥90% 聚合共识) | 3 专家、最多 5 轮、写入门禁文件 |
105
+ | 标准级评审 | 生成 `delphi-reviewed.json`(3 专家、最多 5 轮、≥90% 聚合共识) | 3 专家、最多 5 轮、写入门禁文件 |
106
+ | 复杂级评审 | 生成 `delphi-reviewed.json`(3 专家、最多 5 轮、≥90% 聚合共识) | 3 专家、最多 5 轮、写入门禁文件 |
106
107
  | Phase 4/6 VERIFY 代码走查 | 再次检查 `delphi-reviewed.json` 或重新评审 | 复用 Force Levels 规则 |
107
108
 
108
109
  **关键规则**:
109
110
  - **DELPHI-GATE 永不跳过**:Phase 3/6 BUILD 入口必须检查 `.sprint-state/delphi-reviewed.json` 中 `verdict=APPROVED`
110
- - **Force Levels 定义评审强度**:轻量/标准/复杂决定用 2 专家 1 轮还是 3 专家 3 轮来**产生**门禁文件
111
- - **轻量级不是跳过评审**:而是简化流程(2 专家、1 轮),但仍需生成门禁文件
111
+ - **Force Levels 定义上下文强度**:所有级别都用三专家、distinct model IDs 和最多 5 轮来**产生**门禁文件
112
+ - **轻量级不是跳过评审**:只缩短上下文,不减少专家或共识验证
112
113
  - **LIGHTWEIGHT ≠ ONE-EXPERT**: 1 专家违反 Delphi 核心原则,禁止
113
114
 
114
115
  ---
@@ -122,9 +123,9 @@ AUTO-ESTIMATE 输出 → Force Levels 执行 → 自动升级机制(如触发
122
123
  - 无循环依赖
123
124
 
124
125
  **执行流程**:
125
- 1. 2 位专家独立评审(DeepSeek-v4-pro + Kimi-K2.6)
126
- 2. 单轮评审,无需多轮迭代
127
- 3. **2/2 批准**才通过(不允许 1/2 批准)
126
+ 1. 三位专家独立评审并验证 distinct requested_model
127
+ 2. 最多 5 轮迭代,直到达到 ≥90% 聚合共识
128
+ 3. 三份成功结果且 APPROVED 才通过
128
129
  4. 评审通过后写入 `.sprint-state/delphi-reviewed.json`
129
130
 
130
131
  **输出文件** (`.sprint-state/delphi-reviewed.json`):
@@ -133,13 +134,14 @@ AUTO-ESTIMATE 输出 → Force Levels 执行 → 自动升级机制(如触发
133
134
  "sprint_id": "sprint-2026-06-05-01",
134
135
  "level": "轻量",
135
136
  "delphi_review": {
136
- "experts": ["deepseek-v4-pro", "kimi-k2.6"],
137
+ "experts": ["architecture-model", "technical-model", "feasibility-model"],
137
138
  "rounds": 1,
138
139
  "votes": {
139
140
  "expert_a": "APPROVED",
140
- "expert_b": "APPROVED"
141
+ "expert_b": "APPROVED",
142
+ "expert_c": "APPROVED"
141
143
  },
142
- "consensus": "2/2 APPROVED",
144
+ "consensus": ">=90% APPROVED",
143
145
  "timestamp": "2026-06-05T10:30:00Z"
144
146
  },
145
147
  "status": "passed"
@@ -161,13 +163,13 @@ AUTO-ESTIMATE 输出 → Force Levels 执行 → 自动升级机制(如触发
161
163
  - 中等规模改动(5-15 个文件、200-500 行改动)
162
164
 
163
165
  **执行流程**:
164
- 1. 2 位专家独立评审(Round 1)
165
- 2. 如有 REQUEST_CHANGES,进入 Round 2(最多 2 轮)
166
- 3. **2/2 批准**才通过
166
+ 1. 三位专家独立评审(Round 1)
167
+ 2. 如有 REQUEST_CHANGES,继续后续轮次(最多 5 轮)
168
+ 3. 三份成功结果聚合达到 ≥90% 才通过
167
169
  4. 评审通过后写入 `.sprint-state/delphi-reviewed.json`
168
170
 
169
171
  **升级至复杂级条件**:
170
- - Round 2 仍有分歧(1 票反对)→ 升级至复杂级(第 3 专家仲裁)
172
+ - Round 5 仍未达到共识 → BLOCK,不能以仲裁或多数票绕过
171
173
  - 涉及核心模块(core/handlers)→ 升级至复杂级
172
174
  - 存在循环依赖 → 升级至复杂级
173
175
 
@@ -182,14 +184,14 @@ AUTO-ESTIMATE 输出 → Force Levels 执行 → 自动升级机制(如触发
182
184
  - 公共 API 重大变更
183
185
 
184
186
  **执行流程**:
185
- 1. 3 位专家独立评审(DeepSeek-v4-pro + Kimi-K2.6 + Qwen3.6-Plus)
186
- 2. 最多 3 轮评审(Round 1-3)
187
- 3. **3/3 批准**才通过
187
+ 1. architecture、technical、feasibility 三位专家使用用户配置的任意可执行模型独立评审
188
+ 2. 最多 5 轮评审
189
+ 3. 三份成功结果聚合达到 ≥90% 且全部 APPROVED 才通过
188
190
  4. 评审通过后写入 `.sprint-state/delphi-reviewed.json`
189
191
 
190
- **仲裁机制**:
191
- - Round 2 仍有分歧 → 第 3 专家(Qwen3.6-Plus)加入仲裁
192
- - Round 3 必须达成一致,否则 BLOCK 进入 Phase 3/6 BUILD
192
+ **分歧处理**:
193
+ - 每轮都保持同一组 architecture、technical、feasibility 三个角色,不新增仲裁者,也不减少执行
194
+ - Round 5 仍未达到批准共识时 BLOCK 进入 Phase 3/6 BUILD
193
195
 
194
196
  ---
195
197
 
@@ -50,7 +50,7 @@
50
50
 
51
51
  **Phase 2/6 DESIGN 执行模式(全部 orchestrator 直接执行)**:
52
52
  1. **Orchestrator 直接执行 grill-with-docs**:`skill(name="grill-with-docs")` → 访谈 + CONTEXT.md/ADR
53
- 2. **Orchestrator 执行 R1 需求评审**:`npx xp-gate delphi-review --mode requirements` → requirements-reviewed.json
53
+ 2. **Orchestrator 调用 R1 Agent skill**:`/delphi-review --mode requirements`,分别执行 architecture、technical、feasibility 三个 per-expert runner → requirements-reviewed.json
54
54
  3. **Orchestrator 生成设计文档** → 等待用户 APPROVED
55
55
  4. **Orchestrator 直接执行 batch-grill-me**:`skill(name="batch-grill-me")` → 批量决策确认
56
56
  5. **Orchestrator 直接执行 R2 delphi-review**:`skill(name="delphi-review")` → 等待 APPROVED
@@ -216,7 +216,7 @@ find . -name "*{target}*.test.*" -o -name "*{target}*.spec.*" | grep -v node_mod
216
216
 
217
217
  **DELPHI-GATE invariant**: 所有流程级别(轻量/标准/复杂)的 Phase 3/6 BUILD 启动前,**必须**检查 `.sprint-state/delphi-reviewed.json` 的 verdict 为 `APPROVED`。未通过 delphi-review 直接路由到 BUILD 属于严重违规。
218
218
 
219
- **轻量级的正确理解**: 轻量级意味着 reduced-intensity 的 delphi-review(**2 专家、1 轮、2/2 APPROVED、较短上下文**),**不是**跳过 delphi-review,**不是** 1 专家评审。见 references/force-levels.md 的轻量级流程定义。
219
+ **轻量级的正确理解**: 轻量级意味着 reduced-intensity 的 delphi-review(**3 专家、最多 5 轮、≥90% 聚合共识、较短上下文**),**不是**跳过 delphi-review,**不是**减少专家或模型执行。见 references/force-levels.md 的轻量级流程定义。
220
220
 
221
221
  **自动 escalation 规则**(检测到以下情况时,自动提升流程级别):
222
222
 
@@ -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:** 527fca8
5
- **Branch:** main
6
- **Version:** 0.18.3.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.
@@ -0,0 +1,25 @@
1
+ # @boyingliu01/dsh-plugin-xp-gate
2
+
3
+ XP-Gate deterministic quality gates + AI workflow skills as a **DeepSeek Harness (DSH)** native plugin.
4
+
5
+ ## Tools
6
+
7
+ | Tool | Purpose |
8
+ |------|---------|
9
+ | `gate-check` | Run XP-Gate quality gates (`xp-gate check`) on a file or directory |
10
+ | `gate-principles` | Run the 14 Clean Code/SOLID rules (`xp-gate principles`, Gate 4) |
11
+ | `gate-arch` | Run architecture validation (`xp-gate arch`, Gate 6) |
12
+
13
+ ## Install
14
+
15
+ ```bash
16
+ dsh plugin --profile <name> add @boyingliu01/dsh-plugin-xp-gate
17
+ ```
18
+
19
+ The tools require a global `xp-gate` CLI:
20
+
21
+ ```bash
22
+ npm install -g @boyingliu01/xp-gate
23
+ ```
24
+
25
+ When `xp-gate` is missing the tools degrade gracefully (tool-missing → SKIP-style message) rather than erroring.
@@ -0,0 +1,7 @@
1
+ # XP-Gate DSH bundle patch: mounts the xp-gate tool plugin into a dsh profile.
2
+ # Applied as ONE insert over the empty profile root; reconciled by
3
+ # `dsh plugin add @boyingliu01/dsh-plugin-xp-gate`.
4
+
5
+ - insert:
6
+ - id: tool-xp-gate
7
+ name: '@boyingliu01/dsh-plugin-xp-gate'
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@boyingliu01/dsh-plugin-xp-gate",
3
+ "version": "0.19.0",
4
+ "description": "XP-Gate deterministic quality gates + AI workflow skills as a DeepSeek Harness (DSH) native plugin: gate-check / gate-principles / gate-arch tools + 12 SKILL.md skills",
5
+ "type": "module",
6
+ "main": "./lib/index.js",
7
+ "types": "./lib/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./lib/index.d.ts",
11
+ "import": "./lib/index.js",
12
+ "default": "./lib/index.js"
13
+ },
14
+ "./package.json": "./package.json"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/boyingliu01/xp-gate",
19
+ "directory": "plugins/dsh"
20
+ },
21
+ "dsh": {
22
+ "bundle": {
23
+ "patch": "./cordis.patch.yml"
24
+ }
25
+ },
26
+ "publishConfig": {
27
+ "registry": "https://registry.npmjs.org",
28
+ "access": "public"
29
+ },
30
+ "files": [
31
+ "lib/",
32
+ "cordis.patch.yml",
33
+ "skills/",
34
+ "README.md"
35
+ ],
36
+ "scripts": {
37
+ "build": "tsc -p tsconfig.build.json",
38
+ "check": "tsc -p tsconfig.json",
39
+ "test": "vitest run",
40
+ "prepare-skills": "node scripts/prepack.cjs",
41
+ "prepack": "npm run build && npm run prepare-skills"
42
+ },
43
+ "peerDependencies": {
44
+ "@deepseek-ai/cordis": "^4.0.1",
45
+ "@deepseek-ai/dsh-llm": "^0.1.1-rc.2",
46
+ "@deepseek-ai/dsh-shell": "^0.1.1-rc.2",
47
+ "@deepseek-ai/dsh-tools": "^0.1.1-rc.2"
48
+ },
49
+ "devDependencies": {
50
+ "@deepseek-ai/cordis": "4.0.1",
51
+ "@deepseek-ai/dsh-llm": "0.1.1-rc.2",
52
+ "@deepseek-ai/dsh-shell": "0.1.1-rc.2",
53
+ "@deepseek-ai/dsh-tools": "0.1.1-rc.2",
54
+ "@types/node": "^25.6.0",
55
+ "typescript": "^5.9.3",
56
+ "vitest": "^1.6.1",
57
+ "yaml": "^2.9.0"
58
+ },
59
+ "keywords": [
60
+ "dsh",
61
+ "deepseek-harness",
62
+ "plugin",
63
+ "xp-gate",
64
+ "quality-gates",
65
+ "code-review",
66
+ "sprint-flow"
67
+ ],
68
+ "author": "boyingliu01",
69
+ "license": "MIT"
70
+ }
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ /**
5
+ * prepack.cjs — Bundle the 12 repo skills into @boyingliu01/dsh-plugin-xp-gate
6
+ * before npm publish.
7
+ *
8
+ * Skills live in repo-root `skills/`; `plugins/dsh/skills/` is gitignored and
9
+ * populated here so the published tarball is self-contained (mirrors
10
+ * plugins/opencode/scripts/prepack.cjs).
11
+ */
12
+
13
+ const fs = require('fs');
14
+ const path = require('path');
15
+
16
+ const PLUGIN_ROOT = path.resolve(__dirname, '..');
17
+ const REPO_ROOT = path.resolve(PLUGIN_ROOT, '..', '..');
18
+
19
+ const SKILLS = [
20
+ 'admin-template-guidelines',
21
+ 'batch-grill-me',
22
+ 'delphi-review',
23
+ 'domain-modeling',
24
+ 'grilling',
25
+ 'grill-with-docs',
26
+ 'improve-codebase-architecture',
27
+ 'ralph-loop',
28
+ 'sprint-flow',
29
+ 'test-driven-development',
30
+ 'test-specification-alignment',
31
+ 'to-issues',
32
+ ];
33
+
34
+ const SKIP_DIRS = new Set(['node_modules', '.git', 'dist', 'coverage']);
35
+ const SKIP_FILE_SUFFIXES = ['.lock', '.js.map'];
36
+
37
+ function shouldSkipFile(name) {
38
+ return SKIP_FILE_SUFFIXES.some((suffix) => name.endsWith(suffix));
39
+ }
40
+
41
+ function copyDir(src, dest) {
42
+ if (!fs.existsSync(src)) {
43
+ console.error(`[prepack] SKIP (missing): ${src}`);
44
+ return false;
45
+ }
46
+ fs.mkdirSync(dest, { recursive: true });
47
+ for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
48
+ if (SKIP_DIRS.has(entry.name)) continue;
49
+ const srcPath = path.join(src, entry.name);
50
+ const destPath = path.join(dest, entry.name);
51
+ if (entry.isDirectory()) {
52
+ copyDir(srcPath, destPath);
53
+ } else if (entry.isFile()) {
54
+ if (shouldSkipFile(entry.name)) continue;
55
+ fs.copyFileSync(srcPath, destPath);
56
+ }
57
+ }
58
+ return true;
59
+ }
60
+
61
+ function main() {
62
+ const skillsDest = path.join(PLUGIN_ROOT, 'skills');
63
+ fs.rmSync(skillsDest, { recursive: true, force: true });
64
+ fs.mkdirSync(skillsDest, { recursive: true });
65
+
66
+ let copied = 0;
67
+ for (const name of SKILLS) {
68
+ if (copyDir(path.join(REPO_ROOT, 'skills', name), path.join(skillsDest, name))) {
69
+ copied += 1;
70
+ console.error(`[prepack] skills/${name}`);
71
+ }
72
+ }
73
+
74
+ if (copied !== SKILLS.length) {
75
+ console.error(`[prepack] ERROR: expected ${SKILLS.length} skills, copied ${copied}`);
76
+ process.exit(1);
77
+ }
78
+
79
+ console.error(`[prepack] done: ${copied} skills bundled`);
80
+ }
81
+
82
+ main();
@@ -0,0 +1,113 @@
1
+ ---
2
+ name: admin-template-guidelines
3
+ description: "6 maintainability rules for AI-generated admin interfaces (Fastify + Nunjucks + HTMX + Alpine.js). Prevents route bloat, test inconsistency, Nunjucks traps, repeated data logic, auth blind spots, and HTMX/Alpine confusion."
4
+ maturity: alpha
5
+ ---
6
+
7
+ # Admin Template Guidelines
8
+
9
+ 6 maintainability rules distilled from real rework patterns in interview-bot admin interface development. These constraints MUST be enforced during sprint-flow BUILD phase when generating admin routes, views, or tests.
10
+
11
+ ## 核心原则
12
+
13
+ | 原则 | 说明 |
14
+ |------|------|
15
+ | **路由拆分** | Admin routes 按模块拆分,禁止单文件膨胀 |
16
+ | **测试一致性** | 所有测试使用共享 `createAdminTestApp()` helper |
17
+ | **Nunjucks 括号** | 比较表达式与 filter 混用时必须加括号 |
18
+ | **View Model Mapper** | 重复数据转换提取为独立函数 |
19
+ | **Auth 保护** | 所有 Admin 路由(含 GET)必须认证 |
20
+ | **HTMX+Alpine 分离** | HTMX 管服务端交互,Alpine 管客户端状态 |
21
+
22
+ ---
23
+
24
+ ## 规则 1: 路由拆分(Route Splitting)
25
+
26
+ **Constraint:** Admin routes MUST be split by module — never a single monolithic file.
27
+
28
+ ### 模块划分
29
+
30
+ | 文件 | 职责 |
31
+ |------|------|
32
+ | `admin/routes/templates.ts` | 模板 CRUD(列表/创建/编辑/删除) |
33
+ | `admin/routes/plans.ts` | 访谈计划管理(创建/启动/暂停/完结) |
34
+ | `admin/routes/reports.ts` | 报告生成与导出 |
35
+ | `admin/routes/analytics.ts` | 数据统计与看板 |
36
+ | `admin/routes/tree.ts` | 技能树/目录管理 |
37
+ | `admin/routes/admin-shared.ts` | 共享中间件、通用 helper、布局渲染 |
38
+
39
+ **Examples:** → see `references/rule-1.md`
40
+
41
+ ---
42
+
43
+ ## 规则 2: 测试一致性(Test Consistency)
44
+
45
+ **Constraint:** All admin route tests MUST use a shared `createAdminTestApp()` helper — never hand-roll mini Fastify instances per test file.
46
+
47
+ **Examples:** → see `references/rule-2.md`
48
+
49
+ ---
50
+
51
+ ## 规则 3: Nunjucks 括号陷阱(Nunjucks Parentheses)
52
+
53
+ **Constraint:** Comparison expressions in Nunjucks MUST be wrapped in parentheses when used with filters. The Nunjucks filter operator (`|`) has **higher precedence** than comparison operators, causing silent incorrect output.
54
+
55
+ **Examples & Checklist:** → see `references/rule-3.md`
56
+
57
+ ---
58
+
59
+ ## 规则 4: View Model Mapper
60
+
61
+ **Constraint:** Repeated data transformation patterns MUST be extracted into dedicated functions. Any data mapping, filtering, or calculation that appears in 3+ route handlers must live in a shared `view-models.ts` module.
62
+
63
+ ### 常见重复模式
64
+
65
+ | 模式 | 出现位置 | 提取函数 |
66
+ |------|----------|----------|
67
+ | `_count` → `totalCount` 映射 | templates.ts, plans.ts, reports.ts | `mapCountFields()` |
68
+ | COMPLETED 状态过滤 | plans.ts, reports.ts, analytics.ts | `filterCompletedPlans()` |
69
+ | 完成率计算 | plans.ts, analytics.ts, tree.ts | `calculateCompletionRate()` |
70
+ | 完整 ViewModel 转换 | 所有列表页路由 | `mapTemplateToViewModel()` |
71
+
72
+ **Examples:** → see `references/rule-4.md`
73
+
74
+ ---
75
+
76
+ ## 规则 5: Auth 保护(Auth Protection)
77
+
78
+ **Constraint:** ALL Admin routes MUST be protected by authentication — including GET routes. No admin endpoint is exempt. Prefer cookie/session validation over API key headers.
79
+
80
+ ### 路由豁免规则
81
+
82
+ | 路由类型 | 需要 Auth | 说明 |
83
+ |----------|-----------|------|
84
+ | Admin GET | ✅ 必须 | 管理页面包含敏感数据 |
85
+ | Admin POST/PUT/DELETE | ✅ 必须 | 数据变更操作 |
86
+ | Admin API (HTMX endpoints) | ✅ 必须 | 部分更新接口 |
87
+ | Public GET | ❌ 不需要 | 面向用户的公开页面 |
88
+
89
+ **Examples:** → see `references/rule-5.md`
90
+
91
+ ---
92
+
93
+ ## 规则 6: HTMX + Alpine 分离
94
+
95
+ **Constraint:** Clear separation of concerns between HTMX (server-driven content replacement) and Alpine.js (client-side UI state). HTMX handles server interactions; Alpine handles local component state.
96
+
97
+ ### 职责矩阵
98
+
99
+ | 功能 | HTMX | Alpine.js |
100
+ |------|------|-----------|
101
+ | 页面导航 / URL 变更 | ✅ | ❌ |
102
+ | 表单提交到服务端 | ✅ | ❌ |
103
+ | 列表分页/搜索/排序 | ✅ | ❌ |
104
+ | 局部内容替换(`hx-target`) | ✅ | ❌ |
105
+ | 下拉菜单开关 | ❌ | ✅ |
106
+ | Modal 显示/隐藏 | ❌ | ✅ |
107
+ | 表单字段即时验证 | ❌ | ✅ |
108
+ | Toast 通知本地状态 | ❌ | ✅ |
109
+ | 按钮 loading 状态切换 | ❌ | ✅ |
110
+
111
+ **Examples & Principles:** → see `references/rule-6.md`
112
+
113
+