@boyingliu01/xp-gate 0.19.1 → 0.19.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/gate-10.sh +105 -0
  2. package/hooks/pre-commit +24 -5
  3. package/lib/__tests__/npm-package.test.js +25 -0
  4. package/lib/mattpocock-license-verdict.json +1 -1
  5. package/mock-policy/AGENTS.md +3 -3
  6. package/mutation/AGENTS.md +3 -3
  7. package/package.json +2 -1
  8. package/plugins/claude-code/.claude-plugin/plugin.json +2 -2
  9. package/plugins/claude-code/skills/delphi-review/AGENTS.md +3 -3
  10. package/plugins/claude-code/skills/sprint-flow/AGENTS.md +3 -3
  11. package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +3 -3
  12. package/plugins/dsh/package.json +1 -1
  13. package/plugins/dsh/skills/delphi-review/AGENTS.md +3 -3
  14. package/plugins/dsh/skills/sprint-flow/AGENTS.md +3 -3
  15. package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +3 -3
  16. package/plugins/opencode/package.json +1 -1
  17. package/plugins/opencode/skills/delphi-review/AGENTS.md +3 -3
  18. package/plugins/opencode/skills/sprint-flow/AGENTS.md +3 -3
  19. package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +3 -3
  20. package/plugins/qoder/plugin.json +2 -2
  21. package/plugins/qoder/skills/admin-template-guidelines/SKILL.md +6 -797
  22. package/plugins/qoder/skills/admin-template-guidelines/references/rule-1.md +91 -0
  23. package/plugins/qoder/skills/admin-template-guidelines/references/rule-2.md +155 -0
  24. package/plugins/qoder/skills/admin-template-guidelines/references/rule-3.md +70 -0
  25. package/plugins/qoder/skills/admin-template-guidelines/references/rule-4.md +154 -0
  26. package/plugins/qoder/skills/admin-template-guidelines/references/rule-5.md +126 -0
  27. package/plugins/qoder/skills/admin-template-guidelines/references/rule-6.md +180 -0
  28. package/plugins/qoder/skills/batch-grill-me/SKILL.md +15 -0
  29. package/plugins/qoder/skills/clipboard-vision/describe-clipboard.ps1 +115 -0
  30. package/plugins/qoder/skills/clipboard-vision/describe-clipboard.sh +161 -0
  31. package/plugins/qoder/skills/delphi-review/.delphi-config.json.example +61 -28
  32. package/plugins/qoder/skills/delphi-review/AGENTS.md +3 -3
  33. package/plugins/qoder/skills/delphi-review/INSTALL.md +97 -98
  34. package/plugins/qoder/skills/delphi-review/SKILL.md +77 -54
  35. package/plugins/qoder/skills/delphi-review/hooks.md +19 -0
  36. package/plugins/qoder/skills/delphi-review/opencode.json.delphi.example +6 -10
  37. package/plugins/qoder/skills/delphi-review/references/orchestrator-dispatch.md +64 -0
  38. package/plugins/qoder/skills/delphi-review/references/requirements.md +402 -0
  39. package/plugins/qoder/skills/delphi-review/references/round-templates.md +134 -0
  40. package/plugins/qoder/skills/delphi-review/scripts/verify-consensus.sh +43 -0
  41. package/plugins/qoder/skills/delphi-review/tools.md +29 -0
  42. package/plugins/qoder/skills/domain-modeling/ADR-FORMAT.md +64 -0
  43. package/plugins/qoder/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
  44. package/plugins/qoder/skills/domain-modeling/SKILL.md +74 -0
  45. package/plugins/qoder/skills/grill-with-docs/SKILL.md +7 -0
  46. package/plugins/qoder/skills/grilling/SKILL.md +12 -0
  47. package/plugins/qoder/skills/ralph-loop/SKILL.md +87 -428
  48. package/plugins/qoder/skills/ralph-loop/references/components.md +113 -0
  49. package/plugins/qoder/skills/ralph-loop/references/workflow-details.md +99 -0
  50. package/plugins/qoder/skills/sprint-flow/AGENTS.md +4 -4
  51. package/plugins/qoder/skills/sprint-flow/SKILL.md +255 -454
  52. package/plugins/qoder/skills/sprint-flow/__tests__/sprint-flow.test.cjs +457 -0
  53. package/plugins/qoder/skills/sprint-flow/hooks.md +18 -0
  54. package/plugins/qoder/skills/sprint-flow/references/components/memory.md +1 -1
  55. package/plugins/qoder/skills/sprint-flow/references/components/middleware.md +1 -1
  56. package/plugins/qoder/skills/sprint-flow/references/components/skill-invocations.md +21 -20
  57. package/plugins/qoder/skills/sprint-flow/references/components/tool-descriptions.md +22 -23
  58. package/plugins/qoder/skills/sprint-flow/references/force-levels.md +0 -1
  59. package/plugins/qoder/skills/sprint-flow/references/orchestration-rules.md +34 -27
  60. package/plugins/qoder/skills/sprint-flow/references/phase-1-prep.md +1 -1
  61. package/plugins/qoder/skills/sprint-flow/references/phase-2-design.md +157 -120
  62. package/plugins/qoder/skills/sprint-flow/references/phase-3-build.md +203 -2
  63. package/plugins/qoder/skills/sprint-flow/references/phase-4-verify.md +107 -34
  64. package/plugins/qoder/skills/sprint-flow/references/phase-5-ship.md +194 -12
  65. package/plugins/qoder/skills/sprint-flow/references/phase-6-close.md +139 -7
  66. package/plugins/qoder/skills/sprint-flow/references/phase-overview.md +486 -0
  67. package/plugins/qoder/skills/sprint-flow/scripts/verify-sprint-state.sh +38 -0
  68. package/plugins/qoder/skills/sprint-flow/tools.md +29 -0
  69. package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +3 -3
  70. package/plugins/qoder/skills/test-specification-alignment/SKILL.md +104 -601
  71. package/plugins/qoder/skills/to-issues/SKILL.md +1 -1
  72. package/principles/AGENTS.md +3 -3
  73. package/skills/delphi-review/AGENTS.md +3 -3
  74. package/skills/sprint-flow/AGENTS.md +3 -3
  75. package/skills/test-specification-alignment/AGENTS.md +3 -3
  76. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/SKILL.md +0 -47
  77. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +0 -65
  78. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +0 -185
  79. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +0 -138
  80. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision.test.cjs +0 -273
  81. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/scripts/clipboard-vision.ps1 +0 -86
  82. package/plugins/qoder/skills/clipboard-vision/clipboard-vision/scripts/clipboard-vision.sh +0 -137
  83. package/plugins/qoder/skills/ralph-loop/references/components/memory.md +0 -55
  84. package/plugins/qoder/skills/ralph-loop/references/components/middleware.md +0 -54
  85. package/plugins/qoder/skills/ralph-loop/references/components/skill-invocations.md +0 -39
  86. package/plugins/qoder/skills/ralph-loop/references/components/system-prompt.md +0 -24
  87. package/plugins/qoder/skills/ralph-loop/references/components/tool-descriptions.md +0 -32
@@ -1,42 +1,31 @@
1
1
  ---
2
2
  name: sprint-flow
3
- version: 2.0.0
3
+ version: 2.1.0
4
4
  description: >
5
- One-Shot Sprint 自动流水线。单一入口,自动串联 Think → Plan → Build →
6
- Review → Ship 流程。整合 brainstorming + autoplan + delphi-review + TDD +
7
- delphi-review --mode code-walkthrough + ship 等现有 Skills。关键节点暂停等待用户决策。
8
- 承认 Emergent Requirements 限制,设计用户验收环节。
9
-
10
- TRIGGER:
11
- - "开发新功能"
12
- - "实现 X"
13
- - "start sprint"
14
- - "一键开发"
15
- - "/sprint-flow"
16
- 触发后第一行输出: `Sprint Flow: PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE`
17
- 用法: /sprint-flow "[需求描述]"
18
- 示例: /sprint-flow "开发访谈机器人,支持多轮对话"
19
- 可选参数:
20
- --no-isolate: 跳过自动 worktree 隔离(⚠️ 在保护分支上有污染风险)
21
- --branch-name <name>: 自定义分支名(默认自动生成 sprint/YYYY-MM-DD-NN)
22
- --force: 强制在当前分支继续(即使已是保护分支,⚠️ 输出警告)
23
- --stop-at <phase>: 执行到指定阶段后停止 (prep/design/build/verify/ship/close). Legacy names: isolate/think/plan/review/ship/land/cleanup
24
- --resume-from <phase>: 从指定阶段继续,跳过前面阶段 (prep/design/build/verify/ship/close)
25
- --phase <phase>: 只执行单个阶段 (prep-only/design-only/build-only/verify-only/ship-only/close-only). Legacy: isolate-only/think-only/plan-only/build-only/review-only/ship-only/land-only/cleanup-only
26
- --lang <language>: 指定项目语言 (springboot/django/golang)
27
- --type <project_type>: 指定项目类型 (web-nextjs/web-react/web-vue/mobile-flutter/mobile-react-native/backend-django/backend-go/backend-springboot)
28
- --spec <file>: 使用已有的 specification.yaml 文件
29
- --with-performance: 启用负载/压力测试(后端项目)
30
- --mode <build_mode>: 指定 Phase 3 BUILD 构建模式。默认 = ralph-loop(逐 REQ 迭代,token 节约)。parallel = 旧有并行模式(一次性 dispatch 所有需求)
31
- --status: 查看当前 Sprint 进度看板(不执行任何阶段,仅读取 sprint-state.json 并渲染进度)
32
- Use when asked to "开发新功能", "实现 X", "start sprint", "一键开发", or "/sprint-flow" for end-to-end feature development.
5
+ Orchestrates a 6-phase end-to-end feature development pipeline (PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE).
6
+ Integrates grill-with-docs, batch-grill-me, delphi-review (R1 requirements + R2 design), TDD, ralph-loop, code-walkthrough, and native ship/land steps.
7
+ Pauses at key gates for user decisions. Acknowledges emergent requirements with mandatory manual UAT in CLOSE phase.
8
+
9
+ WHAT: Automates the full development lifecycle from worktree isolation to production deployment.
10
+ WHEN: User explicitly requests building a feature, developing new functionality, starting a sprint, or running /sprint-flow.
11
+ NOT WHEN: Asking HOW to implement something (educational), implementing a single function/algorithm, environment setup,
12
+ deployment-only requests, feature suggestions without execution intent, or casual "do it" requests without a feature scope.
13
+
14
+ TRIGGERS: "/sprint-flow", "start sprint", "开发新功能", "实现 X (where X is a feature/module)", "一键开发", "develop new feature",
15
+ "implement feature X", "one-shot development", "build X (where X is a feature)".
16
+ NEGATIVE TRIGGERS: "实现排序算法", "实现一下", "帮我实现这个函数", "怎么实现登录功能", "start spring boot", "开发环境配置",
17
+ "一键部署", "新功能建议", "implement a sort function", "how to implement auth".
18
+ On trigger, first line MUST output: `Sprint Flow: PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE`
33
19
  maturity: beta
20
+ auto_continue: false # Sprint-flow pauses at user decision gates (unlike delphi-review which auto-continues rounds)
34
21
  triggers:
35
22
  - "/sprint-flow"
36
23
  - "start sprint"
37
24
  - "开发新功能"
38
- - "实现 X"
39
25
  - "一键开发"
26
+ - "implement feature"
27
+ - "one-shot development"
28
+ - "build a feature"
40
29
  triggers_negative_examples:
41
30
  - "实现排序算法" # algorithm implementation, not feature development
42
31
  - "实现一下" # casual "do it", not a sprint request
@@ -48,6 +37,10 @@ triggers_negative_examples:
48
37
  - "新功能建议" # feature suggestion/request, not execution
49
38
  - "implement a sort function" # algorithm, not full feature
50
39
  - "how to implement auth" # educational question
40
+ - "实现一个util函数" # utility function, not feature
41
+ - "帮我写个脚本" # script writing, not feature development
42
+ - "代码review" # code review, not development
43
+ - "refactor this" # refactoring, not new feature
51
44
  triggers_negative_test_cases:
52
45
  - input: "实现排序算法"
53
46
  expect: "NOT triggered"
@@ -75,23 +68,58 @@ triggers_negative_test_cases:
75
68
  expect: "triggered"
76
69
  - input: "一键开发 REST API"
77
70
  expect: "triggered"
71
+ - input: "implement user authentication feature"
72
+ expect: "triggered"
73
+ - input: "start sprint for login module"
74
+ expect: "triggered"
75
+ - input: "帮我写个脚本"
76
+ expect: "NOT triggered"
77
+ - input: "代码review"
78
+ expect: "NOT triggered"
79
+ - input: "refactor this module"
80
+ expect: "NOT triggered"
78
81
  workflow_steps:
79
- - "Phase 1/6: PREP"
80
- - "Phase 2/6: DESIGN"
81
- - "Phase 3/6: BUILD"
82
- - "Phase 4/6: VERIFY"
83
- - "Phase 5/6: SHIP"
84
- - "Phase 6/6: CLOSE"
82
+ - "Phase 1/6: PREP → Output: ## Phase 1/6: PREP (准备工作)"
83
+ - "Phase 2/6: DESIGN → Output: ## Phase 2/6: DESIGN (设计)"
84
+ - "Phase 3/6: BUILD → Output: ## Phase 3/6: BUILD (构建)"
85
+ - "Phase 4/6: VERIFY → Output: ## Phase 4/6: VERIFY (验证)"
86
+ - "Phase 5/6: SHIP → Output: ## Phase 5/6: SHIP (发布)"
87
+ - "Phase 6/6: CLOSE → Output: ## Phase 6/6: CLOSE (收尾)"
88
+ hooks:
89
+ security:
90
+ - "tools_denied": "Destructive commands blocked via tools_denied (rm -rf, git push --force, DROP TABLE)"
91
+ - "Security Notes": "See Security Notes section for safety guarantees"
92
+ operational:
93
+ - "sprint-state.json": "Native sprint state persistence + --resume-from for context restore"
94
+ tools_allowed:
95
+ - "Bash(git, gh, npm, node)" # git worktree/branch/commit, gh PR/release, npm/node CLI
96
+ - "Read" # read project files, configs, docs
97
+ - "Write" # write sprint-state, specification.yaml, phase summaries
98
+ - "Edit" # edit sprint-state, CHANGELOG, VERSION
99
+ - "Glob" # find project files by pattern
100
+ - "Grep" # search file contents
101
+ - "Task" # delegate to subagents (quick, deep, unspecified-high)
102
+ - "Skill" # invoke integrated skills (grill-with-docs, batch-grill-me, delphi-review, to-issues, etc.)
103
+ - "TodoWrite" # track sprint progress
104
+ - "Question" # ask user at decision gates
105
+ tools_denied:
106
+ - "rm -rf (any recursive force remove)"
107
+ - "git push --force"
108
+ - "DROP TABLE or destructive DB operations"
109
+ - "Write(source code)" # NEVER write implementation code directly — delegate to subagents via Task
110
+ - "Edit(source code)" # NEVER edit implementation code — sprint-flow orchestrates, subagents implement
85
111
  ---
86
112
 
113
+ # Sprint Flow — 6-Phase Development Pipeline
114
+
87
115
  ## Triggers
88
116
 
89
117
  | Trigger Type | Phrases |
90
118
  |--------------|---------|
91
- | **中文** | "开发新功能", "实现 X", "start sprint", "一键开发", "/sprint-flow", "开发用户登录", "创建 XXX 模块" |
92
- | **English** | "implement feature", "build X", "start sprint", "one-shot development", "create XXX", "develop new functionality" |
119
+ | **中文** | "开发新功能", "一键开发", "/sprint-flow", "开发用户登录", "创建 XXX 模块" |
120
+ | **English** | "/sprint-flow", "start sprint", "implement feature", "one-shot development", "build a feature" |
93
121
 
94
- **Usage**: `/sprint-flow "[需求描述]"`
122
+ **Usage**: `/sprint-flow "[feature description]"`
95
123
 
96
124
  **Examples**:
97
125
  - `/sprint-flow "开发访谈机器人,支持多轮对话"`
@@ -102,25 +130,22 @@ workflow_steps:
102
130
  - `--no-isolate`: Skip auto worktree isolation (⚠️ risk of polluting protected branches)
103
131
  - `--branch-name <name>`: Custom branch name (default: `sprint/YYYY-MM-DD-NN`)
104
132
  - `--force`: Force continue on current branch even if protected (⚠️ requires explicit confirmation)
105
- - `--stop-at <phase>`: Stop after specified phase (prep/design/build/verify/ship/close). For backward compat, legacy names (isolate/think/plan/review/ship/land/cleanup) are accepted and mapped.
106
- - `--resume-from <phase>`: Resume from specified phase, skipping earlier phases (prep/design/build/verify/ship/close)
107
- - `--phase <phase>`: Execute only single phase (prep-only/design-only/build-only/verify-only/ship-only/close-only). Legacy: isolate-only/think-only/plan-only/build-only/review-only/ship-only/land-only/cleanup-only
133
+ - `--stop-at <phase>`: Stop after specified phase (prep/design/build/verify/ship/close)
134
+ - `--resume-from <phase>`: Resume from specified phase
135
+ - `--phase <phase>`: Execute only single phase (prep-only/design-only/build-only/verify-only/ship-only/close-only)
108
136
  - `--lang <language>`: Specify project language (springboot/django/golang)
109
- - `--type <project_type>`: Specify project type (web-nextjs/web-react/web-vue/mobile-flutter/mobile-react-native/backend-django/backend-go/backend-springboot)
137
+ - `--type <project_type>`: Specify project type (web-nextjs/web-react/web-vue/backend-go/backend-django/backend-springboot)
110
138
  - `--spec <file>`: Use existing specification.yaml file
111
139
  - `--with-performance`: Enable load/stress testing (backend projects)
112
- - `--mode <build_mode>`: Phase 3 BUILD build mode. Default = ralph-loop (REQ-level iteration, token-efficient). parallel = legacy all-at-once mode
113
-
114
- # Sprint Flow Skill
140
+ - `--mode <build_mode>`: Phase 3 BUILD build mode. Default = ralph-loop. parallel = legacy all-at-once mode
141
+ - `--status`: View Sprint progress dashboard (read-only, no execution)
115
142
 
116
143
  ## Security Notes
117
144
 
118
- - sprint-flow **不执行任何破坏性命令**(no `rm -rf`, `git push --force`, `DROP TABLE` 等)
119
- - `git worktree remove` 仅删除 sprint 创建的临时 worktree 目录,不影响主仓库
120
- - Phase 5 SHIP 仅创建 PR(`gh pr create`),不自动 merge(除非用户显式确认)
121
- - Phase 5 SHIP / LAND 使用 `gh pr merge --squash`(非 force push),merge 前等待 CI 通过
122
- - 文档中 `+ platform deploy` 等描述仅表示可选的部署步骤映射,**不是可执行命令**
123
- - sprint-flow 不下载、安装或执行任何外部二进制文件
145
+ - Sprint flow **does NOT execute destructive commands** (no `rm -rf`, `git push --force`, `DROP TABLE`, etc.)
146
+ - `git worktree remove` only deletes temporary worktree directories created by the sprint, never affects the main repo
147
+ - Phase 5 SHIP only creates PRs (`gh pr create`), never auto-merges without explicit user confirmation
148
+ - Sprint flow does not download, install, or execute external binaries
124
149
 
125
150
  ## Permissions
126
151
 
@@ -129,103 +154,33 @@ workflow_steps:
129
154
  - `filesystem`: read/write (project dir + `.worktrees/` only)
130
155
  - `network`: read-only (CI status, canary health)
131
156
 
132
- ## 核心原则
133
-
134
- | 原则 | 说明 |
135
- |------|------|
136
- | **单一入口** | 用户只需调用 `/sprint-flow`,自动串联全流程 |
137
- | **自动流水线** | 类似 autoplan,自动执行多个阶段 |
138
- | **关键节点暂停** | APPROVED 确认、DELPHI-GATE 通过、Ship 确认、⚠️ Phase 6 CLOSE 必须人工 |
139
- | **承认 Emergent** | 用户验收环节必须人工,无法自动化(78% 失败不可见) |
140
- | **复用现有 Skills** | 不重新发明,整合调用现有体系 |
141
-
142
- ---
143
-
144
- ## Unique Value Proposition
145
-
146
- Sprint Flow is NOT just a sequential launcher of existing skills. Here's what makes it different from manually running each skill:
147
-
148
- ### Why Sprint Flow vs Manual Skill Execution
149
-
150
- | Dimension | Manual Execution | Sprint Flow |
151
- |-----------|-----------------|-------------|
152
- | **Context Continuity** | Each skill starts fresh; lost design decisions between phases | Phase summaries + sprint-state.json maintain full traceability across 6 phases |
153
- | **Gate Enforcement** | No enforcement — easy to skip Delphi, skip TDD, skip UAT | HARD-GATE: design must be APPROVED (≥90% Delphi consensus) before coding; UAT is mandatory (no bypass) |
154
- | **Token Efficiency** | Linear context accumulation across phases — ~150K+ tokens | Ralph-loop default: 40-67% token savings via clean REQ-level contexts |
155
- | **Emergent Requirements** | Discovered late, silently ignored or merged | Phase 6 CLOSE explicitly captures emergent issues via template; triggers Sprint 2 for critical issues |
156
- | **Quality Ecosystem** | No integration with quality gates | Integrated with xp-gate's full quality ecosystem: Gate 5 (coverage), Gate M2 (mock density), Delphi code-walkthrough |
157
- | **Progress Tracking** | Ad-hoc, memory-based | `.sprint-state/` persistence with phase history, timing, and metrics — `--status` renders progress dashboard |
158
-
159
- ### Key Differentiators
160
-
161
- 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.
162
-
163
- 2. **HARD-GATE Discipline**: Design must pass Delphi review (≥90% consensus from exactly three successfully executed, distinct model IDs; provider, vendor, and country unrestricted) before Phase 3 BUILD can start. Any expert execution failure blocks approval. This is enforced both in SKILL.md instructions and via the Claude Code plugin's PreToolUse hook.
164
-
165
- 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.
166
-
167
- 4. **XP-Gate Quality Ecosystem Integration**: Sprint Flow is part of the broader xp-gate ecosystem. Phase 3 BUILD integrates with Gate 5 (test coverage ≥80%), Gate M2 (mock density ≤30%), and Gate MW (code-walkthrough validation). Phase 4 VERIFY runs Delphi code-walkthrough that generates `.code-walkthrough-result.json` for pre-push enforcement.
168
-
169
- 5. **Full Lifecycle Coverage**: From worktree isolation (PREP) to cleanup (CLOSE), sprint-flow covers the entire development lifecycle — not just the "write code" part. PREP (Phase 1/6) prevents over-engineering by routing lightweight changes through simplified workflows.
170
-
171
- ---
172
-
173
- ## 完整流程(默认无参数)
174
-
175
- 调用 `/sprint-flow "[需求描述]"` 后,自动执行以下流程:
176
-
177
- ```
178
- Phase 1/6: PREP → worktree隔离 + 规模评估 + 流程路由
179
- Phase 2/6: DESIGN → brainstorming → autoplan → delphi-review → specification.yaml
180
- Phase 3/6: BUILD → GITHOOKS-GATE → DELPHI-GATE → ralph-loop/TDD → freeze/盲评 → verification
181
- Phase 4/6: VERIFY → delphi-review --mode code-walkthrough → test-alignment → browse → learn + retro
182
- Phase 5/6: SHIP → finishing-a-development-branch → ship → land-and-deploy → canary
183
- Phase 6/6: CLOSE → USER ACCEPTANCE (⚠️ 人工) → emergent issues → cleanup
184
- ```
185
-
186
- **v2.0 Compact Redesign** (Issue #290): Merged from 11 phases to 6. PREP = old ISOLATE + AUTO-ESTIMATE. DESIGN = old THINK + PLAN. BUILD = old BUILD (unchanged). VERIFY = old REVIEW + FEEDBACK. SHIP = old SHIP + LAND. CLOSE = old USER ACCEPTANCE + CLEANUP.
187
-
188
- ---
189
-
190
- ## 暂停点设计(不是随时停,而是设计明确的暂停点)
191
-
192
- - **Phase 1/6 PREP**: 保护分支强制隔离 → 输出警告或自动创建 worktree → 自动恢复;AUTO-ESTIMATE 结果展示 → 用户确认 → 按路由继续
193
- - **Phase 2/6 DESIGN**: brainstorming 设计未 APPROVED (HARD-GATE) → 用户修改 → APPROVED 后继续;autoplan taste_decisions → 用户确认;delphi-review 未 APPROVED → 修复 → APPROVED → specification.yaml
194
- - **Phase 3/6 BUILD**: DELPHI-GATE 未通过 → BLOCK;验证失败 > max3 → 用户决策修复/放弃;成本超阈值 → 用户确认
195
- - **Phase 4/6 VERIFY**: delphi code-walkthrough REQUEST_CHANGES → 用户处理 → 重新评审;browse 发现问题 → 回退 Phase 3(不暂停)
196
- - **Phase 5/6 SHIP**: finishing-a-development-branch (4选项) → 确认;ship PR → 用户确认合并;land-and-deploy 完成/失败 → 用户确认
197
- - **Phase 6/6 CLOSE**: USER ACCEPTANCE ⚠️ 必须人工验收 → 用户确认后继续;cleanup 完成/失败 → 用户确认 → 结束流程
198
-
199
157
  ---
200
158
 
201
- ## Workflow Steps
202
-
203
- | Step | Phase | Name | Key Actions | Output |
204
- |------|-------|------|-------------|--------|
205
- | 1 | **1/6** | **PREP** | Detect protected branch → Create git worktree → AUTO-ESTIMATE sizing → Classify (lightweight/standard/complex) | Worktree path + impact assessment |
206
- | 2 | **2/6** | **DESIGN** | brainstorming → autoplan → delphi-review (HARD-GATE ≥90% consensus) → to-issues → specification.yaml | specification.yaml + slices-manifest.json |
207
- | 3 | **3/6** | **BUILD** | GITHOOKS-GATE → DELPHI-GATE → ralph-loop (default) or parallel → TDD → freeze → blind review → verification | MVP code |
208
- | 4 | **4/6** | **VERIFY** | delphi-review --mode code-walkthrough → test-specification-alignment → browse QA → benchmark (optional) → learn + retro | Review report + feedback-log.md |
209
- | 5 | **5/6** | **SHIP** | finishing-a-development-branch → ship (create PR) → land-and-deploy → merge + CI + canary | PR URL + deploy status |
210
- | 6 | **6/6** | **CLOSE** | USER ACCEPTANCE (⚠️ mandatory manual) → Capture emergent issues → Cleanup worktree + branch → Sprint summary | Emergent issues list + cleanup report |
159
+ ## 6-Phase Pipeline
211
160
 
212
- **Phase Flow**:
213
161
  ```
214
162
  PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE
215
163
  ```
216
164
 
165
+ | Phase | Name | Key Actions | Output |
166
+ |-------|------|-------------|--------|
167
+ | 1/6 | PREP | Detect protected branch → Create git worktree → AUTO-ESTIMATE sizing → Classify (lightweight/standard/complex) | Worktree path + impact assessment |
168
+ | 2/6 | DESIGN | CONTEXT.md 预检 (#322) → grill-with-docs → R1 需求评审 → 设计文档+APPROVAL (HARD-GATE) → batch-grill-me → R2 delphi-review (3 distinct models, ≥90% consensus, max 5 rounds) → to-issues → specification.yaml | specification.yaml + slices-manifest.json + requirements-reviewed.json |
169
+ | 3/6 | BUILD | BUILD-ENTRY-CONTRACT → GITHOOKS-GATE → DELPHI-GATE → ralph-loop (default) or parallel → TDD → blind-review (read-only subagent) → verification | MVP code |
170
+ | 4/6 | VERIFY | delphi-review --mode code-walkthrough → test-specification-alignment (#367 HARD-GATE) → xp-gate check --all → browser (Layer 4) → learnings + xp-gate retro | Review report + feedback-log.md + test-alignment-report.json |
171
+ | 5/6 | SHIP | VERSION-GATE → 分支完成决策 (4选项) → native ship (create PR) → native land (merge + CI + canary) | PR URL + deploy status + merge confirmation |
172
+ | 6/6 | CLOSE | SHIP→CLOSE GATE (merge verified) → Backup sprint-state → #369 返工指标 → USER ACCEPTANCE (⚠️ mandatory manual) → Capture emergent issues → Cleanup worktree + branch | Emergent issues list + cleanup report + metrics |
173
+
217
174
  **Hard Gates**:
218
- - **Phase 2/6 → 3/6 (DESIGN → BUILD)**: Design must be APPROVED by delphi-review (≥90% consensus) + GITHOOKS-GATE (hooks installed) + DELPHI-GATE (spec APPROVED)
219
- - **Phase 4/6 → 5/6 (VERIFY → SHIP)**: feedback-log.md must exist (HARD-GATE)
220
- - **Phase 5/6 → 6/6 (SHIP → CLOSE)**: User acceptance must be completed (mandatory manual step)
175
+ - **DESIGN → BUILD**: R1 and R2 invoke all three expert roles independently, verify successful results with three distinct requested models, then aggregate APPROVED consensus ≥90% within 5 rounds, plus GITHOOKS-GATE + DELPHI-GATE + BUILD-ENTRY-CONTRACT (manifest schema + slice↔REQ)
176
+ - **VERIFY → SHIP**: feedback-log.md must exist + test-alignment-report.json PASS (#367 程序化 HARD-GATE)
177
+ - **SHIP → CLOSE**: PR must be merged to main + release completed (HARD-GATE)
221
178
 
222
179
  ---
223
180
 
224
- ## 各 Phase 调用的 Skills
225
-
226
- ### ⚠️ 强制输出格式规范(Mandatory Output Format)
181
+ ## ⚠️ Required Output Format (MANDATORY for L3 Step Adherence)
227
182
 
228
- **执行每个 Phase 时,必须以以下固定格式输出阶段标题**,不可省略、不可合并、不可替换:
183
+ Every phase MUST output its header as the first line of that phase's output. Format MUST be exact:
229
184
 
230
185
  ```markdown
231
186
  ## Phase 1/6: PREP (准备工作)
@@ -236,264 +191,210 @@ PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE
236
191
  ## Phase 6/6: CLOSE (收尾)
237
192
  ```
238
193
 
239
- **规则**:
240
- 1. 每个 Phase **开始执行时必须首先输出**对应的 `## Phase X/6: NAME` 标题行(作为该 Phase 输出的第一行)
241
- 2. **禁止省略** "Phase" 关键词(如不能只写 "PREP" 或 "## 1/6")
242
- 3. **禁止合并**多个 Phase 的输出(每个 Phase 必须有独立标题)
243
- 4. **格式必须精确匹配**:`## Phase X/6:` + 大写英文名 + ` (中文名)`
244
- 5. 跳过某个 Phase(如 `--resume-from build` 跳过了 PREP, DESIGN)时,不输出被跳过 Phase 的标题
245
- 6. 触发 `/sprint-flow` 后,**第一行输出应包含工作流阶段概览**:
246
-
247
- ```
248
- Sprint Flow: PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE
249
- ```
250
-
251
- ### Phase 1/6: PREP (准备工作 — worktree 隔离 + 规模评估)
252
-
253
- **执行时机**: `/sprint-flow` 启动后 → Phase 2/6 DESIGN 前。**自动执行**。
254
-
255
- **对应旧模型**: Phase -1 ISOLATE + Phase -0.5 AUTO-ESTIMATE
256
-
257
- **详细指令**: 参见 `references/phase-1-prep.md` — 包含步骤表、参数处理、错误回退、sprint-state 格式、AUTO-ESTIMATE 指标计算、路由决策。
258
-
259
- **快速参考**:
260
- 1. 检测保护分支 (main/master/develop) → 自动创建 worktree `.worktrees/sprint/sprint-YYYY-MM-DD-NN`
261
- 2. Sprint Lock 检测(Issue #144)— stale 锁自动覆盖,非 stale 阻断
262
- 3. 项目 setup (`npm install`/`go mod download`/`pip install`)
263
- 4. `.gitignore` 校验 + Sprint State 记录 + 基线测试
264
- 5. 识别需求类型 → 收集指标(引用计数、跨模块依赖、循环依赖)→ **轻量** / **标准** / **复杂**
265
- 6. 输出评估结果 → 用户确认后按路由继续
266
- 7. **参数**: `--no-isolate` (跳过), `--branch-name <name>`, `--force` (绕过保护分支)
194
+ **Rules**:
195
+ 1. First line of every phase output MUST be `## Phase X/6: NAME (中文名)`
196
+ 2. NEVER omit "Phase" keyword (not "## 1/6" or "PREP" alone)
197
+ 3. NEVER merge phase output — each phase gets its own header
198
+ 4. On `/sprint-flow` trigger, first line MUST output: `Sprint Flow: PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE`
199
+ 5. Each phase completion MUST write Phase Summary to `.sprint-state/phase-outputs/phase-{N}-summary.md`
267
200
 
268
- ### Phase 2/6: DESIGN (设计 — 需求探索 + 共识评审)
201
+ ### Phase Transition — TodoWrite Embedded (MANDATORY, resolves #366)
269
202
 
270
- **对应旧模型**: Phase 0 THINK + Phase 1 PLAN
203
+ 6. **Sprint initialization**: Phase 1 PREP MUST begin with `npx xp-gate sprint-init "<task_description>"` — this is the single entry point for sprint creation. NEVER manually write sprint-state.json.
271
204
 
272
- **执行者**: orchestrator 直接执行全部步骤(交互式 skill)。
205
+ 7. **Phase transitions are embedded in TodoWrite items**, not as separate post-actions. Each phase's TodoWrite item MUST include the phase-transition call as part of the same atomic step:
273
206
 
274
- **详细指令**: 参见 `references/phase-2-design.md` — 完整流程、条件分支、HARD-GATE。
275
-
276
- **快速参考**:
277
- - **Step 1: brainstorming** — `skill(name="brainstorming")` — 输出设计文档 + CONTEXT.md + ADR。**HARD-GATE**: 设计未批准 → 不可进入实现
278
- - **Step 2: autoplan** — `skill(name="autoplan")` — CEO/设计/工程自动评审 → 用户确认 taste_decisions
279
- - **Step 3: delphi-review** — `skill(name="delphi-review")` — 等待 APPROVED(非 APPROVED 暂停等待用户确认)
280
- - **Step 4: to-issues** — `skill(name="to-issues")` — 垂直切片 Issue 拆分 → slices-manifest.json
281
- - **Step 5: specification.yaml** — 从 APPROVED 设计文档自动提取
282
- - **Web 前端额外注入**: `design-shotgun`
283
- - **条件分支**: force level 只调整上下文深度;所有路径都执行 architecture、technical、feasibility 三个 Custom Agent,最多 5 轮
284
-
285
- ### Phase 2/6→3/6: GITHOOKS-GATE(质量门禁安装检查)
207
+ ```
208
+ TodoWrite item format:
209
+ - "Phase N: <main task> + phase-transition N completed → N+1 in_progress --render"
210
+ ```
286
211
 
287
- **执行时机**: Phase 2/6 DESIGN 完全通过、准备进入 Phase 3/6 BUILD 之前。
212
+ Example TodoWrite items for a sprint:
213
+ ```
214
+ - Phase 1: PREP — estimate + sprint-init + phase-transition 1 completed --render
215
+ - Phase 2: DESIGN — delphi review + phase-transition 2 completed --render
216
+ - Phase 3: BUILD — implementation + phase-transition 3 completed --render
217
+ ```
288
218
 
289
- **必须执行**: 运行 `githooks/verify.sh` 检查当前项目的 hooks 是否安装。
219
+ **Rationale**: TodoWrite items are the LLM's most consistently executed operations. Embedding phase-transition elevates it from "post-action meta-info" (priority 4, ignored) to "main task step" (priority 2, executed).
290
220
 
291
- **检查结果处理**:
292
- - ✅ 全部存在 → 进入 Phase 3/6 BUILD 入口(仍必须先执行 DELPHI-GATE)
293
- - ❌ 部分/全部缺失 → 运行 `githooks/install.sh` 安装(包括 `.git/hooks/pre-commit`、`.git/hooks/pre-push`、`githooks/adapter-common.sh`、`githooks/adapters/`)
294
- - 如果 githooks/ 目录不存在于项目根目录(即当前项目不是 xp-gate) → 从 xp-gate 仓库拉取 `githooks/` 目录结构
295
- - 安装完成后再次 `verify.sh` 确认
221
+ 8. **NEVER** manually write to `sprint-state.json` or manually render the dashboard. ALWAYS use:
222
+ ```
223
+ npx xp-gate phase-transition <phase> <status> --render [--outputs '<json>']
224
+ ```
225
+ - `<phase>`: 1-6
226
+ - `<status>`: `in_progress` | `completed` | `skipped` | `failed` | `paused`
227
+ - `--render`: Auto-renders ASCII progress dashboard after state update
228
+ - `--outputs '<json>'`: Optional JSON of phase outputs to record
296
229
 
297
- **核心原则**: 没有质量门禁的代码不可进入 BUILD 阶段。**GITHOOKS-GATE 失败 → 不可编码。**
230
+ This is a **HARD GATE** — the CLI is the single source of truth for state transitions and dashboard rendering.
298
231
 
299
- ### Phase 3/6: BUILD (构建 — ralph-loop 默认 + TDD + 盲评 + 验证)
232
+ ### Phase Output Status Schema (MANDATORY per phase)
300
233
 
301
- **对应旧模型**: Phase 2 BUILD(功能不变)
234
+ Each phase MUST close with structured status:
302
235
 
303
- **详细指令**: 参见 `references/phase-3-build.md`。
236
+ ```
237
+ status: completed | blocked | user_decision_required
238
+ outputs: [list of files produced]
239
+ decisions: [list of decisions made]
240
+ next_phase_context: [key info for next phase]
241
+ ```
304
242
 
305
- **快速参考**:
306
- 1. **DELPHI-GATE**: 验证 `.sprint-state/delphi-reviewed.json` 存在且 `verdict = "APPROVED"` → 否则 BLOCK
307
- 2. **输入**: `slices-manifest.json`(Phase 2/6 生成),按 `execution_order` 逐个执行
308
- 3. **模式**: 默认 `ralph-loop`(逐 REQ 迭代,token 节约 40-67%),可选 `--mode parallel`
309
- 4. **Skill 步骤**: hooks-install → dispatching-parallel-agents → TDD (RED/GREEN/REFACTOR) → freeze → blind-review → unfreeze → verification-before-completion → 成本监控
310
- 5. **Mock Minimization**: integration-first, mock 仅限 external services, 密度 > 30% 需 `@mock-justified`
243
+ ---
311
244
 
312
- ### Phase 4/6: VERIFY (验证 — 代码走查 + QA + 反馈获取)
245
+ ## Phase 1/6: PREP (准备工作)
313
246
 
314
- **对应旧模型**: Phase 3 REVIEW + Phase 4 FEEDBACK
247
+ **触发条件**:用户输入匹配 Triggers 表中任一短语,或显式调用 `/sprint-flow`。
315
248
 
316
- **详细指令**: 参见 `references/phase-4-verify.md`。
249
+ **输入**:
250
+ | 输入 | 来源 | 必需 |
251
+ |------|------|------|
252
+ | 功能描述 | 用户命令参数 | 是 |
253
+ | 当前分支 | `git branch --show-current` | 自动检测 |
254
+ | 项目语言 | `--lang` 参数或自动检测 | 否 |
255
+
256
+ **步骤**:
257
+ 1. 输出首行:`Sprint Flow: PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE`
258
+ 2. 检测当前分支是否为保护分支(main/master/develop)
259
+ 3. 创建 git worktree 隔离(除非 `--no-isolate`):
260
+ ```bash
261
+ git worktree add .worktrees/sprint-$(date +%Y%m%d-%H%M%S) -b sprint/YYYY-MM-DD-NN
262
+ ```
263
+ 4. AUTO-ESTIMATE 规模评估(分析功能描述复杂度)
264
+ 5. 分类:lightweight / standard / complex
265
+ 6. 执行 `npx xp-gate sprint-init "<task_description>"` 初始化状态
266
+ 7. 执行 `npx xp-gate phase-transition 1 completed --render`
317
267
 
318
- **快速参考**:
319
- - **Orchestrator 直接执行**: delphi-review code-walkthrough 需要用户确认 verdict(Issue #249),**必须由 orchestrator 直接调用** `skill(name="delphi-review")`
320
- - **执行顺序**: `delphi-review --mode code-walkthrough` → 等待 APPROVED → `test-specification-alignment` → `browse` (gstack) → 可选 `qa`/`design-review`/`benchmark` (gstack)
321
- - **Feedback 子阶段**: `learn` (Sprint 级复盘) + `retro` (工程回顾) + 可选 `systematic-debugging` (根因调试)
322
- - **Subagent**: `task(category="quick", load_skills=["learn", "retro", "systematic-debugging"])`
323
- - 输出: 评审报告 + feedback-log.md
324
- - **HARD-GATE**: feedback-log.md must exist before Phase 5/6
268
+ **输出**:
269
+ | 输出物 | 路径 | 格式 |
270
+ |--------|------|------|
271
+ | Worktree 路径 | `.worktrees/sprint-*` | 目录 |
272
+ | Sprint 状态 | `.sprint-state/sprint-state.json` | JSON |
273
+ | Phase Summary | `.sprint-state/phase-outputs/phase-1-summary.md` | Markdown |
325
274
 
326
- ### 负载/压力测试(可选)
275
+ **详细参考**:`@references/phase-1-prep.md`
327
276
 
328
- - **适用项目**:主要用于后端服务的压力测试 (k6/Locust/Gatling),Web 前端已有 `benchmark` 技能覆盖 Core Web Vitals、加载时间和资源大小等性能指标
329
- - **Phase 4/6 技能注入**:可根据项目类型自动选择合适的负载测试工具 (`k6` for Go-based services, `locust` for Python services, `gatling` for JVM-based services)
330
- - **集成方式**:可作为 Phase 4/6 的可选扩展,在 code-walkthrough 之后执行,与基准测试形成完整性能验证链条
331
- - **配置文件**:通过 `.sprint-load-test.yaml` 进行配置(待实现),包含并发用户数、持续时间、SLA 指标等参数
332
- - **触发条件**:后端项目可通过 `--type backend-*` 自动启用,或通过 `--with-performance` 标志手动启用
333
- - **Web 项目补充说明**:对于 Web 前端项目,现有的 `benchmark` 技能已处理页面加载性能、Core Web Vitals 等前端性能指标;负载/压力测试主要针对服务器端承载能力
277
+ ---
334
278
 
335
- ### Phase 5/6: SHIP (发布 — 发布准备 + 合并部署)
279
+ ## 门禁条件表 (Gate Conditions)
336
280
 
337
- **对应旧模型**: Phase 5 SHIP + Phase 6 LAND
281
+ | 门禁 | 位置 | 条件 | 失败处理 |
282
+ |------|------|------|----------|
283
+ | BUILD-ENTRY-CONTRACT | Phase 2→3 | slices-manifest.json schema 合法 + slice↔REQ 一致 | BLOCK,返回 Phase 2 修复 |
284
+ | GITHOOKS-GATE | Phase 2→3 | hooks 已安装且可执行 | 自动修复 (`xp-gate doctor --fix`),失败则 BLOCK |
285
+ | DELPHI-GATE | Phase 2→3 | R2 delphi-review APPROVED (≥90%) | 重新设计或用户覆盖(记录原因) |
286
+ | VERSION-GATE | Phase 4→5 | VERSION 文件与 package.json 一致 | 执行 `node scripts/sync-version.cjs` |
287
+ | #367 EVIDENCE-GATE | Phase 4→5 | test-alignment-report.json PASS + head_commit + spec_hash | BLOCK(--skip-evidence 需 --reason,≤2 次/sprint) |
288
+ | SHIP→CLOSE GATE | Phase 5→6 | PR 已合并 + release 完成 | BLOCK,等待合并确认 |
289
+ | feedback-log GATE | Phase 4→5 | feedback-log.md 存在 | BLOCK,必须完成 VERIFY |
338
290
 
339
- **详细指令**: 参见 `references/phase-5-ship.md` — GITHOOKS-GATE / VERSION-GATE / VERSION CHANGESET (Issue #142) / changeset schema。
291
+ ---
340
292
 
341
- **快速参考**:
342
- - **Orchestrator 直接执行**: `finishing-a-development-branch` 和 `ship` 均为交互式 skill(4 选项菜单 + PR 确认),**必须由 orchestrator 直接调用** `skill(name="finishing-a-development-branch")` 和 `skill(name="ship")`
343
- - 输入: phase-4-summary.md + feedback-log.md → 输出: PR URL
344
- - **HARD-GATE**: Phase 4/6 未完成 → BLOCK。验证 `feedback-log.md` 存在。
345
- - **GITHOOKS-GATE**: 验证 hooks 完整性,缺失则 `githooks/install.sh`
346
- - **VERSION-GATE**: bump PATCH/MINOR/MAJOR → `sync-version.sh` → CHANGELOG.md → `git diff VERSION` 验证
347
- - **LAND**: `land-and-deploy` — merge PR → 等待 CI (10min) → 等待 Deploy (10min) → Canary Health Check (5min)
348
- - **回滚**: `git revert` 最后一次 merge commit
293
+ ## Phase 2–6 详细指令
349
294
 
350
- ### Phase 6/6: CLOSE (收尾 — ⚠️ 人工验收 + 清理)
295
+ > Phase 2–6 的完整步骤、输入/输出契约、模板和 Skill 集成详情见 `references/` 目录。本节提供路由摘要。
351
296
 
352
- **对应旧模型**: Phase 7 USER ACCEPTANCE + Phase 8 CLEANUP
297
+ | Phase | 参考文件 | 核心 Skill 链 |
298
+ |-------|----------|---------------|
299
+ | 2/6 DESIGN | `@references/phase-2-design.md` | CONTEXT.md 预检 → grill-with-docs → R1 需求评审 → 设计文档+APPROVAL → batch-grill-me → R2 delphi-review → to-issues |
300
+ | 3/6 BUILD | `@references/phase-3-build.md` | BUILD-ENTRY-CONTRACT → GITHOOKS-GATE → DELPHI-GATE → ralph-loop (TDD) → blind-review (read-only subagent) |
301
+ | 4/6 VERIFY | `@references/phase-4-verify.md` | delphi code-walkthrough → test-spec-alignment (#367) → xp-gate check --all → browser (Layer 4) → learnings + retro |
302
+ | 5/6 SHIP | `@references/phase-5-ship.md` | VERSION-GATE → 分支完成决策 (4选项) → native ship (PR) → native land (merge+CI+canary) |
303
+ | 6/6 CLOSE | `@references/phase-6-close.md` | SHIP→CLOSE GATE → backup → #369 返工指标 → USER ACCEPTANCE → emergent → cleanup |
353
304
 
354
- **详细指令**: 参见 `references/phase-6-close.md` — UAT checklist, emergent issues capture, cleanup procedure.
305
+ **路径约定**:`@references/` 和 `@templates/` 相对于 skill 目录(`skills/sprint-flow/`)解析。
355
306
 
356
- **快速参考**:
357
- - **USER ACCEPTANCE**: ⚠️ **MUST NOT be automated, skipped, or bypassed.** 即使用户说"赶时间"、"跳过验收"、"直接发布",也必须暂停等待用户确认。使用 `@templates/emergent-issues-template.md` 检查清单
358
- - **CLEANUP**: 保存分支信息 → `git worktree remove <worktree_path>`(精确路径,禁止通配符)→ 删除本地分支 + 远程分支 → 关闭遗留 OPEN PR → 更新 sprint-state.json → 释放 Sprint Lock
359
- - 输出 Cleanup Report + Sprint Summary
360
- - **IF emergent issues → Sprint 2**
307
+ **完整参考文件索引**:
308
+ | 文件 | 内容 |
309
+ |------|------|
310
+ | `@references/phase-overview.md` | 全阶段详情、Skill 集成、参数、输出契约 |
311
+ | `@references/orchestration-rules.md` | Agent 调度、上下文继承、转换门禁 |
312
+ | `@references/force-levels.md` | 阶段强制执行规则 |
313
+ | `@templates/` | Pain doc、emergent issues、sprint summary、progress 模板 |
361
314
 
362
315
  ---
363
316
 
364
- ## 编排层规则(Orchestration Rules)
365
-
366
- 全部内容: 参见 `references/orchestration-rules.md`。包含:
367
- - Agent Dispatch (4 types), Phase Subagent Matrix, CONTEXT INHERITANCE
368
- - Phase Transition Rules, Phase Summary schema, Phase Transition Gate, RESUME GATE
369
- - WORKTREE ENFORCEMENT, Eval assertions
370
-
371
- ## 参数说明
317
+ ## Anti-Patterns
372
318
 
373
- | 参数 | 作用 | 示例 |
374
- |------|------|------|
375
- | (无参数) | 全流程 PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE | `/sprint-flow "开发访谈机器人"` |
376
- | `--stop-at <phase>` | 执行到指定 Phase 后停止 | `--stop-at design` |
377
- | `--resume-from <phase>` | 从指定 Phase 恢复(需先执行 RESUME GATE) | `--resume-from build --spec specification.yaml` |
378
- | `--phase <name>` | 只执行单个 Phase | `--phase build-only` |
379
- | `--status` | 查看 Sprint 进度(只读,不执行 Phase) | `--status` |
380
- | `--lang <lang>` | 指定项目语言 | `--lang springboot` / `django` / `golang` |
381
- | `--type <type>` | 指定项目类型 | `--type web-nextjs` / `backend-django` |
382
- | `--spec <file>` | 使用已有的 specification.yaml | `--spec path/to/spec.yaml` |
383
- | `--no-isolate` | 跳过 git worktree 隔离 | `--no-isolate` |
384
- | `--branch-name <name>` | 自定义分支名 | `--branch-name feat/my-feature` |
385
- | `--force` | 强制在当前分支继续 | `--force` |
386
- | `--with-performance` | 启用负载/压力测试 | `--with-performance` |
387
- | `--mode <mode>` | 构建模式(ralph-loop / parallel) | `--mode ralph-loop` |
388
-
389
- **Backward Compatible Parameter Mapping** (`--stop-at` / `--resume-from` / `--phase`):
390
-
391
- | Legacy Value | Maps To |
392
- |-------------|---------|
393
- | `isolate`, `isolate-only` | `prep`, `prep-only` |
394
- | `think`, `think-only` | `design`, `design-only` |
395
- | `plan`, `plan-only` | `design`, `design-only` |
396
- | `build`, `build-only` | `build`, `build-only` |
397
- | `review`, `review-only` | `verify`, `verify-only` |
398
- | `ship`, `ship-only` | `ship`, `ship-only` |
399
- | `land`, `land-only` | `ship`, `ship-only` |
400
- | `cleanup`, `cleanup-only` | `close`, `close-only` |
401
-
402
- **`--status` 行为规则**:
403
- - 执行 `node scripts/render-sprint-progress.cjs`,读取 `.sprint-state/sprint-state.json` 并渲染 ASCII 进度看板
404
- - 如果 `sprint-state.json` 不存在 → `[INFO] 未找到活跃的 Sprint`
405
- - 如果 `status == "completed"` → 输出完整看板 + `[INFO] Sprint 已完成。`
406
- - `--status` 可与其他参数组合:`--status --resume-from build` → 先展示状态,再提示 "将从 Phase 3/6 BUILD 继续"
407
-
408
- **`--resume-from` 限制**:校验为**尽力而为**(git commit 可被 GC 回收、文件 mtime 可被 `git checkout` 修改)。校验失败时输出完整诊断日志,建议启动新 Sprint。
409
-
410
- **项目类型自动检测**(按顺序检查):
411
-
412
- | 检测条件 | 类型 |
413
- |---------|------|
414
- | `package.json` + `next.config.js` | `web-nextjs` |
415
- | `package.json` + `vite.config.ts` + react 依赖 | `web-react` |
416
- | `package.json` + vue 依赖 | `web-vue` |
417
- | `pubspec.yaml` + `flutter:` | `mobile-flutter` |
418
- | `package.json` + react-native 依赖 or `ios/` + `android/` | `mobile-react-native` |
419
- | `go.mod` | `backend-go` (可选 k6) |
420
- | `pom.xml` | `backend-springboot` (可选 gatling) |
421
- | `manage.py` 或 `pyproject.toml` (django) | `backend-django` (可选 locust) |
422
- | 无匹配 | `backend-cli` |
423
-
424
- **项目类型 → Skill 注入映射**:
425
-
426
- | Phase | Backend (default) | Web Frontend | Mobile | Load Test |
427
- |-------|------------------|-------------|--------|-----------|
428
- | 2/6 DESIGN | `brainstorming` + `autoplan` + `delphi-review` | + `design-shotgun` | (同 web) | (通用) |
429
- | 3/6 BUILD | TDD + blind-review | (同 backend) | + `vercel-react-native-skills` / `flutter-review` | (同) |
430
- | 4/6 VERIFY | `delphi-review --mode code-walkthrough` + `test-specification-alignment` + k6/locust/gatling | + `qa` + `design-review` + `benchmark` | Flutter: `flutter-test` / RN: `detox E2E` | k6/locust/gatling |
431
- | 4/6 VERIFY (Feedback) | `learn` + `retro` | (同) | (同) | (同) |
432
- | 5/6 SHIP | `finishing-a-development-branch` + `ship` + `land-and-deploy` | (同) | + platform deploy | (同) |
433
- | 6/6 CLOSE | — 人工验收 → cleanup | (同) | (同) | (同) |
434
- | Browse | `localhost:3000` | 部署 URL + 表单/交互 | Flutter Web / RN Web | (专用) |
435
-
436
- **Mobile 工具链**: Flutter — `flutter analyze/test/build/pub publish`; RN — `metro/detox/jest/react-native run-ios/android`
319
+ | ❌ Error | ✅ Correct |
320
+ |----------|-----------|
321
+ | Route Q&A, explanation, or code-search requests to sprint-flow | Only trigger for explicit feature development/implementation requests |
322
+ | Skip Phase 1/6 PREP isolation, edit directly on main/master/develop | Default: create worktree; only bypass with `--no-isolate` or `--force` + user confirmation |
323
+ | Skip AUTO-ESTIMATE and apply full heavy pipeline blindly | Evaluate lightweight/standard/complex first, follow recommended or user-confirmed flow |
324
+ | Skip Delphi review in DESIGN, go straight to BUILD | All requirement levels (lightweight/standard/complex) must pass R1 需求评审 + R2 delphi-review; APPROVED before coding |
325
+ | Skip TDD, implement code directly | Phase 3/6 BUILD must follow RED → GREEN → REFACTOR; tests and implementation delivered together |
326
+ | Skip user acceptance, go straight to Ship | Phase 6/6 CLOSE USER ACCEPTANCE must be manual; never automate, skip, or fake |
327
+ | Enter CLOSE without SHIP completing merge to main | Phase 5/6 SHIP must complete merge to main + release before entering Phase 6/6 CLOSE; otherwise worktree cleanup leaves residue + UAT reviews unmerged code |
328
+ | Clean up CLOSE without backing up sprint-state first | `.sprint-state/` is inside worktree; it's lost on worktree removal. CLOSE step 1 MUST back up to repo-tracked path first |
329
+ | Keep adding random changes after verification failures | Max 3 fix cycles; if still failing, BLOCK and request user decision |
330
+ | Enter next phase without generating Phase Summary | Every phase MUST write `.sprint-state/phase-outputs/phase-{N}-summary.md` and pass transition gate |
331
+ | Complete implementation change without running verification | After every file edit/refactor/feature, MUST run `npm test` + `npm run lint` + `npx tsc --noEmit` and record the structured verification event (see `phase-3-build.md` §In-Session Verification) |
437
332
 
438
333
  ---
439
334
 
440
- ## 状态管理
335
+ ## 状态机 (State Machine)
336
+
337
+ ```mermaid
338
+ stateDiagram-v2
339
+ [*] --> PREP : trigger matched
340
+ PREP --> DESIGN : worktree ready
341
+ DESIGN --> BUILD : APPROVED ≥90%
342
+ DESIGN --> DESIGN : REQUEST_CHANGES (max 5 Delphi rounds)
343
+ BUILD --> VERIFY : tests pass
344
+ BUILD --> BUILD : fix cycle (max 3)
345
+ VERIFY --> SHIP : feedback-log exists
346
+ VERIFY --> BUILD : critical issues found
347
+ SHIP --> CLOSE : PR merged
348
+ SHIP --> SHIP : CI failed (retry)
349
+ CLOSE --> [*] : UAT confirmed
350
+ BUILD --> BLOCKED : 3 fix cycles exhausted
351
+ DESIGN --> BLOCKED : 5 Delphi rounds exhausted
352
+ BLOCKED --> [*] : user decision
353
+ ```
441
354
 
442
- **Sprint State**: 存储于 `<project-root>/.sprint-state/` — `sprint-state.yaml`/`.json` + `phase-outputs/` (pain-document.md / specification.yaml / mvp-v1 / review-report.md / emergent-issues.md / feedback-log.md / sprint-summary.md)
355
+ ---
443
356
 
444
- **Sprint 2 自动触发**: Phase 6/6 CLOSE 完成时 — `emergent_issues_count == 0` → 结束; `> 0` → Critical 自动启动 Sprint 2, Major/Minor 询问用户
357
+ ## 决策记录模板 (Decision Record)
445
358
 
446
- ---
359
+ 每个用户决策点必须记录到 `.sprint-state/decisions.md`:
447
360
 
448
- ### ⭐ Phase State Persistence(阶段状态持久化 — MANDATORY)
361
+ ```markdown
362
+ ## Decision DR-{NNN}
363
+ - **Phase**: {phase_number}/6 {PHASE_NAME}
364
+ - **Question**: {what was asked}
365
+ - **Options**: {options presented}
366
+ - **Choice**: {user's selection}
367
+ - **Rationale**: {why this choice}
368
+ - **Timestamp**: {ISO 8601}
369
+ ```
449
370
 
450
- **编排器必须在每个 Phase 完成后更新 `.sprint-state/sprint-state.json`**:
371
+ **强制决策点**:
372
+ | 决策点 | 阶段 | 触发条件 |
373
+ |--------|------|----------|
374
+ | 规模确认 | PREP | AUTO-ESTIMATE 结果与用户预期不符 |
375
+ | 设计审批 | DESIGN | delphi-review 返回 REQUEST_CHANGES |
376
+ | 修复策略 | BUILD | 修复循环达到 3 次上限 |
377
+ | 发布确认 | SHIP | PR 创建后等待用户确认合并 |
378
+ | UAT 结果 | CLOSE | 用户手动验收(必须手动,禁止自动化) |
451
379
 
452
- 1. **Phase 完成后立即更新**(每个 Phase 结束前):
453
- - `phase`: 更新为当前 Phase 编号(如 `1`, `2`, `3`...)
454
- - `status`: 更新为 `"completed"`(已完成 Phase)
455
- - `phase_history`: 追加新条目
380
+ ---
456
381
 
457
- 2. **`phase_history` 数组条目 schema**:
458
- ```json
459
- {
460
- "phase": 1,
461
- "phase_name": "PREP",
462
- "status": "completed",
463
- "timestamp": "2026-07-08T10:30:00Z"
464
- }
465
- ```
382
+ ## 失败处理 (Failure Handling)
466
383
 
467
- 3. **检查点**:
468
- - `--status` 参数读取 `sprint-state.json` 并渲染进度看板
469
- - TUI panel 显示当前 Phase 和历史
470
- - `--resume-from` 校验 `phase_history` 中的最后完成 Phase
471
-
472
- 4. **完整 sprint-state.json 示例**:
473
- ```json
474
- {
475
- "id": "sprint-2026-07-08-01",
476
- "phase": 3,
477
- "status": "in_progress",
478
- "phase_history": [
479
- {"phase": 1, "phase_name": "PREP", "status": "completed", "timestamp": "2026-07-08T10:00:00Z"},
480
- {"phase": 2, "phase_name": "DESIGN", "status": "completed", "timestamp": "2026-07-08T10:30:00Z"}
481
- ],
482
- "isolation": {
483
- "worktree_path": "/home/boyingliu01/projects/xp-gate/.worktrees/sprint/sprint-2026-07-08-01",
484
- "branch": "sprint/2026-07-08-01"
485
- },
486
- "outputs": {
487
- "pain_document": "phase-outputs/phase-2-summary.md",
488
- "specification": "phase-outputs/specification.yaml"
489
- },
490
- "metrics": {
491
- "coverage_pct": 85.5
492
- }
493
- }
494
- ```
384
+ | 失败场景 | 处理策略 | 升级条件 |
385
+ |----------|----------|----------|
386
+ | Worktree 创建失败 | 重试 1 次,失败则提示用户手动处理 | 磁盘空间不足或权限问题 |
387
+ | delphi-review 连续 REQUEST_CHANGES | 最多 3 轮重设计,超过则 BLOCK | 3 轮后仍未 APPROVED |
388
+ | BUILD 修复循环超限 | 最多 3 次 fix cycle,超过则 BLOCK + 用户决策 | 测试持续失败 |
389
+ | CI 失败 | 分析失败原因,尝试 1 次自动修复 | 非 flaky 失败 |
390
+ | PR 合并冲突 | 提示用户手动解决 | 始终(禁止自动 force) |
391
+ | 工具缺失 | SKIP(不 BLOCK),记录到 phase summary | 始终不阻断 |
495
392
 
496
- **Backward compat**: Old sprint-state.json files using negative/legacy phase numbers (`-1`, `-0.5`, `0`..`8`) remain readable. Dashboard renders them as-is. New sprints use phase numbers 1-6.
393
+ **BLOCK 状态处理**:
394
+ 1. 写入 `.sprint-state/sprint-state.json` 状态为 `blocked`
395
+ 2. 输出阻塞原因 + 已完成工作 + 建议操作
396
+ 3. 等待用户决策(继续/放弃/降级)
397
+ 4. 记录决策到 `decisions.md`
497
398
 
498
399
  ---
499
400
 
@@ -507,104 +408,4 @@ Sprint Flow: PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE
507
408
 
508
409
  ## 底层 Skills 保持独立
509
410
 
510
- 所有被调用的 Skills 独立可用:`delphi-review` (单独评审), `test-driven-development` (TDD),sprint-flow 仅自动串联
511
-
512
- ---
513
-
514
- ## Anti-Patterns
515
-
516
- | 错误 | 正确 |
517
- |------|------|
518
- | 把普通问答、解释、代码检索请求路由到 sprint-flow | 仅在用户明确要求开发/实现/一键开发完整需求时触发 sprint-flow |
519
- | 跳过 Phase 1/6 PREP 隔离,直接在 main/master/develop 上改代码 | 默认创建 worktree;除非用户显式使用 `--no-isolate` 或 `--force` 并确认风险 |
520
- | 未完成 PREP AUTO-ESTIMATE 就套用完整重流程 | 先评估轻量/标准/复杂,再按推荐流程或用户确认后的流程执行 |
521
- | DESIGN 阶段跳过 Delphi 评审直接 BUILD | 所有需求级别(轻量/标准/复杂)必须经过 autoplan + delphi-review;未 APPROVED 禁止编码 |
522
- | 跳过 TDD 直接实现代码 | Phase 3/6 BUILD 必须遵循 RED → GREEN → REFACTOR,测试与实现一起交付 |
523
- | 跳过用户验收直接 Ship | Phase 6/6 CLOSE USER ACCEPTANCE 必须人工完成;不得自动化、跳过或伪造 |
524
- | 验证失败后继续追加随机修改 | 最多 3 次修复循环;仍失败则 BLOCK 并请求用户决策 |
525
- | 未生成 Phase Summary 就进入下一阶段 | 每个 Phase 必须写入 `.sprint-state/phase-outputs/phase-{N}-summary.md` 并通过 transition gate |
526
-
527
- ## Output Format
528
-
529
- See [Output Contract](#output-contract) below for the canonical machine-readable output schema.
530
-
531
- ### Eval Assertions
532
- - `phase`, `phase_name`, `status`, `outputs`, `decisions`, `next_phase_context`
533
- - `id`, `isolation.worktree_path`, `isolation.branch`, `metrics.coverage_pct`
534
-
535
- ## Output Contract
536
-
537
- **Phase Summary** (每个 Phase 必须输出 YAML frontmatter): `phase/N`, `phase_name`, `status`, `outputs[]`, `decisions[]`, `next_phase_context` + markdown body (≤50 lines)
538
-
539
- **Sprint State JSON**: `{id, phase, status, phase_history[], isolation {worktree_path, branch}, outputs, metrics}` — 存储于 `.sprint-state/sprint-state.json`
540
-
541
- **Final User-Facing Output**: Phase/status, file paths, validation results, next user decision, PR URL or cleanup report
542
-
543
- ## References
544
-
545
- 详细指令文件位于 `@references/`:
546
-
547
- | File | Phase | Phase Name | Maps From (Old) |
548
- |------|-------|------------|-----------------|
549
- | `@references/phase-1-prep.md` | 1/6 | PREP | Phase -1 ISOLATE + Phase -0.5 AUTO-ESTIMATE |
550
- | `@references/phase-2-design.md` | 2/6 | DESIGN | Phase 0 THINK + Phase 1 PLAN |
551
- | `@references/phase-3-build.md` | 3/6 | BUILD | Phase 2 BUILD |
552
- | `@references/phase-4-verify.md` | 4/6 | VERIFY | Phase 3 REVIEW + Phase 4 FEEDBACK |
553
- | `@references/phase-5-ship.md` | 5/6 | SHIP | Phase 5 SHIP + Phase 6 LAND |
554
- | `@references/phase-6-close.md` | 6/6 | CLOSE | Phase 7 USER ACCEPTANCE + Phase 8 CLEANUP |
555
-
556
- Additional reference files:
557
- - `@references/force-levels.md` — Phase forcing rules
558
- - `@references/orchestration-rules.md` — Orchestration layer rules
559
- - `@references/components/` — Reusable phase building blocks
560
-
561
- ---
562
-
563
- ## Templates
564
-
565
- 模板文件位于 `@templates/`:
566
- - `@templates/pain-document-template.md` — Pain Document 模板 (Phase 2/6 DESIGN)
567
- - `@templates/emergent-issues-template.md` — Emergent Issues 检查清单 (Phase 6/6 CLOSE)
568
- - `@templates/sprint-summary-template.md` — Sprint Summary 模板 (Phase 6/6 CLOSE)
569
- - `@templates/sprint-progress-template.md` — Sprint 进度看板(每个 Phase 完成后 + `--status` 查询时渲染)
570
- - `@templates/auto-estimate-output-template.md` — AUTO-ESTIMATE 输出格式 (Phase 1/6 PREP)
571
-
572
- ---
573
-
574
- ## 研究证据
575
-
576
- | 证据 | 来源 | 应用 |
577
- |------|------|------|
578
- | One-shot = 单次迭代执行 | Boris Cherny interview | Phase 3/6 BUILD 设计 |
579
- | 80% session 从 Plan Mode 开始 | Boris skill | Phase 2/6 DESIGN 设计 |
580
- | Verification improves 2-3x | Boris #1 tip | Phase 4/6 VERIFY 设计 |
581
- | Emergent requirements 无法消除 | Mike Cohn, Rafael Santos | Phase 6/6 CLOSE 人工设计 |
582
- | 78% failures invisible | arXiv research | Phase 6/6 必要性证明 |
583
- | Think → Plan → Build → Ship | gstack ETHOS | 整体流程设计 |
584
-
585
- ---
586
-
587
- ## Phase Flow Consistency
588
-
589
- This section documents the canonical 6-phase order to ensure all future edits keep the phase sequence synchronized across all locations in this document and its reference files.
590
-
591
- **Canonical Phase Order** (Phase 1/6..6/6):
592
-
593
- | Phase # | Name | Phase # | Name |
594
- |---------|------|---------|------|
595
- | 1/6 | PREP | 4/6 | VERIFY |
596
- | 2/6 | DESIGN | 5/6 | SHIP |
597
- | 3/6 | BUILD | 6/6 | CLOSE |
598
-
599
- **Locations that MUST keep this order synchronized**:
600
- 1. **Frontmatter `workflow_steps`** — Phase list
601
- 2. **Frontmatter `description` trigger text** — Flow string
602
- 3. **Body "完整流程" section** — Phase descriptions in order
603
- 4. **Body "Phase Flow" diagram** — ASCII flow diagram
604
- 5. **Body "强制输出格式规范" section** — Output format
605
- 6. **Body "Workflow Steps" table** — Step/Phase table
606
- 7. **Body "References" section** — Reference file list
607
- 8. **`references/orchestration-rules.md` Phase Subagent Dispatch Matrix** — Phase/Name order
608
- 9. **`references/force-levels.md`** — Phase references
609
-
610
- **⚠️ Migration from old 11-phase model (v2.0)**: The 6-phase model was introduced in Issue #290 to reduce cognitive load. Old sprint-state.json files with negative/legacy phase numbers remain backward-compatible.
411
+ 所有被调用的 Skills 独立可用:`delphi-review` (单独评审), `test-driven-development` (TDD), `grill-with-docs` (需求访谈), `batch-grill-me` (批量决策), `to-issues` (切片拆分),sprint-flow 仅自动串联