cc-devflow 2.4.5 → 2.4.6
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/.claude/CLAUDE.md +3 -2
- package/.claude/agents/flow-researcher.md +132 -0
- package/.claude/commands/flow-init.md +33 -65
- package/.claude/docs/templates/INIT_FLOW_TEMPLATE.md +17 -40
- package/.claude/scripts/populate-research-tasks.sh +63 -38
- package/CHANGELOG.md +24 -0
- package/docs/commands/flow-init.md +14 -10
- package/docs/commands/flow-init.zh-CN.md +12 -8
- package/package.json +2 -2
- package/.claude/tsc-cache/6e64f818-6398-49ca-8623-581a9af85c44/edited-files.log +0 -1
- package/.claude/tsc-cache/748c64fa-9e5f-4a1d-9db8-efb8415a6183/affected-repos.txt +0 -1
- package/.claude/tsc-cache/748c64fa-9e5f-4a1d-9db8-efb8415a6183/edited-files.log +0 -1
- package/.claude/tsc-cache/777aa1de-497e-411b-a40f-13b74efcec58/edited-files.log +0 -2
- package/.claude/tsc-cache/795ba6e3-b98a-423b-bab2-51aa62812569/edited-files.log +0 -1
- package/.claude/tsc-cache/ae335694-be5a-4ba4-a1a0-b676c09a7906/edited-files.log +0 -1
- package/.claude/tsc-cache/f903e5df-3c39-4958-b26b-724808f32956/affected-repos.txt +0 -1
- package/.claude/tsc-cache/f903e5df-3c39-4958-b26b-724808f32956/edited-files.log +0 -2
package/.claude/CLAUDE.md
CHANGED
|
@@ -10,6 +10,7 @@ This directory contains Claude Code CLI extensions for the CC-DevFlow developmen
|
|
|
10
10
|
├── agents/ # Agent instruction files (research-type, invoked by commands)
|
|
11
11
|
│ ├── checklist-agent.md # Checklist generation logic [NEW: REQ-002]
|
|
12
12
|
│ ├── clarify-analyst.md # Requirements clarification
|
|
13
|
+
│ ├── flow-researcher.md # /flow-init mandatory research runner (subagent; file-based memory)
|
|
13
14
|
│ ├── prd-writer.md # PRD generation
|
|
14
15
|
│ ├── tech-architect.md # Technical design
|
|
15
16
|
│ ├── planner.md # EPIC/TASKS planning
|
|
@@ -19,7 +20,7 @@ This directory contains Claude Code CLI extensions for the CC-DevFlow developmen
|
|
|
19
20
|
│
|
|
20
21
|
├── commands/ # Slash command definitions
|
|
21
22
|
│ ├── flow-checklist.md # /flow-checklist command [NEW: REQ-002]
|
|
22
|
-
│ ├── flow-init.md # /flow-init (modified:
|
|
23
|
+
│ ├── flow-init.md # /flow-init (modified: research delegated to flow-researcher subagent)
|
|
23
24
|
│ ├── flow-clarify.md # /flow-clarify
|
|
24
25
|
│ ├── flow-prd.md # /flow-prd
|
|
25
26
|
│ ├── flow-tech.md # /flow-tech
|
|
@@ -132,7 +133,7 @@ Combine Ralph-Wiggum's autonomous iteration loop with Manus-style Planning-with-
|
|
|
132
133
|
|
|
133
134
|
**Modified Files**:
|
|
134
135
|
- `commands/flow-dev.md` - Merged Ralph Loop (Autonomous by default)
|
|
135
|
-
- `commands/flow-init.md` -
|
|
136
|
+
- `commands/flow-init.md` - Research made mandatory via `flow-researcher` subagent (context-isolated)
|
|
136
137
|
- `skills/cc-devflow-orchestrator/SKILL.md` - Updated routing for autonomous flow
|
|
137
138
|
|
|
138
139
|
### Attention Refresh Protocols
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: flow-researcher
|
|
3
|
+
description: Executes mandatory /flow-init deep research using MCP services (Context7/WebSearch/WebFetch) with file-based memory. Produces research artifacts under devflow/requirements/$REQ_ID/research/ and returns only a short summary + file paths (no long pastes).
|
|
4
|
+
tools: Read, Write, Grep, Glob, WebFetch, WebSearch, mcp__context7__resolve-library-id, mcp__context7__get-library-docs
|
|
5
|
+
model: inherit
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You are a requirement research runner invoked by `/flow-init`.
|
|
9
|
+
|
|
10
|
+
Your job is to do **research work** without exhausting the main session context:
|
|
11
|
+
- Put large content into files under `devflow/requirements/$REQ_ID/research/`
|
|
12
|
+
- Return only a **short** summary + **paths**, never paste long docs into chat
|
|
13
|
+
|
|
14
|
+
## MCP Research Requirement
|
|
15
|
+
|
|
16
|
+
This agent MUST use **MCP services** to fetch external materials for deep research:
|
|
17
|
+
- **Context7 MCP**: official documentation for detected frameworks/libraries (`mcp__context7__resolve-library-id` + `mcp__context7__get-library-docs`)
|
|
18
|
+
- **WebSearch + WebFetch**: tutorials, guides, examples, case studies, and plan URLs
|
|
19
|
+
|
|
20
|
+
All fetched content MUST be written to `research/mcp/YYYYMMDD/**` (not pasted into chat).
|
|
21
|
+
|
|
22
|
+
## Hard Rules
|
|
23
|
+
|
|
24
|
+
1. **NO USER INTERACTION**
|
|
25
|
+
- Never ask the user questions.
|
|
26
|
+
- If information is missing, record it under `## Unresolved Questions` in `research/research-summary.md`.
|
|
27
|
+
|
|
28
|
+
2. **FILE-BASED MEMORY (MANDATORY)**
|
|
29
|
+
- Any fetched/long content must be written to files in `research/`.
|
|
30
|
+
- Chat output must stay small (decision bullets + file paths).
|
|
31
|
+
|
|
32
|
+
3. **NO PLACEHOLDERS**
|
|
33
|
+
- Do not leave `TODO`, `FIXME`, `{{PLACEHOLDER}}`.
|
|
34
|
+
- Ensure `validate-research.sh --strict` passes.
|
|
35
|
+
|
|
36
|
+
4. **TRACEABILITY**
|
|
37
|
+
- Every decision must include a concrete `Source` (file path + section/line if possible).
|
|
38
|
+
|
|
39
|
+
## Input Contract (provided via prompt)
|
|
40
|
+
|
|
41
|
+
You will receive a JSON payload in the prompt:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"reqId": "REQ-123",
|
|
46
|
+
"reqDir": "devflow/requirements/REQ-123",
|
|
47
|
+
"title": "User Authentication",
|
|
48
|
+
"planUrls": ["https://..."],
|
|
49
|
+
"contextFiles": {
|
|
50
|
+
"brainstorm": "devflow/requirements/REQ-123/BRAINSTORM.md",
|
|
51
|
+
"roadmap": "devflow/ROADMAP.md",
|
|
52
|
+
"architecture": "devflow/ARCHITECTURE.md"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Required Outputs (MUST create/update)
|
|
58
|
+
|
|
59
|
+
Under `${reqDir}/research/`:
|
|
60
|
+
- `internal/codebase-overview.md`
|
|
61
|
+
- `mcp/YYYYMMDD/official/*.md` (if applicable)
|
|
62
|
+
- `mcp/YYYYMMDD/guides/*.md` (if applicable)
|
|
63
|
+
- `mcp/YYYYMMDD/tutorials/*.md` (if applicable)
|
|
64
|
+
- `mcp/YYYYMMDD/examples/*.md` (if applicable)
|
|
65
|
+
- `research-summary.md` (human-readable decisions)
|
|
66
|
+
- `tasks.json` (decision/rationale/alternatives filled)
|
|
67
|
+
- `research.md` (consolidated, Decision/Rationale/Alternatives format)
|
|
68
|
+
|
|
69
|
+
## Execution Procedure (follow in order)
|
|
70
|
+
|
|
71
|
+
### Step 1: Validate Paths & Prepare Directories
|
|
72
|
+
- Ensure `${reqDir}` exists.
|
|
73
|
+
- Ensure `${reqDir}/research/` exists, create missing subfolders:
|
|
74
|
+
- `research/internal/`
|
|
75
|
+
- `research/mcp/YYYYMMDD/{official,guides,tutorials,examples}/`
|
|
76
|
+
- Read `${reqDir}/BRAINSTORM.md` and `${reqDir}/README.md` if present.
|
|
77
|
+
|
|
78
|
+
### Step 2: Internal Codebase Research (S0)
|
|
79
|
+
Goal: produce a **useful** `research/internal/codebase-overview.md` with:
|
|
80
|
+
- Repo tech stack snapshot (from `package.json`, lockfiles, etc.)
|
|
81
|
+
- Relevant modules/entry points you will likely touch
|
|
82
|
+
- Existing patterns for auth/data validation/error handling/tests
|
|
83
|
+
- Constraints you must not violate (existing conventions, CI, tooling)
|
|
84
|
+
|
|
85
|
+
### Step 3: External Research (Task 1-5)
|
|
86
|
+
Do not paste docs into chat; store them as files.
|
|
87
|
+
|
|
88
|
+
1) **Official docs (Context7 MCP)** for the detected key libraries/frameworks
|
|
89
|
+
2) **Tutorials/guides (WebSearch + WebFetch)** for practical patterns
|
|
90
|
+
3) **Examples/case studies (WebSearch + WebFetch)** similar to this requirement
|
|
91
|
+
4) Write short per-source notes at top of each saved file:
|
|
92
|
+
- What it answers
|
|
93
|
+
- What it recommends
|
|
94
|
+
- Any caveats
|
|
95
|
+
|
|
96
|
+
If planUrls exist:
|
|
97
|
+
- Fetch each URL and store content under `research/mcp/YYYYMMDD/guides/plan-*.md` (or `tutorials/` if more appropriate).
|
|
98
|
+
|
|
99
|
+
### Step 4: Write `research/research-summary.md`
|
|
100
|
+
Use `.claude/docs/templates/RESEARCH_TEMPLATE.md` as the format baseline.
|
|
101
|
+
- Create **at least 3** Decision blocks `### R001`, `### R002`, `### R003`.
|
|
102
|
+
- Each decision must cite sources under `research/` (internal or external).
|
|
103
|
+
- Add unresolved questions only when genuinely blocked.
|
|
104
|
+
|
|
105
|
+
### Step 5: Generate & Fill `tasks.json`
|
|
106
|
+
- Run:
|
|
107
|
+
- `bash .claude/scripts/generate-research-tasks.sh "${reqDir}"`
|
|
108
|
+
- Ensure `tasks.json` contains at least **1** task.
|
|
109
|
+
- If the generator produced 0 tasks, append baseline tasks matching your decision blocks (`R001..R003`).
|
|
110
|
+
- Fill each task's `decision`, `rationale`, `alternatives` based on `research-summary.md`.
|
|
111
|
+
- Prefer using `bash .claude/scripts/populate-research-tasks.sh "${reqDir}"` if it matches the ID format.
|
|
112
|
+
|
|
113
|
+
### Step 6: Consolidate & Validate
|
|
114
|
+
- Run:
|
|
115
|
+
- `bash .claude/scripts/consolidate-research.sh "${reqDir}"`
|
|
116
|
+
- `bash .claude/scripts/validate-research.sh "${reqDir}" --strict`
|
|
117
|
+
- If validation fails:
|
|
118
|
+
- Fix the files (do not weaken validation).
|
|
119
|
+
- Re-run validation until it passes.
|
|
120
|
+
|
|
121
|
+
## Return Format (chat output)
|
|
122
|
+
|
|
123
|
+
Return ONLY:
|
|
124
|
+
- 3–6 bullet decisions (R001..), one line each
|
|
125
|
+
- Paths created/updated
|
|
126
|
+
- Any unresolved questions (≤5)
|
|
127
|
+
|
|
128
|
+
Never paste long fetched content.
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
**[PROTOCOL]**: 变更时更新此头部,然后检查 CLAUDE.md
|
|
@@ -219,85 +219,53 @@ Red Flags - STOP:
|
|
|
219
219
|
|
|
220
220
|
---
|
|
221
221
|
|
|
222
|
-
### Stage 2.5: Research (
|
|
222
|
+
### Stage 2.5: Research (Subagent Mandatory)
|
|
223
223
|
|
|
224
|
-
**目标**:
|
|
224
|
+
**目标**: 研究默认必跑,但将“研究型内容”隔离到 subagent,避免主会话上下文耗尽。
|
|
225
225
|
|
|
226
|
-
**
|
|
226
|
+
**Iron Law**: 大内容落盘,主会话只返回「决策摘要 + 文件路径」。
|
|
227
227
|
|
|
228
|
-
|
|
229
|
-
原则 1: 大内容存文件
|
|
230
|
-
→ 抓取的文档存 research/mcp/$(date +%Y%m%d)/
|
|
231
|
-
→ 上下文只保留路径引用
|
|
232
|
-
→ 避免塞满上下文窗口
|
|
233
|
-
|
|
234
|
-
原则 2: 决策前读取
|
|
235
|
-
→ 每次做研究决策前,先读 research/research.md Decisions 章节
|
|
236
|
-
→ 确保不重复已有决策
|
|
237
|
-
→ 注意力刷新,目标回到窗口
|
|
238
|
-
|
|
239
|
-
原则 3: 失败尝试记录
|
|
240
|
-
→ 研究中放弃的方案写入 research/attempts/
|
|
241
|
-
→ 说明放弃原因和学习(见 ATTEMPT_TEMPLATE 格式)
|
|
242
|
-
→ 失败是学习数据,不要隐藏
|
|
243
|
-
|
|
244
|
-
原则 4: 增量追加
|
|
245
|
-
→ 使用 append 而非 rewrite
|
|
246
|
-
→ 保持研究历史完整
|
|
247
|
-
→ 避免覆盖已有信息
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
```
|
|
251
|
-
S0: Internal Codebase Research (必需)
|
|
252
|
-
→ 分析现有代码库,生成 research/internal/codebase-overview.md
|
|
228
|
+
#### ✅ Mandatory: Call `flow-researcher` Subagent
|
|
253
229
|
|
|
254
|
-
|
|
255
|
-
1. Official Documentation (Context7)
|
|
256
|
-
2. Domain Tutorials (Web Search)
|
|
257
|
-
3. Core Materials (WebFetch)
|
|
258
|
-
4. Case Studies/Examples (Web Search + WebFetch)
|
|
259
|
-
5. Summary & Recommendations
|
|
230
|
+
> subagent 负责内部/外部研究、落盘、任务回填、研究整合与质量验证;主 agent 只做编排与最终 Gate。
|
|
260
231
|
|
|
261
|
-
|
|
232
|
+
```
|
|
233
|
+
Task tool call:
|
|
234
|
+
description: "Run mandatory research for /flow-init (file-based memory)"
|
|
235
|
+
subagent_type: "flow-researcher"
|
|
236
|
+
model: "inherit"
|
|
237
|
+
prompt: (JSON)
|
|
238
|
+
{
|
|
239
|
+
"reqId": "${REQ_ID}",
|
|
240
|
+
"reqDir": "devflow/requirements/${REQ_ID}",
|
|
241
|
+
"title": "${TITLE}",
|
|
242
|
+
"planUrls": ["..."],
|
|
243
|
+
"contextFiles": {
|
|
244
|
+
"brainstorm": "devflow/requirements/${REQ_ID}/BRAINSTORM.md",
|
|
245
|
+
"roadmap": "devflow/ROADMAP.md",
|
|
246
|
+
"architecture": "devflow/ARCHITECTURE.md"
|
|
247
|
+
}
|
|
248
|
+
}
|
|
262
249
|
```
|
|
263
250
|
|
|
264
|
-
|
|
265
|
-
- `research/internal/codebase-overview.md`
|
|
266
|
-
- `research/mcp/$(date +%Y%m%d)
|
|
267
|
-
- `
|
|
268
|
-
- `research/
|
|
269
|
-
- `research/
|
|
270
|
-
- `research/research-summary.md`
|
|
251
|
+
**期望输出** (由 subagent 写入):
|
|
252
|
+
- `devflow/requirements/${REQ_ID}/research/internal/codebase-overview.md`
|
|
253
|
+
- `devflow/requirements/${REQ_ID}/research/mcp/$(date +%Y%m%d)/**`
|
|
254
|
+
- `devflow/requirements/${REQ_ID}/research/research-summary.md`
|
|
255
|
+
- `devflow/requirements/${REQ_ID}/research/tasks.json` (decision/rationale/alternatives 完整)
|
|
256
|
+
- `devflow/requirements/${REQ_ID}/research/research.md` (可通过 validate-research)
|
|
271
257
|
|
|
272
258
|
---
|
|
273
259
|
|
|
274
260
|
### Stage 2.6: Research Consolidation
|
|
275
261
|
|
|
276
|
-
|
|
277
|
-
研究决策整合:
|
|
278
|
-
1. Generate research tasks
|
|
279
|
-
→ Run: {SCRIPT:research_tasks} "${REQ_DIR}"
|
|
280
|
-
→ Output: research/tasks.json
|
|
281
|
-
|
|
282
|
-
2. Populate task decisions
|
|
283
|
-
→ Run: {SCRIPT:populate_tasks} "${REQ_DIR}"
|
|
284
|
-
→ Fill decision/rationale/alternatives from research
|
|
285
|
-
|
|
286
|
-
3. Consolidate research
|
|
287
|
-
→ Run: {SCRIPT:consolidate} "${REQ_DIR}"
|
|
288
|
-
→ Output: research/research.md
|
|
289
|
-
→ Format: Decision/Rationale/Alternatives/Source
|
|
262
|
+
> 该阶段由 `flow-researcher` subagent 执行(包含 tasks 生成/回填/整合/校验)。
|
|
290
263
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
→ 详见 {TEMPLATE:flow} Stage 2.6
|
|
295
|
-
```
|
|
264
|
+
主 agent 在 Exit Gate 中只做最终验证与状态更新:
|
|
265
|
+
- Run: `{SCRIPT:validate_research} "${REQ_DIR}" --strict`
|
|
266
|
+
- `orchestration_status.json.phase0_complete = true`
|
|
296
267
|
|
|
297
268
|
---
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
269
|
### Stage 3: README Generation
|
|
302
270
|
|
|
303
271
|
```
|
|
@@ -317,7 +285,7 @@ Level 1: File Existence Check
|
|
|
317
285
|
→ 验证所有必需文件已创建
|
|
318
286
|
|
|
319
287
|
Level 2: Research.md Structure Validation
|
|
320
|
-
→ Run: {SCRIPT:validate_research} "${REQ_DIR}"
|
|
288
|
+
→ Run: {SCRIPT:validate_research} "${REQ_DIR}" --strict
|
|
321
289
|
→ 检查 research.md 结构
|
|
322
290
|
|
|
323
291
|
Level 3: Research.md Content Quality
|
|
@@ -93,55 +93,32 @@ devflow/requirements/${REQ_ID}/
|
|
|
93
93
|
|
|
94
94
|
---
|
|
95
95
|
|
|
96
|
-
## Stage 2.5: Research (
|
|
96
|
+
## Stage 2.5: Research (Subagent Mandatory)
|
|
97
97
|
|
|
98
|
-
**目标**:
|
|
98
|
+
**目标**: 研究默认必跑,但研究过程必须“隔离上下文”。
|
|
99
99
|
|
|
100
|
-
|
|
101
|
-
```bash
|
|
102
|
-
→ 分析现有代码库
|
|
103
|
-
→ 生成 research/internal/codebase-overview.md
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
### Task 1-5: External Learning Materials (MCP)
|
|
107
|
-
```
|
|
108
|
-
1. Official Documentation (Context7)
|
|
109
|
-
→ research/mcp/$(date +%Y%m%d)/official/
|
|
100
|
+
**规则**: 大内容写入 `research/`,主会话只保留路径引用与决策摘要。
|
|
110
101
|
|
|
111
|
-
|
|
112
|
-
→ research/mcp/$(date +%Y%m%d)/guides/
|
|
102
|
+
### Mandatory: Call `flow-researcher` Subagent
|
|
113
103
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
→ research/mcp/$(date +%Y%m%d)/examples/
|
|
119
|
-
|
|
120
|
-
5. Summary & Recommendations
|
|
121
|
-
→ research/research-summary.md
|
|
104
|
+
```
|
|
105
|
+
Task tool call:
|
|
106
|
+
subagent_type: "flow-researcher"
|
|
107
|
+
prompt: (JSON) reqId/reqDir/title/planUrls/contextFiles
|
|
122
108
|
```
|
|
123
109
|
|
|
110
|
+
**产物** (由 subagent 写入):
|
|
111
|
+
- `research/internal/codebase-overview.md`
|
|
112
|
+
- `research/mcp/$(date +%Y%m%d)/**`
|
|
113
|
+
- `research/research-summary.md`
|
|
114
|
+
- `research/tasks.json`
|
|
115
|
+
- `research/research.md`
|
|
116
|
+
|
|
124
117
|
---
|
|
125
118
|
|
|
126
119
|
## Stage 2.6: Research Consolidation
|
|
127
120
|
|
|
128
|
-
|
|
129
|
-
# 1. Generate research tasks
|
|
130
|
-
bash {SCRIPT:research_tasks} "${REQ_DIR}"
|
|
131
|
-
→ Output: research/tasks.json
|
|
132
|
-
|
|
133
|
-
# 2. Populate task decisions
|
|
134
|
-
bash {SCRIPT:populate_tasks} "${REQ_DIR}"
|
|
135
|
-
→ Fill decision/rationale/alternatives from research
|
|
136
|
-
|
|
137
|
-
# 3. Consolidate research
|
|
138
|
-
bash {SCRIPT:consolidate} "${REQ_DIR}"
|
|
139
|
-
→ Output: research/research.md
|
|
140
|
-
→ Format: Decision/Rationale/Alternatives/Source
|
|
141
|
-
|
|
142
|
-
# 4. Update status
|
|
143
|
-
orchestration_status.json.phase0_complete = true
|
|
144
|
-
```
|
|
121
|
+
> 该阶段由 `flow-researcher` subagent 执行(含 tasks 生成/回填/整合/校验)。
|
|
145
122
|
|
|
146
123
|
---
|
|
147
124
|
|
|
@@ -166,7 +143,7 @@ orchestration_status.json.phase0_complete = true
|
|
|
166
143
|
|
|
167
144
|
### Level 2: Research.md Structure Validation
|
|
168
145
|
```bash
|
|
169
|
-
bash {SCRIPT:validate_research} "${REQ_DIR}"
|
|
146
|
+
bash {SCRIPT:validate_research} "${REQ_DIR}" --strict
|
|
170
147
|
→ 检查 research.md 结构
|
|
171
148
|
```
|
|
172
149
|
|
|
@@ -72,24 +72,44 @@ def extract_task_sections(markdown_content: str) -> List[Dict[str, str]]:
|
|
|
72
72
|
从 research-summary.md 中提取任务章节信息。
|
|
73
73
|
|
|
74
74
|
期望格式:
|
|
75
|
-
###
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
### R001 — 输入框架构重构
|
|
76
|
+
- **Decision**: 全面重构方案
|
|
77
|
+
- **Rationale**:
|
|
78
|
+
- 当前实现仅207行...
|
|
79
|
+
- **Alternatives Considered**:
|
|
80
|
+
- 渐进式增强...
|
|
79
81
|
"""
|
|
80
82
|
sections = []
|
|
81
83
|
current_section = None
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
#
|
|
86
|
-
|
|
87
|
-
#
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
84
|
+
current_field = None
|
|
85
|
+
|
|
86
|
+
# 匹配任务标题(兼容历史 RT-001):
|
|
87
|
+
# - ### R001 — Title
|
|
88
|
+
# - ### R001: Title
|
|
89
|
+
# - ### R001 - Title
|
|
90
|
+
# - ### RT-001: Title (legacy)
|
|
91
|
+
task_header = re.compile(r"^###\s+(?P<id>R\d{3}|RT-\d{3})\s*(?:[:—-])\s*(?P<title>.+)$")
|
|
92
|
+
|
|
93
|
+
# 匹配字段头(兼容是否带 bullet):
|
|
94
|
+
# - - **Decision**: xxx
|
|
95
|
+
# - - **Rationale**:
|
|
96
|
+
# - - **Alternatives Considered**:
|
|
97
|
+
field_header = re.compile(
|
|
98
|
+
r"^(?:[-*]\s*)?\*\*(?P<label>决策|Decision|理由|Rationale|备选方案|Alternatives(?:\s+Considered)?|来源|Source)\*\*:\s*(?P<value>.*)$"
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
def normalize_task_id(raw: str) -> str:
|
|
102
|
+
if raw.startswith("RT-"):
|
|
103
|
+
return f"R{raw.split('-', 1)[1]}"
|
|
104
|
+
return raw
|
|
105
|
+
|
|
106
|
+
def normalize_list_item(line: str) -> str:
|
|
107
|
+
line = line.strip()
|
|
108
|
+
line = re.sub(r"^[-*]\s+", "", line)
|
|
109
|
+
return line.strip()
|
|
91
110
|
|
|
92
111
|
for line in markdown_content.splitlines():
|
|
112
|
+
raw_line = line
|
|
93
113
|
line = line.strip()
|
|
94
114
|
|
|
95
115
|
# 检测新任务章节
|
|
@@ -97,9 +117,10 @@ def extract_task_sections(markdown_content: str) -> List[Dict[str, str]]:
|
|
|
97
117
|
if task_match:
|
|
98
118
|
if current_section:
|
|
99
119
|
sections.append(current_section)
|
|
120
|
+
current_field = None
|
|
100
121
|
current_section = {
|
|
101
|
-
"id": task_match.group(
|
|
102
|
-
"title": task_match.group(
|
|
122
|
+
"id": normalize_task_id(task_match.group("id")),
|
|
123
|
+
"title": task_match.group("title"),
|
|
103
124
|
"decision": "",
|
|
104
125
|
"rationale": "",
|
|
105
126
|
"alternatives": "",
|
|
@@ -109,31 +130,35 @@ def extract_task_sections(markdown_content: str) -> List[Dict[str, str]]:
|
|
|
109
130
|
if not current_section:
|
|
110
131
|
continue
|
|
111
132
|
|
|
112
|
-
#
|
|
113
|
-
|
|
114
|
-
if
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
133
|
+
# 检测字段头
|
|
134
|
+
field_match = field_header.match(line)
|
|
135
|
+
if field_match:
|
|
136
|
+
label = field_match.group("label").strip().lower()
|
|
137
|
+
value = (field_match.group("value") or "").strip()
|
|
138
|
+
|
|
139
|
+
if label in {"来源", "source"}:
|
|
140
|
+
current_field = None
|
|
141
|
+
continue
|
|
142
|
+
if label in {"决策", "decision"}:
|
|
143
|
+
current_field = "decision"
|
|
144
|
+
elif label in {"理由", "rationale"}:
|
|
145
|
+
current_field = "rationale"
|
|
146
|
+
else:
|
|
147
|
+
current_field = "alternatives"
|
|
148
|
+
|
|
149
|
+
if value:
|
|
150
|
+
current_section[current_field] = value
|
|
122
151
|
continue
|
|
123
152
|
|
|
124
|
-
#
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
# 继续累积多行备选方案
|
|
135
|
-
if current_section.get("alternatives") and line and not line.startswith("**"):
|
|
136
|
-
current_section["alternatives"] += " " + line.strip()
|
|
153
|
+
# 累积字段内容(支持列表项)
|
|
154
|
+
if current_field and line:
|
|
155
|
+
item = normalize_list_item(raw_line)
|
|
156
|
+
if not item:
|
|
157
|
+
continue
|
|
158
|
+
if current_section[current_field]:
|
|
159
|
+
current_section[current_field] += "\n" + item
|
|
160
|
+
else:
|
|
161
|
+
current_section[current_field] = item
|
|
137
162
|
|
|
138
163
|
# 添加最后一个章节
|
|
139
164
|
if current_section:
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [2.4.6] - 2026-01-12
|
|
11
|
+
|
|
12
|
+
### flow-init 工作流精简:研究步骤抽离为 subagent
|
|
13
|
+
|
|
14
|
+
将研究型内容从主流程中拆分到独立 subagent,减少上下文消耗,并同步更新命令、模板、脚本与文档。
|
|
15
|
+
|
|
16
|
+
#### Added
|
|
17
|
+
|
|
18
|
+
- **flow-researcher agent** - 执行 `/flow-init` 深度研究并写入 `devflow/requirements/$REQ_ID/research/`
|
|
19
|
+
|
|
20
|
+
#### Changed
|
|
21
|
+
|
|
22
|
+
- **flow-init command** - 重组流程,研究部分改由 subagent 执行
|
|
23
|
+
- **INIT_FLOW_TEMPLATE.md** - 精简初始化模板
|
|
24
|
+
- **populate-research-tasks.sh** - 更新 research tasks 填充逻辑
|
|
25
|
+
- **flow-init docs** - 同步更新中英文文档
|
|
26
|
+
|
|
27
|
+
#### Benefits
|
|
28
|
+
|
|
29
|
+
- **更省上下文**: 主会话仅保留关键决策与路径
|
|
30
|
+
- **更可追溯**: 研究产物落盘,便于审计与复用
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
10
34
|
## [2.4.5] - 2026-01-10
|
|
11
35
|
|
|
12
36
|
### 🛠️ Skills 增强:新增开发辅助工具
|
|
@@ -47,6 +47,9 @@ Stage 1: Prerequisites validation
|
|
|
47
47
|
├─ Check devflow/ directory
|
|
48
48
|
└─ Verify REQ-ID uniqueness
|
|
49
49
|
↓
|
|
50
|
+
Stage 1.2: Git branch creation
|
|
51
|
+
└─ Create feature/REQ-XXX-english-slug branch (model-translated, not pinyin)
|
|
52
|
+
↓
|
|
50
53
|
Stage 1.5: Roadmap & Architecture context loading (NEW)
|
|
51
54
|
├─ Check ROADMAP.md existence
|
|
52
55
|
├─ Locate requirement in roadmap
|
|
@@ -64,13 +67,15 @@ Stage 2: Directory structure creation
|
|
|
64
67
|
├─ Initialize orchestration_status.json
|
|
65
68
|
└─ Create EXECUTION_LOG.md
|
|
66
69
|
↓
|
|
67
|
-
Stage 2.
|
|
68
|
-
|
|
69
|
-
├─ Populate research decisions
|
|
70
|
-
└─ Consolidate research findings
|
|
70
|
+
Stage 2.3: Brainstorming (skill)
|
|
71
|
+
└─ Generate devflow/requirements/REQ-XXX/BRAINSTORM.md as the “North Star”
|
|
71
72
|
↓
|
|
72
|
-
Stage
|
|
73
|
-
|
|
73
|
+
Stage 2.5: Research (subagent, mandatory, context-isolated)
|
|
74
|
+
├─ Run internal codebase research → research/internal/codebase-overview.md
|
|
75
|
+
├─ Capture external sources into files → research/mcp/YYYYMMDD/**
|
|
76
|
+
├─ Produce decisions → research/research-summary.md
|
|
77
|
+
├─ Fill tasks → research/tasks.json (decision/rationale/alternatives)
|
|
78
|
+
└─ Consolidate → research/research.md (validated; no TODO/PLACEHOLDER)
|
|
74
79
|
```
|
|
75
80
|
|
|
76
81
|
## 💡 Examples
|
|
@@ -124,10 +129,9 @@ Stage 3: Git branch creation
|
|
|
124
129
|
|
|
125
130
|
## 📂 Output
|
|
126
131
|
|
|
127
|
-
- `devflow/requirements/REQ-XXX/`
|
|
128
|
-
- `orchestration_status.json`
|
|
129
|
-
-
|
|
130
|
-
- Roadmap and architecture context (if exists)
|
|
132
|
+
- `devflow/requirements/REQ-XXX/` initialized directory (includes `BRAINSTORM.md` + `research/`)
|
|
133
|
+
- `orchestration_status.json` + `EXECUTION_LOG.md`
|
|
134
|
+
- Roadmap and architecture context display (if exists)
|
|
131
135
|
|
|
132
136
|
## 🔗 Related Commands
|
|
133
137
|
|
|
@@ -43,6 +43,9 @@ Stage 1: 前置条件验证
|
|
|
43
43
|
├─ 检查 devflow/ 目录
|
|
44
44
|
└─ 验证 REQ-ID 唯一性
|
|
45
45
|
↓
|
|
46
|
+
Stage 1.2: Git 分支创建
|
|
47
|
+
└─ 创建 feature/REQ-XXX-english-slug 分支(标题英文意译,非拼音)
|
|
48
|
+
↓
|
|
46
49
|
Stage 1.5: 路线图与架构上下文加载(NEW)
|
|
47
50
|
├─ 检查 ROADMAP.md 存在性
|
|
48
51
|
├─ 定位需求在路线图中的位置
|
|
@@ -57,17 +60,19 @@ Stage 1.5: 路线图与架构上下文加载(NEW)
|
|
|
57
60
|
↓
|
|
58
61
|
Stage 2: 目录结构创建
|
|
59
62
|
├─ 创建 devflow/requirements/REQ-123/
|
|
60
|
-
├─ 创建子目录
|
|
63
|
+
├─ 创建子目录 research/
|
|
61
64
|
├─ 初始化 orchestration_status.json
|
|
62
65
|
└─ 初始化 EXECUTION_LOG.md
|
|
63
66
|
↓
|
|
64
|
-
Stage 2.
|
|
65
|
-
|
|
66
|
-
├─ 填充研究决策 (populate-research-tasks.sh)
|
|
67
|
-
└─ 整合研究结论 (consolidate-research.sh)
|
|
67
|
+
Stage 2.3: 头脑风暴(skill)
|
|
68
|
+
└─ 生成 devflow/requirements/REQ-XXX/BRAINSTORM.md 作为需求「北极星」
|
|
68
69
|
↓
|
|
69
|
-
Stage
|
|
70
|
-
|
|
70
|
+
Stage 2.5: 调研(subagent,默认必跑,上下文隔离)
|
|
71
|
+
├─ 内部代码库调研 → research/internal/codebase-overview.md
|
|
72
|
+
├─ 外部资料落盘 → research/mcp/YYYYMMDD/**
|
|
73
|
+
├─ 决策摘要 → research/research-summary.md
|
|
74
|
+
├─ 任务回填 → research/tasks.json(decision/rationale/alternatives 完整)
|
|
75
|
+
└─ 研究整合 → research/research.md(通过校验,无 TODO/PLACEHOLDER)
|
|
71
76
|
```
|
|
72
77
|
|
|
73
78
|
## 💡 示例
|
|
@@ -129,7 +134,6 @@ Stage 3: Git 分支创建
|
|
|
129
134
|
devflow/requirements/REQ-123/
|
|
130
135
|
├── orchestration_status.json # 状态管理
|
|
131
136
|
├── EXECUTION_LOG.md # 审计轨迹
|
|
132
|
-
├── tasks/ # 任务产物目录
|
|
133
137
|
├── research/ # 研究材料目录
|
|
134
138
|
└── (等待后续阶段生成其他文档)
|
|
135
139
|
```
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1766046071 Edit /Users/dimon/001Area/80-CodeWorld/002-devflow/cc-devflow/package.json root
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
root
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1768013595 Edit /Users/dimon/001Area/80-CodeWorld/002-devflow/cc-devflow/package.json root
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1766132827 Edit /Users/dimon/001Area/80-CodeWorld/002-devflow/cc-devflow/package.json root
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1766112103 Edit /Users/dimon/001Area/80-CodeWorld/002-devflow/cc-devflow/.gitignore root
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
root
|