specwf 0.2.2 → 0.3.0
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 +96 -59
- package/bin/cli.d.ts +2 -0
- package/bin/cli.js +4425 -0
- package/bin/specwf.js +4424 -1
- package/dist/cli.js +3821 -1462
- package/package.json +2 -1
- package/dist/templates/agents/archiver.md +0 -112
- package/dist/templates/agents/executor.md +0 -125
- package/dist/templates/agents/planner.md +0 -114
- package/dist/templates/agents/researcher.md +0 -104
- package/dist/templates/agents/reviewer.md +0 -98
- package/dist/templates/agents/verifier.md +0 -129
- package/dist/templates/artifacts/context.md +0 -151
- package/dist/templates/artifacts/design.md +0 -224
- package/dist/templates/artifacts/goal-review.md +0 -95
- package/dist/templates/artifacts/project.yml +0 -117
- package/dist/templates/artifacts/proposal.md +0 -124
- package/dist/templates/artifacts/quality-review.md +0 -131
- package/dist/templates/artifacts/research.md +0 -127
- package/dist/templates/artifacts/spec-review.md +0 -84
- package/dist/templates/artifacts/state.md +0 -158
- package/dist/templates/artifacts/summary.md +0 -129
- package/dist/templates/artifacts/tasks.md +0 -109
- package/dist/templates/artifacts/verification.md +0 -113
- package/dist/templates/commands/adhoc.md +0 -38
- package/dist/templates/commands/apply.md +0 -20
- package/dist/templates/commands/archive.md +0 -21
- package/dist/templates/commands/continue.md +0 -27
- package/dist/templates/commands/discuss.md +0 -24
- package/dist/templates/commands/grill.md +0 -24
- package/dist/templates/commands/init.md +0 -37
- package/dist/templates/commands/milestone.md +0 -27
- package/dist/templates/commands/plan.md +0 -22
- package/dist/templates/commands/research-phase.md +0 -20
- package/dist/templates/commands/research.md +0 -24
- package/dist/templates/commands/review.md +0 -20
- package/dist/templates/commands/roadmap.md +0 -23
- package/dist/templates/commands/ship.md +0 -36
- package/dist/templates/commands/split.md +0 -16
- package/dist/templates/commands/verify.md +0 -22
- package/dist/templates/skills/adhoc.md +0 -53
- package/dist/templates/skills/apply.md +0 -134
- package/dist/templates/skills/archive.md +0 -109
- package/dist/templates/skills/continue.md +0 -97
- package/dist/templates/skills/discuss.md +0 -95
- package/dist/templates/skills/grill.md +0 -90
- package/dist/templates/skills/init.md +0 -116
- package/dist/templates/skills/milestone.md +0 -36
- package/dist/templates/skills/plan.md +0 -144
- package/dist/templates/skills/research-phase.md +0 -66
- package/dist/templates/skills/research.md +0 -76
- package/dist/templates/skills/review.md +0 -148
- package/dist/templates/skills/roadmap.md +0 -104
- package/dist/templates/skills/ship.md +0 -94
- package/dist/templates/skills/split.md +0 -96
- package/dist/templates/skills/verify.md +0 -147
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# 初始化项目
|
|
2
|
-
|
|
3
|
-
运行 `specwf init` 创建 specwf/ 目录结构 + platform.yml + state.md。
|
|
4
|
-
|
|
5
|
-
## 存量项目
|
|
6
|
-
|
|
7
|
-
已有代码的项目使用 brownfield 模式:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
specwf init --brownfield
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
CLI 创建目录结构后,**agent 需使用 specwf 子代理并行执行以下任务**:
|
|
14
|
-
|
|
15
|
-
1. **Codebase Mapping**(`specwf-researcher`)— 分析技术栈、模块结构、依赖关系
|
|
16
|
-
- 产出: `specwf/research/STACK.md` + `specwf/research/ARCHITECTURE.md`
|
|
17
|
-
2. **Spec Bootstrap**(`specwf-researcher`)— 从核心模块提取行为契约
|
|
18
|
-
- 产出: `specwf/specs/<domain>/spec.md`(标记 BOOTSTRAPPED)
|
|
19
|
-
|
|
20
|
-
使用 task 工具 fan-out 两个 specwf-researcher 并行执行。
|
|
21
|
-
|
|
22
|
-
## 上下文
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
specwf context init
|
|
26
|
-
specwf state
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
可参考 @specwf/conventions/coding.md。
|
|
30
|
-
|
|
31
|
-
## 下一步
|
|
32
|
-
|
|
33
|
-
完成后:
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
specwf continue
|
|
37
|
-
```
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# 里程碑管理
|
|
2
|
-
|
|
3
|
-
切换或创建 Milestone。
|
|
4
|
-
|
|
5
|
-
## 上下文
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
specwf state
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## 操作
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
# 切换到指定 milestone
|
|
15
|
-
specwf state set-milestone <id>
|
|
16
|
-
|
|
17
|
-
# 切换到指定 phase
|
|
18
|
-
specwf state set-phase <id>
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
可参考 @specwf/roadmap.md 查看 milestone 列表。
|
|
22
|
-
|
|
23
|
-
## 下一步
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
specwf continue
|
|
27
|
-
```
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# Change 设计
|
|
2
|
-
|
|
3
|
-
使用 specwf-planner agent 设计技术方案、拆分任务、预写 delta-specs。
|
|
4
|
-
|
|
5
|
-
## 上下文
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
specwf context plan
|
|
9
|
-
specwf state
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
## 产出
|
|
13
|
-
|
|
14
|
-
- design.md(技术方案)
|
|
15
|
-
- tasks.md(任务清单,标注 TDD type)
|
|
16
|
-
- specs/<domain>/spec.md(delta-specs)
|
|
17
|
-
|
|
18
|
-
## 下一步
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
specwf continue
|
|
22
|
-
```
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# 项目技术调研
|
|
2
|
-
|
|
3
|
-
并行调研多个技术方向。使用 task 工具 fan-out specwf-researcher agent。
|
|
4
|
-
|
|
5
|
-
## 上下文
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
specwf context research
|
|
9
|
-
specwf state
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
## 产出
|
|
13
|
-
|
|
14
|
-
写入 @specwf/research/ 目录:
|
|
15
|
-
- @specwf/research/stack.md
|
|
16
|
-
- @specwf/research/architecture.md
|
|
17
|
-
- @specwf/research/pitfalls.md
|
|
18
|
-
- @specwf/research/summary.md
|
|
19
|
-
|
|
20
|
-
## 下一步
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
specwf continue
|
|
24
|
-
```
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# 路线图拆分
|
|
2
|
-
|
|
3
|
-
将项目拆分为 Milestone × Phase。
|
|
4
|
-
|
|
5
|
-
## 上下文
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
specwf context roadmap
|
|
9
|
-
specwf state
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
可参考 @specwf/requirements.md。
|
|
13
|
-
|
|
14
|
-
## 产出
|
|
15
|
-
|
|
16
|
-
更新 @specwf/roadmap.md。
|
|
17
|
-
|
|
18
|
-
## 下一步
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
specwf state set-milestone <第一个 milestone id>
|
|
22
|
-
specwf continue
|
|
23
|
-
```
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# 交付
|
|
2
|
-
|
|
3
|
-
## Phase ship
|
|
4
|
-
|
|
5
|
-
创建 PR + 更新 @specwf/state.md。
|
|
6
|
-
|
|
7
|
-
PR 正文应包含:
|
|
8
|
-
- Phase scope 概述
|
|
9
|
-
- 包含的 change 列表(每个 change 的 scope 摘要 + 产出文件)
|
|
10
|
-
- 变更统计(文件数、行数)
|
|
11
|
-
- 测试覆盖状态(vitest run 结果)
|
|
12
|
-
- Checklist(所有 change 已 verify passed、已 archive)
|
|
13
|
-
|
|
14
|
-
## Milestone ship
|
|
15
|
-
|
|
16
|
-
发布 release tag + 更新 @specwf/project.md 版本号。
|
|
17
|
-
|
|
18
|
-
Release notes 应包含:
|
|
19
|
-
- 版本号与里程碑名称
|
|
20
|
-
- 变更总览(按 phase 分组)
|
|
21
|
-
- Breaking changes(如有)
|
|
22
|
-
- Git diff 统计(+/- 行数、文件数)
|
|
23
|
-
- 测试结果汇总
|
|
24
|
-
|
|
25
|
-
## 上下文
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
specwf state
|
|
29
|
-
specwf continue change <last-change-name>
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## 下一步
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
specwf continue
|
|
36
|
-
```
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# 测试验证
|
|
2
|
-
|
|
3
|
-
运行测试,诊断根因,路由回环。
|
|
4
|
-
|
|
5
|
-
## 上下文
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
specwf context verify
|
|
9
|
-
specwf state
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
## 回环路由
|
|
13
|
-
|
|
14
|
-
- 计划缺陷 → `specwf continue`(回 plan)
|
|
15
|
-
- 实现缺陷 → 回 apply 重实现
|
|
16
|
-
- 规格缺陷 → 标记 spec 待修
|
|
17
|
-
|
|
18
|
-
## 下一步
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
specwf continue
|
|
22
|
-
```
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# 创建临时 Change 工作流指引
|
|
2
|
-
|
|
3
|
-
## 概述
|
|
4
|
-
|
|
5
|
-
临时 Change 是与 milestone/phase 无关的独立变更,直接走标准 Change 循环。适用于紧急修复、独立改进等场景。
|
|
6
|
-
|
|
7
|
-
## 前置条件
|
|
8
|
-
|
|
9
|
-
- specwf 项目已初始化
|
|
10
|
-
- 变更名称已确定
|
|
11
|
-
|
|
12
|
-
## 执行步骤
|
|
13
|
-
|
|
14
|
-
### 1. 创建 change 目录
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
specwf change new <name>
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
自动生成:
|
|
21
|
-
- `specwf/changes/<name>/proposal.md`
|
|
22
|
-
- `specwf/changes/<name>/design.md`
|
|
23
|
-
- `specwf/changes/<name>/tasks.md`
|
|
24
|
-
- `specwf/changes/<name>/specs/` 目录
|
|
25
|
-
|
|
26
|
-
### 2. 填写 proposal.md
|
|
27
|
-
|
|
28
|
-
### 3. 继续推进
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
specwf continue
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## 产物
|
|
35
|
-
|
|
36
|
-
- proposal.md / design.md / tasks.md
|
|
37
|
-
- state.md adhoc 记录
|
|
38
|
-
|
|
39
|
-
## 验证
|
|
40
|
-
|
|
41
|
-
- [ ] change 目录存在
|
|
42
|
-
- [ ] 模板文件已生成
|
|
43
|
-
- [ ] specwf state 能看到新 change
|
|
44
|
-
|
|
45
|
-
## 常见陷阱
|
|
46
|
-
|
|
47
|
-
- 临时 change 归档后统一存放在 specwf/archive/ 下
|
|
48
|
-
- 临时 change 不走 milestone/phase 的 discuss/research-phase/split 流程
|
|
49
|
-
- 如果需要关联到 phase,使用 `specwf change new --phase <id>`
|
|
50
|
-
|
|
51
|
-
## 参考
|
|
52
|
-
|
|
53
|
-
- specwf 工作流设计中的「临时 Change」章节
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
# Change 实现工作流指引
|
|
2
|
-
|
|
3
|
-
## 概述
|
|
4
|
-
|
|
5
|
-
按 tasks.md 实现代码。TDD 强制执行:type:behavior 任务必须走 RED→GREEN→REFACTOR 循环。
|
|
6
|
-
|
|
7
|
-
Apply 阶段由 specwf-executor agent 在隔离环境中执行,支持多任务分组并发和原子提交。
|
|
8
|
-
|
|
9
|
-
## 前置条件
|
|
10
|
-
|
|
11
|
-
- plan 阶段已完成,tasks.md、design.md、delta-specs 已就位
|
|
12
|
-
- specwf context apply 已获取上下文
|
|
13
|
-
- 隔离环境已准备(git worktree 或 OMP isolated mode)
|
|
14
|
-
|
|
15
|
-
## 执行步骤
|
|
16
|
-
|
|
17
|
-
### 1. 读取上下文
|
|
18
|
-
|
|
19
|
-
运行 \`specwf context apply\`:
|
|
20
|
-
- design.md — 技术方案
|
|
21
|
-
- tasks.md — 实现清单
|
|
22
|
-
- delta-specs — 行为契约
|
|
23
|
-
- 依赖的 specs/ — 已有全局规范
|
|
24
|
-
|
|
25
|
-
### 2. 分组执行
|
|
26
|
-
|
|
27
|
-
根据 tasks.md 中的依赖关系分组,每组作为一次提交(或一组相关提交):
|
|
28
|
-
|
|
29
|
-
**组内串行**:依赖关系强制顺序
|
|
30
|
-
**组间并行**:无依赖的任务由不同 executor agent 并行执行
|
|
31
|
-
|
|
32
|
-
\`\`\`
|
|
33
|
-
# 分组示例
|
|
34
|
-
Group 1(并行): task A, task B(无依赖)
|
|
35
|
-
├── task A → 代码 + 测试 → commit
|
|
36
|
-
└── task B → 代码 + 测试 → commit
|
|
37
|
-
|
|
38
|
-
Group 2(串行): task C → task D
|
|
39
|
-
├── task C → 代码 + 测试 → commit
|
|
40
|
-
└── task D → 代码 + 测试 → commit
|
|
41
|
-
\`\`\`
|
|
42
|
-
|
|
43
|
-
### 3. TDD 执行流程(type:behavior 任务)
|
|
44
|
-
|
|
45
|
-
每个 type:behavior 任务严格执行:
|
|
46
|
-
|
|
47
|
-
**RED — 写失败测试**
|
|
48
|
-
\`\`\`
|
|
49
|
-
1. 根据 delta-spec 的 SHALL/MUST 条目编写测试
|
|
50
|
-
2. 测试应该明确断言行为契约
|
|
51
|
-
3. 运行测试 → 预期失败(红色)
|
|
52
|
-
4. 提交消息格式: \`test(<domain>): add failing test for <feature>\`
|
|
53
|
-
\`\`\`
|
|
54
|
-
|
|
55
|
-
**GREEN — 最小实现**
|
|
56
|
-
\`\`\`
|
|
57
|
-
1. 写恰好让测试通过的最少量代码
|
|
58
|
-
2. 不要过度工程,不要提前优化
|
|
59
|
-
3. 运行测试 → 预期通过(绿色)
|
|
60
|
-
4. 提交消息格式: \`feat(<domain>): implement <feature>\`
|
|
61
|
-
\`\`\`
|
|
62
|
-
|
|
63
|
-
**REFACTOR — 重构改进**
|
|
64
|
-
\`\`\`
|
|
65
|
-
1. 在测试保护下重构代码结构
|
|
66
|
-
2. 测试应该仍然通过
|
|
67
|
-
3. 提交消息格式: \`refactor(<domain>): improve <aspect>\`
|
|
68
|
-
4. REFACTOR 不改变行为,不修改测试
|
|
69
|
-
\`\`\`
|
|
70
|
-
|
|
71
|
-
### 4. 原子提交协议
|
|
72
|
-
|
|
73
|
-
每个任务完成后执行原子提交:
|
|
74
|
-
|
|
75
|
-
\`\`\`
|
|
76
|
-
# 提交原则
|
|
77
|
-
- 每个提交是一个逻辑单元,可独立 review
|
|
78
|
-
- RED/GREEN/REFACTOR 每个阶段至少一个提交
|
|
79
|
-
- 不混合不同任务的改动在一个提交中
|
|
80
|
-
- 提交消息使用 Conventional Commits 格式
|
|
81
|
-
|
|
82
|
-
# 提交消息格式
|
|
83
|
-
<type>(<scope>): <description>
|
|
84
|
-
|
|
85
|
-
[optional body — why]
|
|
86
|
-
\`\`\`
|
|
87
|
-
|
|
88
|
-
### 5. 非 TDD 任务(type:config/refactor/docs/scaffolding)
|
|
89
|
-
|
|
90
|
-
直接实现,单次提交即可:
|
|
91
|
-
\`\`\`
|
|
92
|
-
chore(config): add ESLint rule for ...
|
|
93
|
-
docs(api): add JSDoc to ...
|
|
94
|
-
refactor(core): extract validateInput helper
|
|
95
|
-
\`\`\`
|
|
96
|
-
|
|
97
|
-
### 6. 各组完成检查
|
|
98
|
-
|
|
99
|
-
每组完成后运行:
|
|
100
|
-
- [ ] 所有测试通过
|
|
101
|
-
- [ ] 代码风格一致(运行 formatter)
|
|
102
|
-
- [ ] delta-specs 中的每个 SHALL/MUST 有对应测试覆盖
|
|
103
|
-
- [ ] 无 lint 错误
|
|
104
|
-
- [ ] 无死代码/注释掉的代码
|
|
105
|
-
|
|
106
|
-
## 产物
|
|
107
|
-
|
|
108
|
-
- 实现代码(按 design.md 和 delta-specs)
|
|
109
|
-
- 测试代码(type:behavior 任务)
|
|
110
|
-
- 原子提交记录
|
|
111
|
-
|
|
112
|
-
## 验证
|
|
113
|
-
|
|
114
|
-
- [ ] 所有 type:behavior 任务已完成 RED→GREEN→REFACTOR
|
|
115
|
-
- [ ] 所有非 TDD 任务已实现
|
|
116
|
-
- [ ] 所有测试通过
|
|
117
|
-
- [ ] 每个 delta-spec 的 SHALL/MUST 有对应测试
|
|
118
|
-
- [ ] 代码无 lint/类型错误
|
|
119
|
-
|
|
120
|
-
## 常见陷阱
|
|
121
|
-
|
|
122
|
-
- GREEN 阶段只做「恰好通过」的实现 — 不要提前写 REFACTOR 的内容
|
|
123
|
-
- 不要在 RED 和 GREEN 之间插入无关改动
|
|
124
|
-
- 不要跳过 RED 直接写实现 — 先写测试再写代码
|
|
125
|
-
- 如果测试无法先写(IO 密集型、UI 代码),标注为 \`type:refactor\` 或 \`type:scaffolding\`
|
|
126
|
-
- 一个提交涵盖多个不相关改动 → 无法原子回滚
|
|
127
|
-
- 跨 change 共享代码使用依赖约定或 key_links,不要复制粘贴
|
|
128
|
-
|
|
129
|
-
## 参考
|
|
130
|
-
|
|
131
|
-
- TDD (Test-Driven Development) by Kent Beck
|
|
132
|
-
- Conventional Commits 规范
|
|
133
|
-
- GSD Core 的 execute phase
|
|
134
|
-
- OpenSpec 的 atomic commit 协议
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
# 归档工作流指引
|
|
2
|
-
|
|
3
|
-
## 概述
|
|
4
|
-
|
|
5
|
-
Change 循环的收尾阶段。负责两件事:(1) 将 delta-specs 确定性合并到全局 specs/;(2) 从代码 diff 中提取新的行为和约束,回灌到 specs/ 中。
|
|
6
|
-
|
|
7
|
-
归档完成后,Change 的工作永久记录在 specs/ 中,供后续 Change 参考和使用。
|
|
8
|
-
|
|
9
|
-
## 前置条件
|
|
10
|
-
|
|
11
|
-
- verify 阶段已通过(passed 状态)
|
|
12
|
-
- 合并目标分支的准备已完成(ship 阶段前)
|
|
13
|
-
|
|
14
|
-
## 执行步骤
|
|
15
|
-
|
|
16
|
-
### 1. 读取上下文
|
|
17
|
-
|
|
18
|
-
读取以下文件清单:
|
|
19
|
-
\`\`\`
|
|
20
|
-
changes/<change-name>/specs/<domain>/spec.md — delta-specs
|
|
21
|
-
specs/<domain>/spec.md — 全局 specs(目标)
|
|
22
|
-
changes/<change-name>/tasks.md — 任务清单(确认 REFACTOR 阶段可以删除的实现细节 delta)
|
|
23
|
-
changes/<change-name>/VERIFICATION.md — 验证报告(确认哪些通过了)
|
|
24
|
-
\`\`\`
|
|
25
|
-
|
|
26
|
-
### 2. Delta-Spec 合并
|
|
27
|
-
|
|
28
|
-
将 delta-specs 合并到全局 specs/ 中:
|
|
29
|
-
|
|
30
|
-
**合并规则**:
|
|
31
|
-
- **新增条目**:直接追加到对应域名的 specs/ 文件中
|
|
32
|
-
- **修改条目**:替换或修订全局 specs/ 中的对应 ID
|
|
33
|
-
- **删除条目**:从全局 specs/ 中移除(标记 \`[DELETED: <change-name>]\`)
|
|
34
|
-
- **冲突**:如果全局 specs/ 中的条目与 delta-spec 矛盾,标记 \`[CONFLICT: <change-name>]\` 并列出冲突双方
|
|
35
|
-
|
|
36
|
-
**合并流程**:
|
|
37
|
-
\`\`\`
|
|
38
|
-
1. 读取 changes/<change>/specs/ 下的所有 spec 文件
|
|
39
|
-
2. 对每个文件:
|
|
40
|
-
a. 按 SHALL/MUST 编号索引
|
|
41
|
-
b. 对全局 specs/ 执行新增/修改/删除
|
|
42
|
-
c. 记录变更日志在 spec 文件头部
|
|
43
|
-
3. 处理冲突(见冲突规则)
|
|
44
|
-
4. 写入更新后的 specs/
|
|
45
|
-
\`\`\`
|
|
46
|
-
|
|
47
|
-
### 3. 代码认知提取
|
|
48
|
-
|
|
49
|
-
从代码 diff 中提取未在 delta-specs 中预写的行为和约束:
|
|
50
|
-
|
|
51
|
-
**提取来源**:
|
|
52
|
-
- 新增的函数、方法、模块的公共 API(类型签名、注释、实现)
|
|
53
|
-
- 测试中隐含的行为约束(如「一个用户只有一个 active session」)
|
|
54
|
-
- 配置文件、常量中的业务规则
|
|
55
|
-
- 错误消息中体现的领域概念
|
|
56
|
-
|
|
57
|
-
**提取规则**:
|
|
58
|
-
- **系统行为**(什么是系统做的) → 提取为 SHALL 条目
|
|
59
|
-
- **业务约束**(必须遵守的限制) → 提取为 MUST 条目
|
|
60
|
-
- **用户可见行为**(API 响应格式、错误码) → 提取为 SHOULD 条目
|
|
61
|
-
- **实现细节**(内部变量名、helper 函数) → 不提取
|
|
62
|
-
|
|
63
|
-
**AUTO-EXTRACTED 标记**:
|
|
64
|
-
每个自动提取的条目在末尾添加:
|
|
65
|
-
\`\`\`
|
|
66
|
-
# AUTO-EXTRACTED from <change-name> on <timestamp>
|
|
67
|
-
# Source: <file>:<line>
|
|
68
|
-
\`\`\`
|
|
69
|
-
|
|
70
|
-
标记的目的是:
|
|
71
|
-
- 标识是工具自动生成的,不是人工编写的
|
|
72
|
-
- 便于后续人工 review 时定位和验证
|
|
73
|
-
- 在后续归档中,如果人工 review 确认正确,移除 \`AUTO-EXTRACTED\` 标记
|
|
74
|
-
|
|
75
|
-
### 4. 最终检查
|
|
76
|
-
|
|
77
|
-
- [ ] 所有 delta-specs 已合并或标记冲突
|
|
78
|
-
- [ ] 已扫描代码 diff 并提取认知
|
|
79
|
-
- [ ] 提取的条目有 \`AUTO-EXTRACTED\` 标记
|
|
80
|
-
- [ ] 全局 specs/ 文件无格式损坏
|
|
81
|
-
- [ ] change 目录保留为历史记录(不删除)
|
|
82
|
-
|
|
83
|
-
## 产物
|
|
84
|
-
|
|
85
|
-
- \`specs/<domain>/spec.md\`(更新) — 合并后的全局规范
|
|
86
|
-
- \`specs/<domain>/spec.md\`(追加) — 代码认知提取后的新增条目
|
|
87
|
-
|
|
88
|
-
## 验证
|
|
89
|
-
|
|
90
|
-
- [ ] delta-specs 已正确合并到全局 specs/
|
|
91
|
-
- [ ] 冲突已标记 \`[CONFLICT: <change>]\` 且列出双方
|
|
92
|
-
- [ ] 代码提取条目有 \`AUTO-EXTRACTED\` 标记
|
|
93
|
-
- [ ] 全局 specs/ 可被 parseSpec 读取(无格式错误)
|
|
94
|
-
- [ ] change 目录保留
|
|
95
|
-
|
|
96
|
-
## 常见陷阱
|
|
97
|
-
|
|
98
|
-
- 不要删除 change 目录 — 它是 git 历史之外的辅助审计轨迹
|
|
99
|
-
- 不要覆盖全局 specs/ — 只追加、替换对应 ID、或标记删除
|
|
100
|
-
- 代码提取不是 code review — 提取行为契约,不是判断代码好坏
|
|
101
|
-
- 提取要克制 — 只有「系统行为/约束」才提取,「实现方式」不提取
|
|
102
|
-
- AUTO-EXTRACTED 条目需要人肉 review 确认,不是最终版
|
|
103
|
-
- 如果一个 extract 发现的行为明确违反现有 specs/ 或 conventions/,额外标记 \`[FLAG: conflict with <existing-spec-ref>]\`
|
|
104
|
-
|
|
105
|
-
## 参考
|
|
106
|
-
|
|
107
|
-
- OpenSpec 的 delta-merge 流程
|
|
108
|
-
- Trellis 的代码认知回灌概念(仅参考)
|
|
109
|
-
- GSD Core 的 archive 阶段
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
# 自动推进工作流指引
|
|
2
|
-
|
|
3
|
-
## 概述
|
|
4
|
-
|
|
5
|
-
读取 STATE.md,由状态机确定当前状态,自动触发对应的下一个 slash command。
|
|
6
|
-
|
|
7
|
-
Continue 是整个工作流的自动导航器。它不执行任何业务逻辑,只负责判断「现在该做什么」并触发。
|
|
8
|
-
|
|
9
|
-
## 前置条件
|
|
10
|
-
|
|
11
|
-
- specwf/STATE.md 存在且格式正确
|
|
12
|
-
- specwf 已初始化
|
|
13
|
-
|
|
14
|
-
## 执行步骤
|
|
15
|
-
|
|
16
|
-
### 1. 读取 STATE.md
|
|
17
|
-
|
|
18
|
-
\`\`\`
|
|
19
|
-
specwf state
|
|
20
|
-
\`\`\`
|
|
21
|
-
|
|
22
|
-
STATE.md 包含:
|
|
23
|
-
- 当前 milestone / phase / change 的位置
|
|
24
|
-
- 各个实体的状态
|
|
25
|
-
- 下一步提示(如果有)
|
|
26
|
-
|
|
27
|
-
### 2. 查询特定 change 的状态
|
|
28
|
-
|
|
29
|
-
\`\`\`
|
|
30
|
-
specwf continue change <name>
|
|
31
|
-
\`\`\`
|
|
32
|
-
|
|
33
|
-
查询指定 change 或临时 change 的当前状态和下一步建议。
|
|
34
|
-
|
|
35
|
-
### 3. 状态机匹配
|
|
36
|
-
|
|
37
|
-
根据 STATE.md 数据,状态引擎自动匹配合法转移。每个步骤对应一个 slash command:
|
|
38
|
-
|
|
39
|
-
| 层级 | 当前步骤 | 下一步命令 | 子代理 |
|
|
40
|
-
|------|---------|-----------|--------|
|
|
41
|
-
| 项目层 | initialized | /specwf:grill | — |
|
|
42
|
-
| 项目层 | requirements-defined | /specwf:research | researcher |
|
|
43
|
-
| 项目层 | researched | /specwf:roadmap | — |
|
|
44
|
-
| 项目层 | roadmap-defined | /specwf:discuss | — |
|
|
45
|
-
| Phase | phase-discuss | /specwf:research-phase | researcher |
|
|
46
|
-
| Phase | phase-research | /specwf:split | — |
|
|
47
|
-
| Phase | phase-split 后 | /specwf:plan → apply → review → verify → archive | 各步对应 subagent |
|
|
48
|
-
| Phase | change-archived | /specwf:ship | — |
|
|
49
|
-
| Phase | phase-shipped | /specwf:ship(milestone)或 /specwf:discuss(下一 phase)| — |
|
|
50
|
-
| 临时 change | adhoc-proposal | /specwf:plan | planner |
|
|
51
|
-
|
|
52
|
-
完整的状态转移表见 `src/types/state.ts`。
|
|
53
|
-
|
|
54
|
-
### 3. 输出下一步
|
|
55
|
-
|
|
56
|
-
输出格式:
|
|
57
|
-
\`\`\`
|
|
58
|
-
# Continue 结果
|
|
59
|
-
|
|
60
|
-
## 当前状态
|
|
61
|
-
- Project: <name>
|
|
62
|
-
- Milestone: <ms-name>(<status>)
|
|
63
|
-
- Phase: <ph-name>(<status>)
|
|
64
|
-
- Change: <change-name>(<status>)
|
|
65
|
-
|
|
66
|
-
## 下一步
|
|
67
|
-
- 命令: /specwf:<next-step>
|
|
68
|
-
- 前置条件: ...
|
|
69
|
-
\`\`\`
|
|
70
|
-
|
|
71
|
-
### 4. 触发(可选)
|
|
72
|
-
|
|
73
|
-
如果配置了 \`auto_advance: true\`,自动加载对应的 skill 并开始执行。
|
|
74
|
-
|
|
75
|
-
## 产物
|
|
76
|
-
|
|
77
|
-
- (无永久文件输出)
|
|
78
|
-
- 控制台输出下一步建议(或自动触发)
|
|
79
|
-
|
|
80
|
-
## 验证
|
|
81
|
-
|
|
82
|
-
- [ ] 正确识别当前状态
|
|
83
|
-
- [ ] 正确匹配下一步
|
|
84
|
-
- [ ] STATE.md 格式可解析
|
|
85
|
-
- [ ] 无状态机死循环风险
|
|
86
|
-
|
|
87
|
-
## 常见陷阱
|
|
88
|
-
|
|
89
|
-
- 如果 STATE.md 内容不完整或格式损坏,不要猜测 — 提示用户运行 \`specwf init\` 或手动修复
|
|
90
|
-
- 如果多个 change 存在且状态不一致,优先处理最深的未完成 change
|
|
91
|
-
- 不要自动推进跳过 review → verify → archive 的流程(review 必须由用户触发来确认质量)
|
|
92
|
-
- auto_advance 模式不跳过 review — 只是自动触发 review 命令,仍需要 reviewer agent
|
|
93
|
-
|
|
94
|
-
## 参考
|
|
95
|
-
|
|
96
|
-
- state-machine 模块的状态转换表
|
|
97
|
-
- OMP 的 continue 命令设计
|