@boyingliu01/opencode-plugin 0.12.14 → 0.13.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/package.json +1 -1
- package/skills/delphi-review/AGENTS.md +3 -3
- package/skills/sprint-flow/AGENTS.md +49 -61
- package/skills/sprint-flow/SKILL.md +200 -238
- package/skills/sprint-flow/__tests__/sprint-flow.test.cjs +24 -30
- package/skills/sprint-flow/references/force-levels.md +13 -14
- package/skills/sprint-flow/references/orchestration-rules.md +61 -197
- package/skills/sprint-flow/references/phase-1-prep.md +294 -0
- package/skills/sprint-flow/references/phase-2-design.md +194 -0
- package/skills/sprint-flow/references/{phase-2-build.md → phase-3-build.md} +11 -11
- package/skills/sprint-flow/references/phase-4-verify.md +153 -0
- package/skills/sprint-flow/references/phase-5-ship.md +40 -0
- package/skills/sprint-flow/references/phase-6-close.md +134 -0
- package/skills/sprint-flow/templates/auto-estimate-learning-log.md +1 -1
- package/skills/sprint-flow/templates/auto-estimate-output-template.md +15 -37
- package/skills/sprint-flow/templates/emergent-issues-template.md +7 -7
- package/skills/sprint-flow/templates/pain-document-template.md +5 -5
- package/skills/sprint-flow/templates/sprint-progress-template.md +36 -47
- package/skills/sprint-flow/templates/sprint-summary-template.md +16 -15
- package/skills/test-specification-alignment/AGENTS.md +3 -3
- package/skills/sprint-flow/references/phase-0-think.md +0 -115
- package/skills/sprint-flow/references/phase-1-plan.md +0 -178
- package/skills/sprint-flow/references/phase-3-review.md +0 -215
- package/skills/sprint-flow/references/phase-4-uat.md +0 -125
- package/skills/sprint-flow/references/phase-5-feedback.md +0 -100
- package/skills/sprint-flow/references/phase-6-ship.md +0 -9
- package/skills/sprint-flow/references/phase-7-land.md +0 -9
- package/skills/sprint-flow/references/phase-8-cleanup.md +0 -9
- package/skills/sprint-flow/references/phase-minus-0-5-auto-estimate.md +0 -263
- package/skills/sprint-flow/references/phase-minus-1-isolate.md +0 -58
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
# Phase 1/6: PREP(准备工作 — worktree 隔离 + 规模评估)
|
|
2
|
+
|
|
3
|
+
**执行时机**: `/sprint-flow` 启动后、Phase 2/6 DESIGN 之前。**自动执行**。
|
|
4
|
+
|
|
5
|
+
**目的**: 默认在 git worktree 中隔离 sprint 工作,防止在保护分支上直接运行造成代码污染。随后自动评估需求规模,匹配适度流程,避免小需求走重量级流程造成资源浪费。
|
|
6
|
+
|
|
7
|
+
**对应旧模型**: Phase -1 ISOLATE + Phase -0.5 AUTO-ESTIMATE
|
|
8
|
+
|
|
9
|
+
**核心原则**:
|
|
10
|
+
- **隔离优先**: 默认 worktree 隔离,防止保护分支污染
|
|
11
|
+
- **客观指标 > 主观判断**: 依赖代码结构分析,不依赖人/AI 的主观直觉
|
|
12
|
+
- **显式告知**: 用户看到客观指标,不是 AI 主观结论
|
|
13
|
+
- **可纠偏**: 用户可接受/修改/取消
|
|
14
|
+
- **学习闭环**: 记录用户 override,优化阈值
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Part A: ISOLATE(git worktree 隔离)
|
|
19
|
+
|
|
20
|
+
**AI agent 直接执行 bash 命令**(不需要调用外部 skill),步骤如下:
|
|
21
|
+
|
|
22
|
+
| 步骤 | 动作 | 说明 |
|
|
23
|
+
|------|------|------|
|
|
24
|
+
| 0 | **检测当前环境** | 运行 `git rev-parse --git-dir` 和 `git rev-parse --git-common-dir`。如果 `GIT_DIR != GIT_COMMON`:已在 worktree 中 → 输出 "Already in isolated worktree" → 进入 Part B |
|
|
25
|
+
| 0.5 | **Sprint Lock 检测(Issue #144)** | 检查 `.sprint-state/sprint.lock` 是否存在: `[ -f .sprint-state/sprint.lock ]`。如果存在: 读取锁内容,检查是否 stale(超过 24 小时或 worktree 目录不存在)→ stale → 输出 `[WARN] 发现过期 sprint lock,将覆盖` → 更新锁。非 stale → 输出 `[BLOCK] 已有活跃 sprint (ID: {sprint_id}, started: {started_at})。请先完成当前 sprint 或手动删除 .sprint-state/sprint.lock` → 退出。锁不存在 → 创建锁: `echo '{"sprint_id":"sprint-YYYY-MM-DD-NN","started_at":"<ISO8601>"}' > .sprint-state/sprint.lock` |
|
|
26
|
+
| 1 | **检查保护分支** | 获取当前分支名 `git branch --show-current`。保护分支列表: `main, master, develop, trunk, mainline`。保护分支 → 强制创建 worktree。非保护分支 → 依然创建 worktree(推荐,不阻断) |
|
|
27
|
+
| 2 | **创建 worktree** | 创建目录: `mkdir -p .worktrees/sprint`。检测已有 NN 编号: `ls .worktrees/sprint/ 2>/dev/null \| grep -oE '[0-9]{2}$' \| sort -n \| tail -1`(取最后两位数字,数值排序,取最大),NN = 结果 + 1(无结果则从 01 开始)。运行 `git worktree add .worktrees/sprint/sprint-YYYY-MM-DD-NN -b sprint/YYYY-MM-DD-NN`。**注意**: `cd` 在 AI agent 单次工具调用中不保持状态,步骤 3-6 必须通过 `workdir` 参数或 `&&` 链式命令在新 worktree 目录下执行 |
|
|
28
|
+
| 3 | **项目 setup** | 在 worktree 目录下: 检测项目类型: `package.json` → `npm install`, `go.mod` → `go mod download`, `pyproject.toml` → `pip/poetry install` |
|
|
29
|
+
| 4 | **.gitignore 校验** | 在**仓库根目录**(非 worktree)执行: `git check-ignore -q .worktrees`。如果未忽略 → 将 `.worktrees/` 添加到 `.gitignore` → `git add .gitignore` → `git commit -m 'chore: ignore .worktrees directory'` |
|
|
30
|
+
| 5 | **Sprint State 记录** | `mkdir -p .sprint-state` 在 worktree 目录下。写入 `.sprint-state/sprint-state.json`(如已存在则合并,保留原有字段),新增/更新 `isolation` 对象,设置 `phase: 1`,`status: "running"` |
|
|
31
|
+
| 6 | **基线验证** | 在 worktree 目录下: 检测测试方式(package.json 有 "test" script → `npm test`, go.mod → `go test ./...`, pyproject.toml → `pytest`)。测试失败 → 输出失败信息 → 询问用户是否继续 |
|
|
32
|
+
|
|
33
|
+
### 参数处理
|
|
34
|
+
|
|
35
|
+
- `--no-isolate`: 跳过自动创建,输出 ⚠️ 警告 `'[WARN] 未创建 worktree 隔离,在 {branch} 分支上直接运行 sprint 有污染风险'` → 进入 Part B
|
|
36
|
+
- `--branch-name <name>`: 使用自定义分支名(默认自动生成 `sprint/YYYY-MM-DD-NN`),分支名中的 `/` 在 worktree 路径中自动替换为 `-`(如 `feat/user-login` → 分支名 `feat/user-login`,路径 `.worktrees/sprint/feat-user-login`)
|
|
37
|
+
- `--force`: 强制在当前分支继续(即使已是保护分支),**要求用户显式确认**: 输出 ⚠️ 警告 `'[WARN] 使用 --force 在 {branch} 分支上直接运行 sprint。此操作绕过隔离保护,请确认风险。'` → 等待用户确认("继续" / "取消") → 确认后进入 Part B
|
|
38
|
+
|
|
39
|
+
### 参数交互规则
|
|
40
|
+
|
|
41
|
+
| 参数组合 | 行为 |
|
|
42
|
+
|---------|------|
|
|
43
|
+
| `--no-isolate` 单独 | 跳过隔离,输出警告 → Part B |
|
|
44
|
+
| `--force` 单独 | 跳过隔离,要求确认 → Part B |
|
|
45
|
+
| `--no-isolate` + `--branch-name` | `--branch-name` 忽略,仅 `--no-isolate` 生效 |
|
|
46
|
+
| `--force` + `--branch-name` | `--branch-name` 忽略,仅 `--force` 生效 |
|
|
47
|
+
| `--no-isolate` + `--force` | 等效,输出 `--no-isolate` 警告 → Part B |
|
|
48
|
+
| `--resume-from build` + `--no-isolate` | `--resume-from` 优先,直接跳过 PREP |
|
|
49
|
+
|
|
50
|
+
### 错误处理和回退
|
|
51
|
+
|
|
52
|
+
| 错误场景 | 回退行为 |
|
|
53
|
+
|---------|---------|
|
|
54
|
+
| `git worktree add` 失败(沙箱/权限问题) | 输出 `[ERROR] git worktree add 失败: {error}` → `[WARN] 无法创建 worktree 隔离,将在当前目录继续。请手动设置隔离分支。` → 在当前目录继续 |
|
|
55
|
+
| `.gitignore` 自动添加失败 | 输出 `[WARN] 无法自动添加 .gitignore,请手动将 .worktrees/ 添加到 .gitignore` → 继续 |
|
|
56
|
+
| 基线测试失败 | 输出 `[FAIL] 基线测试未通过:` + 失败详情 → 询问用户 `'基线测试失败,是否继续 sprint?(y/N)'` |
|
|
57
|
+
|
|
58
|
+
### sprint-state.json isolation 对象格式
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"isolation": {
|
|
63
|
+
"worktree_path": ".worktrees/sprint/sprint-2026-05-24-01",
|
|
64
|
+
"branch": "sprint/2026-05-24-01",
|
|
65
|
+
"created_from": "main",
|
|
66
|
+
"created_from_commit": "abc123def..."
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Part B: AUTO-ESTIMATE(自动化规模评估与流程路由)
|
|
74
|
+
|
|
75
|
+
### 步骤 1: 识别需求类型
|
|
76
|
+
|
|
77
|
+
分析用户输入的需求描述,判定变更类型:
|
|
78
|
+
|
|
79
|
+
| 关键词模式 | 变更类型 | AUTO-ESTIMATE 时机 |
|
|
80
|
+
|-----------|---------|-------------------|
|
|
81
|
+
| 删除、移除、去掉、砍掉、清理 + 已有模块名 | 删除已存在代码 | 立即执行 |
|
|
82
|
+
| 修改、改、调整、重构、优化 + 已有模块名 | 修改已存在代码 | 立即执行 |
|
|
83
|
+
| 新增、添加、开发、实现、创建 + 新模块名 | 新增功能 | brainstorming 后执行 |
|
|
84
|
+
| 修复、fix、bug | Bug 修复 | 立即执行 |
|
|
85
|
+
| 无法判断 | 询问用户 | — |
|
|
86
|
+
|
|
87
|
+
**IF 新增功能**: 跳过当前 AUTO-ESTIMATE,先执行 Phase 2/6 DESIGN brainstorming,brainstorming 完成后以设计文档为输入重新执行 AUTO-ESTIMATE。
|
|
88
|
+
|
|
89
|
+
**IF 删除/修改/Bug 修复**: 继续执行以下步骤。
|
|
90
|
+
|
|
91
|
+
### 步骤 2: 收集指标
|
|
92
|
+
|
|
93
|
+
#### 2.1 引用计数
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
grep -rn "{target_pattern}" --include="*.{ext}" . | grep -v node_modules | grep -v .git | wc -l
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**阈值**: ≤3: 轻量 | 4-10: 标准 | >10: 复杂
|
|
100
|
+
|
|
101
|
+
#### 2.2 跨模块依赖
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
grep -rn "{target_pattern}" --include="*.{ext}" . | grep -v node_modules | grep -v .git | \
|
|
105
|
+
awk -F: '{print $1}' | sed 's|/[^/]*$||' | sort -u
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**阈值**: 1 个目录: 轻量 | 2 个目录: 标准 | 3+ 个目录: 复杂
|
|
109
|
+
|
|
110
|
+
#### 2.3 循环依赖检测
|
|
111
|
+
|
|
112
|
+
简单检查:如果 A 引用 B 且 B 引用 A,则存在循环依赖。
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
grep -rn "import.*{target}" --include="*.ts" --include="*.tsx" .
|
|
116
|
+
grep -rn "import.*{caller}" --include="*.ts" --include="*.tsx" {target_dir}/
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**阈值**: 无: 正常 | 存在: 高风险 → 无论如何输出风险警告
|
|
120
|
+
|
|
121
|
+
#### 2.4 Public API 暴露
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
grep -rn "^export " {target_dir}/ --include="*.ts" | wc -l
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**阈值**: ≤2: 低影响 | 3-5: 中影响 | >5: 高影响 → 输出风险警告
|
|
128
|
+
|
|
129
|
+
#### 2.5 相关测试文件
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
find . -name "*{target}*.test.*" -o -name "*{target}*.spec.*" | grep -v node_modules | wc -l
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**阈值**: 0: 无测试覆盖(风险提示) | 1-2: 正常 | >3: 重构工作量大 → 提示
|
|
136
|
+
|
|
137
|
+
### 步骤 3: 汇总评估
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
总分计算:
|
|
141
|
+
- 引用计数:轻量=1, 标准=2, 复杂=3
|
|
142
|
+
- 跨模块:轻量=1, 标准=2, 复杂=3
|
|
143
|
+
- 循环依赖:无=0, 存在=5(强制复杂)
|
|
144
|
+
- Public API:低=0, 中=1, 高=2
|
|
145
|
+
- 测试文件:正常=0, 多=1
|
|
146
|
+
|
|
147
|
+
总分:1-3 = 轻量 | 4-6 = 标准 | 7+ 或 循环依赖存在 = 复杂
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### 步骤 4: 输出评估结果
|
|
151
|
+
|
|
152
|
+
使用 `templates/auto-estimate-output-template.md` 的标准格式向用户展示评估结果。
|
|
153
|
+
|
|
154
|
+
**MUST** 遵循模板格式,包含:
|
|
155
|
+
- 需求描述 + 变更类型
|
|
156
|
+
- 影响级别标识
|
|
157
|
+
- 各项指标的具体数值
|
|
158
|
+
- 建议流程
|
|
159
|
+
- 风险警告(如有)
|
|
160
|
+
- 用户操作选项
|
|
161
|
+
|
|
162
|
+
### 步骤 5: 处理用户选择
|
|
163
|
+
|
|
164
|
+
#### 用户选择「接受建议」
|
|
165
|
+
按推荐流程执行。保存评估结果到 sprint-state.json。
|
|
166
|
+
|
|
167
|
+
```json
|
|
168
|
+
{
|
|
169
|
+
"auto_estimate": {
|
|
170
|
+
"change_type": "删除已存在代码",
|
|
171
|
+
"metrics": {
|
|
172
|
+
"ref_count": 12,
|
|
173
|
+
"cross_module_count": 3,
|
|
174
|
+
"modules": ["auth", "user", "admin"],
|
|
175
|
+
"circular_dep": true,
|
|
176
|
+
"public_api_count": 5,
|
|
177
|
+
"test_file_count": 4
|
|
178
|
+
},
|
|
179
|
+
"estimated_level": "复杂",
|
|
180
|
+
"recommended_flow": "完整 Sprint Flow (6 phases)",
|
|
181
|
+
"risk_warnings": ["循环依赖: user ↔ plane"],
|
|
182
|
+
"user_decision": "accepted"
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
#### 用户选择「修改流程」
|
|
188
|
+
展示修改流程子菜单(3 个选项:轻量/标准/完整)。要求用户输入修改原因(必填)。
|
|
189
|
+
|
|
190
|
+
记录到学习日志:
|
|
191
|
+
```json
|
|
192
|
+
{
|
|
193
|
+
"sprint_id": "{sprint_id}",
|
|
194
|
+
"task_description": "{需求描述}",
|
|
195
|
+
"estimated_level": "标准",
|
|
196
|
+
"user_override_level": "轻量",
|
|
197
|
+
"override_reason": "{用户输入原因}",
|
|
198
|
+
"timestamp": "{当前时间}"
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
数据写入 `.sprint-state/auto-estimate-learning.json`(追加模式)。
|
|
203
|
+
|
|
204
|
+
#### 用户选择「取消」
|
|
205
|
+
停止本次 sprint。输出:`[CANCELLED] 用户取消 Sprint,AUTO-ESTIMATE 评估结果为 {estimated_level}`。
|
|
206
|
+
|
|
207
|
+
### 步骤 6: 路由执行
|
|
208
|
+
|
|
209
|
+
根据最终确定的流程级别,进入对应 Phase:
|
|
210
|
+
|
|
211
|
+
| 流程级别 | 路由 |
|
|
212
|
+
|---------|------|
|
|
213
|
+
| **轻量** | → Phase 2/6 DESIGN(reduced-intensity 流程,见 references/force-levels.md) |
|
|
214
|
+
| **标准** | → Phase 2/6 DESIGN(正常流程) |
|
|
215
|
+
| **复杂** | → Phase 2/6 DESIGN(完整流程 + 风险警告提示) |
|
|
216
|
+
|
|
217
|
+
**DELPHI-GATE invariant**: 所有流程级别(轻量/标准/复杂)的 Phase 3/6 BUILD 启动前,**必须**检查 `.sprint-state/delphi-reviewed.json` 的 verdict 为 `APPROVED`。未通过 delphi-review 直接路由到 BUILD 属于严重违规。
|
|
218
|
+
|
|
219
|
+
**轻量级的正确理解**: 轻量级意味着 reduced-intensity 的 delphi-review(**2 专家、1 轮、2/2 APPROVED、较短上下文**),**不是**跳过 delphi-review,**不是** 1 专家评审。见 references/force-levels.md 的轻量级流程定义。
|
|
220
|
+
|
|
221
|
+
**自动 escalation 规则**(检测到以下情况时,自动提升流程级别):
|
|
222
|
+
|
|
223
|
+
| 触发条件 | 原级别 | 提升级别 | 理由 |
|
|
224
|
+
|---------|--------|---------|------|
|
|
225
|
+
| 风险警告(循环依赖、Public API > 5) | 轻量 | 标准 | 技术风险需要标准流程 |
|
|
226
|
+
| 多位专家 disagreement 或 REQUEST_CHANGES | 轻量/标准 | 复杂 | 意见分歧需要更全面评审 |
|
|
227
|
+
| 涉及文件数 > 10 或 LOC > 500 | 轻量 | 标准 | 超出轻量级预算 |
|
|
228
|
+
| 修改公共 API(export 接口) | 轻量/标准 | 复杂 | API 变更影响范围广 |
|
|
229
|
+
| 检测到循环依赖 | 任何级别 | 复杂 | 架构风险强制复杂流程 |
|
|
230
|
+
| 相关测试文件缺失或覆盖率 < 80% | 轻量/标准 | 标准 | 需要补充测试 |
|
|
231
|
+
|
|
232
|
+
**跨参考**: 详见 references/force-levels.md 的各级别流程定义和强制规则。
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## 特殊场景处理
|
|
237
|
+
|
|
238
|
+
### 场景 1: 小改动(总计 < 20 行新增/删除代码)
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
git diff --stat HEAD 2>/dev/null
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
**处理**: 如果预估改动 < 20 行且涉及 ≤ 2 个文件,自动判定为「轻量」并告知用户,不强制展示完整 AUTO-ESTIMATE 面板。
|
|
245
|
+
|
|
246
|
+
**注意**: 轻量级仍需要完整的 Sprint Flow 流程(包括 delphi-review),只是 reduced-intensity。**不会**绕过 DELPHI-GATE 直接路由到 BUILD。
|
|
247
|
+
|
|
248
|
+
### 场景 2: 无法提取目标关键词
|
|
249
|
+
|
|
250
|
+
**处理**: 询问用户「无法自动识别目标模块,请指定要分析的关键词(函数名/类名/模块名):」
|
|
251
|
+
|
|
252
|
+
### 场景 3: 用户输入包含多个独立需求
|
|
253
|
+
|
|
254
|
+
**处理**: 提示用户「检测到多个独立需求,建议分别执行 sprint。是否拆分?」→ 等待确认
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## 编排注意事项
|
|
259
|
+
|
|
260
|
+
PREP 经常使用并行 background explore agents 评估代码影响范围。Agent dispatch 后必须遵循 **Background Task Resume Protocol**(参见 `orchestration-rules.md`),在所有 background task 返回后自动恢复继续,不得等待人工消息(Issue #248)。
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## 与学习循环的集成
|
|
265
|
+
|
|
266
|
+
### 数据收集
|
|
267
|
+
|
|
268
|
+
每次 sprint 完成(Phase 6/6 CLOSE)后,将以下数据记录到 `.sprint-state/auto-estimate-learning.json`:
|
|
269
|
+
|
|
270
|
+
```json
|
|
271
|
+
{
|
|
272
|
+
"entries": [
|
|
273
|
+
{
|
|
274
|
+
"sprint_id": "sprint-YYYY-MM-DD-NN",
|
|
275
|
+
"estimated_level": "标准",
|
|
276
|
+
"user_decision": "accepted",
|
|
277
|
+
"actual_effort_phase_count": 5,
|
|
278
|
+
"actual_duration_minutes": 45,
|
|
279
|
+
"was_accurate": true
|
|
280
|
+
}
|
|
281
|
+
]
|
|
282
|
+
}
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### 阈值优化
|
|
286
|
+
|
|
287
|
+
当积累 ≥ 20 条记录后,提示用户可以运行阈值分析:
|
|
288
|
+
|
|
289
|
+
> 已积累 {n} 条 AUTO-ESTIMATE 记录。是否运行阈值优化分析?
|
|
290
|
+
> 分析会检查:过度估计(建议标准但实际轻量)、低估(建议轻量但实际复杂),并推荐阈值调整。
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
> **清理提示**: Sprint 完成后,Phase 6/6 CLOSE 执行 `git worktree remove <worktree_path>` 清理 worktree 目录,同时保留 `.sprint-state/` 中的历史记录。
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# Phase 2/6: DESIGN(设计 — 需求探索 + 共识评审)
|
|
2
|
+
|
|
3
|
+
**执行时机**: Phase 1/6 PREP 完成后、Phase 3/6 BUILD 之前。
|
|
4
|
+
**对应旧模型**: Phase 0 THINK + Phase 1 PLAN
|
|
5
|
+
|
|
6
|
+
## 目标
|
|
7
|
+
|
|
8
|
+
使用 brainstorming skill 进行结构化需求探索,输出经用户批准的设计文档。然后通过 autoplan + delphi-review 达成 ≥90% 共识,生成 specification.yaml。
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Part A: THINK(需求探索与设计)
|
|
13
|
+
|
|
14
|
+
### 调用 Skills
|
|
15
|
+
|
|
16
|
+
- `brainstorming` (superpowers) — **HARD-GATE**: 设计未批准 → 不可进入实现
|
|
17
|
+
- 可选补充:`office-hours` (gstack) — 当用户需求非常模糊、需要先验证产品方向时
|
|
18
|
+
|
|
19
|
+
**关键变更(ISSUE30)**: 从 `office-hours` 切换到 `brainstorming`,原因:
|
|
20
|
+
- brainstorming 有 **HARD-GATE**(设计未批准 → 不可进入实现),防止 "觉得已经理解了就直接开始写代码"
|
|
21
|
+
- brainstorming 输出结构化设计文档,可直接作为 Phase 2/6 Part B PLAN 的输入
|
|
22
|
+
- office-hours 的 YC 六问适合新产品方向验证,brainstorming 更适合"具体功能实现前设计"的场景
|
|
23
|
+
|
|
24
|
+
### HARD-GATE 机制
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
DO NOT enter Part B (PLAN) or do any implementation
|
|
28
|
+
until the brainstorming design has been APPROVED by the user.
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
brainstorming skill 内部会执行:
|
|
32
|
+
|
|
33
|
+
1. **Explore project context** — 检查文件、文档、最近 commits
|
|
34
|
+
2. **Ask clarifying questions** — 一次一个,理解目的/约束/成功标准
|
|
35
|
+
3. **Propose approaches** — 2-3 个方案,含 trade-offs 和建议
|
|
36
|
+
4. **Present design** — 分节展示,每节获得用户批准
|
|
37
|
+
5. **Write design doc** — 保存到 `docs/plans/YYYY-MM-DD-<topic>-design.md`
|
|
38
|
+
6. **Transition to implementation** — brainstorming 自动调用 writing-plans
|
|
39
|
+
|
|
40
|
+
**sprint-flow 编排层行为**:
|
|
41
|
+
- 收到 brainstorming APPROVED 设计文档后,自动进入 Part B
|
|
42
|
+
- 如果 brainstorming 未完成(用户未 APPROVED),BLOCK 并等待
|
|
43
|
+
|
|
44
|
+
### 执行步骤
|
|
45
|
+
|
|
46
|
+
#### Step 1: 调用 brainstorming skill
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
skill(name="brainstorming", user_message="[需求描述]")
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
#### Step 2: 等待 HARD-GATE APPROVED
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
⚠️ HARD-GATE: 设计未 APPROVED → 不可进入 Part B
|
|
56
|
+
|
|
57
|
+
等待用户审批 brainstorming 输出的设计文档。
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
#### Step 3: 保存设计文档路径
|
|
61
|
+
|
|
62
|
+
保存到 `<project-root>/.sprint-state/phase-outputs/design-doc.md`
|
|
63
|
+
|
|
64
|
+
### 可选补充: office-hours(方向验证)
|
|
65
|
+
|
|
66
|
+
当用户输入非常模糊时(如 "我想做一个 AI 工具" 而不是 "开发用户登录功能"),可以先调用 `office-hours` 验证产品方向,再进入 brainstorming 详细设计。
|
|
67
|
+
|
|
68
|
+
### 暂停点
|
|
69
|
+
|
|
70
|
+
| 暂停点 | 触发条件 | 用户操作 | 自动恢复条件 |
|
|
71
|
+
|--------|---------|---------|-------------|
|
|
72
|
+
| **HARD-GATE** | brainstorming 设计未 APPROVED | 用户审批设计文档 | 设计 APPROVED 后自动进入 Part B |
|
|
73
|
+
|
|
74
|
+
### 输出
|
|
75
|
+
|
|
76
|
+
- Design Document (`docs/plans/YYYY-MM-DD-<topic>-design.md`)
|
|
77
|
+
- Implementation Plan(brainstorming 内部 writing-plans 输出)
|
|
78
|
+
- 进入 Part B 自动执行(使用设计文档作为输入)
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Part B: PLAN(共识评审)
|
|
83
|
+
|
|
84
|
+
### 调用 Skills
|
|
85
|
+
|
|
86
|
+
- `autoplan` (gstack) — CEO → Design → Eng 自动流水线
|
|
87
|
+
- `delphi-review` — 多轮匿名评审直到共识
|
|
88
|
+
- specification.yaml 从 APPROVED 设计文档自动生成(无需独立 skill)
|
|
89
|
+
|
|
90
|
+
**Web 前端项目额外注入**:
|
|
91
|
+
- `design-shotgun` (gstack) — 生成多版 UI 设计变体
|
|
92
|
+
|
|
93
|
+
**Mobile 项目额外注入** (`--type mobile-flutter` / `mobile-react-native`):
|
|
94
|
+
- `design-shotgun` (gstack) — 移动端 UI 设计探索
|
|
95
|
+
|
|
96
|
+
### 执行步骤
|
|
97
|
+
|
|
98
|
+
#### Step 0: Web 前端项目 — 调用 design-shotgun(如适用)
|
|
99
|
+
|
|
100
|
+
**IF project_type is web-nextjs / web-react / web-vue / mobile-flutter / mobile-react-native:**
|
|
101
|
+
```
|
|
102
|
+
skill(name="design-shotgun", user_message="[Pain Document 内容 + 需求描述]")
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
#### Step 1: 调用 autoplan skill
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
skill(name="autoplan", user_message="[Pain Document 内容]")
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
autoplan 自动执行 `plan-ceo-review` → `plan-design-review` → `plan-eng-review`,使用 6 个决策原则自动决策:
|
|
112
|
+
|
|
113
|
+
```yaml
|
|
114
|
+
autoplan_result:
|
|
115
|
+
taste_decisions: [] | [decision1, decision2, ...]
|
|
116
|
+
verdict: "AUTO_APPROVED" | "NEEDS_REVIEW"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
#### Step 2: 条件分支
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
┌───────────────────────────────────────────────────────────────────┐
|
|
123
|
+
│ Phase 2/6: 条件分支逻辑 │
|
|
124
|
+
├───────────────────────────────────────────────────────────────────┤
|
|
125
|
+
│ IF autoplan_result.verdict == "AUTO_APPROVED" │
|
|
126
|
+
│ AND autoplan_result.taste_decisions == [] │
|
|
127
|
+
│ → 调用 lightweight delphi-review(2 专家、1 轮、2/2 APPROVED) │
|
|
128
|
+
│ │
|
|
129
|
+
│ IF autoplan_result.verdict == "NEEDS_REVIEW" │
|
|
130
|
+
│ OR autoplan_result.taste_decisions.length > 0 │
|
|
131
|
+
│ → ⚠️ 暂停等待用户确认 taste_decisions │
|
|
132
|
+
│ → 用户确认后,调用标准 delphi-review(3 专家) │
|
|
133
|
+
└───────────────────────────────────────────────────────────────────┘
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
#### Step 2a: 如果需要用户确认 taste_decisions
|
|
137
|
+
|
|
138
|
+
暂停并提示用户决策选项。
|
|
139
|
+
|
|
140
|
+
#### Step 2b: 调用 delphi-review(强制,orchestrator 直接执行)
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
skill(name="delphi-review", user_message="[设计文档 + taste_decisions 确认结果]")
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
- Round 1: 3 专家匿名独立评审
|
|
147
|
+
- Round 2+: 交换意见直到共识
|
|
148
|
+
- 输出: APPROVED / REQUEST_CHANGES
|
|
149
|
+
|
|
150
|
+
**如果 REQUEST_CHANGES**: 暂停等待用户处理 → 修复后重新评审 → 直到 APPROVED
|
|
151
|
+
|
|
152
|
+
#### Step 3: 从 APPROVED 设计文档提取 specification.yaml
|
|
153
|
+
|
|
154
|
+
```yaml
|
|
155
|
+
specification:
|
|
156
|
+
requirements:
|
|
157
|
+
- id: REQ-001
|
|
158
|
+
description: [需求描述]
|
|
159
|
+
priority: [critical/high/medium/low]
|
|
160
|
+
acceptance_criteria:
|
|
161
|
+
- id: AC-001
|
|
162
|
+
requirement: REQ-001
|
|
163
|
+
criteria: [验收标准]
|
|
164
|
+
test_type: [unit/integration/e2e]
|
|
165
|
+
design_decisions:
|
|
166
|
+
- id: DD-001
|
|
167
|
+
decision: [设计决策]
|
|
168
|
+
rationale: [理由]
|
|
169
|
+
alternatives_considered: [备选方案]
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
#### Step 4: 调用 to-issues
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
skill(name="to-issues")
|
|
176
|
+
```
|
|
177
|
+
垂直切片 Issue 拆分 → `slices-manifest.json` → Phase 3/6 BUILD 按 execution_order 执行
|
|
178
|
+
|
|
179
|
+
#### Step 5: 保存 specification.yaml
|
|
180
|
+
|
|
181
|
+
保存到 `<project-root>/.sprint-state/phase-outputs/specification.yaml`
|
|
182
|
+
|
|
183
|
+
### 暂停点
|
|
184
|
+
|
|
185
|
+
| 暂停点 | 触发条件 | 用户操作 |
|
|
186
|
+
|--------|---------|---------|
|
|
187
|
+
| taste_decisions 确认 | autoplan 无法自动决策 | 用户确认每个决策 |
|
|
188
|
+
| delphi-review APPROVED | Round 结果 REQUEST_CHANGES | 用户修复并重新评审 |
|
|
189
|
+
|
|
190
|
+
### 输出
|
|
191
|
+
|
|
192
|
+
- specification.yaml
|
|
193
|
+
- slices-manifest.json
|
|
194
|
+
- 进入 Phase 3/6 BUILD(除非 `--stop-at design`)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
# Phase
|
|
1
|
+
# Phase 3/6: BUILD(TDD + 并行执行 + 盲评 + 验证)
|
|
2
2
|
|
|
3
|
-
**完整指令**: @see SKILL.md `## Phase
|
|
3
|
+
**完整指令**: @see SKILL.md `## Phase 3/6: BUILD` section.
|
|
4
|
+
|
|
5
|
+
**对应旧模型**: Phase 2 BUILD(功能不变)
|
|
4
6
|
|
|
5
7
|
**摘要**: TDD 执行, 多 Agent 并行加速, 盲评验证, Gate 1 验证通过。
|
|
6
8
|
|
|
@@ -10,7 +12,7 @@
|
|
|
10
12
|
|
|
11
13
|
---
|
|
12
14
|
|
|
13
|
-
## Gate 参考表(Phase
|
|
15
|
+
## Gate 参考表(Phase 3/6 相关)
|
|
14
16
|
|
|
15
17
|
| Gate | 名称 | 行为 |
|
|
16
18
|
|------|------|------|
|
|
@@ -26,7 +28,7 @@
|
|
|
26
28
|
|
|
27
29
|
**Purpose**: Prevent entering BUILD with uncommitted changes that could mix with sprint work.
|
|
28
30
|
|
|
29
|
-
**Execution**: Before entering Phase
|
|
31
|
+
**Execution**: Before entering Phase 3/6 BUILD, the orchestrator MUST check for uncommitted changes in the worktree.
|
|
30
32
|
|
|
31
33
|
### Gate Logic
|
|
32
34
|
|
|
@@ -71,7 +73,7 @@ SKIP_UNCOMMITTED_GATE=1
|
|
|
71
73
|
"blocked": false,
|
|
72
74
|
"skipped": false,
|
|
73
75
|
"uncommitted_files": 0,
|
|
74
|
-
"timestamp": "2026-07-
|
|
76
|
+
"timestamp": "2026-07-08T10:00:00Z"
|
|
75
77
|
}
|
|
76
78
|
```
|
|
77
79
|
|
|
@@ -105,8 +107,6 @@ SKIP_GATE_5A_BLOCK=1 git commit -m "message"
|
|
|
105
107
|
|
|
106
108
|
## Timing & Stability
|
|
107
109
|
|
|
108
|
-
This section documents expected execution times and timeout handling for each Phase 2 sub-step to reduce execution timing stddev and prevent pipeline stalls.
|
|
109
|
-
|
|
110
110
|
### Expected Execution Times
|
|
111
111
|
|
|
112
112
|
| Step | Description | Expected Time | Timeout | On Timeout |
|
|
@@ -118,13 +118,13 @@ This section documents expected execution times and timeout handling for each Ph
|
|
|
118
118
|
| freeze + blind-review | Code review in isolation | 5-10 min | 20 min | WARNING, continue |
|
|
119
119
|
| verification | Test suite + coverage check | 2-5 min | 15 min | Retry once, then BLOCK |
|
|
120
120
|
| cost monitor | Token cost accounting | <1s | 5s | Skip, log warning |
|
|
121
|
-
| Phase
|
|
122
|
-
| Phase
|
|
123
|
-
| Phase
|
|
121
|
+
| Phase 3/6 total (lightweight) | ≤3 REQs | 15-30 min | 45 min | — |
|
|
122
|
+
| Phase 3/6 total (standard) | 4-10 REQs | 30-120 min | 150 min | — |
|
|
123
|
+
| Phase 3/6 total (complex) | >10 REQs | 60-240 min | 300 min | — |
|
|
124
124
|
|
|
125
125
|
### Stability Guidelines
|
|
126
126
|
|
|
127
|
-
1. **Timeout handling**: All
|
|
127
|
+
1. **Timeout handling**: All sub-steps MUST have explicit timeouts. If a step times out, log the failure to `.sprint-state/phase-outputs/phase-3-errors.json` and continue to the next step (except DELPHI-GATE which is a hard BLOCK).
|
|
128
128
|
|
|
129
129
|
2. **Retry strategy**: For recoverable failures (verification, TDD cycle):
|
|
130
130
|
- First failure: log warning, retry once
|