@boyingliu01/xp-gate 0.14.3 → 0.14.4

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 (25) hide show
  1. package/package.json +1 -1
  2. package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
  3. package/plugins/claude-code/skills/delphi-review/AGENTS.md +3 -3
  4. package/plugins/claude-code/skills/delphi-review/SKILL.md +193 -157
  5. package/plugins/claude-code/skills/sprint-flow/AGENTS.md +3 -3
  6. package/plugins/claude-code/skills/sprint-flow/SKILL.md +138 -495
  7. package/plugins/claude-code/skills/sprint-flow/references/phase-overview.md +481 -0
  8. package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +3 -3
  9. package/plugins/opencode/package.json +1 -1
  10. package/plugins/opencode/skills/delphi-review/AGENTS.md +3 -3
  11. package/plugins/opencode/skills/delphi-review/SKILL.md +193 -157
  12. package/plugins/opencode/skills/sprint-flow/AGENTS.md +3 -3
  13. package/plugins/opencode/skills/sprint-flow/SKILL.md +138 -495
  14. package/plugins/opencode/skills/sprint-flow/references/phase-overview.md +481 -0
  15. package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +3 -3
  16. package/plugins/qoder/plugin.json +1 -1
  17. package/plugins/qoder/skills/delphi-review/AGENTS.md +3 -3
  18. package/plugins/qoder/skills/sprint-flow/AGENTS.md +3 -3
  19. package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +3 -3
  20. package/skills/delphi-review/AGENTS.md +3 -3
  21. package/skills/delphi-review/SKILL.md +193 -157
  22. package/skills/sprint-flow/AGENTS.md +3 -3
  23. package/skills/sprint-flow/SKILL.md +138 -495
  24. package/skills/sprint-flow/references/phase-overview.md +481 -0
  25. package/skills/test-specification-alignment/AGENTS.md +3 -3
@@ -0,0 +1,481 @@
1
+ # Sprint Flow — Phase Overview & Detailed Instructions
2
+
3
+ > **This file**: detailed phase descriptions, skill integration, parameter docs, output contract, templates, research evidence, and orchestration rules.
4
+ > **Router file**: `../SKILL.md` — description, triggers, workflow steps, constraints, anti-patterns only.
5
+
6
+ ---
7
+
8
+ ## 核心原则
9
+
10
+ | 原则 | 说明 |
11
+ |------|------|
12
+ | **单一入口** | 用户只需调用 `/sprint-flow`,自动串联全流程 |
13
+ | **自动流水线** | 类似 autoplan,自动执行多个阶段 |
14
+ | **关键节点暂停** | APPROVED 确认、DELPHI-GATE 通过、Ship 确认、⚠️ Phase 6 CLOSE 必须人工 |
15
+ | **承认 Emergent** | 用户验收环节必须人工,无法自动化(78% 失败不可见) |
16
+ | **复用现有 Skills** | 不重新发明,整合调用现有体系 |
17
+
18
+ ---
19
+
20
+ ## Unique Value Proposition
21
+
22
+ Sprint Flow is NOT just a sequential launcher of existing skills. Here's what makes it different from manually running each skill:
23
+
24
+ ### Why Sprint Flow vs Manual Skill Execution
25
+
26
+ | Dimension | Manual Execution | Sprint Flow |
27
+ |-----------|-----------------|-------------|
28
+ | **Context Continuity** | Each skill starts fresh; lost design decisions between phases | Phase summaries + sprint-state.json maintain full traceability across 6 phases |
29
+ | **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) |
30
+ | **Token Efficiency** | Linear context accumulation across phases — ~150K+ tokens | Ralph-loop default: 40-67% token savings via clean REQ-level contexts |
31
+ | **Emergent Requirements** | Discovered late, silently ignored or merged | Phase 6 CLOSE explicitly captures emergent issues via template; triggers Sprint 2 for critical issues |
32
+ | **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 |
33
+ | **Progress Tracking** | Ad-hoc, memory-based | `.sprint-state/` persistence with phase history, timing, and metrics — `--status` renders progress dashboard |
34
+
35
+ ### Key Differentiators
36
+
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
+
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.
40
+
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
+
43
+ 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.
44
+
45
+ 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.
46
+
47
+ ---
48
+
49
+ ## 完整流程(默认无参数)
50
+
51
+ 调用 `/sprint-flow "[需求描述]"` 后,自动执行以下流程:
52
+
53
+ ```
54
+ Phase 1/6: PREP → worktree隔离 + 规模评估 + 流程路由
55
+ Phase 2/6: DESIGN → brainstorming → autoplan → delphi-review → specification.yaml
56
+ Phase 3/6: BUILD → GITHOOKS-GATE → DELPHI-GATE → ralph-loop/TDD → freeze/盲评 → verification
57
+ Phase 4/6: VERIFY → delphi-review --mode code-walkthrough → test-alignment → browse → learn + retro
58
+ Phase 5/6: SHIP → finishing-a-development-branch → ship → land-and-deploy → canary
59
+ Phase 6/6: CLOSE → USER ACCEPTANCE (⚠️ 人工) → emergent issues → cleanup
60
+ ```
61
+
62
+ **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.
63
+
64
+ ---
65
+
66
+ ## 暂停点设计(不是随时停,而是设计明确的暂停点)
67
+
68
+ - **Phase 1/6 PREP**: 保护分支强制隔离 → 输出警告或自动创建 worktree → 自动恢复;AUTO-ESTIMATE 结果展示 → 用户确认 → 按路由继续
69
+ - **Phase 2/6 DESIGN**: brainstorming 设计未 APPROVED (HARD-GATE) → 用户修改 → APPROVED 后继续;autoplan taste_decisions → 用户确认;delphi-review 未 APPROVED → 修复 → APPROVED → specification.yaml
70
+ - **Phase 3/6 BUILD**: DELPHI-GATE 未通过 → BLOCK;验证失败 > max3 → 用户决策修复/放弃;成本超阈值 → 用户确认
71
+ - **Phase 4/6 VERIFY**: delphi code-walkthrough REQUEST_CHANGES → 用户处理 → 重新评审;browse 发现问题 → 回退 Phase 3(不暂停)
72
+ - **Phase 5/6 SHIP**: finishing-a-development-branch (4选项) → 确认;ship PR → 用户确认合并;land-and-deploy 完成/失败 → 用户确认;⚠️ SHIP must complete merge to main + release before Phase 6
73
+ - **Phase 6/6 CLOSE**: SHIP→CLOSE GATE (校验 merge 已完成 + git status clean + 当前在 main) → Backup sprint-state → USER ACCEPTANCE ⚠️ 必须人工验收 → 用户确认后继续;cleanup 完成/失败 → 用户确认 → 结束流程
74
+
75
+ ---
76
+
77
+ ## Workflow Steps Detail
78
+
79
+ | Step | Phase | Name | Key Actions | Output |
80
+ |------|-------|------|-------------|--------|
81
+ | 1 | **1/6** | **PREP** | Detect protected branch → Create git worktree → AUTO-ESTIMATE sizing → Classify (lightweight/standard/complex) | Worktree path + impact assessment |
82
+ | 2 | **2/6** | **DESIGN** | brainstorming → autoplan → delphi-review (HARD-GATE ≥90% consensus) → to-issues → specification.yaml | specification.yaml + slices-manifest.json |
83
+ | 3 | **3/6** | **BUILD** | GITHOOKS-GATE → DELPHI-GATE → ralph-loop (default) or parallel → TDD → freeze → blind review → verification | MVP code |
84
+ | 4 | **4/6** | **VERIFY** | delphi-review --mode code-walkthrough → test-specification-alignment → browse QA → benchmark (optional) → learn + retro | Review report + feedback-log.md |
85
+ | 5 | **5/6** | **SHIP** | VERSION-GATE → finishing-a-development-branch → ship (create PR) → land-and-deploy → merge to main + CI + canary → release | PR URL + deploy status + merge confirmation |
86
+ | 6 | **6/6** | **CLOSE** | SHIP→CLOSE GATE (merge + release verified) → Backup sprint-state → USER ACCEPTANCE (⚠️ mandatory manual) → Capture emergent issues → Cleanup worktree + branch → Sprint summary | Emergent issues list + cleanup report |
87
+
88
+ **Phase Flow**:
89
+ ```
90
+ PREP → DESIGN → BUILD → VERIFY → SHIP (merge to main + release) → CLOSE
91
+
92
+ SHIP→CLOSE GATE
93
+ (merge verified + main clean)
94
+ ```
95
+
96
+ **Hard Gates**:
97
+ - **Phase 2/6 → 3/6 (DESIGN → BUILD)**: Design must be APPROVED by delphi-review (≥90% consensus) + GITHOOKS-GATE (hooks installed) + DELPHI-GATE (spec APPROVED)
98
+ - **Phase 4/6 → 5/6 (VERIFY → SHIP)**: feedback-log.md must exist (HARD-GATE)
99
+ - **Phase 5/6 → 6/6 (SHIP → CLOSE)**: PR must be merged to main + release completed (HARD-GATE). See `references/phase-6-close.md#ship--close-gate`.
100
+
101
+ ---
102
+
103
+ ## 各 Phase 调用的 Skills
104
+
105
+ ### ⚠️ 强制输出格式规范(Mandatory Output Format)
106
+
107
+ **执行每个 Phase 时,必须以以下固定格式输出阶段标题**,不可省略、不可合并、不可替换:
108
+
109
+ ```markdown
110
+ ## Phase 1/6: PREP (准备工作)
111
+ ## Phase 2/6: DESIGN (设计)
112
+ ## Phase 3/6: BUILD (构建)
113
+ ## Phase 4/6: VERIFY (验证)
114
+ ## Phase 5/6: SHIP (发布)
115
+ ## Phase 6/6: CLOSE (收尾)
116
+ ```
117
+
118
+ **规则**:
119
+ 1. 每个 Phase **开始执行时必须首先输出**对应的 `## Phase X/6: NAME` 标题行(作为该 Phase 输出的第一行)
120
+ 2. **禁止省略** "Phase" 关键词(如不能只写 "PREP" 或 "## 1/6")
121
+ 3. **禁止合并**多个 Phase 的输出(每个 Phase 必须有独立标题)
122
+ 4. **格式必须精确匹配**:`## Phase X/6:` + 大写英文名 + ` (中文名)`
123
+ 5. 跳过某个 Phase(如 `--resume-from build` 跳过了 PREP, DESIGN)时,不输出被跳过 Phase 的标题
124
+ 6. 触发 `/sprint-flow` 后,**第一行输出应包含工作流阶段概览**:
125
+
126
+ ```
127
+ Sprint Flow: PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE
128
+ ```
129
+
130
+ ### Phase 1/6: PREP (准备工作 — worktree 隔离 + 规模评估)
131
+
132
+ **执行时机**: `/sprint-flow` 启动后 → Phase 2/6 DESIGN 前。**自动执行**。
133
+
134
+ **对应旧模型**: Phase -1 ISOLATE + Phase -0.5 AUTO-ESTIMATE
135
+
136
+ **详细指令**: 参见 `references/phase-1-prep.md` — 包含步骤表、参数处理、错误回退、sprint-state 格式、AUTO-ESTIMATE 指标计算、路由决策。
137
+
138
+ **快速参考**:
139
+ 1. 检测保护分支 (main/master/develop) → 自动创建 worktree `.worktrees/sprint/sprint-YYYY-MM-DD-NN`
140
+ 2. Sprint Lock 检测(Issue #144)— stale 锁自动覆盖,非 stale 阻断
141
+ 3. 项目 setup (`npm install`/`go mod download`/`pip install`)
142
+ 4. `.gitignore` 校验 + Sprint State 记录 + 基线测试
143
+ 5. 识别需求类型 → 收集指标(引用计数、跨模块依赖、循环依赖)→ **轻量** / **标准** / **复杂**
144
+ 6. 输出评估结果 → 用户确认后按路由继续
145
+ 7. **参数**: `--no-isolate` (跳过), `--branch-name <name>`, `--force` (绕过保护分支)
146
+
147
+ ### Phase 2/6: DESIGN (设计 — 需求探索 + 共识评审)
148
+
149
+ **对应旧模型**: Phase 0 THINK + Phase 1 PLAN
150
+
151
+ **执行者**: orchestrator 直接执行全部步骤(交互式 skill)。
152
+
153
+ **详细指令**: 参见 `references/phase-2-design.md` — 完整流程、条件分支、HARD-GATE。
154
+
155
+ **快速参考**:
156
+ - **Step 0.5: DESIGN 路由分叉 (v0.14.0+)**: 根据 PREP 的 `change_type` 决定路径。`修改已存在代码` → SKIP autoplan, 直接 lightweight delphi-review (2 专家, 1 轮)。`新增功能` 或 undefined → 标准 autoplan 路径。详见 `references/phase-2-design.md#step-05-design-路由分叉`。
157
+ - **Step 1: brainstorming** — `skill(name="brainstorming")` — 输出设计文档 + CONTEXT.md + ADR。**HARD-GATE**: 设计未批准 → 不可进入实现
158
+ - **Step 2: autoplan** — `skill(name="autoplan")` — CEO/设计/工程自动评审 → 用户确认 taste_decisions(仅标准路径)
159
+ - **Step 3: delphi-review** — `skill(name="delphi-review")` — 等待 APPROVED(非 APPROVED 暂停等待用户确认)
160
+ - **Step 4: to-issues** — `skill(name="to-issues")` — 垂直切片 Issue 拆分 → slices-manifest.json
161
+ - **Step 5: specification.yaml** — 从 APPROVED 设计文档自动提取
162
+ - **Web 前端额外注入**: `design-shotgun`
163
+ - **条件分支**: IF autoplan AUTO_APPROVED → lightweight delphi-review (2 专家、1 轮); ELSE → 标准 delphi-review (3 专家)
164
+
165
+ ### Phase 2/6→3/6: GITHOOKS-GATE(质量门禁安装检查)
166
+
167
+ **执行时机**: Phase 2/6 DESIGN 完全通过、准备进入 Phase 3/6 BUILD 之前。
168
+
169
+ **必须执行**: 运行 `githooks/verify.sh` 检查当前项目的 hooks 是否安装。
170
+
171
+ **检查结果处理**:
172
+ - ✅ 全部存在 → 进入 Phase 3/6 BUILD 入口(仍必须先执行 DELPHI-GATE)
173
+ - ❌ 部分/全部缺失 → 运行 `githooks/install.sh` 安装(包括 `.git/hooks/pre-commit`、`.git/hooks/pre-push`、`githooks/adapter-common.sh`、`githooks/adapters/`)
174
+ - 如果 githooks/ 目录不存在于项目根目录(即当前项目不是 xp-gate) → 从 xp-gate 仓库拉取 `githooks/` 目录结构
175
+ - 安装完成后再次 `verify.sh` 确认
176
+
177
+ **核心原则**: 没有质量门禁的代码不可进入 BUILD 阶段。**GITHOOKS-GATE 失败 → 不可编码。**
178
+
179
+ ### Phase 3/6: BUILD (构建 — ralph-loop 默认 + TDD + 盲评 + 验证)
180
+
181
+ **对应旧模型**: Phase 2 BUILD(功能不变)
182
+
183
+ **详细指令**: 参见 `references/phase-3-build.md`。
184
+
185
+ **快速参考**:
186
+ 1. **DELPHI-GATE**: 验证 `.sprint-state/delphi-reviewed.json` 存在且 `verdict = "APPROVED"` → 否则 BLOCK
187
+ 2. **TDD-GATE (MANDATORY — v0.14.0+)**: 在 delegation 前验证每个 REQ 存在 failing test。无 test → mark `[TDD-RED]`(ralph-loop 创建)。有 test 且 GREEN 且无实现 → BLOCK(TDD bypass)。详见 `references/phase-3-build.md#tdd-gate-pre-implementation-tdd-check-mandatory`。
188
+ 3. **输入**: `slices-manifest.json`(Phase 2/6 生成),按 `execution_order` 逐个执行
189
+ 4. **模式**: 默认 `ralph-loop`(逐 REQ 迭代,token 节约 40-67%),可选 `--mode parallel`
190
+ 5. **Skill 步骤**: hooks-install → TDD-GATE → dispatching-parallel-agents → TDD (RED/GREEN/REFACTOR) → freeze → blind-review → unfreeze → verification-before-completion → 成本监控
191
+ 6. **Mock Minimization**: integration-first, mock 仅限 external services, 密度 > 30% 需 `@mock-justified`
192
+
193
+ ### Phase 4/6: VERIFY (验证 — 代码走查 + QA + 反馈获取)
194
+
195
+ **对应旧模型**: Phase 3 REVIEW + Phase 4 FEEDBACK
196
+
197
+ **详细指令**: 参见 `references/phase-4-verify.md`。
198
+
199
+ **快速参考**:
200
+ - **Orchestrator 直接执行**: delphi-review code-walkthrough 需要用户确认 verdict(Issue #249),**必须由 orchestrator 直接调用** `skill(name="delphi-review")`
201
+ - **执行顺序**: `delphi-review --mode code-walkthrough` → 等待 APPROVED → `test-specification-alignment` → `browse` (gstack) → 可选 `qa`/`design-review`/`benchmark` (gstack)
202
+ - **Feedback 子阶段**: `learn` (Sprint 级复盘) + `retro` (工程回顾) + 可选 `systematic-debugging` (根因调试)
203
+ - **Subagent**: `task(category="quick", load_skills=["learn", "retro", "systematic-debugging"])`
204
+ - 输出: 评审报告 + feedback-log.md
205
+ - **HARD-GATE**: feedback-log.md must exist before Phase 5/6
206
+
207
+ ### 负载/压力测试(可选)
208
+
209
+ - **适用项目**:主要用于后端服务的压力测试 (k6/Locust/Gatling),Web 前端已有 `benchmark` 技能覆盖 Core Web Vitals、加载时间和资源大小等性能指标
210
+ - **Phase 4/6 技能注入**:可根据项目类型自动选择合适的负载测试工具 (`k6` for Go-based services, `locust` for Python services, `gatling` for JVM-based services)
211
+ - **集成方式**:可作为 Phase 4/6 的可选扩展,在 code-walkthrough 之后执行,与基准测试形成完整性能验证链条
212
+ - **配置文件**:通过 `.sprint-load-test.yaml` 进行配置(待实现),包含并发用户数、持续时间、SLA 指标等参数
213
+ - **触发条件**:后端项目可通过 `--type backend-*` 自动启用,或通过 `--with-performance` 标志手动启用
214
+ - **Web 项目补充说明**:对于 Web 前端项目,现有的 `benchmark` 技能已处理页面加载性能、Core Web Vitals 等前端性能指标;负载/压力测试主要针对服务器端承载能力
215
+
216
+ ### Phase 5/6: SHIP (发布 — 发布准备 + 合并部署)
217
+
218
+ **对应旧模型**: Phase 5 SHIP + Phase 6 LAND
219
+
220
+ **详细指令**: 参见 `references/phase-5-ship.md` — VERSION-GATE (MANDATORY) / finishing-a-development-branch / VERSION CHANGESET (Issue #142) / changeset schema。
221
+
222
+ **快速参考**:
223
+ - **Step 0: VERSION-GATE (MANDATORY — 必须在 finishing-a-development-branch 之前)**: bump VERSION → update CHANGELOG.md → run sync-version.sh → commit + push → verify PR updated。详见 `references/phase-5-ship.md#step-0-version-gate`
224
+ - **Step 1: finishing-a-development-branch**: 4 选项菜单,选择 "Push and create a Pull Request"
225
+ - **Orchestrator 直接执行**: `finishing-a-development-branch` 和 `ship` 均为交互式 skill,**必须由 orchestrator 直接调用** `skill(name="finishing-a-development-branch")` 和 `skill(name="ship")`
226
+ - 输入: phase-4-summary.md + feedback-log.md → 输出: PR URL (含版本变更 commit)
227
+ - **HARD-GATE**: Phase 4/6 未完成 → BLOCK。验证 `feedback-log.md` 存在。
228
+ - **GITHOOKS-GATE**: 验证 hooks 完整性,缺失则 `githooks/install.sh`
229
+ - **LAND**: `land-and-deploy` — merge PR → 等待 CI (10min) → 等待 Deploy (10min) → Canary Health Check (5min)
230
+ - **回滚**: `git revert` 最后一次 merge commit
231
+ - ⚠️ **SHIP COMPLETION**: Phase 5/6 结束前必须确认 PR 已 merge 到 main + release 已创建。未完成 merge 不得进入 Phase 6/6。详见 `references/phase-5-ship.md#ship-completion-gate`。
232
+
233
+ **⚠️ VERSION-GATE 必须在 finishing-a-development-branch 之前执行。顺序反了会导致 PR 不含版本变更 → CI release workflow 不触发 → 无新版本发布。**
234
+
235
+ ### Phase 6/6: CLOSE (收尾 — ⚠️ 人工验收 + 清理)
236
+
237
+ **对应旧模型**: Phase 7 USER ACCEPTANCE + Phase 8 CLEANUP
238
+
239
+ **详细指令**: 参见 `references/phase-6-close.md` — UAT checklist, emergent issues capture, cleanup procedure.
240
+
241
+ **快速参考**:
242
+ - **SHIP→CLOSE GATE (MANDATORY — v0.14.3+)**: 校验 PR 已 merge、当前在 main 分支、`git status --porcelain` 为空。详见 `references/phase-6-close.md#ship--close-gate`。
243
+ - **Backup sprint-state**(MANDATORY): Phase 6 开始前将 `.sprint-state/` 备份到 repo 追踪路径,防止 worktree 清理后状态丢失。详见 `references/phase-6-close.md#backup-sprint-state`。
244
+ - **USER ACCEPTANCE**: ⚠️ **MUST NOT be automated, skipped, or bypassed.** 即使用户说"赶时间"、"跳过验收"、"直接发布",也必须暂停等待用户确认。使用 `@templates/emergent-issues-template.md` 检查清单
245
+ - **CLEANUP**: 保存分支信息 → `git worktree remove <worktree_path>`(精确路径,禁止通配符)→ 删除本地分支 + 远程分支 → 关闭遗留 OPEN PR → 更新 sprint-state.json → 释放 Sprint Lock
246
+ - 输出 Cleanup Report + Sprint Summary
247
+ - **IF emergent issues → Sprint 2**
248
+
249
+ ---
250
+
251
+ ## 编排层规则(Orchestration Rules)
252
+
253
+ 全部内容: 参见 `references/orchestration-rules.md`。包含:
254
+ - Agent Dispatch (4 types), Phase Subagent Matrix, CONTEXT INHERITANCE
255
+ - Phase Transition Rules, Phase Summary schema, Phase Transition Gate, RESUME GATE
256
+ - WORKTREE ENFORCEMENT, Eval assertions
257
+
258
+ ## 参数说明
259
+
260
+ | 参数 | 作用 | 示例 |
261
+ |------|------|------|
262
+ | (无参数) | 全流程 PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE | `/sprint-flow "开发访谈机器人"` |
263
+ | `--stop-at <phase>` | 执行到指定 Phase 后停止 | `--stop-at design` |
264
+ | `--resume-from <phase>` | 从指定 Phase 恢复(需先执行 RESUME GATE) | `--resume-from build --spec specification.yaml` |
265
+ | `--phase <name>` | 只执行单个 Phase | `--phase build-only` |
266
+ | `--status` | 查看 Sprint 进度(只读,不执行 Phase) | `--status` |
267
+ | `--lang <lang>` | 指定项目语言 | `--lang springboot` / `django` / `golang` |
268
+ | `--type <type>` | 指定项目类型 | `--type web-nextjs` / `backend-django` |
269
+ | `--spec <file>` | 使用已有的 specification.yaml | `--spec path/to/spec.yaml` |
270
+ | `--no-isolate` | 跳过 git worktree 隔离 | `--no-isolate` |
271
+ | `--branch-name <name>` | 自定义分支名 | `--branch-name feat/my-feature` |
272
+ | `--force` | 强制在当前分支继续 | `--force` |
273
+ | `--with-performance` | 启用负载/压力测试 | `--with-performance` |
274
+ | `--mode <mode>` | 构建模式(ralph-loop / parallel) | `--mode ralph-loop` |
275
+
276
+ **Backward Compatible Parameter Mapping** (`--stop-at` / `--resume-from` / `--phase`):
277
+
278
+ | Legacy Value | Maps To |
279
+ |-------------|---------|
280
+ | `isolate`, `isolate-only` | `prep`, `prep-only` |
281
+ | `think`, `think-only` | `design`, `design-only` |
282
+ | `plan`, `plan-only` | `design`, `design-only` |
283
+ | `build`, `build-only` | `build`, `build-only` |
284
+ | `review`, `review-only` | `verify`, `verify-only` |
285
+ | `ship`, `ship-only` | `ship`, `ship-only` |
286
+ | `land`, `land-only` | `ship`, `ship-only` |
287
+ | `cleanup`, `cleanup-only` | `close`, `close-only` |
288
+
289
+ **`--status` 行为规则**:
290
+ - 执行 `node scripts/render-sprint-progress.cjs`,读取 `.sprint-state/sprint-state.json` 并渲染 ASCII 进度看板
291
+ - 如果 `sprint-state.json` 不存在 → `[INFO] 未找到活跃的 Sprint`
292
+ - 如果 `status == "completed"` → 输出完整看板 + `[INFO] Sprint 已完成。`
293
+ - `--status` 可与其他参数组合:`--status --resume-from build` → 先展示状态,再提示 "将从 Phase 3/6 BUILD 继续"
294
+
295
+ **`--resume-from` 限制**:校验为**尽力而为**(git commit 可被 GC 回收、文件 mtime 可被 `git checkout` 修改)。校验失败时输出完整诊断日志,建议启动新 Sprint。
296
+
297
+ **项目类型自动检测**(按顺序检查):
298
+
299
+ | 检测条件 | 类型 |
300
+ |---------|------|
301
+ | `package.json` + `next.config.js` | `web-nextjs` |
302
+ | `package.json` + `vite.config.ts` + react 依赖 | `web-react` |
303
+ | `package.json` + vue 依赖 | `web-vue` |
304
+ | `pubspec.yaml` + `flutter:` | `mobile-flutter` |
305
+ | `package.json` + react-native 依赖 or `ios/` + `android/` | `mobile-react-native` |
306
+ | `go.mod` | `backend-go` (可选 k6) |
307
+ | `pom.xml` | `backend-springboot` (可选 gatling) |
308
+ | `manage.py` 或 `pyproject.toml` (django) | `backend-django` (可选 locust) |
309
+ | 无匹配 | `backend-cli` |
310
+
311
+ **项目类型 → Skill 注入映射**:
312
+
313
+ | Phase | Backend (default) | Web Frontend | Mobile | Load Test |
314
+ |-------|------------------|-------------|--------|-----------|
315
+ | 2/6 DESIGN | `brainstorming` + `autoplan` + `delphi-review` | + `design-shotgun` | (同 web) | (通用) |
316
+ | 3/6 BUILD | TDD + blind-review | (同 backend) | + `vercel-react-native-skills` / `flutter-review` | (同) |
317
+ | 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 |
318
+ | 4/6 VERIFY (Feedback) | `learn` + `retro` | (同) | (同) | (同) |
319
+ | 5/6 SHIP | `finishing-a-development-branch` + `ship` + `land-and-deploy` | (同) | + platform deploy | (同) |
320
+ | 6/6 CLOSE | — 人工验收 → cleanup | (同) | (同) | (同) |
321
+ | Browse | `localhost:3000` | 部署 URL + 表单/交互 | Flutter Web / RN Web | (专用) |
322
+
323
+ **Mobile 工具链**: Flutter — `flutter analyze/test/build/pub publish`; RN — `metro/detox/jest/react-native run-ios/android`
324
+
325
+ ---
326
+
327
+ ## 状态管理
328
+
329
+ **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)
330
+
331
+ **Sprint 2 自动触发**: Phase 6/6 CLOSE 完成时 — `emergent_issues_count == 0` → 结束; `> 0` → Critical 自动启动 Sprint 2, Major/Minor 询问用户
332
+
333
+ ---
334
+
335
+ ### ⭐ Phase State Persistence(阶段状态持久化 — MANDATORY)
336
+
337
+ **编排器必须在每个 Phase 完成后更新 `.sprint-state/sprint-state.json`**:
338
+
339
+ 1. **Phase 完成后立即更新**(每个 Phase 结束前):
340
+ - `phase`: 更新为当前 Phase 编号(如 `1`, `2`, `3`...)
341
+ - `status`: 更新为 `"completed"`(已完成 Phase)
342
+ - `phase_history`: 追加新条目
343
+
344
+ 2. **`phase_history` 数组条目 schema**:
345
+ ```json
346
+ {
347
+ "phase": 1,
348
+ "phase_name": "PREP",
349
+ "status": "completed",
350
+ "timestamp": "2026-07-08T10:30:00Z"
351
+ }
352
+ ```
353
+
354
+ 3. **检查点**:
355
+ - `--status` 参数读取 `sprint-state.json` 并渲染进度看板
356
+ - TUI panel 显示当前 Phase 和历史
357
+ - `--resume-from` 校验 `phase_history` 中的最后完成 Phase
358
+
359
+ 4. **完整 sprint-state.json 示例**:
360
+ ```json
361
+ {
362
+ "id": "sprint-2026-07-08-01",
363
+ "phase": 3,
364
+ "status": "in_progress",
365
+ "phase_history": [
366
+ {"phase": 1, "phase_name": "PREP", "status": "completed", "timestamp": "2026-07-08T10:00:00Z"},
367
+ {"phase": 2, "phase_name": "DESIGN", "status": "completed", "timestamp": "2026-07-08T10:30:00Z"}
368
+ ],
369
+ "isolation": {
370
+ "worktree_path": "/home/boyingliu01/projects/xp-gate/.worktrees/sprint/sprint-2026-07-08-01",
371
+ "branch": "sprint/2026-07-08-01"
372
+ },
373
+ "outputs": {
374
+ "pain_document": "phase-outputs/phase-2-summary.md",
375
+ "specification": "phase-outputs/specification.yaml"
376
+ },
377
+ "metrics": {
378
+ "coverage_pct": 85.5
379
+ }
380
+ }
381
+ ```
382
+
383
+ **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.
384
+
385
+ ---
386
+
387
+ ## 使用示例
388
+
389
+ | 场景 | 命令 | 说明 |
390
+ |------|------|------|
391
+ | 完整流水线 | `/sprint-flow "开发访谈机器人"` | 自动执行 6 阶段 → specification.yaml + PR URL |
392
+ | 设计后停止 | `/sprint-flow "开发认证模块" --stop-at design` | 输出 specification.yaml 后停止,供评审 |
393
+ | 仅构建阶段 | `/sprint-flow "开发 API" --lang django --phase build-only` | 跳过准备/设计,直接 Build |
394
+
395
+ ## 底层 Skills 保持独立
396
+
397
+ 所有被调用的 Skills 独立可用:`delphi-review` (单独评审), `test-driven-development` (TDD),sprint-flow 仅自动串联
398
+
399
+ ---
400
+
401
+ ## Output Contract
402
+
403
+ **Phase Summary** (每个 Phase 必须输出 YAML frontmatter): `phase/N`, `phase_name`, `status`, `outputs[]`, `decisions[]`, `next_phase_context` + markdown body (≤50 lines)
404
+
405
+ **Sprint State JSON**: `{id, phase, status, phase_history[], isolation {worktree_path, branch}, outputs, metrics}` — 存储于 `.sprint-state/sprint-state.json`
406
+
407
+ **Final User-Facing Output**: Phase/status, file paths, validation results, next user decision, PR URL or cleanup report
408
+
409
+ ### Eval Assertions
410
+ - `phase`, `phase_name`, `status`, `outputs`, `decisions`, `next_phase_context`
411
+ - `id`, `isolation.worktree_path`, `isolation.branch`, `metrics.coverage_pct`
412
+
413
+ ## References
414
+
415
+ 详细指令文件位于 `@references/`:
416
+
417
+ | File | Phase | Phase Name | Maps From (Old) |
418
+ |------|-------|------------|-----------------|
419
+ | `@references/phase-1-prep.md` | 1/6 | PREP | Phase -1 ISOLATE + Phase -0.5 AUTO-ESTIMATE |
420
+ | `@references/phase-2-design.md` | 2/6 | DESIGN | Phase 0 THINK + Phase 1 PLAN |
421
+ | `@references/phase-3-build.md` | 3/6 | BUILD | Phase 2 BUILD |
422
+ | `@references/phase-4-verify.md` | 4/6 | VERIFY | Phase 3 REVIEW + Phase 4 FEEDBACK |
423
+ | `@references/phase-5-ship.md` | 5/6 | SHIP | Phase 5 SHIP + Phase 6 LAND |
424
+ | `@references/phase-6-close.md` | 6/6 | CLOSE | Phase 7 USER ACCEPTANCE + Phase 8 CLEANUP |
425
+
426
+ Additional reference files:
427
+ - `@references/force-levels.md` — Phase forcing rules
428
+ - `@references/orchestration-rules.md` — Orchestration layer rules
429
+
430
+ - `@references/components/` — Reusable phase building blocks
431
+
432
+ ---
433
+
434
+ ## Templates
435
+
436
+ 模板文件位于 `@templates/`:
437
+ - `@templates/pain-document-template.md` — Pain Document 模板 (Phase 2/6 DESIGN)
438
+ - `@templates/emergent-issues-template.md` — Emergent Issues 检查清单 (Phase 6/6 CLOSE)
439
+ - `@templates/sprint-summary-template.md` — Sprint Summary 模板 (Phase 6/6 CLOSE)
440
+ - `@templates/sprint-progress-template.md` — Sprint 进度看板(每个 Phase 完成后 + `--status` 查询时渲染)
441
+ - `@templates/auto-estimate-output-template.md` — AUTO-ESTIMATE 输出格式 (Phase 1/6 PREP)
442
+
443
+ ---
444
+
445
+ ## 研究证据
446
+
447
+ | 证据 | 来源 | 应用 |
448
+ |------|------|------|
449
+ | One-shot = 单次迭代执行 | Boris Cherny interview | Phase 3/6 BUILD 设计 |
450
+ | 80% session 从 Plan Mode 开始 | Boris skill | Phase 2/6 DESIGN 设计 |
451
+ | Verification improves 2-3x | Boris #1 tip | Phase 4/6 VERIFY 设计 |
452
+ | Emergent requirements 无法消除 | Mike Cohn, Rafael Santos | Phase 6/6 CLOSE 人工设计 |
453
+ | 78% failures invisible | arXiv research | Phase 6/6 必要性证明 |
454
+ | Think → Plan → Build → Ship | gstack ETHOS | 整体流程设计 |
455
+
456
+ ---
457
+
458
+ ## Phase Flow Consistency
459
+
460
+ 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.
461
+
462
+ **Canonical Phase Order** (Phase 1/6..6/6):
463
+
464
+ | Phase # | Name | Phase # | Name |
465
+ |---------|------|---------|------|
466
+ | 1/6 | PREP | 4/6 | VERIFY |
467
+ | 2/6 | DESIGN | 5/6 | SHIP |
468
+ | 3/6 | BUILD | 6/6 | CLOSE |
469
+
470
+ **Locations that MUST keep this order synchronized**:
471
+ 1. **Frontmatter `workflow_steps`** — Phase list
472
+ 2. **Frontmatter `description` trigger text** — Flow string
473
+ 3. **Body "完整流程" section** — Phase descriptions in order
474
+ 4. **Body "Phase Flow" diagram** — ASCII flow diagram
475
+ 5. **Body "强制输出格式规范" section** — Output format
476
+ 6. **Body "Workflow Steps" table** — Step/Phase table
477
+ 7. **Body "References" section** — Reference file list
478
+ 8. **`references/orchestration-rules.md` Phase Subagent Dispatch Matrix** — Phase/Name order
479
+ 9. **`references/force-levels.md`** — Phase references
480
+
481
+ **⚠️ 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.
@@ -1,9 +1,9 @@
1
1
  # SKILLS/TEST-SPECIFICATION-ALIGNMENT KNOWLEDGE BASE
2
2
 
3
3
  **Generated:** 2026-07-09
4
- **Commit:** a09c009
5
- **Branch:** main
6
- **Version:** 0.14.3.0
4
+ **Commit:** 8408ba6
5
+ **Branch:** sprint/2026-07-09-01
6
+ **Version:** 0.14.4.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xp-gate",
3
- "version": "0.14.3",
3
+ "version": "0.14.4",
4
4
  "displayName": "XP-Gate",
5
5
  "description": "Extreme Programming quality gates + AI workflow skills for Qoder. Includes 10 quality gates (Gate 0-9), Sprint Flow (11 phases), and Delphi multi-expert review (>=90% consensus).",
6
6
  "author": {
@@ -1,9 +1,9 @@
1
1
  # SKILLS/DELPHI-REVIEW KNOWLEDGE BASE
2
2
 
3
3
  **Generated:** 2026-07-09
4
- **Commit:** a09c009
5
- **Branch:** main
6
- **Version:** 0.14.3.0
4
+ **Commit:** 8408ba6
5
+ **Branch:** sprint/2026-07-09-01
6
+ **Version:** 0.14.4.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, 3 experts from ≥2 providers, domestic models only). Supports design + code-walkthrough modes.
@@ -1,9 +1,9 @@
1
1
  # SKILLS/SPRINT-FLOW KNOWLEDGE BASE
2
2
 
3
3
  **Generated:** 2026-07-09
4
- **Commit:** a09c009
5
- **Branch:** main
6
- **Version:** 0.14.3.0
4
+ **Commit:** 8408ba6
5
+ **Branch:** sprint/2026-07-09-01
6
+ **Version:** 0.14.4.0
7
7
 
8
8
  ## OVERVIEW
9
9
  **6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration, 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.
@@ -1,9 +1,9 @@
1
1
  # SKILLS/TEST-SPECIFICATION-ALIGNMENT KNOWLEDGE BASE
2
2
 
3
3
  **Generated:** 2026-07-09
4
- **Commit:** a09c009
5
- **Branch:** main
6
- **Version:** 0.14.3.0
4
+ **Commit:** 8408ba6
5
+ **Branch:** sprint/2026-07-09-01
6
+ **Version:** 0.14.4.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
@@ -1,9 +1,9 @@
1
1
  # SKILLS/DELPHI-REVIEW KNOWLEDGE BASE
2
2
 
3
3
  **Generated:** 2026-07-09
4
- **Commit:** a09c009
5
- **Branch:** main
6
- **Version:** 0.14.3.0
4
+ **Commit:** 8408ba6
5
+ **Branch:** sprint/2026-07-09-01
6
+ **Version:** 0.14.4.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, 3 experts from ≥2 providers, domestic models only). Supports design + code-walkthrough modes.