@jahanxu/code-flow 0.2.2 → 0.2.3
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/src/adapters/claude/commands/cf-task/archive.md +10 -7
- package/src/adapters/claude/commands/cf-task/block.md +4 -2
- package/src/adapters/claude/commands/cf-task/graph.md +5 -3
- package/src/adapters/claude/commands/cf-task/note.md +4 -2
- package/src/adapters/claude/commands/cf-task/plan.md +52 -13
- package/src/adapters/claude/commands/cf-task/start.md +32 -11
- package/src/adapters/claude/commands/cf-task/status.md +1 -1
package/package.json
CHANGED
|
@@ -6,13 +6,15 @@
|
|
|
6
6
|
|
|
7
7
|
- `/cf-task:archive <file>` — 归档指定的 task 文件
|
|
8
8
|
|
|
9
|
-
其中 `<file>`
|
|
9
|
+
其中 `<file>` 可省略日期目录前缀和 `.md` 后缀。
|
|
10
|
+
|
|
11
|
+
查找逻辑:用 Glob 搜索 `.code-flow/tasks/**/<file>.md`(排除 `archived/`),匹配第一个结果。
|
|
10
12
|
|
|
11
13
|
## 执行步骤
|
|
12
14
|
|
|
13
15
|
### 1. 完成度检查
|
|
14
16
|
|
|
15
|
-
1. 用 Read
|
|
17
|
+
1. 用 Read 读取匹配到的 task 文件
|
|
16
18
|
2. 提取所有 `## TASK-xxx` 段落的 Status
|
|
17
19
|
3. 检查是否所有子任务均为 `done`
|
|
18
20
|
|
|
@@ -32,17 +34,18 @@
|
|
|
32
34
|
|
|
33
35
|
所有子任务已完成:
|
|
34
36
|
|
|
35
|
-
1.
|
|
37
|
+
1. 提取文件所在的日期目录名(如 `2026-03-15`)
|
|
38
|
+
2. 用 Bash 创建归档目录并移动文件:
|
|
36
39
|
```bash
|
|
37
|
-
mkdir -p .code-flow/tasks/archived
|
|
38
|
-
mv .code-flow/tasks
|
|
40
|
+
mkdir -p .code-flow/tasks/archived/<日期目录>
|
|
41
|
+
mv .code-flow/tasks/<日期目录>/<file>.md .code-flow/tasks/archived/<日期目录>/
|
|
39
42
|
```
|
|
40
|
-
|
|
43
|
+
3. 如果原日期目录为空,删除空目录
|
|
41
44
|
|
|
42
45
|
### 3. 归档摘要
|
|
43
46
|
|
|
44
47
|
```
|
|
45
|
-
已归档: <file>.md → .code-flow/tasks/archived
|
|
48
|
+
已归档: <file>.md → .code-flow/tasks/archived/<日期目录>/<file>.md
|
|
46
49
|
|
|
47
50
|
摘要:
|
|
48
51
|
- 来源: docs/xxx设计说明书.md
|
|
@@ -6,11 +6,13 @@
|
|
|
6
6
|
|
|
7
7
|
- `/cf-task:block <file> TASK-001 "阻塞原因"`
|
|
8
8
|
|
|
9
|
-
其中 `<file>`
|
|
9
|
+
其中 `<file>` 可省略日期目录前缀和 `.md` 后缀。
|
|
10
|
+
|
|
11
|
+
查找逻辑:用 Glob 搜索 `.code-flow/tasks/**/<file>.md`(排除 `archived/`),匹配第一个结果。
|
|
10
12
|
|
|
11
13
|
## 执行步骤
|
|
12
14
|
|
|
13
|
-
1. 用 Read 读取
|
|
15
|
+
1. 用 Glob 定位任务文件,Read 读取
|
|
14
16
|
2. 定位 `## TASK-001` 段落,检查当前 Status:
|
|
15
17
|
- `done` → 拒绝:`TASK-001 已完成,无法标记阻塞`
|
|
16
18
|
- `blocked` → 提示:`TASK-001 已处于 blocked 状态`,仍追加新的阻塞原因
|
|
@@ -7,14 +7,16 @@
|
|
|
7
7
|
- `/cf-task:graph <file>` — 显示指定文件的依赖图
|
|
8
8
|
- `/cf-task:graph` — 显示所有活跃 task 文件的依赖图
|
|
9
9
|
|
|
10
|
-
其中 `<file>`
|
|
10
|
+
其中 `<file>` 可省略日期目录前缀和 `.md` 后缀。
|
|
11
|
+
|
|
12
|
+
查找逻辑:用 Glob 搜索 `.code-flow/tasks/**/<file>.md`(排除 `archived/`),匹配第一个结果。
|
|
11
13
|
|
|
12
14
|
## 执行步骤
|
|
13
15
|
|
|
14
16
|
### 1. 读取任务数据
|
|
15
17
|
|
|
16
|
-
- 指定文件:Read
|
|
17
|
-
- 全部文件:Glob `.code-flow/tasks
|
|
18
|
+
- 指定文件:Glob 定位后 Read
|
|
19
|
+
- 全部文件:Glob `.code-flow/tasks/**/*.md`(排除 `archived/` 目录),逐个 Read
|
|
18
20
|
|
|
19
21
|
从每个 `## TASK-xxx` 段落提取:ID、标题、Status、Depends。
|
|
20
22
|
|
|
@@ -8,13 +8,15 @@
|
|
|
8
8
|
- `/cf-task:note <file> TASK-001 resolve NOTE-1` — 标记批注为已解决
|
|
9
9
|
- `/cf-task:note <file> TASK-001 resolve all` — 标记所有批注为已解决
|
|
10
10
|
|
|
11
|
-
其中 `<file>`
|
|
11
|
+
其中 `<file>` 可省略日期目录前缀和 `.md` 后缀。
|
|
12
|
+
|
|
13
|
+
查找逻辑:用 Glob 搜索 `.code-flow/tasks/**/<file>.md`(排除 `archived/`),匹配第一个结果。
|
|
12
14
|
|
|
13
15
|
## 添加批注
|
|
14
16
|
|
|
15
17
|
### 执行步骤
|
|
16
18
|
|
|
17
|
-
1. 用 Read 读取
|
|
19
|
+
1. 用 Glob 定位任务文件,Read 读取
|
|
18
20
|
2. 定位 `## TASK-001` 段落下的 `### Notes` 区域
|
|
19
21
|
3. 扫描已有 `[NOTE-n]`,计算下一个编号
|
|
20
22
|
4. 用 Edit 在 `### Notes` 下追加:`- [NOTE-<n>] <批注内容>`
|
|
@@ -18,7 +18,26 @@
|
|
|
18
18
|
2. 展示列表,让用户选择目标文档
|
|
19
19
|
3. Read 读取选中的文档
|
|
20
20
|
|
|
21
|
-
### 2.
|
|
21
|
+
### 2. 建立章节索引
|
|
22
|
+
|
|
23
|
+
Read 设计文档后,**先扫描文档结构**,建立章节索引表:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
章节索引:
|
|
27
|
+
§1 概述 (L1-L25)
|
|
28
|
+
§2 需求分析 (L26-L80)
|
|
29
|
+
§2.1 用户故事 (L28-L55)
|
|
30
|
+
§2.2 非功能需求 (L56-L80)
|
|
31
|
+
§3 详细设计 (L81-L200)
|
|
32
|
+
§3.1 数据模型 (L83-L110)
|
|
33
|
+
§3.2 API 接口 (L111-L155)
|
|
34
|
+
§3.3 业务逻辑 (L156-L200)
|
|
35
|
+
...
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
此索引用于后续步骤中精确记录每个子任务的来源章节。
|
|
39
|
+
|
|
40
|
+
### 3. 分析文档,拆解子任务
|
|
22
41
|
|
|
23
42
|
阅读设计文档内容,按以下原则拆解:
|
|
24
43
|
|
|
@@ -28,12 +47,20 @@
|
|
|
28
47
|
- 预估编码时间 15-60 分钟
|
|
29
48
|
|
|
30
49
|
**提取内容**:
|
|
31
|
-
- 功能需求 → 子任务标题 +
|
|
50
|
+
- 功能需求 → 子任务标题 + 描述(提炼重点,不必复制全文)
|
|
32
51
|
- 实现要点 → Checklist 条目
|
|
33
52
|
- 模块依赖 → Depends 字段
|
|
34
53
|
- 紧急程度 → Priority(P0 核心功能 / P1 重要功能 / P2 优化项)
|
|
35
54
|
|
|
36
|
-
|
|
55
|
+
**关键:精确记录章节引用**
|
|
56
|
+
|
|
57
|
+
每个子任务的 `Source` 字段必须记录该任务对应的详设文档**具体章节和行号范围**。
|
|
58
|
+
|
|
59
|
+
引用格式:`文件路径#章节标题(L起始-L结束)`,多个章节用逗号分隔。
|
|
60
|
+
|
|
61
|
+
验证方法:记录引用后,用 Read 工具按行号范围回读验证,确保引用内容与子任务描述一致。如不一致,修正行号。
|
|
62
|
+
|
|
63
|
+
### 4. 生成任务文件方案
|
|
37
64
|
|
|
38
65
|
将拆解结果按以下格式组织,展示给用户确认:
|
|
39
66
|
|
|
@@ -51,9 +78,10 @@
|
|
|
51
78
|
- **Status**: draft
|
|
52
79
|
- **Priority**: P0
|
|
53
80
|
- **Depends**:
|
|
81
|
+
- **Source**: docs/xxx.md#§3.1 数据模型(L83-L110)
|
|
54
82
|
|
|
55
83
|
### Description
|
|
56
|
-
|
|
84
|
+
<从设计文档提取的需求重点,不必复制全文>
|
|
57
85
|
|
|
58
86
|
### Checklist
|
|
59
87
|
- [ ] <具体实现步骤1>
|
|
@@ -68,6 +96,13 @@
|
|
|
68
96
|
---
|
|
69
97
|
|
|
70
98
|
## TASK-002: <子任务标题>
|
|
99
|
+
|
|
100
|
+
- **Status**: draft
|
|
101
|
+
- **Priority**: P1
|
|
102
|
+
- **Depends**: TASK-001
|
|
103
|
+
- **Source**: docs/xxx.md#§3.2 API 接口(L111-L155), docs/xxx.md#§3.3 业务逻辑(L156-L180)
|
|
104
|
+
|
|
105
|
+
### Description
|
|
71
106
|
...
|
|
72
107
|
```
|
|
73
108
|
|
|
@@ -77,11 +112,13 @@
|
|
|
77
112
|
拆解结果(共 N 个子任务):
|
|
78
113
|
|
|
79
114
|
TASK-001: <标题> [P0]
|
|
115
|
+
来源: §3.1 数据模型 (L83-L110)
|
|
80
116
|
描述: ...
|
|
81
117
|
Checklist: N 项
|
|
82
118
|
依赖: 无
|
|
83
119
|
|
|
84
120
|
TASK-002: <标题> [P1]
|
|
121
|
+
来源: §3.2 API 接口 (L111-L155), §3.3 业务逻辑 (L156-L180)
|
|
85
122
|
描述: ...
|
|
86
123
|
Checklist: N 项
|
|
87
124
|
依赖: TASK-001
|
|
@@ -90,24 +127,26 @@ TASK-002: <标题> [P1]
|
|
|
90
127
|
- 修改某个子任务的内容
|
|
91
128
|
- 删除不需要的子任务
|
|
92
129
|
- 合并过于细碎的子任务
|
|
93
|
-
-
|
|
130
|
+
- 调整依赖关系和章节引用
|
|
94
131
|
```
|
|
95
132
|
|
|
96
133
|
等待用户确认或调整。
|
|
97
134
|
|
|
98
|
-
###
|
|
135
|
+
### 5. 写入文件
|
|
99
136
|
|
|
100
137
|
用户确认后:
|
|
101
|
-
1. 文件名取模块/功能名(kebab-case),如 `auth-module.md
|
|
102
|
-
2.
|
|
138
|
+
1. 文件名取模块/功能名(kebab-case),如 `auth-module.md`
|
|
139
|
+
2. 按当前日期创建目录:`.code-flow/tasks/<YYYY-MM-DD>/`
|
|
140
|
+
3. 用 Write 写入 `.code-flow/tasks/<YYYY-MM-DD>/<name>.md`
|
|
103
141
|
|
|
104
|
-
###
|
|
142
|
+
### 6. 输出摘要
|
|
105
143
|
|
|
106
144
|
```
|
|
107
|
-
已生成任务文件: .code-flow/tasks
|
|
145
|
+
已生成任务文件: .code-flow/tasks/2026-03-15/auth-module.md
|
|
108
146
|
- 子任务数: N
|
|
109
147
|
- P0: x 个, P1: y 个, P2: z 个
|
|
110
148
|
- 依赖链深度: N 层
|
|
149
|
+
- 详设引用覆盖: §3.1, §3.2, §3.3, §3.5 (共 4 个章节)
|
|
111
150
|
|
|
112
151
|
建议执行顺序:
|
|
113
152
|
1. TASK-001 (无依赖)
|
|
@@ -116,7 +155,7 @@ TASK-002: <标题> [P1]
|
|
|
116
155
|
...
|
|
117
156
|
|
|
118
157
|
下一步:
|
|
119
|
-
- 审阅任务: 直接阅读 .code-flow/tasks
|
|
120
|
-
- 添加批注: /cf-task:note
|
|
121
|
-
- 开始编码: /cf-task:start
|
|
158
|
+
- 审阅任务: 直接阅读 .code-flow/tasks/2026-03-15/auth-module.md
|
|
159
|
+
- 添加批注: /cf-task:note auth-module TASK-001 "批注内容"
|
|
160
|
+
- 开始编码: /cf-task:start auth-module
|
|
122
161
|
```
|
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
- `/cf-task:start <file> TASK-001` — 激活指定文件中的单个子任务
|
|
8
8
|
- `/cf-task:start <file>` — 激活文件内所有可执行的 draft 子任务
|
|
9
9
|
|
|
10
|
-
其中 `<file>` 为 `.code-flow/tasks/`
|
|
10
|
+
其中 `<file>` 为 `.code-flow/tasks/` 下的文件名,可省略日期目录前缀和 `.md` 后缀。
|
|
11
|
+
|
|
12
|
+
查找逻辑:用 Glob 搜索 `.code-flow/tasks/**/<file>.md`,匹配第一个结果。
|
|
11
13
|
|
|
12
14
|
示例:
|
|
13
15
|
- `/cf-task:start auth-module TASK-002`
|
|
@@ -17,7 +19,7 @@
|
|
|
17
19
|
|
|
18
20
|
### 1. 前置检查
|
|
19
21
|
|
|
20
|
-
用 Read
|
|
22
|
+
用 Read 读取任务文件,定位 `## TASK-xxx` 段落:
|
|
21
23
|
|
|
22
24
|
**状态检查**:Status 必须为 `draft`。若为其他状态:
|
|
23
25
|
- `in-progress` → 提示"任务已在进行中,继续编码"(不阻塞,直接跳到步骤 2)
|
|
@@ -33,22 +35,35 @@
|
|
|
33
35
|
- 所有依赖必须为 `done`
|
|
34
36
|
- 未满足 → 输出:`前置检查失败:以下依赖未完成\n- TASK-001: in-progress\n- TASK-003: draft`
|
|
35
37
|
|
|
36
|
-
### 2.
|
|
38
|
+
### 2. 加载详设上下文
|
|
39
|
+
|
|
40
|
+
前置检查通过后,**编码前先加载关联的详设文档章节**:
|
|
41
|
+
|
|
42
|
+
1. 读取子任务的 `Source` 字段,解析章节引用
|
|
43
|
+
- 格式:`docs/xxx.md#§3.1 数据模型(L83-L110)`
|
|
44
|
+
- 提取:文件路径 + 行号范围
|
|
45
|
+
2. 用 Read 按行号范围读取详设文档的对应章节(使用 offset/limit 参数)
|
|
46
|
+
3. 将读取的章节内容作为编码上下文,与 Checklist 一起指导实现
|
|
47
|
+
|
|
48
|
+
示例:Source 为 `docs/auth.md#§3.2 API 接口(L111-L155), docs/auth.md#§3.5 错误码(L201-L220)`
|
|
49
|
+
→ Read `docs/auth.md` offset=111 limit=45
|
|
50
|
+
→ Read `docs/auth.md` offset=201 limit=20
|
|
51
|
+
|
|
52
|
+
### 3. 激活并编码
|
|
37
53
|
|
|
38
|
-
前置检查通过后:
|
|
39
54
|
1. 用 Edit 更新子任务 Status 为 `in-progress`
|
|
40
55
|
2. 在 `### Log` 追加:`- [<当前日期>] started (in-progress)`
|
|
41
56
|
3. 更新文件头 `Updated` 日期
|
|
42
|
-
4.
|
|
57
|
+
4. 结合详设上下文 + Checklist,逐项执行编码工作
|
|
43
58
|
5. 每完成一个 checklist 项 → 用 Edit 将 `- [ ]` 改为 `- [x]`
|
|
44
59
|
|
|
45
|
-
###
|
|
60
|
+
### 4. 自动完成
|
|
46
61
|
|
|
47
62
|
当所有 checklist 项都勾选为 `[x]` 后:
|
|
48
63
|
1. 用 Edit 更新 Status 为 `done`
|
|
49
64
|
2. 在 `### Log` 追加:`- [<当前日期>] completed (done)`
|
|
50
65
|
3. 更新文件头 `Updated` 日期
|
|
51
|
-
4. 输出:`TASK-xxx
|
|
66
|
+
4. 输出:`TASK-xxx 已完成`
|
|
52
67
|
|
|
53
68
|
## 整文件模式
|
|
54
69
|
|
|
@@ -56,7 +71,13 @@
|
|
|
56
71
|
|
|
57
72
|
用 Read 读取整个 task 文件,提取所有 `## TASK-xxx` 段落的 ID、Status、Depends。
|
|
58
73
|
|
|
59
|
-
### 2.
|
|
74
|
+
### 2. 加载详设文档
|
|
75
|
+
|
|
76
|
+
读取文件头的 `Source` 字段,用 Read 加载完整的详设文档作为全局上下文。
|
|
77
|
+
|
|
78
|
+
> 注:整文件模式加载完整详设(因为涉及所有子任务),单任务模式只加载关联章节(节省 token)。
|
|
79
|
+
|
|
80
|
+
### 3. 构建执行计划
|
|
60
81
|
|
|
61
82
|
按依赖关系拓扑排序:
|
|
62
83
|
1. 筛选所有 `draft` 状态的子任务
|
|
@@ -81,13 +102,13 @@
|
|
|
81
102
|
开始执行...
|
|
82
103
|
```
|
|
83
104
|
|
|
84
|
-
###
|
|
105
|
+
### 4. 按序执行
|
|
85
106
|
|
|
86
|
-
对每个可激活的子任务,执行单任务模式的步骤 2
|
|
107
|
+
对每个可激活的子任务,执行单任务模式的步骤 3-4(详设已在步骤 2 加载,无需重复读取)。
|
|
87
108
|
|
|
88
109
|
完成一个子任务后,检查是否解锁了新的子任务(依赖已满足),如果是则继续执行。
|
|
89
110
|
|
|
90
|
-
###
|
|
111
|
+
### 5. 输出摘要
|
|
91
112
|
|
|
92
113
|
```
|
|
93
114
|
执行完成:
|