@gavin-hjw/sddflow 0.3.2 → 0.3.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.
- package/README.md +154 -105
- package/README.zh-CN.md +154 -104
- package/bin/sddflow.js +1 -1
- package/dist/cli/init.js +78 -47
- package/dist/cli/status.js +22 -24
- package/dist/cli/update.js +3 -3
- package/dist/core/change-status.d.ts +9 -0
- package/dist/core/change-status.js +66 -0
- package/dist/core/constants.d.ts +14 -2
- package/dist/core/constants.js +60 -2
- package/dist/core/dependency-check.d.ts +29 -3
- package/dist/core/dependency-check.js +167 -17
- package/dist/core/skill-generator.js +15 -115
- package/dist/utils/shell.d.ts +5 -0
- package/dist/utils/shell.js +14 -5
- package/package.json +1 -1
- package/templates/SKILL.md +23 -19
- package/templates/amend.md +18 -14
- package/templates/brainstorming.md +136 -33
- package/templates/build.md +229 -81
- package/templates/close.md +204 -43
- package/templates/spec.md +192 -36
- package/templates/proposal.md +0 -62
package/README.md
CHANGED
|
@@ -2,7 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
[中文文档](./README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## About
|
|
6
|
+
|
|
7
|
+
sddflow is an OpenSpec + Superpowers workflow orchestrator. It connects **design exploration → spec documents → implementation → verification and archive** into one resumable flow, bridging the format gap between requirements specs and engineering execution.
|
|
8
|
+
|
|
9
|
+
**Before use, you must complete two steps:**
|
|
10
|
+
|
|
11
|
+
1. **Install dependencies** — OpenSpec CLI, Superpowers plugin, and its 6 required skills (see **Dependencies** below)
|
|
12
|
+
2. **Initialize the project** — run `sddflow init` in the target project directory to check dependencies, run `openspec init`, and generate sddflow skills in your AI tool
|
|
13
|
+
|
|
14
|
+
Until init succeeds, `/sddflow` commands are not available in the AI tool. Each project needs init once; after upgrading the npm package, run `sddflow update` to regenerate skills.
|
|
6
15
|
|
|
7
16
|
## Installation
|
|
8
17
|
|
|
@@ -10,143 +19,183 @@ OpenSpec + Superpowers workflow orchestrator — bridging requirements specs and
|
|
|
10
19
|
npm install -g @gavin-hjw/sddflow
|
|
11
20
|
```
|
|
12
21
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
### Initialize a project
|
|
22
|
+
Initialize in your project directory:
|
|
16
23
|
|
|
17
24
|
```bash
|
|
18
25
|
cd your-project
|
|
19
26
|
sddflow init --tools claude
|
|
20
27
|
```
|
|
21
28
|
|
|
22
|
-
`
|
|
23
|
-
1. Detect and guide OpenSpec CLI installation
|
|
24
|
-
2. Detect Superpowers and show install instructions
|
|
25
|
-
3. Check if OpenSpec is initialized in the project
|
|
26
|
-
4. Generate sddflow skills to the selected tools' local skill directories, such as `.claude/skills/sddflow/`, `.codex/skills/sddflow/`, `.cursor/skills/sddflow/`, or `.opencode/commands/sddflow/`
|
|
27
|
-
|
|
28
|
-
Supported tools: `claude`, `codex`, `cursor`, `opencode` (comma-separated, e.g. `--tools claude,codex`)
|
|
29
|
+
Supported tools: `claude`, `codex`, `cursor`, `opencode` (comma-separated, e.g. `--tools claude,cursor`).
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
Install skills globally (shared across projects):
|
|
31
32
|
|
|
32
33
|
```bash
|
|
33
|
-
sddflow init --tools claude
|
|
34
|
-
sddflow init --tools claude,codex,cursor,opencode --global
|
|
34
|
+
sddflow init --tools claude --global
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
| Tool | Global skill path |
|
|
40
|
-
|------|-------------------|
|
|
41
|
-
| `claude` | `~/.claude/skills/sddflow/` |
|
|
42
|
-
| `codex` | `~/.codex/skills/sddflow/` |
|
|
43
|
-
| `cursor` | `~/.cursor/skills/sddflow/` |
|
|
44
|
-
| `opencode` | `~/.opencode/commands/sddflow/` |
|
|
45
|
-
|
|
46
|
-
### Check status
|
|
37
|
+
After upgrading the npm package, regenerate project skills:
|
|
47
38
|
|
|
48
39
|
```bash
|
|
49
|
-
sddflow
|
|
40
|
+
sddflow update
|
|
50
41
|
```
|
|
51
42
|
|
|
52
|
-
|
|
43
|
+
Run `sddflow status` to check dependency readiness, OpenSpec init integrity, and the current stage of each active change.
|
|
53
44
|
|
|
54
|
-
|
|
45
|
+
## Dependencies
|
|
55
46
|
|
|
56
|
-
|
|
57
|
-
sddflow update
|
|
58
|
-
```
|
|
47
|
+
`sddflow init` checks each item and aborts with install guidance if anything is missing.
|
|
59
48
|
|
|
60
|
-
|
|
49
|
+
| Dependency | Role | Install |
|
|
50
|
+
|------------|------|---------|
|
|
51
|
+
| **OpenSpec CLI** | Generate and manage structured specs | `npm install -g @fission-ai/openspec@latest` |
|
|
52
|
+
| **OpenSpec skill integration** | Invoke OpenSpec from AI tools | Run automatically via `openspec init --tools <tools>` during `sddflow init` |
|
|
53
|
+
| **Superpowers plugin** | Implementation planning and build execution | Claude Code: `/plugin install superpowers@claude-plugins-official`; Cursor: Settings → Plugins → superpowers |
|
|
61
54
|
|
|
62
|
-
|
|
55
|
+
Superpowers must also provide these 6 skills: `brainstorming`, `writing-plans`, `subagent-driven-development`, `test-driven-development`, `verification-before-completion`, `finishing-a-development-branch`.
|
|
63
56
|
|
|
64
|
-
|
|
65
|
-
`sddflow` also generates visible phase aliases such as `/sddflow-spec` or
|
|
66
|
-
`$sddflow-spec` so typing `sddflow` in the command/skill picker surfaces the
|
|
67
|
-
available phases. OpenCode keeps its native command-tree form under
|
|
68
|
-
`/sddflow/spec`, `/sddflow/build`, and so on.
|
|
57
|
+
## Workflow
|
|
69
58
|
|
|
70
|
-
|
|
71
|
-
|---------|-------|-------------|
|
|
72
|
-
| `/sddflow proposal` | proposal | Lightweight capture — 3-5 questions to converge on requirements |
|
|
73
|
-
| `/sddflow brainstorming` | brainstorming | Deep design — multi-round tradeoff exploration |
|
|
74
|
-
| `/sddflow spec` | spec | Call OpenSpec to generate specs + auto-translate to plan-ready.md |
|
|
75
|
-
| `/sddflow amend` | amend | Revise requirements/specs before close and update plan-ready.md |
|
|
76
|
-
| `/sddflow build` | build | Call Superpowers to execute implementation |
|
|
77
|
-
| `/sddflow close` | close | Verify consistency + archive |
|
|
59
|
+
Run these steps in order inside your AI tool. Canonical usage is `/sddflow <phase>`; you can also type `/sddflow` to auto-route based on the current change state.
|
|
78
60
|
|
|
79
|
-
|
|
61
|
+
Claude / Codex / Cursor expose phase aliases (e.g. `/sddflow-brainstorming`); OpenCode uses forms like `/sddflow/brainstorming`.
|
|
80
62
|
|
|
81
63
|
```
|
|
82
|
-
|
|
83
|
-
|
|
64
|
+
brainstorming → spec → build → close
|
|
65
|
+
↑ │
|
|
66
|
+
└── amend (on requirement change, as needed)
|
|
84
67
|
```
|
|
85
68
|
|
|
86
|
-
|
|
87
|
-
|------------|---------|----------------------|
|
|
88
|
-
| OpenSpec | `npm install -g @fission-ai/openspec@latest` | Manually create `openspec/changes/` directories and files |
|
|
89
|
-
| Superpowers | `/plugin install superpowers@claude-plugins-official` | Manually break down plan-ready.md steps in build phase |
|
|
69
|
+
---
|
|
90
70
|
|
|
91
|
-
###
|
|
71
|
+
### Step 1: brainstorming — explore requirements and design
|
|
92
72
|
|
|
93
|
-
|
|
94
|
-
|-------|-----------|-------------|
|
|
95
|
-
| **Init time** | Detect OpenSpec CLI from `PATH`; detect project OpenSpec in `./openspec/`; detect Superpowers in the selected tools' local/global skill dirs | Non-blocking, skills still generated |
|
|
96
|
-
| **Runtime** | Dependency check injected into SKILL.md | Build phase falls back to manual step-by-step execution |
|
|
73
|
+
**What you do**
|
|
97
74
|
|
|
98
|
-
|
|
75
|
+
1. Type `/sddflow brainstorming` and describe the change you want
|
|
76
|
+
2. Answer AI follow-up questions (one at a time): user scenarios, constraints, tradeoffs, boundaries, acceptance criteria
|
|
77
|
+
3. Review 2–3 proposed approaches and pick a direction
|
|
78
|
+
4. Confirm the design section by section, then explicitly reply "confirmed" / "OK"
|
|
99
79
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
80
|
+
**Output**
|
|
81
|
+
|
|
82
|
+
- `openspec/changes/<name>/proposal.md`
|
|
83
|
+
|
|
84
|
+
**What you verify**
|
|
85
|
+
|
|
86
|
+
- [ ] `openspec/changes/<name>/` directory exists
|
|
87
|
+
- [ ] `proposal.md` matches what you confirmed: background, scenarios, approach, scope boundaries, acceptance criteria
|
|
88
|
+
- [ ] **No code changes** in this phase
|
|
89
|
+
|
|
90
|
+
**Then** → proceed to Step 2
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
### Step 2: spec — generate specs and implementation plan
|
|
95
|
+
|
|
96
|
+
**What you do**
|
|
97
|
+
|
|
98
|
+
1. Type `/sddflow spec`
|
|
99
|
+
2. If multiple active changes exist, tell the AI which one to spec
|
|
100
|
+
3. Review the spec summary (proposal, design, specs, tasks) and confirm or request edits
|
|
101
|
+
4. Wait for OpenSpec artifacts, the translation layer, and the detailed implementation plan
|
|
102
|
+
|
|
103
|
+
**Output**
|
|
104
|
+
|
|
105
|
+
- `openspec/changes/<name>/specs/` (spec deltas)
|
|
106
|
+
- `openspec/changes/<name>/tasks.md`
|
|
107
|
+
- `openspec/changes/<name>/design.md` (optional)
|
|
108
|
+
- `openspec/changes/<name>/plan-ready.md` (engineering translation)
|
|
109
|
+
- `docs/superpowers/plans/YYYY-MM-DD-<name>.md` (detailed plan)
|
|
110
|
+
|
|
111
|
+
**What you verify**
|
|
112
|
+
|
|
113
|
+
- [ ] `openspec validate <name> --strict` passes (AI should run this; you can re-run it)
|
|
114
|
+
- [ ] `specs/` is non-empty and `tasks.md` exists
|
|
115
|
+
- [ ] Both `plan-ready.md` and the superpowers plan file exist
|
|
116
|
+
- [ ] All three task documents (`tasks.md`, `plan-ready.md`, superpowers plan) use `- [ ]` checkboxes with matching Task numbers
|
|
117
|
+
- [ ] No `TODO`, `TBD`, or similar placeholders in plan files
|
|
118
|
+
- [ ] **No code changes** in this phase
|
|
119
|
+
|
|
120
|
+
**Then** → proceed to Step 3
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
### Step 3: build — execute implementation
|
|
125
|
+
|
|
126
|
+
**What you do**
|
|
127
|
+
|
|
128
|
+
1. Type `/sddflow build`
|
|
129
|
+
2. If the AI reports missing pre-flight files, go back to Step 2
|
|
130
|
+
3. Say "continue" anytime to resume from the last checkpoint
|
|
131
|
+
4. Monitor Task-by-Task execution with TDD (tests before implementation)
|
|
132
|
+
|
|
133
|
+
**Output**
|
|
134
|
+
|
|
135
|
+
- Code and test files
|
|
136
|
+
- Plan checkboxes gradually change from `[ ]` to `[x]`
|
|
137
|
+
|
|
138
|
+
**What you verify**
|
|
139
|
+
|
|
140
|
+
- [ ] Before build starts, AI confirms: `proposal.md`, `specs/`, `tasks.md`, `plan-ready.md`, and superpowers plan all exist
|
|
141
|
+
- [ ] If **requirements or acceptance criteria change**, do not edit code directly — switch to amend (below)
|
|
142
|
+
- [ ] Build is complete when all Task and Step checkboxes are `[x]`
|
|
143
|
+
|
|
144
|
+
**Then** → proceed to Step 4
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
### (As needed) amend — revise requirements
|
|
149
|
+
|
|
150
|
+
**When to use**
|
|
151
|
+
|
|
152
|
+
- Requirements, boundaries, or acceptance criteria change during build
|
|
153
|
+
- Specs are incomplete before close (not "code doesn't match existing spec")
|
|
154
|
+
|
|
155
|
+
**What you do**
|
|
156
|
+
|
|
157
|
+
1. Type `/sddflow amend` and describe what to change
|
|
158
|
+
2. Confirm updates to `proposal.md`, `specs/`, `tasks.md`, `plan-ready.md`, and the implementation plan
|
|
159
|
+
3. Type `/sddflow build` to continue implementation
|
|
160
|
+
|
|
161
|
+
**What you verify**
|
|
162
|
+
|
|
163
|
+
- [ ] OpenSpec documents and all three task documents are in sync
|
|
164
|
+
- [ ] `openspec validate <name> --strict` still passes (if specs changed)
|
|
165
|
+
- [ ] amend should **not** modify code directly (unless updating plan documents as part of the amend flow)
|
|
166
|
+
|
|
167
|
+
**Then** → return to Step 3
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
### Step 4: close — verify and archive
|
|
172
|
+
|
|
173
|
+
**What you do**
|
|
174
|
+
|
|
175
|
+
1. Confirm build is fully complete (all checkboxes `[x]`)
|
|
176
|
+
2. Type `/sddflow close`
|
|
177
|
+
3. Follow prompts on whether to run a final code review
|
|
178
|
+
4. Review verification results and confirm archive
|
|
179
|
+
|
|
180
|
+
**What the AI runs**
|
|
181
|
+
|
|
182
|
+
- Full test suite and build (must show actual passing output)
|
|
183
|
+
- Cross-check `tasks.md`, `plan-ready.md`, and specs against implementation
|
|
184
|
+
- `openspec validate <name> --strict` for spec consistency
|
|
185
|
+
- OpenSpec Archive to move the change into `openspec/changes/archive/`
|
|
138
186
|
|
|
139
|
-
|
|
187
|
+
**What you verify**
|
|
140
188
|
|
|
141
|
-
|
|
189
|
+
- [ ] All tests pass (0 failures)
|
|
190
|
+
- [ ] Every task has implementation and test evidence
|
|
191
|
+
- [ ] No CRITICAL spec inconsistencies
|
|
192
|
+
- [ ] After archive, `openspec/changes/<name>/` is under `archive/`
|
|
193
|
+
- [ ] `openspec/specs/` is updated if the change merged spec deltas
|
|
142
194
|
|
|
143
|
-
|
|
144
|
-
|---------|-----------|---------|-------|
|
|
145
|
-
| [OpenSpec](https://github.com/Fission-AI/OpenSpec) | `@fission-ai/openspec` | MIT | Generates structured spec files (proposal.md, design.md, specs/, tasks.md). sddflow calls its CLI and reads its output format. |
|
|
146
|
-
| [Superpowers](https://github.com/obra/superpowers) | `superpowers` plugin | MIT | Provides `writing-plans` skill for detailed implementation planning. sddflow delegates build-phase execution to its workflow. |
|
|
195
|
+
**Done** → change complete; start a new change from Step 1
|
|
147
196
|
|
|
148
|
-
|
|
197
|
+
---
|
|
149
198
|
|
|
150
|
-
|
|
199
|
+
### Resuming
|
|
151
200
|
|
|
152
|
-
|
|
201
|
+
Follow-up messages that refine scope, answer confirmation questions, or say "continue" stay in the **current phase** — they do not auto-enter build. Code changes only happen after you explicitly run `/sddflow build` or auto-routing determines the build phase.
|
package/README.zh-CN.md
CHANGED
|
@@ -2,7 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
[English](./README.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## 介绍
|
|
6
|
+
|
|
7
|
+
sddflow 是 OpenSpec + Superpowers 的工作流协调器,把「需求与设计 → 规格文档 → 代码实现 → 验证归档」串成一条可续接的流程,消除需求规格与工程执行之间的格式鸿沟。
|
|
8
|
+
|
|
9
|
+
**使用前必须完成两件事:**
|
|
10
|
+
|
|
11
|
+
1. **安装依赖** — OpenSpec CLI、Superpowers 插件及其 6 个必需 skills(见下方「依赖」)
|
|
12
|
+
2. **初始化项目** — 在目标项目目录执行 `sddflow init`,检测依赖、运行 `openspec init`,并在 AI 工具中生成 sddflow skills
|
|
13
|
+
|
|
14
|
+
初始化完成前,AI 工具里无法使用 `/sddflow` 工作流。每个项目只需 init 一次;升级 sddflow 包后运行 `sddflow update` 重新生成 skills 即可。
|
|
6
15
|
|
|
7
16
|
## 安装
|
|
8
17
|
|
|
@@ -10,142 +19,183 @@ OpenSpec + Superpowers 工作流协调器,串联需求规格与工程执行,
|
|
|
10
19
|
npm install -g @gavin-hjw/sddflow
|
|
11
20
|
```
|
|
12
21
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
### 初始化项目
|
|
22
|
+
在项目目录初始化:
|
|
16
23
|
|
|
17
24
|
```bash
|
|
18
25
|
cd your-project
|
|
19
26
|
sddflow init --tools claude
|
|
20
27
|
```
|
|
21
28
|
|
|
22
|
-
|
|
23
|
-
1. 检测并引导安装 OpenSpec CLI
|
|
24
|
-
2. 检测 Superpowers 并提示安装方式
|
|
25
|
-
3. 检测项目 OpenSpec 初始化状态
|
|
26
|
-
4. 生成 sddflow skills 到所选工具的项目级 skill 目录,如 `.claude/skills/sddflow/`、`.codex/skills/sddflow/`、`.cursor/skills/sddflow/` 或 `.opencode/commands/sddflow/`
|
|
27
|
-
|
|
28
|
-
支持的工具:`claude`、`codex`、`cursor`、`opencode`(逗号分隔,如 `--tools claude,codex`)
|
|
29
|
+
支持的工具:`claude`、`codex`、`cursor`、`opencode`(逗号分隔,如 `--tools claude,cursor`)。
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
安装到全局 skills 目录(所有项目共用):
|
|
31
32
|
|
|
32
33
|
```bash
|
|
33
|
-
sddflow init --tools claude
|
|
34
|
-
sddflow init --tools claude,codex,cursor,opencode --global
|
|
34
|
+
sddflow init --tools claude --global
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
| 工具 | 全局 skill 路径 |
|
|
40
|
-
|------|-----------------|
|
|
41
|
-
| `claude` | `~/.claude/skills/sddflow/` |
|
|
42
|
-
| `codex` | `~/.codex/skills/sddflow/` |
|
|
43
|
-
| `cursor` | `~/.cursor/skills/sddflow/` |
|
|
44
|
-
| `opencode` | `~/.opencode/commands/sddflow/` |
|
|
45
|
-
|
|
46
|
-
### 查看状态
|
|
37
|
+
升级 npm 包后,在项目目录重新生成 skills:
|
|
47
38
|
|
|
48
39
|
```bash
|
|
49
|
-
sddflow
|
|
40
|
+
sddflow update
|
|
50
41
|
```
|
|
51
42
|
|
|
52
|
-
|
|
43
|
+
可用 `sddflow status` 查看依赖是否就绪、OpenSpec 是否初始化完整,以及当前活跃变更处于哪个阶段。
|
|
53
44
|
|
|
54
|
-
|
|
45
|
+
## 依赖
|
|
55
46
|
|
|
56
|
-
|
|
57
|
-
sddflow update
|
|
58
|
-
```
|
|
47
|
+
`sddflow init` 会逐项检测,任一缺失则中止并给出安装指引。
|
|
59
48
|
|
|
60
|
-
|
|
49
|
+
| 依赖 | 作用 | 安装方式 |
|
|
50
|
+
|------|------|----------|
|
|
51
|
+
| **OpenSpec CLI** | 生成与管理结构化规格 | `npm install -g @fission-ai/openspec@latest` |
|
|
52
|
+
| **OpenSpec Skill 集成** | 在 AI 工具中调用 OpenSpec 流程 | 由 `sddflow init` 自动执行 `openspec init --tools <tools>` |
|
|
53
|
+
| **Superpowers 插件** | 实现计划与 build 阶段执行 | Claude Code:`/plugin install superpowers@claude-plugins-official`;Cursor:Settings → Plugins → superpowers |
|
|
61
54
|
|
|
62
|
-
|
|
55
|
+
Superpowers 还需具备以下 6 个 skills:`brainstorming`、`writing-plans`、`subagent-driven-development`、`test-driven-development`、`verification-before-completion`、`finishing-a-development-branch`。
|
|
63
56
|
|
|
64
|
-
|
|
65
|
-
Codex 和 Cursor 会额外生成可见的阶段别名,例如 `/sddflow-spec` 或
|
|
66
|
-
`$sddflow-spec`,这样在命令/skill 选择器里输入 `sddflow` 时能看到可用阶段。
|
|
67
|
-
OpenCode 保持原生命令树形式,例如 `/sddflow/spec`、`/sddflow/build`。
|
|
57
|
+
## 工作流
|
|
68
58
|
|
|
69
|
-
|
|
70
|
-
|------|------|------|
|
|
71
|
-
| `/sddflow proposal` | proposal | 轻量提问,3-5 问快速收敛需求 |
|
|
72
|
-
| `/sddflow brainstorming` | brainstorming | 深度设计,多轮方案探索 |
|
|
73
|
-
| `/sddflow spec` | spec | 调用 OpenSpec 生成规格 + 自动翻译 |
|
|
74
|
-
| `/sddflow amend` | amend | close 前修订需求/规格并更新 plan-ready.md |
|
|
75
|
-
| `/sddflow build` | build | 调用 Superpowers 执行实现 |
|
|
76
|
-
| `/sddflow close` | close | 验证一致性 + 归档 |
|
|
59
|
+
在 AI 工具中按顺序执行。规范调用方式为 `/sddflow <阶段>`;也可输入 `/sddflow` 让系统根据当前变更状态自动路由。
|
|
77
60
|
|
|
78
|
-
|
|
61
|
+
Claude / Codex / Cursor 提供阶段别名(如 `/sddflow-brainstorming`);OpenCode 使用 `/sddflow/brainstorming` 等形式。
|
|
79
62
|
|
|
80
63
|
```
|
|
81
|
-
|
|
82
|
-
|
|
64
|
+
brainstorming → spec → build → close
|
|
65
|
+
↑ │
|
|
66
|
+
└── amend(需求变更时,按需插入)
|
|
83
67
|
```
|
|
84
68
|
|
|
85
|
-
|
|
86
|
-
|------|----------|-----------|
|
|
87
|
-
| OpenSpec | `npm install -g @fission-ai/openspec@latest` | 手动创建 `openspec/changes/` 目录和文件 |
|
|
88
|
-
| Superpowers | `/plugin install superpowers@claude-plugins-official` | build 阶段手动拆解 plan-ready.md 步骤执行 |
|
|
69
|
+
---
|
|
89
70
|
|
|
90
|
-
###
|
|
71
|
+
### 第一步:brainstorming — 需求与设计探索
|
|
91
72
|
|
|
92
|
-
|
|
93
|
-
|----|------|--------|
|
|
94
|
-
| **init 时** | 从 `PATH` 检测 OpenSpec CLI;从 `./openspec/` 检测当前项目 OpenSpec;从所选工具的本地/全局 skill 目录检测 Superpowers | 不阻断,继续生成 skills |
|
|
95
|
-
| **运行时** | SKILL.md 注入依赖检测段 | build 阶段降级为手动拆解步骤执行 |
|
|
73
|
+
**你做什么**
|
|
96
74
|
|
|
97
|
-
|
|
75
|
+
1. 在 AI 工具中输入 `/sddflow brainstorming`,描述你想做的变更
|
|
76
|
+
2. 回答 AI 的追问(目的一次只问一个):用户场景、约束、方案取舍、边界、验收标准
|
|
77
|
+
3. 阅读 AI 提出的 2–3 种方案,选定方向
|
|
78
|
+
4. 逐段确认设计(架构、数据流、错误处理等),最后明确回复「确认」
|
|
98
79
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
80
|
+
**产出**
|
|
81
|
+
|
|
82
|
+
- `openspec/changes/<变更名>/proposal.md`
|
|
83
|
+
|
|
84
|
+
**你需要检查**
|
|
85
|
+
|
|
86
|
+
- [ ] `openspec/changes/<变更名>/` 目录已创建
|
|
87
|
+
- [ ] `proposal.md` 内容与你确认的设计一致:背景、场景、方案、范围边界、验收标准
|
|
88
|
+
- [ ] 此阶段**不应**出现任何代码改动
|
|
89
|
+
|
|
90
|
+
**通过后** → 进入第二步
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
### 第二步:spec — 生成规格与实现计划
|
|
95
|
+
|
|
96
|
+
**你做什么**
|
|
97
|
+
|
|
98
|
+
1. 输入 `/sddflow spec`
|
|
99
|
+
2. 若存在多个活跃变更,告诉 AI 要对哪一个生成规格
|
|
100
|
+
3. 阅读 AI 展示的规格摘要(提案、设计、specs、tasks),确认或提出修改
|
|
101
|
+
4. 确认后等待 AI 完成 OpenSpec 制品、翻译层和详细实现计划
|
|
102
|
+
|
|
103
|
+
**产出**
|
|
104
|
+
|
|
105
|
+
- `openspec/changes/<变更名>/specs/`(规格 delta)
|
|
106
|
+
- `openspec/changes/<变更名>/tasks.md`
|
|
107
|
+
- `openspec/changes/<变更名>/design.md`(按需,非必须)
|
|
108
|
+
- `openspec/changes/<变更名>/plan-ready.md`(工程视角翻译)
|
|
109
|
+
- `docs/superpowers/plans/YYYY-MM-DD-<变更名>.md`(详细实现计划)
|
|
110
|
+
|
|
111
|
+
**你需要检查**
|
|
112
|
+
|
|
113
|
+
- [ ] `openspec validate <变更名> --strict` 通过(AI 应已执行,你可自行复验)
|
|
114
|
+
- [ ] `specs/` 非空,`tasks.md` 存在
|
|
115
|
+
- [ ] `plan-ready.md` 与 `docs/superpowers/plans/` 下计划文件均存在
|
|
116
|
+
- [ ] 三份任务文档(`tasks.md`、`plan-ready.md`、superpowers plan)中任务项均含 `- [ ]` checkbox,且 Task 序号一一对应
|
|
117
|
+
- [ ] 计划文件中无 `TODO`、`TBD` 等占位符
|
|
118
|
+
- [ ] 此阶段**不应**出现任何代码改动
|
|
119
|
+
|
|
120
|
+
**通过后** → 进入第三步
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
### 第三步:build — 执行实现
|
|
125
|
+
|
|
126
|
+
**你做什么**
|
|
127
|
+
|
|
128
|
+
1. 输入 `/sddflow build`
|
|
129
|
+
2. 若 AI 提示前置文件缺失,回到第二步补齐 spec
|
|
130
|
+
3. 实现过程中可随时说「继续」让 AI 从断点恢复
|
|
131
|
+
4. 关注 AI 按 plan 逐 Task 执行,每个 Task 遵循 TDD(先写测试再写实现)
|
|
132
|
+
|
|
133
|
+
**产出**
|
|
134
|
+
|
|
135
|
+
- 代码与测试文件
|
|
136
|
+
- plan 文件中 checkbox 逐步从 `[ ]` 变为 `[x]`
|
|
137
|
+
|
|
138
|
+
**你需要检查**
|
|
139
|
+
|
|
140
|
+
- [ ] build 开始前,AI 已校验:`proposal.md`、`specs/`、`tasks.md`、`plan-ready.md`、superpowers plan 均存在
|
|
141
|
+
- [ ] 实现过程中若发现**需求或验收条件变了**,不要直接改代码,应切到 amend(见下方)
|
|
142
|
+
- [ ] 全部 Task 与 Step 的 checkbox 均为 `[x]` 时,build 才算完成
|
|
143
|
+
|
|
144
|
+
**通过后** → 进入第四步
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
### (按需)amend — 需求变更修订
|
|
149
|
+
|
|
150
|
+
**何时使用**
|
|
151
|
+
|
|
152
|
+
- build 中发现原需求遗漏、边界或验收条件需调整
|
|
153
|
+
- close 前发现规格本身不完整(不是代码没按 spec 实现)
|
|
154
|
+
|
|
155
|
+
**你做什么**
|
|
156
|
+
|
|
157
|
+
1. 输入 `/sddflow amend`,说明要改什么
|
|
158
|
+
2. 确认 AI 对 `proposal.md`、`specs/`、`tasks.md`、`plan-ready.md`、实现计划的修订
|
|
159
|
+
3. 修订完成后输入 `/sddflow build` 继续实现
|
|
160
|
+
|
|
161
|
+
**你需要检查**
|
|
162
|
+
|
|
163
|
+
- [ ] 变更已同步到 OpenSpec 文档与三份任务文档
|
|
164
|
+
- [ ] `openspec validate <变更名> --strict` 仍能通过(若 specs 有改动)
|
|
165
|
+
- [ ] amend 阶段**不应**直接改代码(除非 AI 明确是在 amend 流程中更新计划文档)
|
|
166
|
+
|
|
167
|
+
**完成后** → 回到第三步继续 build
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
### 第四步:close — 验证与归档
|
|
172
|
+
|
|
173
|
+
**你做什么**
|
|
174
|
+
|
|
175
|
+
1. 确认 build 已全部完成(所有 checkbox 为 `[x]`)
|
|
176
|
+
2. 输入 `/sddflow close`
|
|
177
|
+
3. 按 AI 提示确认是否执行代码审查
|
|
178
|
+
4. 阅读验证结果,确认归档
|
|
179
|
+
|
|
180
|
+
**AI 会执行**
|
|
181
|
+
|
|
182
|
+
- 运行测试套件与构建(必须看到实际通过输出)
|
|
183
|
+
- 对照 `tasks.md`、`plan-ready.md` 与 specs 验证实现完整性
|
|
184
|
+
- `openspec validate <变更名> --strict` 规格一致性校验
|
|
185
|
+
- 调用 OpenSpec Archive 将变更移入 `openspec/changes/archive/`
|
|
137
186
|
|
|
138
|
-
|
|
187
|
+
**你需要检查**
|
|
139
188
|
|
|
140
|
-
|
|
189
|
+
- [ ] 测试全部通过(0 failures)
|
|
190
|
+
- [ ] 每条 task 有对应实现与测试证据
|
|
191
|
+
- [ ] 无 CRITICAL 级别的规格不一致问题
|
|
192
|
+
- [ ] 归档后 `openspec/changes/<变更名>/` 已移至 `archive/` 目录
|
|
193
|
+
- [ ] `openspec/specs/` 已同步更新(若本次变更涉及规格合并)
|
|
141
194
|
|
|
142
|
-
|
|
143
|
-
|------|------|--------|----------|
|
|
144
|
-
| [OpenSpec](https://github.com/Fission-AI/OpenSpec) | `@fission-ai/openspec` | MIT | 生成结构化规格文件(proposal.md、design.md、specs/、tasks.md)。sddflow 调用其 CLI 并读取其输出格式。 |
|
|
145
|
-
| [Superpowers](https://github.com/obra/superpowers) | `superpowers` 插件 | MIT | 提供 `writing-plans` skill 用于生成详细实现计划。sddflow 在 build 阶段委托其工作流执行。 |
|
|
195
|
+
**完成后** → 本次变更结束;新需求从第一步重新开始
|
|
146
196
|
|
|
147
|
-
|
|
197
|
+
---
|
|
148
198
|
|
|
149
|
-
|
|
199
|
+
### 续接说明
|
|
150
200
|
|
|
151
|
-
|
|
201
|
+
对话中补充范围、回答确认问题或说「继续」时,默认**保持当前阶段**,不会自动跳到 build。只有显式输入 `/sddflow build` 或在状态检测判定为 build 阶段时,才应修改代码。
|
package/bin/sddflow.js
CHANGED