@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
@@ -0,0 +1,89 @@
1
+ # Ralph Loop — Phase 2 BUILD 默认模式
2
+
3
+ > ralph-loop 是 Sprint-Flow Phase 2 BUILD 的默认执行模式。token-constraint 优先:每次只处理一个 REQ,干净上下文,全量回归。
4
+
5
+ ## 模式切换
6
+
7
+ ### 默认行为
8
+
9
+ ```bash
10
+ /sprint-flow "需求描述"
11
+ # → Phase 2 自动使用 ralph-loop 模式
12
+ ```
13
+
14
+ ### 可选并行模式
15
+
16
+ ```bash
17
+ /sprint-flow "需求描述" --mode parallel
18
+ # → 旧有行为:一次性并行 dispatch 所有需求
19
+ ```
20
+
21
+ ## 核心差异
22
+
23
+ | 维度 | ralph-loop (默认) | --mode parallel (可选) |
24
+ |------|-------------------|----------------------|
25
+ | 需求源 | specification.yaml | specification.yaml |
26
+ | 执行方式 | 逐 REQ 串行迭代 | 一次性并行 dispatch |
27
+ | 上下文 | 每个 REQ 独立 dispatch,干净上下文 | 共享 session,线性增长 |
28
+ | 验证范围 | **全量测试**(含跨 REQ 回归) | 关联测试 |
29
+ | AGENTS.md 更新 | **orchestrator 统一写** | subagent 写 |
30
+ | 依赖排序 | 拓扑排序 + 同层 priority | 无 |
31
+
32
+ ## 流程
33
+
34
+ ```
35
+ 默认模式: ralph-loop 模式:
36
+ ┌──────────────────────┐ ┌──────────────────────────┐
37
+ │ dispatching-parallel │ │ 读取 specification.yaml │
38
+ │ -agents │ │ 构建依赖图 │
39
+ │ │ │ 拓扑排序 (Kahn's algo) │
40
+ │ 一次性 dispatch 所有 │ └──────────┬───────────────┘
41
+ │ 共享同一 session │ ▼
42
+ └──────────┬───────────┘ ┌──────────────────────────┐
43
+ │ │ 迭代循环: │
44
+ ▼ │ 取 next READY REQ │
45
+ ┌──────────────────────┐ │ dispatch 独立 subagent │
46
+ │ verification + │ │ (clean context) │
47
+ │ commit │ │ L1: typecheck+lint │
48
+ └──────────────────────┘ │ L2: 全量测试 ← 回归检测 │
49
+ │ L3: coverage ≥ 80% │
50
+ │ PASS → commit + learn │
51
+ │ FAIL → retry max 3 │
52
+ └──────────┬───────────────┘
53
+ ▼
54
+ Phase 3 REVIEW
55
+ ```
56
+
57
+ ## 与 Sprint-Flow 参数交互
58
+
59
+ | 参数 | 行为 (默认=ralph-loop) |
60
+ |------|----------------------|
61
+ | `--stop-at build` | 执行完 ralph-loop 后停止 |
62
+ | `--resume-from build` | 从 checkpoint 恢复,跳过已 done REQs |
63
+ | `--phase build-only` | 只执行 ralph-loop |
64
+ | `--mode parallel` | 切换回旧有并行模式 |
65
+
66
+ ## Token 对比
67
+
68
+ | REQ 数量 | 默认模式 | ralph-loop | 节约 |
69
+ |---------|---------|-----------|------|
70
+ | 3 | ~15k | ~9k | 40% |
71
+ | 5 | ~50k | ~25k | 50% |
72
+ | 10 | ~150k | ~50k | 67% |
73
+
74
+ ## 集成检查点
75
+
76
+ Ralph Loop 完成后返回:
77
+
78
+ ```json
79
+ {
80
+ "mode": "ralph-loop",
81
+ "specification_source": "specification.yaml",
82
+ "topology_order": ["REQ-001", "REQ-002", "REQ-003"],
83
+ "requirements": { "total": 6, "done": 6, "pending": 0, "blocked": 0 },
84
+ "learnings": { "permanent": ["..."], "contextual": ["..."] },
85
+ "status": "completed"
86
+ }
87
+ ```
88
+
89
+ Phase 3 REVIEW 正常执行(delphi code-walkthrough + test-specification-alignment)。PARTIAL 状态时仅检查 done REQs。
@@ -0,0 +1,99 @@
1
+ # Ralph Loop Workflow Details
2
+
3
+ ## Mandatory Execution Order
4
+
5
+ 每个 REQ 必须按以下顺序执行,不得跳过或重排:
6
+
7
+ ### 1. Load next READY REQ
8
+ - 从 specification.yaml 读取下一个依赖已满足的 REQ
9
+ - 检查 priority 和 status (pending 状态)
10
+ - 构建依赖图,确认无循环依赖
11
+
12
+ ### 2. Create isolated context
13
+ - 清空前一个 REQ 的对话历史
14
+ - 注入:当前 REQ + AC + permanent learnings + contextual learnings (最近 3 条)
15
+ - 注入:AGENTS.md + git log --oneline -5 + 测试基础设施摘要
16
+
17
+ ### 3. Pre-REQ snapshot(Issue #137)
18
+ 在 dispatch subagent 前记录当前 git HEAD,用于 TDD 合规的基线对比:
19
+ ```bash
20
+ PRE_REQ_HASH=$(git rev-parse HEAD)
21
+ echo "$PRE_REQ_HASH" > .sprint-state/last-req-baseline.txt
22
+ ```
23
+
24
+ ### 4. Dispatch build subagent
25
+ - 使用 `task(category="unspecified-high", load_skills=["test-driven-development"], timeout=300)`
26
+ - 强制 TDD 流程:RED → GREEN → REFACTOR
27
+ - 强制执行 Mock 边界策略
28
+
29
+ ### 5. Run full regression tests
30
+ - **L1**: typecheck + lint on changed files
31
+ - **L1b**: 使用 git diff 验证新增测试行数占总新增行数比例 ≥ 40%
32
+ - **L1b-alt**: 当 diff 为空时,降级检查测试文件是否在 changeset 中
33
+ - **L2**: 全量测试运行(不只是 @test 当前 REQ 的测试)
34
+ - **L3**: 检查整体覆盖率 ≥ 80%
35
+
36
+ ### 6. Fix until green or block
37
+ - 失败 → retry (max 3 次,每次注入失败摘要)
38
+ - 第 3 次仍失败 → BLOCK → 等待用户决策 (skip/manual/stop/rollback)
39
+ - 通过 → git commit + 标记 done
40
+
41
+ ### 7. Persist learnings
42
+ - 分类为 permanent(架构级)或 contextual(临时性)
43
+ - 自动升级条件:被≥2 个 REQ 引用 或 涉及接口/数据结构
44
+ - 调用 `gstack/learn` 总结经验教训
45
+
46
+ ### 8. Update sprint state
47
+ - orchestrator 统一更新 AGENTS.md(append `## ralph-loop: [REQ-XXX title]`)
48
+ - 原子写 checkpoint (progress.log)
49
+ - 继续下一个 READY REQ
50
+
51
+ ### 禁止行为
52
+ - ❌ 跳过测试基础设施检查
53
+ - ❌ 只运行部分测试(必须全量回归)
54
+ - ❌ 验证失败仍 commit
55
+ - ❌ 多个 subagent 同时写 AGENTS.md
56
+ - ❌ 修改前一个 REQ 的代码(除非修复回归)
57
+
58
+ ## Output Contract (Mandatory Checklist)
59
+
60
+ 每个 REQ 完成时必须输出以下结构化检查清单:
61
+
62
+ ```markdown
63
+ ## REQ-XXX: [Title] - Execution Summary
64
+
65
+ **Status**: ✅ PASS / ❌ FAIL (retry n/3) / 🚫 BLOCKED
66
+
67
+ **Context Isolation**:
68
+ - [ ] Previous REQ context cleared
69
+ - [ ] Permanent learnings injected (N items)
70
+ - [ ] Contextual learnings injected (≤3 items)
71
+ - [ ] Test infrastructure confirmed ready
72
+
73
+ **TDD Compliance**:
74
+ - [ ] Tests written BEFORE implementation
75
+ - [ ] Test/implementation ratio ≥ 40% (L1b)
76
+ - [ ] Mock usage justified (if >30% mock density)
77
+ - [ ] Test files present in changeset (L1b-alt)
78
+ - [ ] TDD 合规检查 (test-first or @no-test-required)
79
+
80
+ **Verification Layers**:
81
+ - [ ] L1: typecheck + lint pass
82
+ - [ ] L1b: Test-first ratio check pass
83
+ - [ ] L2: FULL regression tests (all tests)
84
+ - [ ] L3: coverage ≥ 80%
85
+
86
+ **Learnings Persisted**:
87
+ - [ ] Permanent: [N items]
88
+ - [ ] Contextual: [N items, sliding window]
89
+ - [ ] `gstack/learn` called
90
+
91
+ **State Updated**:
92
+ - [ ] AGENTS.md updated (orchestrator)
93
+ - [ ] progress.log atomically written
94
+ - [ ] Git commit created (if PASS)
95
+
96
+ **Next Step**: [REQ-YYY title / COMPLETE / BLOCKED]
97
+ ```
98
+
99
+ **Eval Criteria**: Structured execution plan visible, all 7 workflow steps followed, full regression tests run.
@@ -0,0 +1,36 @@
1
+ # Ralph Loop — Progress Log
2
+
3
+ Feature: [feature name]
4
+ Started: [ISO 8601]
5
+ Source: specification.yaml
6
+ Topology Order: [REQ-001, REQ-002, ...]
7
+
8
+ ---
9
+
10
+ ## REQ-001 — [title]
11
+
12
+ **Status**: PASS / FAIL / TIMEOUT / BLOCKED
13
+ **Retry count**: 0
14
+ **Test infra**: generated / existing / skipped
15
+ **Files changed**: [file1, file2, ...]
16
+ **Learnings**:
17
+ - `[permanent]` migration files must be in src/migrations/
18
+ - `[contextual]` off-by-one at line 42 in utils.ts
19
+ **Timestamp**: [ISO 8601]
20
+
21
+ ---
22
+
23
+ ## REQ-002 — [title]
24
+
25
+ **Status**: PASS
26
+ **Retry count**: 1
27
+ **Failure injected**: Linter: unused-var at line 42
28
+ **Test infra**: existing (createTestApp, withTestDb)
29
+ **Files changed**: [file1, file2, ...]
30
+ **Learnings**:
31
+ - `[permanent]` Auth middleware must run before validation
32
+ **Timestamp**: [ISO 8601]
33
+
34
+ ---
35
+
36
+ <!-- Append new REQs below. Tag: permanent / contextual -->
@@ -0,0 +1,103 @@
1
+ # SKILLS/SPRINT-FLOW KNOWLEDGE BASE
2
+
3
+ **Generated:** 2026-08-24
4
+ **Commit:** a1a4683
5
+ **Branch:** dsh-plugin
6
+ **Version:** 0.19.0.0
7
+
8
+ ## OVERVIEW
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, 40-67% token savings vs parallel). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
10
+
11
+ > **v2.0 Compact Redesign (Issue #290)**: Merged from 11 phases to 6. PREP = old ISOLATE + AUTO-ESTIMATE. DESIGN = old THINK + PLAN. BUILD = old BUILD. VERIFY = old REVIEW + FEEDBACK. SHIP = old SHIP + LAND. CLOSE = old USER ACCEPTANCE + CLEANUP.
12
+
13
+ ## STRUCTURE
14
+ ```
15
+ skills/sprint-flow/
16
+ ├── SKILL.md # 6-phase pipeline definition (canonical, v2.0)
17
+ ├── AGENTS.md # This file (mirrored to 7 other locations — DO NOT edit mirrors)
18
+ ├── evals/ # Evaluation test cases
19
+ ├── evolution-history.json
20
+ ├── evolution-log.md
21
+ ├── references/
22
+ │ ├── phase-1-prep.md # Phase 1/6: PREP (worktree isolation + sizing)
23
+ │ ├── phase-2-design.md # Phase 2/6: DESIGN (brainstorming + delphi-review HARD-GATE)
24
+ │ ├── phase-3-build.md # Phase 3/6: BUILD (ralph-loop default + TDD + test-align)
25
+ │ ├── phase-4-verify.md # Phase 4/6: VERIFY (code-walkthrough + QA + feedback)
26
+ │ ├── phase-5-ship.md # Phase 5/6: SHIP (PR + merge + deploy + canary)
27
+ │ ├── phase-6-close.md # Phase 6/6: CLOSE (UAT + cleanup)
28
+ │ ├── force-levels.md # Phase forcing rules
29
+ │ ├── orchestration-rules.md # Agent dispatch, context inheritance, transition rules
30
+ │ └── components/ # Reusable phase building blocks
31
+ └── templates/
32
+ ├── auto-estimate-output-template.md
33
+ ├── auto-estimate-learning-log.md
34
+ ├── pain-document-template.md
35
+ ├── sprint-progress-template.md
36
+ ├── sprint-summary-template.md
37
+ └── emergent-issues-template.md
38
+ ```
39
+
40
+ ## WHERE TO LOOK
41
+ | Task | Location | Notes |
42
+ |------|----------|-------|
43
+ | Pipeline definition | SKILL.md | 6 phases with HARD-GATE between DESIGN (2/6) and BUILD (3/6) |
44
+ | PREP phase | references/phase-1-prep.md | worktree isolation + sizing pass |
45
+ | DESIGN phase + HARD-GATE | references/phase-2-design.md | brainstorming + autoplan + delphi-review → specification.yaml |
46
+ | BUILD phase | references/phase-3-build.md | ralph-loop (default) vs parallel |
47
+ | VERIFY phase | references/phase-4-verify.md | code-walkthrough + QA + retro + learn |
48
+ | SHIP phase | references/phase-5-ship.md | PR + merge + deploy + canary |
49
+ | CLOSE phase | references/phase-6-close.md | UAT + cleanup |
50
+ | Force-level rules | references/force-levels.md | Defines when each phase becomes mandatory |
51
+ | Orchestration rules | references/orchestration-rules.md | Agent dispatch, context inheritance, transition gates |
52
+ | Templates | templates/ | Auto-estimate, sprint progress/summary, pain doc, emergent issues |
53
+
54
+ ## THE 6 PHASES (v2.0)
55
+
56
+ | Phase | Name | Maps From (old 11) | Key Action | Hard Gate |
57
+ |-------|------|-------------------|------------|-----------|
58
+ | 1/6 | PREP | ISOLATE + AUTO-ESTIMATE | Worktree isolation + sizing | — |
59
+ | 2/6 | DESIGN | THINK + PLAN | brainstorming → autoplan → Delphi consensus | **HARD-GATE**: design must reach ≥90% Delphi consensus |
60
+ | 3/6 | BUILD | BUILD | ralph-loop (default) + TDD + test-spec-alignment | — |
61
+ | 4/6 | VERIFY | REVIEW + FEEDBACK | code-walkthrough + QA + retro + learn | HARD-GATE: feedback-log.md must exist |
62
+ | 5/6 | SHIP | SHIP + LAND | PR → squash-merge → deploy → canary | — |
63
+ | 6/6 | CLOSE | USER ACCEPT + CLEANUP | Manual UAT → emergent issues → cleanup | HARD-GATE: UAT mandatory manual |
64
+
65
+ ## CONVENTIONS
66
+ - **ralph-loop is Phase 3/6 BUILD default**. Each REQ runs in a clean context, saving 40-67% tokens.
67
+ - **delphi-review HARD-GATE in Phase 2/6 DESIGN**: all three expert roles must execute with three distinct requested model IDs, then aggregate ≥90% consensus within 5 rounds. Unapproved or unverifiable → BLOCK coding.
68
+ - **`learn` is called twice**: once per REQ in Phase 3/6 (ralph-loop internal) and once in Phase 4/6 VERIFY (Sprint-level retro).
69
+ - **Phase isolation**: each phase has explicit entry/exit criteria documented in its `references/phase-*.md` file.
70
+ - **Emergent Requirements** discovered in Phase 6/6 CLOSE (USER ACCEPTANCE) are explicitly captured via `templates/emergent-issues-template.md` — never silently merged.
71
+ - **Auto-detection**: Phase 2/6 DESIGN uses `src/npm-package/lib/ui-detector.ts` to pick the right tech-stack templates.
72
+
73
+ ## ANTI-PATTERNS (THIS PROJECT)
74
+ - Do NOT skip `delphi-review` in Phase 2/6 DESIGN — HARD-GATE blocks implementation.
75
+ - Do NOT use parallel build mode unless explicitly requested. Ralph-loop is the default for a reason.
76
+ - Do NOT enter Phase 2/6 DESIGN (PLAN) without completing DESIGN (brainstorming).
77
+ - Do NOT implement before design is APPROVED — Phase 2/6 DESIGN must reach Delphi consensus first.
78
+ - Do NOT merge an Emergent Requirement into the original Sprint silently — capture it via the template in Phase 6/6 CLOSE.
79
+ - Do NOT terminate Delphi review before ≥90% consensus or 5 rounds, whichever first.
80
+
81
+ ## UNIQUE STYLES
82
+ - **6 phases** (v2.0 Issue #290) — compact design with merged phases (1-6 numbering)
83
+ - **HARD-GATE** between DESIGN and BUILD enforced both in SKILL.md and Claude Code plugin's PreToolUse hook.
84
+ - **Per-REQ clean context in ralph-loop** = the core efficiency mechanism.
85
+ - **Tech-stack auto-detection** via `--type` and `--lang` flags or `ui-detector.ts`.
86
+
87
+ ## COMMANDS
88
+ ```bash
89
+ /sprint-flow "开发用户登录" # Full 6-phase pipeline
90
+ /sprint-flow "开发用户登录" --type web-nextjs --lang typescript # Pin tech stack
91
+ /sprint-flow "开发用户登录" --phase build-only # Skip design (advanced)
92
+ /sprint-flow "开发用户登录" --mode parallel # Legacy all-at-once (NOT default)
93
+ /sprint-flow "开发用户登录" --stop-at design # Stop after DESIGN phase
94
+ /delphi-review "开发用户登录" --type web-nextjs --lang typescript
95
+ ```
96
+
97
+ ## NOTES
98
+ - Integrates: brainstorming, autoplan, delphi-review, TDD, test-specification-alignment, qa, design-review, benchmark, systematic-debugging, retro, learn, finishing-a-development-branch, land-and-deploy.
99
+ - ralph-loop's internal learnings are persisted via `progress.log` (permanent vs contextual classification).
100
+ - Phase 4/6 VERIFY calls `gstack/learn` for Sprint-level retrospective.
101
+ - Phase 6/6 CLOSE cleanup behavior is governed by `docs/plans/2026-06-06-sprint-branch-cleanup-design.md`.
102
+ - This `AGENTS.md` is the canonical version. **7 byte-identical mirrors** exist.
103
+ Mirrors are updated by `scripts/copy-skills.sh`. Do NOT edit them by hand.