cc-devflow 4.1.4 → 4.1.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.
Files changed (128) hide show
  1. package/.claude/CLAUDE.md +87 -1183
  2. package/.claude/commands/core/architecture.md +2 -2
  3. package/.claude/commands/core/guidelines.md +2 -2
  4. package/.claude/commands/core/roadmap.md +4 -4
  5. package/.claude/commands/core/style.md +40 -268
  6. package/.claude/commands/flow/CLAUDE.md +28 -0
  7. package/.claude/commands/flow/archive.md +2 -2
  8. package/.claude/commands/flow/checklist.md +9 -251
  9. package/.claude/commands/flow/clarify.md +9 -127
  10. package/.claude/commands/flow/constitution.md +1 -1
  11. package/.claude/commands/flow/context.md +1 -1
  12. package/.claude/commands/flow/dev.md +19 -395
  13. package/.claude/commands/flow/fix.md +1 -6
  14. package/.claude/commands/flow/ideate.md +13 -13
  15. package/.claude/commands/flow/init.md +19 -41
  16. package/.claude/commands/flow/new.md +12 -268
  17. package/.claude/commands/flow/quality.md +10 -153
  18. package/.claude/commands/flow/release.md +18 -131
  19. package/.claude/commands/flow/restart.md +15 -16
  20. package/.claude/commands/flow/spec.md +14 -164
  21. package/.claude/commands/flow/status.md +12 -12
  22. package/.claude/commands/flow/update.md +4 -4
  23. package/.claude/commands/flow/upgrade.md +6 -6
  24. package/.claude/commands/flow/verify.md +19 -78
  25. package/.claude/commands/flow/workspace.md +3 -20
  26. package/.claude/docs/guides/INIT_TROUBLESHOOTING.md +7 -7
  27. package/.claude/docs/guides/NEW_TROUBLESHOOTING.md +44 -96
  28. package/.claude/docs/guides/ROADMAP_TROUBLESHOOTING.md +1 -1
  29. package/.claude/docs/guides/TASK_COMPLETION_MARKING.md +5 -5
  30. package/.claude/docs/guides/TEAM_MODE_GUIDE.md +0 -1
  31. package/.claude/docs/templates/ATTEMPT_TEMPLATE.md +1 -1
  32. package/.claude/docs/templates/BACKLOG_TEMPLATE.md +3 -3
  33. package/.claude/docs/templates/CLARIFICATION_REPORT_TEMPLATE.md +5 -5
  34. package/.claude/docs/templates/ERROR_LOG_TEMPLATE.md +2 -2
  35. package/.claude/docs/templates/INIT_FLOW_TEMPLATE.md +3 -3
  36. package/.claude/docs/templates/NEW_ORCHESTRATION_TEMPLATE.md +33 -64
  37. package/.claude/docs/templates/RESEARCH_TEMPLATE.md +3 -3
  38. package/.claude/docs/templates/ROADMAP_DIALOGUE_TEMPLATE.md +2 -2
  39. package/.claude/docs/templates/ROADMAP_TEMPLATE.md +2 -2
  40. package/.claude/docs/templates/STYLE_TEMPLATE.md +3 -3
  41. package/.claude/docs/templates/UI_PROTOTYPE_TEMPLATE.md +8 -9
  42. package/.claude/guides/workflow-guides/flow-orchestrator.md +31 -265
  43. package/.claude/hooks/CLAUDE.md +1 -1
  44. package/.claude/hooks/checklist-gate.js +4 -4
  45. package/.claude/hooks/inject-agent-context.ts +2 -2
  46. package/.claude/hooks/teammate-idle-hook.ts +1 -1
  47. package/.claude/rules/devflow-conventions.md +2 -93
  48. package/.claude/scripts/CLAUDE.md +1 -4
  49. package/.claude/scripts/calculate-checklist-completion.sh +2 -2
  50. package/.claude/scripts/check-prerequisites.sh +2 -2
  51. package/.claude/scripts/checklist-errors.sh +4 -4
  52. package/.claude/scripts/common.sh +12 -147
  53. package/.claude/scripts/flow-quality-full.sh +5 -5
  54. package/.claude/scripts/flow-quality-quick.sh +4 -4
  55. package/.claude/scripts/flow-workspace-init.sh +2 -2
  56. package/.claude/scripts/generate-clarification-report.sh +4 -4
  57. package/.claude/scripts/recover-workflow.sh +70 -73
  58. package/.claude/scripts/run-quality-gates.sh +1 -1
  59. package/.claude/scripts/setup-epic.sh +2 -2
  60. package/.claude/scripts/setup-ralph-loop.sh +2 -2
  61. package/.claude/scripts/validate-research.sh +1 -1
  62. package/.claude/scripts/verify-setup.sh +1 -1
  63. package/.claude/skills/cc-devflow-orchestrator/SKILL.md +88 -108
  64. package/.claude/skills/workflow/CLAUDE.md +24 -0
  65. package/.claude/skills/workflow/flow-dev/CLAUDE.md +14 -76
  66. package/.claude/skills/workflow/flow-dev/SKILL.md +29 -67
  67. package/.claude/skills/workflow/flow-dev/context.jsonl +4 -8
  68. package/.claude/skills/workflow/flow-init/SKILL.md +23 -186
  69. package/.claude/skills/workflow/flow-init/assets/RESEARCH_TEMPLATE.md +1 -1
  70. package/.claude/skills/workflow/flow-init/context.jsonl +3 -3
  71. package/.claude/skills/workflow/flow-init/scripts/check-prerequisites.sh +1 -1
  72. package/.claude/skills/workflow/flow-init/scripts/create-requirement.sh +15 -134
  73. package/.claude/skills/workflow/flow-init/scripts/validate-research.sh +1 -1
  74. package/.claude/skills/workflow/flow-release/SKILL.md +20 -110
  75. package/.claude/skills/workflow/flow-release/context.jsonl +5 -7
  76. package/.claude/skills/workflow/flow-spec/CLAUDE.md +15 -101
  77. package/.claude/skills/workflow/flow-spec/SKILL.md +15 -518
  78. package/.claude/skills/workflow/flow-spec/context.jsonl +5 -7
  79. package/.claude/skills/workflow/flow-verify/CLAUDE.md +10 -0
  80. package/.claude/skills/workflow/flow-verify/SKILL.md +53 -0
  81. package/.claude/skills/workflow/flow-verify/context.jsonl +5 -0
  82. package/.claude/skills/workflow.yaml +72 -270
  83. package/CHANGELOG.md +72 -0
  84. package/README.md +91 -69
  85. package/README.zh-CN.md +90 -67
  86. package/bin/harness.js +22 -0
  87. package/docs/commands/README.md +34 -38
  88. package/docs/commands/README.zh-CN.md +34 -36
  89. package/docs/commands/core-roadmap.md +2 -2
  90. package/docs/commands/core-roadmap.zh-CN.md +2 -2
  91. package/docs/commands/core-style.md +29 -381
  92. package/docs/commands/core-style.zh-CN.md +29 -381
  93. package/docs/commands/flow-init.md +10 -10
  94. package/docs/commands/flow-init.zh-CN.md +11 -11
  95. package/docs/commands/flow-new.md +25 -260
  96. package/docs/commands/flow-new.zh-CN.md +26 -257
  97. package/docs/guides/getting-started.md +16 -15
  98. package/docs/guides/getting-started.zh-CN.md +10 -12
  99. package/lib/compiler/__tests__/manifest.test.js +156 -0
  100. package/lib/compiler/__tests__/parser.test.js +21 -0
  101. package/lib/compiler/index.js +17 -1
  102. package/lib/compiler/manifest.js +68 -6
  103. package/lib/compiler/parser.js +5 -0
  104. package/lib/harness/CLAUDE.md +21 -0
  105. package/lib/harness/cli.js +208 -0
  106. package/lib/harness/index.js +16 -0
  107. package/lib/harness/operations/dispatch.js +285 -0
  108. package/lib/harness/operations/init.js +48 -0
  109. package/lib/harness/operations/janitor.js +74 -0
  110. package/lib/harness/operations/pack.js +100 -0
  111. package/lib/harness/operations/plan.js +29 -0
  112. package/lib/harness/operations/release.js +83 -0
  113. package/lib/harness/operations/resume.js +44 -0
  114. package/lib/harness/operations/verify.js +163 -0
  115. package/lib/harness/planner.js +141 -0
  116. package/lib/harness/schemas.js +108 -0
  117. package/lib/harness/store.js +240 -0
  118. package/package.json +9 -1
  119. package/.claude/scripts/flow-workspace-start.sh +0 -217
  120. package/.claude/scripts/flow-workspace-switch.sh +0 -234
  121. package/.claude/skills/domain/using-git-worktrees/SKILL.md +0 -252
  122. package/.claude/skills/domain/using-git-worktrees/assets/SHELL_ALIASES.md +0 -133
  123. package/.claude/skills/domain/using-git-worktrees/context.jsonl +0 -4
  124. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-cleanup.sh +0 -218
  125. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-create.sh +0 -232
  126. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-list.sh +0 -130
  127. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-status.sh +0 -140
  128. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-switch.sh +0 -70
@@ -1,416 +1,40 @@
1
1
  ---
2
2
  name: flow-dev
3
- description: 'Execute development tasks following TDD order. Usage: /flow-dev "REQ-123" [--manual] [--max-iterations N] [--team] [--agents N]'
4
- scripts:
5
- prereq: .claude/scripts/check-prerequisites.sh
6
- check_tasks: .claude/scripts/check-task-status.sh
7
- mark_task: .claude/scripts/mark-task-complete.sh
8
- validate_constitution: .claude/scripts/validate-constitution.sh
9
- verify_gate: .claude/scripts/verify-gate.sh
10
- setup_loop: .claude/scripts/setup-ralph-loop.sh
11
- team_init: .claude/scripts/team-dev-init.sh
12
- parse_tasks: .claude/scripts/parse-task-dependencies.js
13
- detect_conflicts: .claude/scripts/detect-file-conflicts.sh
14
- skills:
15
- tdd: .claude/skills/flow-tdd/SKILL.md
16
- verification: .claude/skills/verification-before-completion/SKILL.md
17
- attention: .claude/skills/flow-attention-refresh/SKILL.md
3
+ description: 'Execute task-manifest with checkpointed parallel dispatch. Usage: /flow:dev "REQ-123" [--parallel 3] [--resume] [--max-retries N]'
4
+ skill: workflow/flow-dev
18
5
  ---
19
6
 
20
- # Flow-Dev - 开发执行命令
7
+ # Flow-Dev Command (Harness Dispatch)
21
8
 
22
- ## TDD Iron Law (新增)
23
-
24
- 参考 `{SKILL:tdd}`:
25
-
26
- ```
27
- NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
28
- ```
29
-
30
- ### TDD Checkpoint
31
-
32
- 在 Phase 2 (Tests) 和 Phase 3 (Implementation) 之间,必须执行:
33
-
34
- ```yaml
35
- ⚠️ TEST VERIFICATION CHECKPOINT:
36
- 1. 运行所有 Phase 2 测试
37
- → npm test (或 quickstart 中的测试命令)
38
-
39
- 2. 验证所有新测试 FAIL
40
- → 如果任何测试 PASS → STOP
41
- → 通过的测试 = 无效测试或代码已存在
42
-
43
- 3. 只有全部 FAIL 后才能进入 Phase 3
44
-
45
- 4. 如果已经写了实现代码:
46
- → DELETE 代码
47
- → 重新从 failing tests 开始
48
- ```
49
-
50
- ### Rationalization Prevention
51
-
52
- | Excuse | Reality |
53
- |--------|---------|
54
- | "Tests are ready, let's implement" | Run tests first. Verify they FAIL. |
55
- | "I'll run tests after implementation" | That's testing-after, not TDD. |
56
- | "Test passed, that's good" | Test passing before implementation = invalid test. |
57
- | "Just this once" | No exceptions. TDD is non-negotiable. |
9
+ > 触发入口:执行细节由 `.claude/skills/workflow/flow-dev/SKILL.md` 定义。
58
10
 
59
11
  ## User Input
12
+
60
13
  ```text
61
- $ARGUMENTS = "REQ_ID? [--task T###] [--manual] [--max-iterations N] [--team] [--agents N]"
14
+ $ARGUMENTS = "REQ_ID [--parallel N] [--resume] [--max-retries N]"
62
15
  ```
63
16
 
64
- - **REQ_ID**: 未提供时从当前分支或 `DEVFLOW_REQ_ID` 推断
65
- - **--task T###**: 指定起始任务(从该任务开始执行)
66
- - **--manual**: Manual模式,遇错停止等待人工修复(向后兼容)
67
- - **--max-iterations N**: Autonomous模式最大迭代次数(默认10)
68
- - **--team**: Team模式,启用多 Agent 并行执行 [NEW: v4.7]
69
- - **--agents N**: Team模式下的 Agent 数量(默认3,范围2-5)[NEW: v4.7]
70
-
71
- **默认行为**: Autonomous模式(自动重试直到完成)
72
-
73
- ### 运行模式对比
17
+ ## Usage
74
18
 
75
- | | Manual模式 | Autonomous模式(默认) | Team模式 [NEW] |
76
- |--|------------|----------------------|----------------|
77
- | 触发方式 | `--manual` | 默认 | `--team` |
78
- | 遇到错误 | 停止,等待人工修复 | 自动重试 | 分布式重试 |
79
- | 并行执行 | 否 | 否 | 是(多 Agent) |
80
- | 注意力刷新 | Protocol 2 | Protocol 2+3+4 | 每 Agent 独立 |
81
- | 适用场景 | 复杂需求 | 清晰需求 | 大量并行任务 |
82
- | 退出条件 | 任务失败可停止 | 迭代直到完成 | 所有 Agent 完成 |
83
-
84
- **示例**:
85
19
  ```bash
86
- /flow-dev "REQ-123" # Autonomous模式,max 10 iterations
87
- /flow-dev "REQ-123" --max-iterations 20 # Autonomous模式,max 20 iterations
88
- /flow-dev "REQ-123" --manual # Manual模式,遇错停止
89
- /flow-dev "REQ-123" --task T005 # 从 T005 开始(Autonomous模式)
90
- /flow-dev "REQ-123" --task T005 --manual # 从 T005 开始(Manual模式)
91
- /flow-dev "REQ-123" --team # Team模式,3 个 Agent 并行
92
- /flow-dev "REQ-123" --team --agents 5 # Team模式,5 个 Agent 并行
93
- ```
94
-
95
- ## 执行流程
96
-
97
- ### 阶段 1: Entry Gate
98
- ```
99
- 1. 解析参数
100
- → Parse: REQ_ID, --task, --manual, --max-iterations, --team, --agents
101
- → If REQ_ID not provided: run {SCRIPT:prereq} --json --paths-only
102
- → Determine mode:
103
- • --team flag present → Team mode
104
- • --manual flag present → Manual mode
105
- • Otherwise → Autonomous mode (default max_iterations = 10)
106
-
107
- 2. 校验资产
108
- → 必须存在(/flow-tech 产物):
109
- • TECH_DESIGN.md (技术方案总纲)
110
- • research/codebase-tech-analysis.md (代码库技术分析)
111
- • data-model.md (数据模型定义)
112
- • contracts/ (API 契约目录,至少 1 个文件)
113
- • quickstart.md (快速启动指南)
114
- → 必须存在(/flow-epic 产物):
115
- • EPIC.md (Epic 规划文档)
116
- • TASKS.md (任务分解清单)
117
- → 状态校验:
118
- • orchestration_status.status ∈ {"epic_complete", "development_in_progress"}
119
- • phase0_complete == true (研究阶段完成)
120
- • phase1_complete == true (技术设计完成)
121
-
122
- 3. TASKS 结构校验
123
- → Phase 顺序: Setup → Foundational → Phase 2 Tests First → ⚠️ Test Verification → Phase 3 Core Implementation → ...
124
- → 任务格式 `- [ ] T### [P?] [US?] Description (path)`
125
-
126
- 4. 模式初始化
127
- → If Team mode:
128
- • Run: {SCRIPT:team_init} init "${REPO_ROOT}" "${REQ_ID}" ${NUM_AGENTS}
129
- • Analyze tasks: {SCRIPT:team_init} analyze "${REPO_ROOT}" "${REQ_ID}"
130
- • Check conflicts: {SCRIPT:team_init} conflicts "${REPO_ROOT}" "${REQ_ID}"
131
- • Assign tasks: {SCRIPT:team_init} assign "${REPO_ROOT}" "${REQ_ID}" ${NUM_AGENTS}
132
- • Log to EXECUTION_LOG.md: "Starting Team mode with N agents"
133
- → If Autonomous mode:
134
- • Run: {SCRIPT:setup_loop} "${REQ_ID}" --max-iterations ${MAX_ITERATIONS}
135
- • Creates .claude/ralph-loop.local.md (state file for Stop Hook)
136
- • Creates ERROR_LOG.md if not exists
137
- • Log to EXECUTION_LOG.md: "Starting Autonomous mode"
138
- → If Manual mode:
139
- • Log to EXECUTION_LOG.md: "Starting Manual mode"
140
-
141
- 5. 起始任务
142
- → Run: {SCRIPT:check_tasks} --json
143
- → 若指定 --task,验证任务存在且未完成
144
- → 记录下一任务 ID
145
- ```
146
-
147
- ### 阶段 2: Quickstart 与风格指南加载
20
+ /flow:dev "REQ-123"
21
+ /flow:dev "REQ-123" --parallel 3
22
+ /flow:dev "REQ-123" --resume --max-retries 2
148
23
  ```
149
- 1. 读取 quickstart.md
150
- → 获取环境变量、依赖安装、测试命令
151
-
152
- 2. 读取 STYLE.md(如存在)
153
- → 检查 devflow/STYLE.md 文件
154
- → 如存在:
155
- • 加载设计风格指南(颜色、字体、间距、组件样式等)
156
- • 所有前端代码生成必须遵循 STYLE.md 定义的风格
157
- • 特别注意:
158
- - 颜色使用(使用 CSS Variables 或 Tailwind classes 引用 STYLE.md 定义)
159
- - 字体使用(字体族、字阶、行高、字重等必须符合 STYLE.md)
160
- - 间距使用(padding, margin, gap 必须使用 STYLE.md 的间距系统)
161
- - 组件结构(Button, Card, Input 等必须遵循 STYLE.md 的组件规范)
162
- - 阴影、圆角、动画、透明度等(必须遵循 STYLE.md)
163
- • 在 EXECUTION_LOG.md 记录 STYLE.md 版本和使用情况
164
- → 如不存在:
165
- • 使用项目现有的样式约定(如有)
166
- • 建议用户运行 /flow-style 建立项目设计标准
167
24
 
168
- 3. 如果首次运行:
169
- → 执行 quickstart 中的 setup 命令
25
+ ## Internal Execution
170
26
 
171
- 4. EXECUTION_LOG.md 记录 quickstart 版本 + STYLE.md 版本(如有)
172
- ```
173
-
174
- ### 阶段 3: 执行循环
27
+ - Normal: `npm run harness:dispatch -- --change-id <REQ_ID> --parallel <N> [--max-retries <N>]`
28
+ - Resume: `npm run harness:resume -- --change-id <REQ_ID> --parallel <N> [--max-retries <N>]`
175
29
 
176
- **Team 模式循环** (--team) [NEW: v4.7]:
177
- ```
178
- ┌──────────────────────────────────────────────────────────────────┐
179
- │ Team Mode Execution Flow │
180
- ├──────────────────────────────────────────────────────────────────┤
181
- │ │
182
- │ 1. 任务分析与分配 │
183
- │ → Run: {SCRIPT:team_init} analyze "${REPO_ROOT}" "${REQ_ID}" │
184
- │ → Run: {SCRIPT:team_init} conflicts "${REPO_ROOT}" "${REQ_ID}"│
185
- │ → Run: {SCRIPT:team_init} assign "${REPO_ROOT}" "${REQ_ID}" N │
186
- │ │
187
- │ 2. 并行执行 │
188
- │ → 每个 Agent 独立执行分配的任务 │
189
- │ → 文件冲突的任务分配给同一 Agent 串行执行 │
190
- │ → 无冲突的任务可并行执行 │
191
- │ │
192
- │ 3. 任务完成处理 │
193
- │ → TeammateIdle Hook 验证任务完成 │
194
- │ → 验证通过 → 标记完成,分配下一任务 │
195
- │ → 验证失败 → 继续修复 │
196
- │ │
197
- │ 4. 阶段转换 │
198
- │ → 当前阶段所有任务完成 → 进入下一阶段 │
199
- │ → 重新分析任务并行性和冲突 │
200
- │ │
201
- │ 5. 完成条件 │
202
- │ → 所有任务完成 → 所有 Agent shutdown │
203
- │ → 更新 orchestration_status.json │
204
- │ │
205
- └──────────────────────────────────────────────────────────────────┘
30
+ ## Output
206
31
 
207
- Task Assignment Strategy:
208
- ┌─────────────────────────────────────────────────────────────────┐
209
- 1. 解析 TASKS.md 获取当前阶段任务 │
210
- │ → node {SCRIPT:parse_tasks} next TASKS.md │
211
- │ │
212
- │ 2. 检测文件冲突 │
213
- │ → {SCRIPT:detect_conflicts} < tasks.json │
214
- │ │
215
- │ 3. 分配策略 │
216
- │ → 有冲突: 冲突任务分配给同一 Agent │
217
- │ → 无冲突: Round-robin 分配给各 Agent │
218
- │ │
219
- │ 4. 输出分配计划 │
220
- │ { │
221
- │ "assignments": [ │
222
- │ {"agent": "dev-1", "tasks": ["T001", "T002"]}, │
223
- │ {"agent": "dev-2", "tasks": ["T003"]}, │
224
- │ {"agent": "dev-3", "tasks": ["T004"]} │
225
- │ ], │
226
- │ "hasConflicts": false │
227
- │ } │
228
- └─────────────────────────────────────────────────────────────────┘
32
+ - `devflow/requirements/<REQ_ID>/task-manifest.json` (状态更新)
33
+ - `.harness/runtime/<REQ_ID>/<TASK_ID>/events.jsonl`
34
+ - `.harness/runtime/<REQ_ID>/<TASK_ID>/checkpoint.json`
229
35
 
230
- Conflict Resolution:
231
- ┌─────────────────────────────────────────────────────────────────┐
232
- │ 文件冲突检测示例: │
233
- │ │
234
- │ Input: │
235
- │ T001 [P] 修改 src/user.ts │
236
- │ T002 [P] 修改 src/user.ts │
237
- │ T003 [P] 修改 src/order.ts │
238
- │ │
239
- │ Output: │
240
- │ { │
241
- │ "hasConflicts": true, │
242
- │ "conflicts": [ │
243
- │ {"file": "src/user.ts", "tasks": ["T001", "T002"]} │
244
- │ ], │
245
- │ "safeGroups": [{"tasks": ["T003"]}] │
246
- │ } │
247
- │ │
248
- │ Assignment: │
249
- │ dev-1: T001, T002 (串行,因为冲突) │
250
- │ dev-2: T003 (独立) │
251
- └─────────────────────────────────────────────────────────────────┘
252
- ```
253
-
254
- **Manual 模式循环** (--manual):
255
- ```
256
- For each remaining task (顺序严格遵循 TASKS.md):
257
-
258
- **注意力刷新** (参见 {SKILL:attention} Protocol 2):
259
- → Read: TASKS.md 当前任务 T### 段落 + DoD
260
- → Read: quickstart.md 相关命令
261
- → Focus: 这个任务的验收标准是什么?
262
- → Then: 开始执行任务
263
-
264
- 1. 读取任务定义
265
- → 提取 task id、phase、文件路径、是否 [P]
266
-
267
- 2. 执行策略
268
- - Phase 2 (测试任务):
269
- • 根据 contracts/ 生成 contract/integration tests
270
- • 每个测试必须 FAIL (使用 quickstart 的 test 命令)
271
- - Phase 3 (实现任务):
272
- • 依据 data-model.md、TECH_DESIGN.md、contracts/ 实现代码
273
- • 运行相关测试 (quickstart) 确认 PASS
274
- - 后续 Phase:
275
- • 按任务描述(安全、性能、文档等)完成
276
-
277
- 3. 验证 DoD
278
- → 测试失败/成功状态符合阶段要求
279
- → 文件路径与任务描述一致
280
-
281
- 4. 错误处理 (Manual 模式)
282
- → 遇到错误 → 停止执行
283
- → 提示用户修复问题
284
- → 可选:记录到 ERROR_LOG.md
285
-
286
- 5. 标记完成 (CRITICAL)
287
- → Run: {SCRIPT:mark_task} T### (MANDATORY)
288
- → 必须执行此脚本将 TASKS.md 中的 [ ] update 为 [x]
289
- → 如果不执行此脚本,Check Tasks 将认为任务未完成并导致死循环
290
- → Git 提交 (一任务一提交)
291
- ```
292
-
293
- **Autonomous 模式循环** (默认):
294
- ```
295
- FOR iteration in 1..max_iterations:
296
-
297
- ┌──────────────────────────────────────────────────────┐
298
- │ Step A: 注意力刷新 (Protocol 2 + Protocol 3) │
299
- ├──────────────────────────────────────────────────────┤
300
- │ → Read: TASKS.md 第一个未完成任务 `- [ ]` │
301
- │ → Read: ERROR_LOG.md 最近 5 条记录(如存在) │
302
- │ → Read: quickstart.md 相关命令 │
303
- │ → Focus: 下一步行动 + 避免重复错误 │
304
- └──────────────────────────────────────────────────────┘
305
-
306
- ┌──────────────────────────────────────────────────────┐
307
- │ Step B: 执行任务 (TDD 方式) │
308
- ├──────────────────────────────────────────────────────┤
309
- │ → 提取任务 ID, phase, 文件路径 │
310
- │ → 遵循 {SKILL:tdd} 执行 │
311
- │ → Phase 2: 写测试,验证 FAIL │
312
- │ → Phase 3: 写实现,验证 PASS │
313
- │ → 后续 Phase: 按任务描述完成 │
314
- └──────────────────────────────────────────────────────┘
315
-
316
- ┌──────────────────────────────────────────────────────┐
317
- │ Step C: 错误处理 (Autonomous 自动重试) │
318
- ├──────────────────────────────────────────────────────┤
319
- │ IF test fails OR build error: │
320
- │ → Record error to ERROR_LOG.md (强制) │
321
- │ → Apply Protocol 4 (Error Recovery) │
322
- │ → Analyze root cause │
323
- │ → Fix and re-run tests │
324
- │ → Update ERROR_LOG.md with resolution │
325
- │ ELSE: │
326
- │ → Task succeeded │
327
- │ → Run: {SCRIPT:mark_task} T### (CRITICAL: MUST RUN)│
328
- │ → NEVER skip this step. Task is NOT done until marked.│
329
- │ → Git commit (one task per commit) │
330
- └──────────────────────────────────────────────────────┘
331
-
332
- ┌──────────────────────────────────────────────────────┐
333
- │ Step D: 完成检查 │
334
- ├──────────────────────────────────────────────────────┤
335
- │ → Run: {SCRIPT:check_tasks} --json │
336
- │ → IF remaining_tasks == 0: │
337
- │ → Output "AUTONOMOUS_COMPLETE" │
338
- │ → BREAK (Exit loop successfully) │
339
- │ → ELSE IF iteration == max_iterations: │
340
- │ → Output status report │
341
- │ → BREAK (Reached limit) │
342
- │ → ELSE: │
343
- │ → Continue to next iteration │
344
- │ → Stop Hook will re-inject same prompt │
345
- └──────────────────────────────────────────────────────┘
346
-
347
- END FOR
348
-
349
- Note: Stop Hook (.claude/hooks/ralph-stop-hook.sh) 会在 Autonomous 模式下:
350
- • 检测 .claude/ralph-loop.local.md 存在
351
- • 阻止退出,重新注入任务继续 prompt
352
- • 直到 remaining_tasks == 0 或达到 max_iterations
353
- ```
354
-
355
- ### 阶段 4: Exit Gate
356
- ```
357
- 1. 所有任务完成?
358
- → {SCRIPT:check_tasks} --json 确认 remaining=0
359
-
360
- 2. 清理 Autonomous 状态文件(如存在)
361
- → rm .claude/ralph-loop.local.md
362
-
363
- 3. 代码质量
364
- → 运行 quickstart 中全量测试命令
365
- → 可选: {SCRIPT:validate_constitution} --type dev --severity warning
366
-
367
- 4. 状态更新
368
- → orchestration_status:
369
- status = "development_complete"
370
- completedSteps append "dev"
371
- → EXECUTION_LOG.md 记录完成
372
- ```
373
-
374
- ## 运行提示
375
- - **默认 Autonomous 模式**: 遇错自动重试,无需人工干预
376
- - **使用 `--manual` 退出**: 适合需要人工判断的复杂场景
377
- - **使用 `--team` 并行**: 适合大量可并行任务的需求 [NEW: v4.7]
378
- - **使用 `/cancel-ralph` 停止**: 紧急停止 Autonomous 循环
379
- - 始终使用 quickstart 中提供的命令(测试、lint、db migrate 等)
380
- - Phase 2 的所有测试必须在实现前失败;若某测试直接通过,回滚并修正
381
- - 遵循 TASKS.md 标注的 `[P]` 表示可并行,Team 模式下会真正并行执行
382
- - 如需恢复,可使用 `/flow-dev --task TXYZ` 指向首个未完成任务
383
-
384
- ## 错误处理
385
-
386
- **Manual 模式**:
387
- - 缺少资产 → 引导用户先运行 `/flow-tech` 或 `/flow-epic`
388
- - quickstart 命令失败 → 输出日志路径,要求修复环境后重试
389
- - 任务执行失败 → 保留当前状态,停止执行,等待人工修复
390
-
391
- **Autonomous 模式**:
392
- - 缺少资产 → 同 Manual 模式(Entry Gate 阻止)
393
- - quickstart 命令失败 → 记录 ERROR_LOG.md,分析根因,自动修复,重试
394
- - 任务执行失败 → 记录 ERROR_LOG.md,Protocol 4 刷新注意力,自动重试
395
- - 达到 max_iterations → 输出状态报告(已完成/剩余任务),保持 development_in_progress
396
- - 紧急停止 → 使用 `/cancel-ralph` 删除状态文件,立即终止循环
397
-
398
- **Team 模式** [NEW: v4.7]:
399
- - 缺少资产 → 同 Manual 模式(Entry Gate 阻止)
400
- - 文件冲突 → 自动检测并分配给同一 Agent 串行执行
401
- - Agent 任务失败 → TeammateIdle Hook 触发重试
402
- - 所有 Agent 空闲但任务未完成 → 重新分配任务
403
- - 紧急停止 → 清理 Team 状态,所有 Agent shutdown
404
-
405
- ## 取消 Autonomous 循环
36
+ ## Next Step
406
37
 
407
38
  ```bash
408
- /cancel-ralph
409
- # 检查 .claude/ralph-loop.local.md 存在性
410
- # 删除状态文件,Stop Hook 将允许退出
411
- # 输出:Cancelled autonomous loop (was at iteration N)
39
+ /flow:verify "<REQ_ID>"
412
40
  ```
413
-
414
- ## 下一步
415
- 1. 完成所有任务后运行 `/flow-quality` 进入测试与安全审查(需要深度审查时再加 `--full`)
416
- 2. 若有新技术引入,回到 `research/tasks.json` 补记并通知 planner
@@ -73,14 +73,9 @@ Bug 修复不是猜测游戏。系统化调试 = 更快修复 + 更少回归。
73
73
  ### 阶段 0: Entry Gate
74
74
  ```
75
75
  1. 解析 BUG_ID、TITLE
76
- → 若 TITLE 含中文/非ASCII,使用模型意译生成 BRANCH_TITLE_EN(英文语义翻译,禁止拼音/音译)
77
- → 若意译不确定或未生成 ASCII 结果,向用户确认英文分支标题
78
76
  2. {SCRIPT:prereq} --json 验证:
79
77
  → devflow/bugs/${BUG_ID}/ 是否存在(首次执行将创建)
80
- Git 工作区干净
81
- 3. 创建目录与分支:
82
- → git checkout -b "bugfix/${BUG_ID}-${slug(BRANCH_TITLE_EN)}"
83
- → 初始化 devflow/bugs/${BUG_ID}/ 结构与 orchestration_status.json
78
+ 3. 初始化 devflow/bugs/${BUG_ID}/ 结构与 orchestration_status.json
84
79
  4. 检查 quickstart.md
85
80
  → 若需求目录已有 quickstart.md,复制引用用于测试执行
86
81
  ```
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: flow-ideate
3
- description: 'Intent-driven requirement development. Usage: /flow-ideate "我想做一个用户管理系统" or /flow-ideate "REQ-123|我想要一个数据分析的东西"'
3
+ description: 'Intent-driven requirement development. Usage: /flow:ideate "我想做一个用户管理系统" or /flow:ideate "REQ-123|我想要一个数据分析的东西"'
4
4
  scripts:
5
5
  prereq: .claude/scripts/check-prerequisites.sh
6
6
  create_requirement: .claude/scripts/create-requirement.sh
@@ -20,17 +20,17 @@ $ARGUMENTS = "REQ_ID?|IDEA|LINKS?"
20
20
 
21
21
  ## 命令格式
22
22
  ```text
23
- /flow-ideate "我想做一个用户管理系统"
24
- /flow-ideate "REQ-123|我想要一个用户管理的东西"
25
- /flow-ideate "|数据分析功能|一些想法和计划链接"
26
- /flow-ideate "REQ-123|支持用户下单|https://plan.example.com/Q1"
23
+ /flow:ideate "我想做一个用户管理系统"
24
+ /flow:ideate "REQ-123|我想要一个用户管理的东西"
25
+ /flow:ideate "|数据分析功能|一些想法和计划链接"
26
+ /flow:ideate "REQ-123|支持用户下单|https://plan.example.com/Q1"
27
27
  ```
28
28
 
29
29
  ## 执行流程
30
30
 
31
31
  ### 阶段 1: 输入解析
32
32
  - 解析 `$ARGUMENTS`:
33
- - 如果匹配 `REQ|TITLE|LINKS` → 跳转 `/flow-new`。
33
+ - 如果匹配 `REQ|TITLE|LINKS` → 进入 `/flow:init`(随后执行 `/flow:spec`)。
34
34
  - 如果包含 `REQ-XXX` 且标题为空 → 视为已有需求再澄清。
35
35
  - 纯自然语言 → 进入意图澄清模式。
36
36
  - 对于新需求生成候选 `REQ-${YYYYMMDD}-${seq}`。
@@ -62,8 +62,8 @@ $ARGUMENTS = "REQ_ID?|IDEA|LINKS?"
62
62
  ```
63
63
 
64
64
  ### 阶段 4: 标准流程对接
65
- - 对于模糊输入:推荐自动触发 `/flow-prd` 或提示用户继续。
66
- - 对于已有 REQ-ID:在 README 中记录追加需求并提示 `/flow-upgrade`。
65
+ - 对于模糊输入:推荐自动触发 `/flow:spec` 或提示用户继续。
66
+ - 对于已有 REQ-ID:在 README 中记录追加需求并提示 `/flow:upgrade`。
67
67
  - 将澄清会话摘要写入 `research/intent-log.md` 供后续引用。
68
68
 
69
69
  ## 错误处理
@@ -80,9 +80,9 @@ $ARGUMENTS = "REQ_ID?|IDEA|LINKS?"
80
80
  ```
81
81
 
82
82
  ## 下一步
83
- - 对新需求执行 `/flow-init "REQ_ID|TITLE"` 完成 Phase0 调研。
84
- - 若是已有需求的变更,使用 `/flow-upgrade` 创建版本升级。
85
- - 通过 `/flow-status REQ_ID --detailed` 查看澄清结果与推荐动作。
83
+ - 对新需求执行 `/flow:init "REQ_ID|TITLE"` 完成初始化。
84
+ - 若是已有需求的变更,使用 `/flow:upgrade` 创建版本升级。
85
+ - 通过 `/flow:status REQ_ID --detailed` 查看澄清结果与推荐动作。
86
86
 
87
87
  ### 3. 这是新系统还是现有系统的改进?
88
88
  **Why this matters**: 影响技术方案和实施策略
@@ -130,7 +130,7 @@ Once you provide these answers, I'll generate more specific questions about功
130
130
 
131
131
  **用户输入**:
132
132
  ```text
133
- /flow-ideate "需要一个数据分析功能来帮助业务决策"
133
+ /flow:ideate "需要一个数据分析功能来帮助业务决策"
134
134
  ```
135
135
 
136
136
  **系统澄清过程**:
@@ -211,4 +211,4 @@ export FLOW_QUESTION_SELECTION_STRATEGY="adaptive"
211
211
 
212
212
  ---
213
213
 
214
- **核心价值**: /flow-ideate 将 cc-devflow 的能力边界从"明确需求的快速实现"扩展到"模糊想法的完整转化",显著降低了使用门槛,支持更多探索性和创新性的开发场景。
214
+ **核心价值**: /flow:ideate 将 cc-devflow 的能力边界从"明确需求的快速实现"扩展到"模糊想法的完整转化",显著降低了使用门槛,支持更多探索性和创新性的开发场景。
@@ -1,60 +1,38 @@
1
1
  ---
2
2
  name: flow-init
3
- description: 'Initialize requirement structure. Usage: /flow-init "REQ-123|Title|URLs"'
3
+ description: 'Initialize requirement context via harness engine. Usage: /flow:init "REQ-123|Title|URLs?"'
4
4
  skill: workflow/flow-init
5
5
  ---
6
6
 
7
- # Flow-Init Command (Trigger Entry)
7
+ # Flow-Init Command (Harness Entry)
8
8
 
9
- > 此文件为触发入口,详细实现见 `.claude/skills/workflow/flow-init/SKILL.md`
9
+ > 触发入口:执行细节由 `.claude/skills/workflow/flow-init/SKILL.md` 定义。
10
10
 
11
- ## Usage
11
+ ## User Input
12
12
 
13
- ```bash
14
- /flow-init "REQ-123|User Authentication"
15
- /flow-init "REQ-124|数据导出|https://docs.example.com/export-spec.md"
16
- /flow-init --interactive
13
+ ```text
14
+ $ARGUMENTS = "REQ_ID|TITLE|PLAN_URLS?"
17
15
  ```
18
16
 
19
- ## Quick Reference
20
-
21
- | Stage | Purpose | Output |
22
- |-------|---------|--------|
23
- | 1 | Entry Gate | 参数验证 |
24
- | 1.2 | Git Worktree (默认) / Branch (--branch-only) | `../{repo}-{REQ_ID}` + `feature|bugfix/{REQ_ID}-{slug}` |
25
- | 1.5 | Context Loading | ROADMAP/ARCHITECTURE |
26
- | 2 | Directory Init | 目录结构 |
27
- | 2.3 | Brainstorming | BRAINSTORM.md |
28
- | 2.5 | Research | research/* |
29
- | 3 | README | README.md |
30
- | 4 | Exit Gate | 5-Level 验证 |
31
-
32
- ## Worktree Naming
33
-
34
- - 默认模式会创建独立 worktree(不是只建分支)。
35
- - 目录命名:`{repo-name}-{REQ_ID}`(示例:`cc-devflow-REQ-123`)。
36
- - 分支命名:
37
- - Requirement: `feature/{REQ_ID}-{slug(title)}`
38
- - Bug: `bugfix/{REQ_ID}-{slug(title)}`
39
- - `--branch-only` 才会退回传统单仓库分支模式。
17
+ ## Usage
40
18
 
41
- ## Session Continuity
19
+ ```bash
20
+ /flow:init "REQ-123|User Auth"
21
+ /flow:init "REQ-124|订单导出|https://plan.example.com/req-124"
22
+ ```
42
23
 
43
- - 需求上下文由 `devflow/requirements/${REQ_ID}/` 下的文档和 `orchestration_status.json` 持久化。
44
- - REQ 识别优先级:`DEVFLOW_REQ_ID` → worktree 目录名 → 当前分支名。
45
- - 进入新会话时,应先进入目标 worktree 目录再继续命令;worktree 路径可按命名规则直接定位,或使用 `using-git-worktrees` 的切换脚本。
24
+ ## Internal Execution
46
25
 
47
- ## Skill Location
26
+ 1. `npm run harness:init -- --change-id <REQ_ID> --goal "Deliver <REQ_ID>: <TITLE>"`
27
+ 2. `npm run harness:pack -- --change-id <REQ_ID>`
48
28
 
49
- **Full Implementation**: `.claude/skills/workflow/flow-init/SKILL.md`
29
+ ## Output
50
30
 
51
- **Resources**:
52
- - Scripts: `.claude/skills/workflow/flow-init/scripts/`
53
- - References: `.claude/skills/workflow/flow-init/references/`
54
- - Assets: `.claude/skills/workflow/flow-init/assets/`
31
+ - `devflow/requirements/<REQ_ID>/context-package.md`
32
+ - `devflow/requirements/<REQ_ID>/harness-state.json`
55
33
 
56
34
  ## Next Step
57
35
 
58
- ```
59
- /flow-prd "${REQ_ID}"
36
+ ```bash
37
+ /flow:spec "<REQ_ID>"
60
38
  ```