@boyingliu01/xp-gate 0.6.0 → 0.6.1
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.
- package/lib/__tests__/audit-log.test.ts +107 -0
- package/lib/__tests__/gate-audit.test.ts +59 -0
- package/lib/__tests__/ui-detector.test.ts +112 -1
- package/lib/__tests__/ui-review.test.ts +119 -0
- package/lib/gate-audit.ts +26 -42
- package/lib/install-skill.js +1 -15
- package/lib/rollback.js +1 -16
- package/lib/shared-utils.js +25 -0
- package/lib/ui-review.ts +58 -53
- package/package.json +1 -1
- package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
- package/skills/delphi-review/SKILL.md +112 -29
- package/skills/ralph-loop/SKILL.md +179 -8
- package/skills/sprint-flow/SKILL.md +412 -24
- package/skills/sprint-flow/templates/sprint-progress-template.md +151 -0
- package/skills/test-specification-alignment/SKILL.md +98 -1
|
@@ -12,10 +12,8 @@ description: >
|
|
|
12
12
|
- "start sprint"
|
|
13
13
|
- "一键开发"
|
|
14
14
|
- "/sprint-flow"
|
|
15
|
-
|
|
16
15
|
用法: /sprint-flow "[需求描述]"
|
|
17
16
|
示例: /sprint-flow "开发访谈机器人,支持多轮对话"
|
|
18
|
-
|
|
19
17
|
可选参数:
|
|
20
18
|
--no-isolate: 跳过自动 worktree 隔离(⚠️ 在保护分支上有污染风险)
|
|
21
19
|
--branch-name <name>: 自定义分支名(默认自动生成 sprint/YYYY-MM-DD-NN)
|
|
@@ -28,12 +26,117 @@ description: >
|
|
|
28
26
|
--spec <file>: 使用已有的 specification.yaml 文件
|
|
29
27
|
--with-performance: 启用负载/压力测试(后端项目)
|
|
30
28
|
--mode <build_mode>: 指定 Phase 2 构建模式。默认 = ralph-loop(逐 REQ 迭代,token 节约)。parallel = 旧有并行模式(一次性 dispatch 所有需求)
|
|
31
|
-
|
|
29
|
+
--status: 查看当前 Sprint 进度看板(不执行任何阶段,仅读取 sprint-state.json 并渲染进度)
|
|
30
|
+
Use when asked to "开发新功能", "实现 X", "start sprint", "一键开发", or "/sprint-flow" for end-to-end feature development.
|
|
32
31
|
maturity: beta
|
|
33
32
|
---
|
|
34
33
|
|
|
34
|
+
## Triggers
|
|
35
|
+
|
|
36
|
+
| Trigger Type | Phrases |
|
|
37
|
+
|--------------|---------|
|
|
38
|
+
| **中文** | "开发新功能", "实现 X", "start sprint", "一键开发", "/sprint-flow", "开发用户登录", "创建 XXX 模块" |
|
|
39
|
+
| **English** | "implement feature", "build X", "start sprint", "one-shot development", "create XXX", "develop new functionality" |
|
|
40
|
+
|
|
41
|
+
**Usage**: `/sprint-flow "[需求描述]"`
|
|
42
|
+
|
|
43
|
+
**Examples**:
|
|
44
|
+
- `/sprint-flow "开发访谈机器人,支持多轮对话"`
|
|
45
|
+
- `/sprint-flow "实现用户认证模块,支持 OAuth2"`
|
|
46
|
+
- `/sprint-flow "开发 REST API 端点"`
|
|
47
|
+
|
|
48
|
+
**Optional Parameters**:
|
|
49
|
+
- `--no-isolate`: Skip auto worktree isolation (⚠️ risk of polluting protected branches)
|
|
50
|
+
- `--branch-name <name>`: Custom branch name (default: `sprint/YYYY-MM-DD-NN`)
|
|
51
|
+
- `--force`: Force continue on current branch even if protected (⚠️ requires explicit confirmation)
|
|
52
|
+
- `--stop-at <phase>`: Stop after specified phase (isolate/think/plan/build/review/ship/land/cleanup)
|
|
53
|
+
- `--resume-from <phase>`: Resume from specified phase, skipping earlier phases
|
|
54
|
+
- `--phase <phase>`: Execute only single phase (isolate-only/think-only/plan-only/build-only/review-only/ship-only/land-only/cleanup-only)
|
|
55
|
+
- `--lang <language>`: Specify project language (springboot/django/golang)
|
|
56
|
+
- `--type <project_type>`: Specify project type (web-nextjs/web-react/web-vue/mobile-flutter/mobile-react-native/backend-django/backend-go/backend-springboot)
|
|
57
|
+
- `--spec <file>`: Use existing specification.yaml file
|
|
58
|
+
- `--with-performance`: Enable load/stress testing (backend projects)
|
|
59
|
+
- `--mode <build_mode>`: Phase 2 build mode. Default = ralph-loop (REQ-level iteration, token-efficient). parallel = legacy all-at-once mode
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Scope
|
|
64
|
+
|
|
65
|
+
**What this skill does**:
|
|
66
|
+
- Automates the full 7-phase development pipeline from requirement to production
|
|
67
|
+
- Integrates existing skills (brainstorming, autoplan, delphi-review, TDD, ship, etc.)
|
|
68
|
+
- Enforces quality gates and hard transitions between phases
|
|
69
|
+
- Captures emergent requirements and feedback for continuous improvement
|
|
70
|
+
|
|
71
|
+
**What this skill does NOT do**:
|
|
72
|
+
- Replace individual skills — users can still call `delphi-review`, `test-driven-development`, etc. directly
|
|
73
|
+
- Bypass quality gates or user confirmations at critical checkpoints
|
|
74
|
+
- Automatically merge to main without explicit user approval (Phase 6/7)
|
|
75
|
+
- Handle non-development tasks (bug reports, code review requests without implementation, questions)
|
|
76
|
+
|
|
77
|
+
**Applicable scenarios**:
|
|
78
|
+
- New feature development
|
|
79
|
+
- Module creation
|
|
80
|
+
- End-to-end implementation of user stories
|
|
81
|
+
- Sprint-level planning and execution
|
|
82
|
+
|
|
83
|
+
**Not applicable**:
|
|
84
|
+
- Single bug fixes (use `/investigate` or direct TDD)
|
|
85
|
+
- Code review requests (use `/review` or `delphi-review --mode code-walkthrough`)
|
|
86
|
+
- Architecture questions (use `/plan-eng-review`)
|
|
87
|
+
- Simple explanations or documentation requests
|
|
88
|
+
|
|
89
|
+
## Examples
|
|
90
|
+
|
|
91
|
+
### Example 1: Full feature sprint
|
|
92
|
+
User: `/sprint-flow "开发用户认证模块,支持登录、登出、权限检查"`
|
|
93
|
+
Expected behavior: create/verify isolated worktree, run estimate, produce design/spec, build with TDD, review, wait for manual acceptance, then prepare ship path.
|
|
94
|
+
Expected output: phase summaries, `specification.yaml`, verification evidence, and PR URL if the user chooses PR shipping.
|
|
95
|
+
|
|
96
|
+
### Example 2: Stop after planning
|
|
97
|
+
User: `/sprint-flow "开发 REST API" --stop-at plan`
|
|
98
|
+
Expected behavior: complete isolate/estimate/think/plan, produce specification and slices, then stop without implementation.
|
|
99
|
+
Expected output: phase-1 summary and clear next command to resume from build.
|
|
100
|
+
|
|
101
|
+
### Example 3: Should not trigger
|
|
102
|
+
User: "解释一下这个函数为什么报错"
|
|
103
|
+
Expected behavior: do not run sprint-flow; route to investigation/explanation instead.
|
|
104
|
+
|
|
35
105
|
# Sprint Flow Skill
|
|
36
106
|
|
|
107
|
+
## Scope
|
|
108
|
+
|
|
109
|
+
**In Scope:**
|
|
110
|
+
- Sprint 全流程编排(Phase -1 ISOLATE 到 Phase 8 CLEANUP)
|
|
111
|
+
- Git worktree 隔离与环境准备
|
|
112
|
+
- 自动规模评估与流程路由(轻量/标准/复杂)
|
|
113
|
+
- 多 Skill 串联调用(brainstorming, autoplan, delphi-review, TDD, ralph-loop 等)
|
|
114
|
+
- 关键节点暂停与用户决策
|
|
115
|
+
- 状态持久化(sprint-state.json)
|
|
116
|
+
- 多平台适配(Claude Code, OpenCode, Qoder)
|
|
117
|
+
|
|
118
|
+
**Out of Scope:**
|
|
119
|
+
- Does NOT handle internal Skill implementation (each Skill remains independent)
|
|
120
|
+
- Does NOT write business code
|
|
121
|
+
- Does NOT configure CI/CD pipelines (project's own responsibility)
|
|
122
|
+
- Does NOT deploy to production (only up to PR creation + merge)
|
|
123
|
+
|
|
124
|
+
## Security Notes
|
|
125
|
+
|
|
126
|
+
- sprint-flow **不执行任何破坏性命令**(no `rm -rf`, `git push --force`, `DROP TABLE` 等)
|
|
127
|
+
- `git worktree remove` 仅删除 sprint 创建的临时 worktree 目录,不影响主仓库
|
|
128
|
+
- Phase 6 SHIP 仅创建 PR(`gh pr create`),不自动 merge(除非用户显式确认)
|
|
129
|
+
- Phase 7 LAND 使用 `gh pr merge --squash`(非 force push),merge 前等待 CI 通过
|
|
130
|
+
- 文档中 `+ platform deploy` 等描述仅表示可选的部署步骤映射,**不是可执行命令**
|
|
131
|
+
- sprint-flow 不下载、安装或执行任何外部二进制文件
|
|
132
|
+
|
|
133
|
+
## Permissions
|
|
134
|
+
|
|
135
|
+
- `git`: read/write (worktree, branch, commit)
|
|
136
|
+
- `gh` (GitHub CLI): read/write (PR create, merge, CI query)
|
|
137
|
+
- `filesystem`: read/write (project dir + `.worktrees/` only)
|
|
138
|
+
- `network`: read-only (CI status, canary health)
|
|
139
|
+
|
|
37
140
|
## 核心原则
|
|
38
141
|
|
|
39
142
|
| 原则 | 说明 |
|
|
@@ -102,6 +205,35 @@ Phase 8: CLEANUP → git worktree remove + sprint-state.json update → status:
|
|
|
102
205
|
|
|
103
206
|
---
|
|
104
207
|
|
|
208
|
+
## Workflow Steps
|
|
209
|
+
|
|
210
|
+
| Step | Phase | Name | Key Actions | Output |
|
|
211
|
+
|------|-------|------|-------------|--------|
|
|
212
|
+
| 1 | **-1** | **ISOLATE** | Detect protected branch → Create git worktree → Setup project → Validate .gitignore → Record sprint state | Worktree path |
|
|
213
|
+
| 2 | **-0.5** | **AUTO-ESTIMATE** | Analyze code structure → Count references → Assess cross-module impact → Classify (lightweight/standard/complex) | Impact assessment + flow recommendation |
|
|
214
|
+
| 3 | **0** | **THINK** | brainstorming → Generate design doc + CONTEXT.md + ADR | Design document |
|
|
215
|
+
| 4 | **1** | **PLAN** | autoplan → delphi-review (if needed) → Generate specification.yaml + slices-manifest.json | specification.yaml |
|
|
216
|
+
| 5 | **2** | **BUILD** | GITHOOKS-GATE → ralph-loop (default) or parallel → TDD → freeze → blind review → verification | MVP code |
|
|
217
|
+
| 6 | **3** | **REVIEW** | delphi-review --mode code-walkthrough → test-specification-alignment → browse QA → benchmark (optional) | Review report |
|
|
218
|
+
| 7 | **4** | **USER ACCEPT** | **Manual verification** → Capture emergent issues | Emergent issues list |
|
|
219
|
+
| 8 | **5** | **FEEDBACK** | learn → retro → systematic-debugging | feedback-log.md |
|
|
220
|
+
| 9 | **6** | **SHIP** | finishing-a-development-branch → ship (create PR) | PR URL |
|
|
221
|
+
| 10 | **7** | **LAND** | land-and-deploy → merge PR → wait CI → canary health check → rollback on failure | Deploy status |
|
|
222
|
+
| 11 | **8** | **CLEANUP** | Safe worktree removal → Update sprint state → Sprint summary | Cleanup report |
|
|
223
|
+
|
|
224
|
+
**Phase Flow**:
|
|
225
|
+
```
|
|
226
|
+
ISOLATE → AUTO-ESTIMATE → THINK → PLAN → [GITHOOKS-GATE] → BUILD → REVIEW → USER ACCEPT → FEEDBACK → SHIP → LAND → CLEANUP
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
**Hard Gates**:
|
|
230
|
+
- **Phase 0→1**: Design must be APPROVED by delphi-review (≥91% consensus)
|
|
231
|
+
- **Phase 1→2**: GITHOOKS-GATE (hooks must be installed) + DELPHI-GATE (spec must be APPROVED)
|
|
232
|
+
- **Phase 4→5**: User acceptance must be completed (mandatory manual step)
|
|
233
|
+
- **Phase 5→6**: feedback-log.md must exist (HARD-GATE)
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
105
237
|
## 各 Phase 调用的 Skills
|
|
106
238
|
|
|
107
239
|
### Phase -1: ISOLATE(git worktree 隔离)
|
|
@@ -343,6 +475,13 @@ Phase 2 第一步必须执行 DELPHI-GATE 检查。没有 delphi-review APPROVED
|
|
|
343
475
|
- **HARD-GATE**: Phase 5 未完成 → 不可进入 Phase 6。验证 `.sprint-state/phase-outputs/feedback-log.md` 存在。
|
|
344
476
|
- **⚠️ GITHOOKS-GATE**: 再次验证 hooks 完整性(Phase 2 的 TDD 编码已触发提交,SHIP 阶段还会再次提交)
|
|
345
477
|
- 运行 `githooks/verify.sh` → 缺失 → `githooks/install.sh` → 阻断直至修复
|
|
478
|
+
- **⚠️ VERSION-GATE**: Phase 6 提交前必须 bump VERSION 文件(与变更类型无关)
|
|
479
|
+
- 默认 bump PATCH 位(如 `0.6.0.0` → `0.6.1.0`,MICRO 重置为 0)
|
|
480
|
+
- 重大新功能 bump MINOR 位(如 `0.6.0.0` → `0.7.0.0`),Breaking change bump MAJOR 位
|
|
481
|
+
- 运行 `bash scripts/sync-version.sh` 同步到所有 package.json(root、npm-package、claude-plugin、opencode)
|
|
482
|
+
- 更新 `CHANGELOG.md` 添加本次变更记录(含变更类型说明:skill-only / code / mixed)
|
|
483
|
+
- 验证:`git diff VERSION` 确认版本号已变更,未变更 → 阻断
|
|
484
|
+
- **此规则与变更类型无关** — 纯 skill 变更(仅 .md 文件)也必须 bump PATCH,确保每次 sprint 都触发 npm 发布
|
|
346
485
|
- **`finishing-a-development-branch`** (superpowers) — 结构化完成流:4 选项(merge / PR / discard / keep)
|
|
347
486
|
- `ship` (gstack) — 创建 PR(PR 路径时使用)
|
|
348
487
|
- Phase 6 输出:PR URL(用于 Phase 7 输入)
|
|
@@ -365,21 +504,28 @@ Phase 2 第一步必须执行 DELPHI-GATE 检查。没有 delphi-review APPROVED
|
|
|
365
504
|
- 条件跳过:无部署配置时,仅执行 merge + CI checks,跳过 deploy/canary
|
|
366
505
|
- 输出:部署状态 + Canary 报告(成功/失败/跳过)
|
|
367
506
|
|
|
368
|
-
### Phase 8: CLEANUP
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
-
|
|
382
|
-
-
|
|
507
|
+
### Phase 8: CLEANUP(安全清理 + 总结)
|
|
508
|
+
|
|
509
|
+
**执行时机**: Phase 7 LAND 成功后(或 Phase 6 Option 1 本地 Merge 后)
|
|
510
|
+
|
|
511
|
+
**动作**:
|
|
512
|
+
1. **检测 worktree 是否存在**: `[ -d <worktree_path> ]`
|
|
513
|
+
2. **安全清理**:
|
|
514
|
+
- **⚠️ 禁止使用通配符或递归 shell 删除命令** — 必须先列出 `isolation.worktree_path` 并确认只清理本 sprint worktree
|
|
515
|
+
- 首选 git worktree 管理命令清理该精确路径;失败时重试最多 3 次,间隔 1s
|
|
516
|
+
- 如果仍失败:输出 `[WARN] Worktree cleanup failed; list the target path and ask the user to clean it manually`
|
|
517
|
+
- ** NEVER delete arbitrary directories** — 只删除本 sprint 创建的 `isolation.worktree_path`
|
|
518
|
+
3. **残留检测**: `[ -d <worktree_path> ]` → 如果仍有残留,输出警告 `[WARN] 检测到残留目录,请手动检查:<worktree_path>`
|
|
519
|
+
4. **更新 `.sprint-state/sprint-state.json`**:
|
|
520
|
+
- `phase: 8`
|
|
521
|
+
- `status: "merged"` 或 `"completed"`
|
|
522
|
+
5. **输出 Cleanup Report + Sprint Summary**
|
|
523
|
+
|
|
524
|
+
**条件跳过**: `--no-isolate` 路径(无 worktree 可清理)
|
|
525
|
+
|
|
526
|
+
**输出**: `[CLEANUP] Worktree removed:` + 残留检测(✅ clean / ⚠️ residual)
|
|
527
|
+
|
|
528
|
+
**IF emergent issues → Sprint 2**
|
|
383
529
|
|
|
384
530
|
---
|
|
385
531
|
|
|
@@ -467,9 +613,21 @@ Phase 2 第一步必须执行 DELPHI-GATE 检查。没有 delphi-review APPROVED
|
|
|
467
613
|
2. **更新 sprint-state.json**:
|
|
468
614
|
- `phase`: 当前阶段编号
|
|
469
615
|
- `outputs`: 新增当前阶段输出文件路径
|
|
616
|
+
- `phase_history`: 追加或更新当前阶段的记录
|
|
617
|
+
- Phase 开始时:追加 `{ "phase": N, "phase_name": "NAME", "status": "running", "started_at": "<ISO 8601>", "completed_at": null, "duration_seconds": null }`
|
|
618
|
+
- Phase 完成时:更新对应条目,填充 `completed_at`(ISO 8601)和 `duration_seconds`(`completed_at - started_at` 的秒数)
|
|
619
|
+
- Phase 跳过时(如轻量路由跳过 Phase 0 brainstorming):设置 `status: "skipped"`
|
|
470
620
|
|
|
471
621
|
3. **等待用户确认 checkpoint**(如适用)
|
|
472
622
|
|
|
623
|
+
4. **展示进度看板**:读取 `sprint-state.json`,使用 `@templates/sprint-progress-template.md` 渲染进度看板
|
|
624
|
+
- 渲染规则:已完成阶段显示 ✅ + 耗时,当前阶段 🔄,待做 ⬜,跳过 ⏭️,失败 ❌
|
|
625
|
+
- 进度条:`[████▓░░░░░░] {pct}%`(已完成数/总阶段数 11)
|
|
626
|
+
- 下一步行动:根据当前阶段 + 状态,从模板的"下一步行动表"中查找对应提示
|
|
627
|
+
- 输出物路径:列出 `outputs` 中已有的文件路径
|
|
628
|
+
- 时机:每个 Phase 完成后的 transition 阶段自动展示,用户无需请求
|
|
629
|
+
- 向后兼容:旧版 `sprint-state.json` 缺少 `phase_history` 时,从 `phase` 字段推断状态
|
|
630
|
+
|
|
473
631
|
### Phase Summary 格式(YAML Frontmatter Schema)
|
|
474
632
|
|
|
475
633
|
每个 `phase-N-summary.md` 必须包含以下 YAML frontmatter:
|
|
@@ -530,8 +688,10 @@ Sprint state is persisted as JSON in `.sprint-state/sprint-state.json`:
|
|
|
530
688
|
```json
|
|
531
689
|
{
|
|
532
690
|
"id": "sprint-2026-04-26-01",
|
|
691
|
+
"task_description": "开发访谈机器人,支持多轮对话",
|
|
533
692
|
"phase": -1,
|
|
534
693
|
"status": "running|paused|completed",
|
|
694
|
+
"started_at": "2026-04-26T10:00:00Z",
|
|
535
695
|
"isolation": {
|
|
536
696
|
"worktree_path": ".worktrees/sprint/sprint-2026-04-26-01",
|
|
537
697
|
"branch": "sprint/2026-04-26-01",
|
|
@@ -554,6 +714,16 @@ Sprint state is persisted as JSON in `.sprint-state/sprint-state.json`:
|
|
|
554
714
|
"user_decision": "accepted|overridden|cancelled",
|
|
555
715
|
"override_reason": null
|
|
556
716
|
},
|
|
717
|
+
"phase_history": [
|
|
718
|
+
{
|
|
719
|
+
"phase": -1,
|
|
720
|
+
"phase_name": "ISOLATE",
|
|
721
|
+
"status": "completed",
|
|
722
|
+
"started_at": "2026-04-26T10:00:00Z",
|
|
723
|
+
"completed_at": "2026-04-26T10:03:00Z",
|
|
724
|
+
"duration_seconds": 180
|
|
725
|
+
}
|
|
726
|
+
],
|
|
557
727
|
"outputs": {
|
|
558
728
|
"pain_document": "docs/pain-document.md",
|
|
559
729
|
"specification": "specification.yaml",
|
|
@@ -567,7 +737,19 @@ Sprint state is persisted as JSON in `.sprint-state/sprint-state.json`:
|
|
|
567
737
|
}
|
|
568
738
|
}
|
|
569
739
|
```
|
|
570
|
-
|
|
740
|
+
|
|
741
|
+
**新增字段说明**:
|
|
742
|
+
- `task_description`: Sprint 需求描述(Phase -1 启动时写入)
|
|
743
|
+
- `started_at`: Sprint 启动时间戳(Phase -1 启动时写入,ISO 8601 格式)
|
|
744
|
+
- `phase_history`: 阶段历史数组,每个元素记录阶段的执行信息:
|
|
745
|
+
- `phase`: 阶段编号
|
|
746
|
+
- `phase_name`: 阶段名称
|
|
747
|
+
- `status`: completed / running / failed / skipped
|
|
748
|
+
- `started_at`: 阶段开始时间(ISO 8601)
|
|
749
|
+
- `completed_at`: 阶段完成时间(null 表示未完成)
|
|
750
|
+
- `duration_seconds`: 耗时秒数(null 表示未完成)
|
|
751
|
+
|
|
752
|
+
**Eval assertions check for:** `phase`, `status`, `isolation.branch`, `outputs.specification`, `metrics.coverage_pct`, `phase_history`, `task_description`.
|
|
571
753
|
|
|
572
754
|
---
|
|
573
755
|
|
|
@@ -606,6 +788,24 @@ Sprint state is persisted as JSON in `.sprint-state/sprint-state.json`:
|
|
|
606
788
|
# 适用场景:单独验证某个阶段
|
|
607
789
|
```
|
|
608
790
|
|
|
791
|
+
### --status(查看 Sprint 进度)
|
|
792
|
+
|
|
793
|
+
```bash
|
|
794
|
+
/sprint-flow --status
|
|
795
|
+
# → 读取 .sprint-state/sprint-state.json
|
|
796
|
+
# → 渲染进度看板(使用 @templates/sprint-progress-template.md)
|
|
797
|
+
# → 不执行任何 Phase,仅展示当前状态
|
|
798
|
+
# 适用场景:碎片时间恢复时快速查看进度、中断后确认当前阶段和下一步操作
|
|
799
|
+
```
|
|
800
|
+
|
|
801
|
+
**行为规则**:
|
|
802
|
+
- 读取 `.sprint-state/sprint-state.json` 获取 `id`, `task_description`, `phase`, `status`, `phase_history`, `outputs`, `isolation`
|
|
803
|
+
- 扫描 `.sprint-state/phase-outputs/phase-*-summary.md` 获取各阶段 `status` 和 `phase_name`
|
|
804
|
+
- 如果 `sprint-state.json` 不存在 → 输出 `[INFO] 未找到活跃的 Sprint。请先运行 /sprint-flow "[需求描述]" 启动新 Sprint。`
|
|
805
|
+
- 如果 `status == "completed"` → 展示完整看板 + `[INFO] Sprint 已完成。` + Sprint Summary 路径
|
|
806
|
+
- `--status` 可与其他参数组合:`--status --resume-from build` → 先展示状态,再提示 "将从 Phase 2 BUILD 继续"
|
|
807
|
+
- 向后兼容:旧版 `sprint-state.json` 缺少 `phase_history`/`task_description` 时,按模板"向后兼容"规则渲染
|
|
808
|
+
|
|
609
809
|
### --lang(指定项目语言)
|
|
610
810
|
|
|
611
811
|
```bash
|
|
@@ -771,7 +971,7 @@ Sprint 结束时 (Phase 6 完成):
|
|
|
771
971
|
# → mkdir -p .worktrees/sprint
|
|
772
972
|
# → 检测已有 NN 编号(.worktrees/sprint/ | grep -oE '[0-9]{2}$' | sort -n | tail -1)
|
|
773
973
|
# → git worktree add .worktrees/sprint/sprint-2026-05-24-01 -b sprint/2026-05-24-01
|
|
774
|
-
# → 在 worktree
|
|
974
|
+
# → 在 worktree 目录下:npm install → 基线测试 → .sprint-state/ 记录
|
|
775
975
|
# → 进入 Phase 0 THINK...
|
|
776
976
|
|
|
777
977
|
# 跳过隔离(⚠️ 有污染风险)
|
|
@@ -785,11 +985,13 @@ Sprint 结束时 (Phase 6 完成):
|
|
|
785
985
|
|
|
786
986
|
# 自定义分支名
|
|
787
987
|
/sprint-flow "开发用户登录" --branch-name feat/user-login
|
|
788
|
-
# →
|
|
789
|
-
# → worktree
|
|
988
|
+
# → 分支名:feat/user-login(保留 /)
|
|
989
|
+
# → worktree 路径:.worktrees/sprint/feat-user-login(/ 替换为 -)
|
|
790
990
|
|
|
791
|
-
#
|
|
792
|
-
|
|
991
|
+
# Sprint 完成后安全清理:先列出本 sprint 的 isolation.worktree_path
|
|
992
|
+
# 仅清理 sprint-state 中记录的精确 worktree 路径
|
|
993
|
+
# 禁止使用通配符或递归 shell 删除命令
|
|
994
|
+
# 如果自动清理失败,输出目标路径并要求用户手动处理
|
|
793
995
|
```
|
|
794
996
|
|
|
795
997
|
---
|
|
@@ -803,6 +1005,87 @@ git worktree remove .worktrees/sprint/sprint-2026-05-24-01
|
|
|
803
1005
|
|
|
804
1006
|
---
|
|
805
1007
|
|
|
1008
|
+
## Anti-Patterns
|
|
1009
|
+
|
|
1010
|
+
| 错误 | 正确 |
|
|
1011
|
+
|------|------|
|
|
1012
|
+
| 把普通问答、解释、代码检索请求路由到 sprint-flow | 仅在用户明确要求开发/实现/一键开发完整需求时触发 sprint-flow |
|
|
1013
|
+
| 跳过 Phase -1 隔离,直接在 main/master/develop 上改代码 | 默认创建 worktree;除非用户显式使用 `--no-isolate` 或 `--force` 并确认风险 |
|
|
1014
|
+
| 未完成 Phase -0.5 AUTO-ESTIMATE 就套用完整重流程 | 先评估轻量/标准/复杂,再按推荐流程或用户确认后的流程执行 |
|
|
1015
|
+
| Plan 阶段跳过 Delphi 评审直接 Build | 标准/复杂需求必须经过 autoplan + delphi-review;未 APPROVED 禁止编码 |
|
|
1016
|
+
| 跳过 TDD 直接实现代码 | Phase 2 必须遵循 RED → GREEN → REFACTOR,测试与实现一起交付 |
|
|
1017
|
+
| 跳过用户验收直接 Ship | Phase 4 USER ACCEPTANCE 必须人工完成;不得自动化、跳过或伪造 |
|
|
1018
|
+
| 验证失败后继续追加随机修改 | 最多 3 次修复循环;仍失败则 BLOCK 并请求用户决策 |
|
|
1019
|
+
| 未生成 Phase Summary 就进入下一阶段 | 每个 Phase 必须写入 `.sprint-state/phase-outputs/phase-{N}-summary.md` 并通过 transition gate |
|
|
1020
|
+
|
|
1021
|
+
## Output Format
|
|
1022
|
+
|
|
1023
|
+
See [Output Contract](#output-contract) below for the canonical machine-readable output schema.
|
|
1024
|
+
|
|
1025
|
+
### Eval Assertions
|
|
1026
|
+
- `phase`, `phase_name`, `status`, `outputs`, `decisions`, `next_phase_context`
|
|
1027
|
+
- `id`, `isolation.worktree_path`, `isolation.branch`, `metrics.coverage_pct`
|
|
1028
|
+
|
|
1029
|
+
## Output Contract
|
|
1030
|
+
|
|
1031
|
+
### Machine-Readable Outputs
|
|
1032
|
+
|
|
1033
|
+
**Phase Summary** (all automated Phases must output):
|
|
1034
|
+
```markdown
|
|
1035
|
+
---
|
|
1036
|
+
phase: <N>
|
|
1037
|
+
phase_name: <NAME>
|
|
1038
|
+
status: completed|paused|failed
|
|
1039
|
+
outputs:
|
|
1040
|
+
- path: "path/to/output"
|
|
1041
|
+
type: file|directory
|
|
1042
|
+
decisions:
|
|
1043
|
+
- title: "Decision title"
|
|
1044
|
+
rationale: "Rationale for decision"
|
|
1045
|
+
unresolved_issues: []
|
|
1046
|
+
next_phase_context: "Context needed by next phase"
|
|
1047
|
+
---
|
|
1048
|
+
|
|
1049
|
+
## Phase Summary
|
|
1050
|
+
Concise summary, <= 50 lines.
|
|
1051
|
+
```
|
|
1052
|
+
|
|
1053
|
+
**Sprint State JSON** (all Phases must maintain):
|
|
1054
|
+
```json
|
|
1055
|
+
{
|
|
1056
|
+
"id": "sprint-YYYY-MM-DD-NN",
|
|
1057
|
+
"phase": <N>,
|
|
1058
|
+
"status": "running|paused|completed|failed",
|
|
1059
|
+
"isolation": {
|
|
1060
|
+
"worktree_path": ".worktrees/sprint/sprint-YYYY-MM-DD-NN",
|
|
1061
|
+
"branch": "sprint/YYYY-MM-DD-NN"
|
|
1062
|
+
},
|
|
1063
|
+
"outputs": {},
|
|
1064
|
+
"metrics": {}
|
|
1065
|
+
}
|
|
1066
|
+
```
|
|
1067
|
+
|
|
1068
|
+
### Final User-Facing Output
|
|
1069
|
+
|
|
1070
|
+
When ending or pausing, output:
|
|
1071
|
+
- Current Phase and status
|
|
1072
|
+
- Generated file paths
|
|
1073
|
+
- Passed/failed validation commands
|
|
1074
|
+
- Next user decision required (if applicable)
|
|
1075
|
+
- PR URL (Phase 6 success) or cleanup report (Phase 8 success)
|
|
1076
|
+
|
|
1077
|
+
## Security Notes
|
|
1078
|
+
|
|
1079
|
+
- Sprint Flow 会执行 git 操作(worktree、branch、commit、PR、merge),在受保护分支上默认必须隔离。
|
|
1080
|
+
- 不得使用 `--no-verify` 绕过 quality gates;hook 失败必须修复根因。
|
|
1081
|
+
- 不得自动推送、创建 PR、merge 或 deploy,除非用户请求的流程明确进入 Ship/Land 阶段并已通过前置 gate。
|
|
1082
|
+
- 不得修改、打印或提交 `.delphi-config.json`、API keys、tokens、cookies、SSH keys 等敏感信息。
|
|
1083
|
+
- Phase 7 deploy/canary 失败时必须报告失败并按配置回滚;不可静默忽略部署失败。
|
|
1084
|
+
- Phase 4 用户验收不可由模型代替;人工验收是发布安全边界。
|
|
1085
|
+
- worktree 清理只允许删除本 sprint 创建的 `isolation.worktree_path`,不得删除任意用户目录。
|
|
1086
|
+
|
|
1087
|
+
---
|
|
1088
|
+
|
|
806
1089
|
## References
|
|
807
1090
|
|
|
808
1091
|
详细指令文件位于 `@references/`:
|
|
@@ -823,6 +1106,111 @@ git worktree remove .worktrees/sprint/sprint-2026-05-24-01
|
|
|
823
1106
|
- `@templates/pain-document-template.md` — Pain Document 模板
|
|
824
1107
|
- `@templates/emergent-issues-template.md` — Emergent Issues 检查清单
|
|
825
1108
|
- `@templates/sprint-summary-template.md` — Sprint Summary 模板
|
|
1109
|
+
- `@templates/sprint-progress-template.md` — Sprint 进度看板(每个 Phase 完成后 + `--status` 查询时渲染)
|
|
1110
|
+
|
|
1111
|
+
---
|
|
1112
|
+
|
|
1113
|
+
## Anti-Patterns
|
|
1114
|
+
|
|
1115
|
+
| ❌ 错误 | ✅ 正确 |
|
|
1116
|
+
|---|---|
|
|
1117
|
+
| 在保护分支 (main/master) 上直接执行 sprint | Phase -1 自动创建 worktree 隔离 |
|
|
1118
|
+
| 跳过 Phase 4 用户验收("赶时间") | Phase 4 是 HARD-GATE,必须人工验收 |
|
|
1119
|
+
| Phase 2 不安装 Git Hooks 就开始编码 | GITHOOKS-GATE 检查必须先于 BUILD |
|
|
1120
|
+
| 单个 subagent 处理所有 REQ | ralph-loop 逐 REQ 迭代,每个 REQ 独立上下文 |
|
|
1121
|
+
| 验证失败仍 commit | 验证不通过的代码不 commit |
|
|
1122
|
+
| 跳过 Phase 5 FEEDBACK 直接 SHIP | Phase 5 是 HARD-GATE,不可跳过 |
|
|
1123
|
+
| --force 在生产分支上运行不确认 | --force 必须等待用户显式确认风险 |
|
|
1124
|
+
| Phase 6 SHIP 后不清理 worktree | Phase 8 CLEANUP 必须执行 git worktree remove |
|
|
1125
|
+
|
|
1126
|
+
---
|
|
1127
|
+
|
|
1128
|
+
## Output Format (MANDATORY)
|
|
1129
|
+
|
|
1130
|
+
Sprint-flow orchestrator MUST output phase transition status as valid JSON:
|
|
1131
|
+
|
|
1132
|
+
```json
|
|
1133
|
+
{
|
|
1134
|
+
"skill_name": "sprint-flow",
|
|
1135
|
+
"sprint_id": "sprint-YYYY-MM-DD-NN",
|
|
1136
|
+
"current_phase": 2,
|
|
1137
|
+
"phase_name": "BUILD",
|
|
1138
|
+
"status": "running|paused|completed|failed",
|
|
1139
|
+
"isolation": {
|
|
1140
|
+
"worktree_path": ".worktrees/sprint/sprint-YYYY-MM-DD-NN",
|
|
1141
|
+
"branch": "sprint/YYYY-MM-DD-NN"
|
|
1142
|
+
},
|
|
1143
|
+
"progress": {
|
|
1144
|
+
"total_phases": 11,
|
|
1145
|
+
"completed_phases": 4,
|
|
1146
|
+
"percentage": 36,
|
|
1147
|
+
"phase_history": [
|
|
1148
|
+
{ "phase": -1, "phase_name": "ISOLATE", "status": "completed", "started_at": "2026-06-02T14:30:00Z", "completed_at": "2026-06-02T14:33:00Z", "duration_seconds": 180 },
|
|
1149
|
+
{ "phase": -0.5, "phase_name": "AUTO-ESTIMATE", "status": "completed", "started_at": "2026-06-02T14:33:00Z", "completed_at": "2026-06-02T14:34:00Z", "duration_seconds": 60 },
|
|
1150
|
+
{ "phase": 0, "phase_name": "THINK", "status": "completed", "started_at": "2026-06-02T14:34:00Z", "completed_at": "2026-06-02T14:59:00Z", "duration_seconds": 1500 },
|
|
1151
|
+
{ "phase": 1, "phase_name": "PLAN", "status": "completed", "started_at": "2026-06-02T14:59:00Z", "completed_at": "2026-06-02T15:17:00Z", "duration_seconds": 1080 },
|
|
1152
|
+
{ "phase": 2, "phase_name": "BUILD", "status": "running", "started_at": "2026-06-02T15:17:00Z", "completed_at": null, "duration_seconds": null }
|
|
1153
|
+
]
|
|
1154
|
+
},
|
|
1155
|
+
"outputs": {
|
|
1156
|
+
"specification": "specification.yaml",
|
|
1157
|
+
"mvp": "mvp-v1/"
|
|
1158
|
+
},
|
|
1159
|
+
"metrics": {
|
|
1160
|
+
"tests_passed": 15,
|
|
1161
|
+
"tests_failed": 0,
|
|
1162
|
+
"coverage_pct": 85
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
```
|
|
1166
|
+
|
|
1167
|
+
**Eval assertions check for:** `phase`, `status`, `isolation.branch`, `outputs.specification`, `metrics.coverage_pct`, `progress.phase_history`.
|
|
1168
|
+
|
|
1169
|
+
---
|
|
1170
|
+
|
|
1171
|
+
## Anti-Patterns
|
|
1172
|
+
|
|
1173
|
+
| ❌ 错误 | ✅ 正确 |
|
|
1174
|
+
|---|---|
|
|
1175
|
+
| 在保护分支 (main/master) 上直接执行 sprint | Phase -1 自动创建 worktree 隔离 |
|
|
1176
|
+
| 跳过 Phase 4 用户验收("赶时间") | Phase 4 是 HARD-GATE,必须人工验收 |
|
|
1177
|
+
| Phase 2 不安装 Git Hooks 就开始编码 | GITHOOKS-GATE 检查必须先于 BUILD |
|
|
1178
|
+
| 单个 subagent 处理所有 REQ | ralph-loop 逐 REQ 迭代,每个 REQ 独立上下文 |
|
|
1179
|
+
| 验证失败仍 commit | 验证不通过的代码不 commit |
|
|
1180
|
+
| 跳过 Phase 5 FEEDBACK 直接 SHIP | Phase 5 是 HARD-GATE,不可跳过 |
|
|
1181
|
+
| --force 在生产分支上运行不确认 | --force 必须等待用户显式确认风险 |
|
|
1182
|
+
| Phase 6 SHIP 后不清理 worktree | Phase 8 CLEANUP 必须执行 git worktree remove |
|
|
1183
|
+
|
|
1184
|
+
---
|
|
1185
|
+
|
|
1186
|
+
## Output Format (MANDATORY)
|
|
1187
|
+
|
|
1188
|
+
Sprint-flow orchestrator MUST output phase transition status as valid JSON:
|
|
1189
|
+
|
|
1190
|
+
```json
|
|
1191
|
+
{
|
|
1192
|
+
"skill_name": "sprint-flow",
|
|
1193
|
+
"sprint_id": "sprint-YYYY-MM-DD-NN",
|
|
1194
|
+
"current_phase": 2,
|
|
1195
|
+
"phase_name": "BUILD",
|
|
1196
|
+
"status": "running|paused|completed|failed",
|
|
1197
|
+
"isolation": {
|
|
1198
|
+
"worktree_path": ".worktrees/sprint/sprint-YYYY-MM-DD-NN",
|
|
1199
|
+
"branch": "sprint/YYYY-MM-DD-NN"
|
|
1200
|
+
},
|
|
1201
|
+
"outputs": {
|
|
1202
|
+
"specification": "specification.yaml",
|
|
1203
|
+
"mvp": "mvp-v1/"
|
|
1204
|
+
},
|
|
1205
|
+
"metrics": {
|
|
1206
|
+
"tests_passed": 15,
|
|
1207
|
+
"tests_failed": 0,
|
|
1208
|
+
"coverage_pct": 85
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
```
|
|
1212
|
+
|
|
1213
|
+
**Eval assertions check for:** `phase`, `status`, `isolation.branch`, `outputs.specification`, `metrics.coverage_pct`.
|
|
826
1214
|
|
|
827
1215
|
---
|
|
828
1216
|
|