@boyingliu01/xp-gate 0.6.0 → 0.6.2
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__/detect-deps.test.js +188 -17
- package/lib/__tests__/doctor.test.js +1 -0
- package/lib/__tests__/gate-audit.test.ts +59 -0
- package/lib/__tests__/init.test.js +15 -0
- package/lib/__tests__/install-skill.test.js +1 -0
- package/lib/__tests__/ui-detector.test.ts +112 -1
- package/lib/__tests__/ui-review.test.ts +119 -0
- package/lib/__tests__/uninstall.test.js +1 -0
- package/lib/detect-deps.js +181 -27
- package/lib/doctor.js +7 -9
- package/lib/gate-audit.ts +26 -42
- package/lib/init.js +42 -13
- package/lib/install-skill.js +6 -23
- package/lib/rollback.js +1 -16
- package/lib/shared-paths.js +30 -0
- package/lib/shared-utils.js +25 -0
- package/lib/ui-review.ts +58 -53
- package/lib/uninstall.js +8 -9
- 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 +416 -25
- 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 隔离)
|
|
@@ -330,9 +462,12 @@ Phase 2 第一步必须执行 DELPHI-GATE 检查。没有 delphi-review APPROVED
|
|
|
330
462
|
- 输入: phase-4-summary.md(验收结果)+ emergent-issues.md(如有)
|
|
331
463
|
- 输出: `feedback-log.md`
|
|
332
464
|
- **HARD-GATE**: Phase 5 不可跳过。Phase 4 完成后 → 必须进入 Phase 5 → 完成后才能进入 Phase 6。
|
|
333
|
-
- **`learn` (gstack)** — Sprint
|
|
465
|
+
- **`learn` (gstack)** — Sprint 级复盘(**Phase 5 必须自动调用,不依赖手动触发**)
|
|
466
|
+
- **默认提炼模板**(无需用户额外输入):
|
|
467
|
+
> 提炼总结并保存可复用的经验教训,把大模型不知道、并且犯错后无法立即发现和纠正的知识保存下来。如果是对其他项目也有价值的,就保存成全局记忆,否则保存为项目记忆。
|
|
334
468
|
- ralph-loop 已在 BUILD Phase 内部实现 per-REQ learn(permanent/contextual 分类)
|
|
335
469
|
- Phase 5 额外进行 Sprint 级复盘,总结全 Phase 经验
|
|
470
|
+
- **learnings 自动注入**:`/learn export` 时自动 append 到 CLAUDE.md / AGENTS.md 末尾形成 `## Project Learnings` 章节
|
|
336
471
|
- **`retro` (gstack)** — 工程回顾:提交历史、工作模式、代码质量趋势
|
|
337
472
|
- **`systematic-debugging` (superpowers)** — 根因调试
|
|
338
473
|
|
|
@@ -343,6 +478,13 @@ Phase 2 第一步必须执行 DELPHI-GATE 检查。没有 delphi-review APPROVED
|
|
|
343
478
|
- **HARD-GATE**: Phase 5 未完成 → 不可进入 Phase 6。验证 `.sprint-state/phase-outputs/feedback-log.md` 存在。
|
|
344
479
|
- **⚠️ GITHOOKS-GATE**: 再次验证 hooks 完整性(Phase 2 的 TDD 编码已触发提交,SHIP 阶段还会再次提交)
|
|
345
480
|
- 运行 `githooks/verify.sh` → 缺失 → `githooks/install.sh` → 阻断直至修复
|
|
481
|
+
- **⚠️ VERSION-GATE**: Phase 6 提交前必须 bump VERSION 文件(与变更类型无关)
|
|
482
|
+
- 默认 bump PATCH 位(如 `0.6.0.0` → `0.6.1.0`,MICRO 重置为 0)
|
|
483
|
+
- 重大新功能 bump MINOR 位(如 `0.6.0.0` → `0.7.0.0`),Breaking change bump MAJOR 位
|
|
484
|
+
- 运行 `bash scripts/sync-version.sh` 同步到所有 package.json(root、npm-package、claude-plugin、opencode)
|
|
485
|
+
- 更新 `CHANGELOG.md` 添加本次变更记录(含变更类型说明:skill-only / code / mixed)
|
|
486
|
+
- 验证:`git diff VERSION` 确认版本号已变更,未变更 → 阻断
|
|
487
|
+
- **此规则与变更类型无关** — 纯 skill 变更(仅 .md 文件)也必须 bump PATCH,确保每次 sprint 都触发 npm 发布
|
|
346
488
|
- **`finishing-a-development-branch`** (superpowers) — 结构化完成流:4 选项(merge / PR / discard / keep)
|
|
347
489
|
- `ship` (gstack) — 创建 PR(PR 路径时使用)
|
|
348
490
|
- Phase 6 输出:PR URL(用于 Phase 7 输入)
|
|
@@ -365,21 +507,28 @@ Phase 2 第一步必须执行 DELPHI-GATE 检查。没有 delphi-review APPROVED
|
|
|
365
507
|
- 条件跳过:无部署配置时,仅执行 merge + CI checks,跳过 deploy/canary
|
|
366
508
|
- 输出:部署状态 + Canary 报告(成功/失败/跳过)
|
|
367
509
|
|
|
368
|
-
### Phase 8: CLEANUP
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
-
|
|
382
|
-
-
|
|
510
|
+
### Phase 8: CLEANUP(安全清理 + 总结)
|
|
511
|
+
|
|
512
|
+
**执行时机**: Phase 7 LAND 成功后(或 Phase 6 Option 1 本地 Merge 后)
|
|
513
|
+
|
|
514
|
+
**动作**:
|
|
515
|
+
1. **检测 worktree 是否存在**: `[ -d <worktree_path> ]`
|
|
516
|
+
2. **安全清理**:
|
|
517
|
+
- **⚠️ 禁止使用通配符或递归 shell 删除命令** — 必须先列出 `isolation.worktree_path` 并确认只清理本 sprint worktree
|
|
518
|
+
- 首选 git worktree 管理命令清理该精确路径;失败时重试最多 3 次,间隔 1s
|
|
519
|
+
- 如果仍失败:输出 `[WARN] Worktree cleanup failed; list the target path and ask the user to clean it manually`
|
|
520
|
+
- ** NEVER delete arbitrary directories** — 只删除本 sprint 创建的 `isolation.worktree_path`
|
|
521
|
+
3. **残留检测**: `[ -d <worktree_path> ]` → 如果仍有残留,输出警告 `[WARN] 检测到残留目录,请手动检查:<worktree_path>`
|
|
522
|
+
4. **更新 `.sprint-state/sprint-state.json`**:
|
|
523
|
+
- `phase: 8`
|
|
524
|
+
- `status: "merged"` 或 `"completed"`
|
|
525
|
+
5. **输出 Cleanup Report + Sprint Summary**
|
|
526
|
+
|
|
527
|
+
**条件跳过**: `--no-isolate` 路径(无 worktree 可清理)
|
|
528
|
+
|
|
529
|
+
**输出**: `[CLEANUP] Worktree removed:` + 残留检测(✅ clean / ⚠️ residual)
|
|
530
|
+
|
|
531
|
+
**IF emergent issues → Sprint 2**
|
|
383
532
|
|
|
384
533
|
---
|
|
385
534
|
|
|
@@ -467,9 +616,22 @@ Phase 2 第一步必须执行 DELPHI-GATE 检查。没有 delphi-review APPROVED
|
|
|
467
616
|
2. **更新 sprint-state.json**:
|
|
468
617
|
- `phase`: 当前阶段编号
|
|
469
618
|
- `outputs`: 新增当前阶段输出文件路径
|
|
619
|
+
- `phase_history`: 追加或更新当前阶段的记录
|
|
620
|
+
- Phase 开始时:追加 `{ "phase": N, "phase_name": "NAME", "status": "running", "started_at": "<ISO 8601>", "completed_at": null, "duration_seconds": null }`
|
|
621
|
+
- Phase 完成时:更新对应条目,填充 `completed_at`(ISO 8601)和 `duration_seconds`(`completed_at - started_at` 的秒数)
|
|
622
|
+
- Phase 跳过时(如轻量路由跳过 Phase 0 brainstorming):设置 `status: "skipped"`
|
|
470
623
|
|
|
471
624
|
3. **等待用户确认 checkpoint**(如适用)
|
|
472
625
|
|
|
626
|
+
4. **展示进度看板**:执行 `node scripts/render-sprint-progress.cjs` 渲染进度看板
|
|
627
|
+
- 脚本自动读取 `.sprint-state/sprint-state.json` 并输出 ASCII 进度看板
|
|
628
|
+
- 渲染规则:已完成阶段显示 ✅ + 耗时,当前阶段 🔄,待做 ⬜,跳过 ⏭️,失败 ❌
|
|
629
|
+
- 进度条:`[████▓░░░░░░] {pct}%`(已完成数/总阶段数 11)
|
|
630
|
+
- 下一步行动:根据当前阶段 + 状态,自动查找对应提示
|
|
631
|
+
- 输出物路径:列出 `outputs` 中已有的文件路径
|
|
632
|
+
- 时机:每个 Phase 完成后的 transition 阶段自动展示,用户无需请求
|
|
633
|
+
- 向后兼容:旧版 `sprint-state.json` 缺少 `phase_history` 时,从 `phase` 字段推断状态
|
|
634
|
+
|
|
473
635
|
### Phase Summary 格式(YAML Frontmatter Schema)
|
|
474
636
|
|
|
475
637
|
每个 `phase-N-summary.md` 必须包含以下 YAML frontmatter:
|
|
@@ -530,8 +692,10 @@ Sprint state is persisted as JSON in `.sprint-state/sprint-state.json`:
|
|
|
530
692
|
```json
|
|
531
693
|
{
|
|
532
694
|
"id": "sprint-2026-04-26-01",
|
|
695
|
+
"task_description": "开发访谈机器人,支持多轮对话",
|
|
533
696
|
"phase": -1,
|
|
534
697
|
"status": "running|paused|completed",
|
|
698
|
+
"started_at": "2026-04-26T10:00:00Z",
|
|
535
699
|
"isolation": {
|
|
536
700
|
"worktree_path": ".worktrees/sprint/sprint-2026-04-26-01",
|
|
537
701
|
"branch": "sprint/2026-04-26-01",
|
|
@@ -554,6 +718,16 @@ Sprint state is persisted as JSON in `.sprint-state/sprint-state.json`:
|
|
|
554
718
|
"user_decision": "accepted|overridden|cancelled",
|
|
555
719
|
"override_reason": null
|
|
556
720
|
},
|
|
721
|
+
"phase_history": [
|
|
722
|
+
{
|
|
723
|
+
"phase": -1,
|
|
724
|
+
"phase_name": "ISOLATE",
|
|
725
|
+
"status": "completed",
|
|
726
|
+
"started_at": "2026-04-26T10:00:00Z",
|
|
727
|
+
"completed_at": "2026-04-26T10:03:00Z",
|
|
728
|
+
"duration_seconds": 180
|
|
729
|
+
}
|
|
730
|
+
],
|
|
557
731
|
"outputs": {
|
|
558
732
|
"pain_document": "docs/pain-document.md",
|
|
559
733
|
"specification": "specification.yaml",
|
|
@@ -567,7 +741,19 @@ Sprint state is persisted as JSON in `.sprint-state/sprint-state.json`:
|
|
|
567
741
|
}
|
|
568
742
|
}
|
|
569
743
|
```
|
|
570
|
-
|
|
744
|
+
|
|
745
|
+
**新增字段说明**:
|
|
746
|
+
- `task_description`: Sprint 需求描述(Phase -1 启动时写入)
|
|
747
|
+
- `started_at`: Sprint 启动时间戳(Phase -1 启动时写入,ISO 8601 格式)
|
|
748
|
+
- `phase_history`: 阶段历史数组,每个元素记录阶段的执行信息:
|
|
749
|
+
- `phase`: 阶段编号
|
|
750
|
+
- `phase_name`: 阶段名称
|
|
751
|
+
- `status`: completed / running / failed / skipped
|
|
752
|
+
- `started_at`: 阶段开始时间(ISO 8601)
|
|
753
|
+
- `completed_at`: 阶段完成时间(null 表示未完成)
|
|
754
|
+
- `duration_seconds`: 耗时秒数(null 表示未完成)
|
|
755
|
+
|
|
756
|
+
**Eval assertions check for:** `phase`, `status`, `isolation.branch`, `outputs.specification`, `metrics.coverage_pct`, `phase_history`, `task_description`.
|
|
571
757
|
|
|
572
758
|
---
|
|
573
759
|
|
|
@@ -606,6 +792,23 @@ Sprint state is persisted as JSON in `.sprint-state/sprint-state.json`:
|
|
|
606
792
|
# 适用场景:单独验证某个阶段
|
|
607
793
|
```
|
|
608
794
|
|
|
795
|
+
### --status(查看 Sprint 进度)
|
|
796
|
+
|
|
797
|
+
```bash
|
|
798
|
+
/sprint-flow --status
|
|
799
|
+
# → 执行 node scripts/render-sprint-progress.cjs
|
|
800
|
+
# → 读取 .sprint-state/sprint-state.json 并渲染 ASCII 进度看板
|
|
801
|
+
# → 不执行任何 Phase,仅展示当前状态
|
|
802
|
+
# 适用场景:碎片时间恢复时快速查看进度、中断后确认当前阶段和下一步操作
|
|
803
|
+
```
|
|
804
|
+
|
|
805
|
+
**行为规则**:
|
|
806
|
+
- 执行 `node scripts/render-sprint-progress.cjs`(脚本自动处理所有渲染逻辑)
|
|
807
|
+
- 如果 `sprint-state.json` 不存在 → 脚本输出 `[INFO] 未找到活跃的 Sprint。请先运行 /sprint-flow "[需求描述]" 启动新 Sprint。`
|
|
808
|
+
- 如果 `status == "completed"` → 脚本输出完整看板 + `[INFO] Sprint 已完成。`
|
|
809
|
+
- `--status` 可与其他参数组合:`--status --resume-from build` → 先展示状态,再提示 "将从 Phase 2 BUILD 继续"
|
|
810
|
+
- 向后兼容:旧版 `sprint-state.json` 缺少 `phase_history`/`task_description` 时,按模板"向后兼容"规则渲染
|
|
811
|
+
|
|
609
812
|
### --lang(指定项目语言)
|
|
610
813
|
|
|
611
814
|
```bash
|
|
@@ -771,7 +974,7 @@ Sprint 结束时 (Phase 6 完成):
|
|
|
771
974
|
# → mkdir -p .worktrees/sprint
|
|
772
975
|
# → 检测已有 NN 编号(.worktrees/sprint/ | grep -oE '[0-9]{2}$' | sort -n | tail -1)
|
|
773
976
|
# → git worktree add .worktrees/sprint/sprint-2026-05-24-01 -b sprint/2026-05-24-01
|
|
774
|
-
# → 在 worktree
|
|
977
|
+
# → 在 worktree 目录下:npm install → 基线测试 → .sprint-state/ 记录
|
|
775
978
|
# → 进入 Phase 0 THINK...
|
|
776
979
|
|
|
777
980
|
# 跳过隔离(⚠️ 有污染风险)
|
|
@@ -785,11 +988,13 @@ Sprint 结束时 (Phase 6 完成):
|
|
|
785
988
|
|
|
786
989
|
# 自定义分支名
|
|
787
990
|
/sprint-flow "开发用户登录" --branch-name feat/user-login
|
|
788
|
-
# →
|
|
789
|
-
# → worktree
|
|
991
|
+
# → 分支名:feat/user-login(保留 /)
|
|
992
|
+
# → worktree 路径:.worktrees/sprint/feat-user-login(/ 替换为 -)
|
|
790
993
|
|
|
791
|
-
#
|
|
792
|
-
|
|
994
|
+
# Sprint 完成后安全清理:先列出本 sprint 的 isolation.worktree_path
|
|
995
|
+
# 仅清理 sprint-state 中记录的精确 worktree 路径
|
|
996
|
+
# 禁止使用通配符或递归 shell 删除命令
|
|
997
|
+
# 如果自动清理失败,输出目标路径并要求用户手动处理
|
|
793
998
|
```
|
|
794
999
|
|
|
795
1000
|
---
|
|
@@ -803,6 +1008,87 @@ git worktree remove .worktrees/sprint/sprint-2026-05-24-01
|
|
|
803
1008
|
|
|
804
1009
|
---
|
|
805
1010
|
|
|
1011
|
+
## Anti-Patterns
|
|
1012
|
+
|
|
1013
|
+
| 错误 | 正确 |
|
|
1014
|
+
|------|------|
|
|
1015
|
+
| 把普通问答、解释、代码检索请求路由到 sprint-flow | 仅在用户明确要求开发/实现/一键开发完整需求时触发 sprint-flow |
|
|
1016
|
+
| 跳过 Phase -1 隔离,直接在 main/master/develop 上改代码 | 默认创建 worktree;除非用户显式使用 `--no-isolate` 或 `--force` 并确认风险 |
|
|
1017
|
+
| 未完成 Phase -0.5 AUTO-ESTIMATE 就套用完整重流程 | 先评估轻量/标准/复杂,再按推荐流程或用户确认后的流程执行 |
|
|
1018
|
+
| Plan 阶段跳过 Delphi 评审直接 Build | 标准/复杂需求必须经过 autoplan + delphi-review;未 APPROVED 禁止编码 |
|
|
1019
|
+
| 跳过 TDD 直接实现代码 | Phase 2 必须遵循 RED → GREEN → REFACTOR,测试与实现一起交付 |
|
|
1020
|
+
| 跳过用户验收直接 Ship | Phase 4 USER ACCEPTANCE 必须人工完成;不得自动化、跳过或伪造 |
|
|
1021
|
+
| 验证失败后继续追加随机修改 | 最多 3 次修复循环;仍失败则 BLOCK 并请求用户决策 |
|
|
1022
|
+
| 未生成 Phase Summary 就进入下一阶段 | 每个 Phase 必须写入 `.sprint-state/phase-outputs/phase-{N}-summary.md` 并通过 transition gate |
|
|
1023
|
+
|
|
1024
|
+
## Output Format
|
|
1025
|
+
|
|
1026
|
+
See [Output Contract](#output-contract) below for the canonical machine-readable output schema.
|
|
1027
|
+
|
|
1028
|
+
### Eval Assertions
|
|
1029
|
+
- `phase`, `phase_name`, `status`, `outputs`, `decisions`, `next_phase_context`
|
|
1030
|
+
- `id`, `isolation.worktree_path`, `isolation.branch`, `metrics.coverage_pct`
|
|
1031
|
+
|
|
1032
|
+
## Output Contract
|
|
1033
|
+
|
|
1034
|
+
### Machine-Readable Outputs
|
|
1035
|
+
|
|
1036
|
+
**Phase Summary** (all automated Phases must output):
|
|
1037
|
+
```markdown
|
|
1038
|
+
---
|
|
1039
|
+
phase: <N>
|
|
1040
|
+
phase_name: <NAME>
|
|
1041
|
+
status: completed|paused|failed
|
|
1042
|
+
outputs:
|
|
1043
|
+
- path: "path/to/output"
|
|
1044
|
+
type: file|directory
|
|
1045
|
+
decisions:
|
|
1046
|
+
- title: "Decision title"
|
|
1047
|
+
rationale: "Rationale for decision"
|
|
1048
|
+
unresolved_issues: []
|
|
1049
|
+
next_phase_context: "Context needed by next phase"
|
|
1050
|
+
---
|
|
1051
|
+
|
|
1052
|
+
## Phase Summary
|
|
1053
|
+
Concise summary, <= 50 lines.
|
|
1054
|
+
```
|
|
1055
|
+
|
|
1056
|
+
**Sprint State JSON** (all Phases must maintain):
|
|
1057
|
+
```json
|
|
1058
|
+
{
|
|
1059
|
+
"id": "sprint-YYYY-MM-DD-NN",
|
|
1060
|
+
"phase": <N>,
|
|
1061
|
+
"status": "running|paused|completed|failed",
|
|
1062
|
+
"isolation": {
|
|
1063
|
+
"worktree_path": ".worktrees/sprint/sprint-YYYY-MM-DD-NN",
|
|
1064
|
+
"branch": "sprint/YYYY-MM-DD-NN"
|
|
1065
|
+
},
|
|
1066
|
+
"outputs": {},
|
|
1067
|
+
"metrics": {}
|
|
1068
|
+
}
|
|
1069
|
+
```
|
|
1070
|
+
|
|
1071
|
+
### Final User-Facing Output
|
|
1072
|
+
|
|
1073
|
+
When ending or pausing, output:
|
|
1074
|
+
- Current Phase and status
|
|
1075
|
+
- Generated file paths
|
|
1076
|
+
- Passed/failed validation commands
|
|
1077
|
+
- Next user decision required (if applicable)
|
|
1078
|
+
- PR URL (Phase 6 success) or cleanup report (Phase 8 success)
|
|
1079
|
+
|
|
1080
|
+
## Security Notes
|
|
1081
|
+
|
|
1082
|
+
- Sprint Flow 会执行 git 操作(worktree、branch、commit、PR、merge),在受保护分支上默认必须隔离。
|
|
1083
|
+
- 不得使用 `--no-verify` 绕过 quality gates;hook 失败必须修复根因。
|
|
1084
|
+
- 不得自动推送、创建 PR、merge 或 deploy,除非用户请求的流程明确进入 Ship/Land 阶段并已通过前置 gate。
|
|
1085
|
+
- 不得修改、打印或提交 `.delphi-config.json`、API keys、tokens、cookies、SSH keys 等敏感信息。
|
|
1086
|
+
- Phase 7 deploy/canary 失败时必须报告失败并按配置回滚;不可静默忽略部署失败。
|
|
1087
|
+
- Phase 4 用户验收不可由模型代替;人工验收是发布安全边界。
|
|
1088
|
+
- worktree 清理只允许删除本 sprint 创建的 `isolation.worktree_path`,不得删除任意用户目录。
|
|
1089
|
+
|
|
1090
|
+
---
|
|
1091
|
+
|
|
806
1092
|
## References
|
|
807
1093
|
|
|
808
1094
|
详细指令文件位于 `@references/`:
|
|
@@ -823,6 +1109,111 @@ git worktree remove .worktrees/sprint/sprint-2026-05-24-01
|
|
|
823
1109
|
- `@templates/pain-document-template.md` — Pain Document 模板
|
|
824
1110
|
- `@templates/emergent-issues-template.md` — Emergent Issues 检查清单
|
|
825
1111
|
- `@templates/sprint-summary-template.md` — Sprint Summary 模板
|
|
1112
|
+
- `@templates/sprint-progress-template.md` — Sprint 进度看板(每个 Phase 完成后 + `--status` 查询时渲染)
|
|
1113
|
+
|
|
1114
|
+
---
|
|
1115
|
+
|
|
1116
|
+
## Anti-Patterns
|
|
1117
|
+
|
|
1118
|
+
| ❌ 错误 | ✅ 正确 |
|
|
1119
|
+
|---|---|
|
|
1120
|
+
| 在保护分支 (main/master) 上直接执行 sprint | Phase -1 自动创建 worktree 隔离 |
|
|
1121
|
+
| 跳过 Phase 4 用户验收("赶时间") | Phase 4 是 HARD-GATE,必须人工验收 |
|
|
1122
|
+
| Phase 2 不安装 Git Hooks 就开始编码 | GITHOOKS-GATE 检查必须先于 BUILD |
|
|
1123
|
+
| 单个 subagent 处理所有 REQ | ralph-loop 逐 REQ 迭代,每个 REQ 独立上下文 |
|
|
1124
|
+
| 验证失败仍 commit | 验证不通过的代码不 commit |
|
|
1125
|
+
| 跳过 Phase 5 FEEDBACK 直接 SHIP | Phase 5 是 HARD-GATE,不可跳过 |
|
|
1126
|
+
| --force 在生产分支上运行不确认 | --force 必须等待用户显式确认风险 |
|
|
1127
|
+
| Phase 6 SHIP 后不清理 worktree | Phase 8 CLEANUP 必须执行 git worktree remove |
|
|
1128
|
+
|
|
1129
|
+
---
|
|
1130
|
+
|
|
1131
|
+
## Output Format (MANDATORY)
|
|
1132
|
+
|
|
1133
|
+
Sprint-flow orchestrator MUST output phase transition status as valid JSON:
|
|
1134
|
+
|
|
1135
|
+
```json
|
|
1136
|
+
{
|
|
1137
|
+
"skill_name": "sprint-flow",
|
|
1138
|
+
"sprint_id": "sprint-YYYY-MM-DD-NN",
|
|
1139
|
+
"current_phase": 2,
|
|
1140
|
+
"phase_name": "BUILD",
|
|
1141
|
+
"status": "running|paused|completed|failed",
|
|
1142
|
+
"isolation": {
|
|
1143
|
+
"worktree_path": ".worktrees/sprint/sprint-YYYY-MM-DD-NN",
|
|
1144
|
+
"branch": "sprint/YYYY-MM-DD-NN"
|
|
1145
|
+
},
|
|
1146
|
+
"progress": {
|
|
1147
|
+
"total_phases": 11,
|
|
1148
|
+
"completed_phases": 4,
|
|
1149
|
+
"percentage": 36,
|
|
1150
|
+
"phase_history": [
|
|
1151
|
+
{ "phase": -1, "phase_name": "ISOLATE", "status": "completed", "started_at": "2026-06-02T14:30:00Z", "completed_at": "2026-06-02T14:33:00Z", "duration_seconds": 180 },
|
|
1152
|
+
{ "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 },
|
|
1153
|
+
{ "phase": 0, "phase_name": "THINK", "status": "completed", "started_at": "2026-06-02T14:34:00Z", "completed_at": "2026-06-02T14:59:00Z", "duration_seconds": 1500 },
|
|
1154
|
+
{ "phase": 1, "phase_name": "PLAN", "status": "completed", "started_at": "2026-06-02T14:59:00Z", "completed_at": "2026-06-02T15:17:00Z", "duration_seconds": 1080 },
|
|
1155
|
+
{ "phase": 2, "phase_name": "BUILD", "status": "running", "started_at": "2026-06-02T15:17:00Z", "completed_at": null, "duration_seconds": null }
|
|
1156
|
+
]
|
|
1157
|
+
},
|
|
1158
|
+
"outputs": {
|
|
1159
|
+
"specification": "specification.yaml",
|
|
1160
|
+
"mvp": "mvp-v1/"
|
|
1161
|
+
},
|
|
1162
|
+
"metrics": {
|
|
1163
|
+
"tests_passed": 15,
|
|
1164
|
+
"tests_failed": 0,
|
|
1165
|
+
"coverage_pct": 85
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
```
|
|
1169
|
+
|
|
1170
|
+
**Eval assertions check for:** `phase`, `status`, `isolation.branch`, `outputs.specification`, `metrics.coverage_pct`, `progress.phase_history`.
|
|
1171
|
+
|
|
1172
|
+
---
|
|
1173
|
+
|
|
1174
|
+
## Anti-Patterns
|
|
1175
|
+
|
|
1176
|
+
| ❌ 错误 | ✅ 正确 |
|
|
1177
|
+
|---|---|
|
|
1178
|
+
| 在保护分支 (main/master) 上直接执行 sprint | Phase -1 自动创建 worktree 隔离 |
|
|
1179
|
+
| 跳过 Phase 4 用户验收("赶时间") | Phase 4 是 HARD-GATE,必须人工验收 |
|
|
1180
|
+
| Phase 2 不安装 Git Hooks 就开始编码 | GITHOOKS-GATE 检查必须先于 BUILD |
|
|
1181
|
+
| 单个 subagent 处理所有 REQ | ralph-loop 逐 REQ 迭代,每个 REQ 独立上下文 |
|
|
1182
|
+
| 验证失败仍 commit | 验证不通过的代码不 commit |
|
|
1183
|
+
| 跳过 Phase 5 FEEDBACK 直接 SHIP | Phase 5 是 HARD-GATE,不可跳过 |
|
|
1184
|
+
| --force 在生产分支上运行不确认 | --force 必须等待用户显式确认风险 |
|
|
1185
|
+
| Phase 6 SHIP 后不清理 worktree | Phase 8 CLEANUP 必须执行 git worktree remove |
|
|
1186
|
+
|
|
1187
|
+
---
|
|
1188
|
+
|
|
1189
|
+
## Output Format (MANDATORY)
|
|
1190
|
+
|
|
1191
|
+
Sprint-flow orchestrator MUST output phase transition status as valid JSON:
|
|
1192
|
+
|
|
1193
|
+
```json
|
|
1194
|
+
{
|
|
1195
|
+
"skill_name": "sprint-flow",
|
|
1196
|
+
"sprint_id": "sprint-YYYY-MM-DD-NN",
|
|
1197
|
+
"current_phase": 2,
|
|
1198
|
+
"phase_name": "BUILD",
|
|
1199
|
+
"status": "running|paused|completed|failed",
|
|
1200
|
+
"isolation": {
|
|
1201
|
+
"worktree_path": ".worktrees/sprint/sprint-YYYY-MM-DD-NN",
|
|
1202
|
+
"branch": "sprint/YYYY-MM-DD-NN"
|
|
1203
|
+
},
|
|
1204
|
+
"outputs": {
|
|
1205
|
+
"specification": "specification.yaml",
|
|
1206
|
+
"mvp": "mvp-v1/"
|
|
1207
|
+
},
|
|
1208
|
+
"metrics": {
|
|
1209
|
+
"tests_passed": 15,
|
|
1210
|
+
"tests_failed": 0,
|
|
1211
|
+
"coverage_pct": 85
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
```
|
|
1215
|
+
|
|
1216
|
+
**Eval assertions check for:** `phase`, `status`, `isolation.branch`, `outputs.specification`, `metrics.coverage_pct`.
|
|
826
1217
|
|
|
827
1218
|
---
|
|
828
1219
|
|