cc-devflow 2.4.6 → 4.1.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.
Files changed (191) hide show
  1. package/.claude/CLAUDE.md +1065 -48
  2. package/.claude/agents/dev-implementer.md +195 -0
  3. package/.claude/commands/{flow-archive.md → flow/archive.md} +46 -11
  4. package/.claude/commands/flow/context.md +150 -0
  5. package/.claude/commands/flow/delta.md +245 -0
  6. package/.claude/commands/{flow-dev.md → flow/dev.md} +112 -11
  7. package/.claude/commands/flow/init.md +45 -0
  8. package/.claude/commands/flow/quality.md +159 -0
  9. package/.claude/commands/flow/spec.md +186 -0
  10. package/.claude/commands/flow/workspace.md +146 -0
  11. package/.claude/commands/{cancel-ralph.md → util/cancel-ralph.md} +1 -0
  12. package/.claude/config/quality-gates.yml +305 -0
  13. package/.claude/docs/guides/TEAM_MODE_GUIDE.md +313 -0
  14. package/.claude/docs/templates/DELTA_SPEC_TEMPLATE.md +91 -0
  15. package/.claude/docs/templates/DESIGN_DECISIONS_TEMPLATE.md +151 -0
  16. package/.claude/docs/templates/JOURNAL_TEMPLATE.md +75 -0
  17. package/.claude/docs/templates/_shared/CLAUDE.md +36 -0
  18. package/.claude/docs/templates/_shared/CONSTITUTION_CHECK.md +125 -0
  19. package/.claude/docs/templates/_shared/VALIDATION_CHECKLIST.md +187 -0
  20. package/.claude/docs/templates/_shared/YAML_FRONTMATTER.md +164 -0
  21. package/.claude/docs/templates/context/dev.jsonl.template +6 -0
  22. package/.claude/docs/templates/context/epic.jsonl.template +5 -0
  23. package/.claude/docs/templates/context/prd.jsonl.template +4 -0
  24. package/.claude/docs/templates/context/research.jsonl.template +4 -0
  25. package/.claude/docs/templates/context/review.jsonl.template +5 -0
  26. package/.claude/docs/templates/context/tech.jsonl.template +5 -0
  27. package/.claude/hooks/CLAUDE.md +342 -0
  28. package/.claude/hooks/inject-agent-context.ts +480 -0
  29. package/.claude/hooks/inject-skill-context.ts +359 -0
  30. package/.claude/hooks/ralph-loop.ts +931 -0
  31. package/.claude/hooks/task-completed-hook.ts +593 -0
  32. package/.claude/hooks/teammate-idle-hook.ts +690 -0
  33. package/.claude/hooks/types/team-types.d.ts +238 -0
  34. package/.claude/rules/devflow-conventions.md +82 -9
  35. package/.claude/scripts/archive-requirement.sh +44 -1
  36. package/.claude/scripts/common.sh +670 -3
  37. package/.claude/scripts/delta-parser.ts +527 -0
  38. package/.claude/scripts/detect-file-conflicts.sh +151 -0
  39. package/.claude/scripts/flow-context-add.sh +134 -0
  40. package/.claude/scripts/flow-context-init.sh +133 -0
  41. package/.claude/scripts/flow-context-validate.sh +144 -0
  42. package/.claude/scripts/flow-delta-apply.sh +297 -0
  43. package/.claude/scripts/flow-delta-archive.sh +71 -0
  44. package/.claude/scripts/flow-delta-create.sh +202 -0
  45. package/.claude/scripts/flow-delta-list.sh +142 -0
  46. package/.claude/scripts/flow-delta-status.sh +235 -0
  47. package/.claude/scripts/flow-quality-full.sh +184 -0
  48. package/.claude/scripts/flow-quality-quick.sh +64 -0
  49. package/.claude/scripts/flow-workspace-init.sh +117 -0
  50. package/.claude/scripts/flow-workspace-record.sh +164 -0
  51. package/.claude/scripts/flow-workspace-start.sh +88 -0
  52. package/.claude/scripts/get-workflow-status.sh +415 -0
  53. package/.claude/scripts/parse-task-dependencies.js +334 -0
  54. package/.claude/scripts/record-quality-error.sh +165 -0
  55. package/.claude/scripts/run-quality-gates.sh +242 -0
  56. package/.claude/scripts/team-dev-init.sh +319 -0
  57. package/.claude/scripts/team-state-recovery.sh +229 -0
  58. package/.claude/scripts/workflow-status.ts +433 -0
  59. package/.claude/settings.json +19 -0
  60. package/.claude/skills/cc-devflow-orchestrator/SKILL.md +85 -200
  61. package/.claude/skills/domain/using-git-worktrees/SKILL.md +252 -0
  62. package/.claude/skills/domain/using-git-worktrees/assets/SHELL_ALIASES.md +133 -0
  63. package/.claude/skills/domain/using-git-worktrees/context.jsonl +4 -0
  64. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-cleanup.sh +218 -0
  65. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-create.sh +232 -0
  66. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-list.sh +130 -0
  67. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-status.sh +140 -0
  68. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-switch.sh +70 -0
  69. package/.claude/skills/skill-rules.json +72 -1
  70. package/.claude/skills/utility/journey-checker/SKILL.md +199 -0
  71. package/.claude/skills/utility/journey-checker/pressure-scenarios.md +164 -0
  72. package/.claude/skills/utility/skill-creator/LICENSE.txt +202 -0
  73. package/.claude/skills/utility/skill-creator/SKILL.md +356 -0
  74. package/.claude/skills/utility/skill-creator/references/output-patterns.md +82 -0
  75. package/.claude/skills/utility/skill-creator/references/workflows.md +28 -0
  76. package/.claude/skills/utility/skill-creator/scripts/init_skill.py +303 -0
  77. package/.claude/skills/utility/skill-creator/scripts/package_skill.py +110 -0
  78. package/.claude/skills/utility/skill-creator/scripts/quick_validate.py +95 -0
  79. package/.claude/skills/workflow/flow-dev/CLAUDE.md +78 -0
  80. package/.claude/skills/workflow/flow-dev/SKILL.md +96 -0
  81. package/.claude/skills/workflow/flow-dev/assets/IMPLEMENTATION_PLAN_TEMPLATE.md +71 -0
  82. package/.claude/skills/workflow/flow-dev/context.jsonl +8 -0
  83. package/.claude/skills/workflow/flow-dev/dev-implementer.jsonl +8 -0
  84. package/.claude/skills/workflow/flow-dev/scripts/entry-gate.sh +116 -0
  85. package/.claude/skills/workflow/flow-dev/scripts/exit-gate.sh +101 -0
  86. package/.claude/skills/workflow/flow-dev/scripts/task-orchestrator.sh +106 -0
  87. package/.claude/skills/workflow/flow-fix/SKILL.md +105 -0
  88. package/.claude/skills/workflow/flow-fix/context.jsonl +6 -0
  89. package/.claude/skills/workflow/flow-fix/references/bug-analyzer.md +381 -0
  90. package/.claude/skills/workflow/flow-init/SKILL.md +211 -0
  91. package/.claude/skills/workflow/flow-init/assets/BRAINSTORM_TEMPLATE.md +148 -0
  92. package/.claude/skills/workflow/flow-init/assets/INIT_FLOW_TEMPLATE.md +198 -0
  93. package/.claude/skills/workflow/flow-init/assets/RESEARCH_TEMPLATE.md +276 -0
  94. package/.claude/skills/workflow/flow-init/context.jsonl +5 -0
  95. package/.claude/skills/workflow/flow-init/references/flow-researcher.md +132 -0
  96. package/.claude/skills/workflow/flow-init/scripts/check-prerequisites.sh +232 -0
  97. package/.claude/skills/workflow/flow-init/scripts/consolidate-research.sh +182 -0
  98. package/.claude/skills/workflow/flow-init/scripts/create-requirement.sh +515 -0
  99. package/.claude/skills/workflow/flow-init/scripts/generate-research-tasks.sh +157 -0
  100. package/.claude/skills/workflow/flow-init/scripts/populate-research-tasks.sh +284 -0
  101. package/.claude/skills/workflow/flow-init/scripts/validate-research.sh +332 -0
  102. package/.claude/skills/workflow/flow-quality/SKILL.md +94 -0
  103. package/.claude/skills/workflow/flow-quality/context.jsonl +6 -0
  104. package/.claude/skills/workflow/flow-quality/references/code-quality-reviewer.md +205 -0
  105. package/.claude/skills/workflow/flow-quality/references/qa-tester.md +313 -0
  106. package/.claude/skills/workflow/flow-quality/references/security-reviewer.md +314 -0
  107. package/.claude/skills/workflow/flow-quality/references/spec-reviewer.md +221 -0
  108. package/.claude/skills/workflow/flow-release/SKILL.md +126 -0
  109. package/.claude/skills/workflow/flow-release/context.jsonl +7 -0
  110. package/.claude/skills/workflow/flow-release/references/release-manager.md +295 -0
  111. package/.claude/skills/workflow/flow-spec/CLAUDE.md +103 -0
  112. package/.claude/skills/workflow/flow-spec/SKILL.md +545 -0
  113. package/.claude/skills/workflow/flow-spec/context.jsonl +7 -0
  114. package/.claude/skills/workflow/flow-spec/scripts/entry-gate.sh +194 -0
  115. package/.claude/skills/workflow/flow-spec/scripts/exit-gate.sh +244 -0
  116. package/.claude/skills/workflow/flow-spec/scripts/parallel-orchestrator.sh +205 -0
  117. package/.claude/skills/workflow/flow-spec/scripts/team-communication.sh +353 -0
  118. package/.claude/skills/workflow/flow-spec/scripts/team-init.sh +195 -0
  119. package/.claude/skills/workflow/flow-spec/scripts/test-team-mode.sh +496 -0
  120. package/.claude/skills/workflow/flow-spec/team-config.json +165 -0
  121. package/.claude/skills/workflow.yaml +417 -0
  122. package/CHANGELOG.md +254 -0
  123. package/README.md +193 -33
  124. package/README.zh-CN.md +206 -46
  125. package/lib/compiler/CLAUDE.md +77 -46
  126. package/lib/compiler/__tests__/multi-module-emitters.test.js +508 -0
  127. package/lib/compiler/context-expander.js +179 -0
  128. package/lib/compiler/emitters/antigravity-emitter.js +195 -5
  129. package/lib/compiler/emitters/base-emitter.js +217 -2
  130. package/lib/compiler/emitters/codex-emitter.js +200 -4
  131. package/lib/compiler/emitters/cursor-emitter.js +307 -3
  132. package/lib/compiler/emitters/qwen-emitter.js +196 -4
  133. package/lib/compiler/index.js +197 -2
  134. package/lib/compiler/platforms.js +270 -21
  135. package/package.json +1 -1
  136. package/.claude/commands/flow-epic.md +0 -183
  137. package/.claude/commands/flow-init.md +0 -370
  138. package/.claude/commands/flow-prd.md +0 -144
  139. package/.claude/commands/flow-qa.md +0 -93
  140. package/.claude/commands/flow-review.md +0 -257
  141. package/.claude/commands/flow-tech.md +0 -142
  142. package/.claude/commands/flow-ui.md +0 -189
  143. package/.claude/skills/file-header-guardian/SKILL.md +0 -56
  144. package/.claude/skills/skill-developer/ADVANCED.md +0 -197
  145. package/.claude/skills/skill-developer/HOOK_MECHANISMS.md +0 -306
  146. package/.claude/skills/skill-developer/PATTERNS_LIBRARY.md +0 -152
  147. package/.claude/skills/skill-developer/SKILL.md +0 -426
  148. package/.claude/skills/skill-developer/SKILL_RULES_REFERENCE.md +0 -315
  149. package/.claude/skills/skill-developer/TRIGGER_TYPES.md +0 -305
  150. package/.claude/skills/skill-developer/TROUBLESHOOTING.md +0 -514
  151. package/.claude/skills/writing-skills/SKILL.md +0 -655
  152. package/.claude/skills/writing-skills/anthropic-best-practices.md +0 -1150
  153. package/.claude/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +0 -189
  154. package/.claude/skills/writing-skills/graphviz-conventions.dot +0 -172
  155. package/.claude/skills/writing-skills/persuasion-principles.md +0 -187
  156. package/.claude/skills/writing-skills/render-graphs.js +0 -168
  157. package/.claude/skills/writing-skills/testing-skills-with-subagents.md +0 -384
  158. package/.claude/tsc-cache/795ba6e3-b98a-423b-bab2-51aa62812569/affected-repos.txt +0 -1
  159. package/.claude/tsc-cache/ae335694-be5a-4ba4-a1a0-b676c09a7906/affected-repos.txt +0 -1
  160. /package/.claude/commands/{core-architecture.md → core/architecture.md} +0 -0
  161. /package/.claude/commands/{core-guidelines.md → core/guidelines.md} +0 -0
  162. /package/.claude/commands/{core-roadmap.md → core/roadmap.md} +0 -0
  163. /package/.claude/commands/{core-style.md → core/style.md} +0 -0
  164. /package/.claude/commands/{flow-checklist.md → flow/checklist.md} +0 -0
  165. /package/.claude/commands/{flow-clarify.md → flow/clarify.md} +0 -0
  166. /package/.claude/commands/{flow-constitution.md → flow/constitution.md} +0 -0
  167. /package/.claude/commands/{flow-fix.md → flow/fix.md} +0 -0
  168. /package/.claude/commands/{flow-ideate.md → flow/ideate.md} +0 -0
  169. /package/.claude/commands/{flow-new.md → flow/new.md} +0 -0
  170. /package/.claude/commands/{flow-release.md → flow/release.md} +0 -0
  171. /package/.claude/commands/{flow-restart.md → flow/restart.md} +0 -0
  172. /package/.claude/commands/{flow-status.md → flow/status.md} +0 -0
  173. /package/.claude/commands/{flow-update.md → flow/update.md} +0 -0
  174. /package/.claude/commands/{flow-upgrade.md → flow/upgrade.md} +0 -0
  175. /package/.claude/commands/{flow-verify.md → flow/verify.md} +0 -0
  176. /package/.claude/commands/{code-review-high.md → util/code-review.md} +0 -0
  177. /package/.claude/commands/{git-commit.md → util/git-commit.md} +0 -0
  178. /package/.claude/commands/{problem-analyzer.md → util/problem-analyzer.md} +0 -0
  179. /package/.claude/skills/{flow-attention-refresh → domain/attention-refresh}/SKILL.md +0 -0
  180. /package/.claude/skills/{flow-brainstorming → domain/brainstorming}/SKILL.md +0 -0
  181. /package/.claude/skills/{flow-debugging → domain/debugging}/SKILL.md +0 -0
  182. /package/.claude/skills/{flow-finishing-branch → domain/finishing-branch}/SKILL.md +0 -0
  183. /package/.claude/skills/{flow-receiving-review → domain/receiving-review}/SKILL.md +0 -0
  184. /package/.claude/skills/{flow-tdd → domain/tdd}/SKILL.md +0 -0
  185. /package/.claude/skills/{verification-before-completion → domain/verification}/SKILL.md +0 -0
  186. /package/.claude/skills/{constitution-guardian → guardrail/constitution-guardian}/SKILL.md +0 -0
  187. /package/.claude/skills/{devflow-tdd-enforcer → guardrail/tdd-enforcer}/SKILL.md +0 -0
  188. /package/.claude/skills/{devflow-constitution-quick-ref → utility/constitution-quick-ref}/SKILL.md +0 -0
  189. /package/.claude/skills/{devflow-file-standards → utility/file-standards}/SKILL.md +0 -0
  190. /package/.claude/skills/{fractal-docs-generator → utility/fractal-docs}/SKILL.md +0 -0
  191. /package/.claude/skills/{npm-release → utility/npm-release}/SKILL.md +0 -0
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: flow-dev
3
- description: 'Execute development tasks following TDD order. Usage: /flow-dev "REQ-123" [--manual] [--max-iterations N]'
3
+ description: 'Execute development tasks following TDD order. Usage: /flow-dev "REQ-123" [--manual] [--max-iterations N] [--team] [--agents N]'
4
4
  scripts:
5
5
  prereq: .claude/scripts/check-prerequisites.sh
6
6
  check_tasks: .claude/scripts/check-task-status.sh
@@ -8,6 +8,9 @@ scripts:
8
8
  validate_constitution: .claude/scripts/validate-constitution.sh
9
9
  verify_gate: .claude/scripts/verify-gate.sh
10
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
11
14
  skills:
12
15
  tdd: .claude/skills/flow-tdd/SKILL.md
13
16
  verification: .claude/skills/verification-before-completion/SKILL.md
@@ -55,25 +58,28 @@ NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
55
58
 
56
59
  ## User Input
57
60
  ```text
58
- $ARGUMENTS = "REQ_ID? [--task T###] [--manual] [--max-iterations N]"
61
+ $ARGUMENTS = "REQ_ID? [--task T###] [--manual] [--max-iterations N] [--team] [--agents N]"
59
62
  ```
60
63
 
61
64
  - **REQ_ID**: 未提供时从当前分支或 `DEVFLOW_REQ_ID` 推断
62
65
  - **--task T###**: 指定起始任务(从该任务开始执行)
63
66
  - **--manual**: Manual模式,遇错停止等待人工修复(向后兼容)
64
67
  - **--max-iterations N**: Autonomous模式最大迭代次数(默认10)
68
+ - **--team**: Team模式,启用多 Agent 并行执行 [NEW: v4.7]
69
+ - **--agents N**: Team模式下的 Agent 数量(默认3,范围2-5)[NEW: v4.7]
65
70
 
66
71
  **默认行为**: Autonomous模式(自动重试直到完成)
67
72
 
68
73
  ### 运行模式对比
69
74
 
70
- | | Manual模式 | Autonomous模式(默认) |
71
- |--|------------|----------------------|
72
- | 触发方式 | `--manual` | 默认(或指定 `--max-iterations`) |
73
- | 遇到错误 | 停止,等待人工修复 | 自动重试,记录 ERROR_LOG.md |
74
- | 注意力刷新 | Protocol 2(每任务) | Protocol 2 + Protocol 3(每迭代) + Protocol 4(遇错) |
75
- | 适用场景 | 复杂需求需人工判断 | 清晰需求可无人值守 |
76
- | 退出条件 | 任务失败可停止 | 迭代直到完成或达到上限 |
75
+ | | Manual模式 | Autonomous模式(默认) | Team模式 [NEW] |
76
+ |--|------------|----------------------|----------------|
77
+ | 触发方式 | `--manual` | 默认 | `--team` |
78
+ | 遇到错误 | 停止,等待人工修复 | 自动重试 | 分布式重试 |
79
+ | 并行执行 | | | 是(多 Agent) |
80
+ | 注意力刷新 | Protocol 2 | Protocol 2+3+4 | 每 Agent 独立 |
81
+ | 适用场景 | 复杂需求 | 清晰需求 | 大量并行任务 |
82
+ | 退出条件 | 任务失败可停止 | 迭代直到完成 | 所有 Agent 完成 |
77
83
 
78
84
  **示例**:
79
85
  ```bash
@@ -82,6 +88,8 @@ $ARGUMENTS = "REQ_ID? [--task T###] [--manual] [--max-iterations N]"
82
88
  /flow-dev "REQ-123" --manual # Manual模式,遇错停止
83
89
  /flow-dev "REQ-123" --task T005 # 从 T005 开始(Autonomous模式)
84
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 并行
85
93
  ```
86
94
 
87
95
  ## 执行流程
@@ -89,9 +97,10 @@ $ARGUMENTS = "REQ_ID? [--task T###] [--manual] [--max-iterations N]"
89
97
  ### 阶段 1: Entry Gate
90
98
  ```
91
99
  1. 解析参数
92
- → Parse: REQ_ID, --task, --manual, --max-iterations
100
+ → Parse: REQ_ID, --task, --manual, --max-iterations, --team, --agents
93
101
  → If REQ_ID not provided: run {SCRIPT:prereq} --json --paths-only
94
102
  → Determine mode:
103
+ • --team flag present → Team mode
95
104
  • --manual flag present → Manual mode
96
105
  • Otherwise → Autonomous mode (default max_iterations = 10)
97
106
 
@@ -115,6 +124,12 @@ $ARGUMENTS = "REQ_ID? [--task T###] [--manual] [--max-iterations N]"
115
124
  → 任务格式 `- [ ] T### [P?] [US?] Description (path)`
116
125
 
117
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"
118
133
  → If Autonomous mode:
119
134
  • Run: {SCRIPT:setup_loop} "${REQ_ID}" --max-iterations ${MAX_ITERATIONS}
120
135
  • Creates .claude/ralph-loop.local.md (state file for Stop Hook)
@@ -158,6 +173,84 @@ $ARGUMENTS = "REQ_ID? [--task T###] [--manual] [--max-iterations N]"
158
173
 
159
174
  ### 阶段 3: 执行循环
160
175
 
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
+ └──────────────────────────────────────────────────────────────────┘
206
+
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
+ └─────────────────────────────────────────────────────────────────┘
229
+
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
+
161
254
  **Manual 模式循环** (--manual):
162
255
  ```
163
256
  For each remaining task (顺序严格遵循 TASKS.md):
@@ -281,10 +374,11 @@ Note: Stop Hook (.claude/hooks/ralph-stop-hook.sh) 会在 Autonomous 模式下:
281
374
  ## 运行提示
282
375
  - **默认 Autonomous 模式**: 遇错自动重试,无需人工干预
283
376
  - **使用 `--manual` 退出**: 适合需要人工判断的复杂场景
377
+ - **使用 `--team` 并行**: 适合大量可并行任务的需求 [NEW: v4.7]
284
378
  - **使用 `/cancel-ralph` 停止**: 紧急停止 Autonomous 循环
285
379
  - 始终使用 quickstart 中提供的命令(测试、lint、db migrate 等)
286
380
  - Phase 2 的所有测试必须在实现前失败;若某测试直接通过,回滚并修正
287
- - 遵循 TASKS.md 标注的 `[P]` 仅表示逻辑上可并行,实际执行依旧串行
381
+ - 遵循 TASKS.md 标注的 `[P]` 表示可并行,Team 模式下会真正并行执行
288
382
  - 如需恢复,可使用 `/flow-dev --task TXYZ` 指向首个未完成任务
289
383
 
290
384
  ## 错误处理
@@ -301,6 +395,13 @@ Note: Stop Hook (.claude/hooks/ralph-stop-hook.sh) 会在 Autonomous 模式下:
301
395
  - 达到 max_iterations → 输出状态报告(已完成/剩余任务),保持 development_in_progress
302
396
  - 紧急停止 → 使用 `/cancel-ralph` 删除状态文件,立即终止循环
303
397
 
398
+ **Team 模式** [NEW: v4.7]:
399
+ - 缺少资产 → 同 Manual 模式(Entry Gate 阻止)
400
+ - 文件冲突 → 自动检测并分配给同一 Agent 串行执行
401
+ - Agent 任务失败 → TeammateIdle Hook 触发重试
402
+ - 所有 Agent 空闲但任务未完成 → 重新分配任务
403
+ - 紧急停止 → 清理 Team 状态,所有 Agent shutdown
404
+
304
405
  ## 取消 Autonomous 循环
305
406
 
306
407
  ```bash
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: flow-init
3
+ description: 'Initialize requirement structure. Usage: /flow-init "REQ-123|Title|URLs"'
4
+ skill: workflow/flow-init
5
+ ---
6
+
7
+ # Flow-Init Command (Trigger Entry)
8
+
9
+ > 此文件为触发入口,详细实现见 `.claude/skills/workflow/flow-init/SKILL.md`
10
+
11
+ ## Usage
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
17
+ ```
18
+
19
+ ## Quick Reference
20
+
21
+ | Stage | Purpose | Output |
22
+ |-------|---------|--------|
23
+ | 1 | Entry Gate | 参数验证 |
24
+ | 1.2 | Git Branch | feature/REQ-xxx-title |
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
+ ## Skill Location
33
+
34
+ **Full Implementation**: `.claude/skills/workflow/flow-init/SKILL.md`
35
+
36
+ **Resources**:
37
+ - Scripts: `.claude/skills/workflow/flow-init/scripts/`
38
+ - References: `.claude/skills/workflow/flow-init/references/`
39
+ - Assets: `.claude/skills/workflow/flow-init/assets/`
40
+
41
+ ## Next Step
42
+
43
+ ```
44
+ /flow-prd "${REQ_ID}"
45
+ ```
@@ -0,0 +1,159 @@
1
+ ---
2
+ name: flow-quality
3
+ description: Combined quality verification (replaces flow-review + flow-qa)
4
+ version: 3.0.0
5
+ ---
6
+
7
+ # /flow-quality
8
+
9
+ > **[PROTOCOL]**: 变更时更新此头部,然后检查 CLAUDE.md
10
+
11
+ ## Purpose
12
+
13
+ Combined quality verification command that replaces the separate `/flow-review` and `/flow-qa` commands.
14
+ Provides both quick programmatic verification and full comprehensive review.
15
+
16
+ ## Usage
17
+
18
+ ```bash
19
+ # Quick mode (default) - programmatic verification only
20
+ /flow-quality [REQ-ID]
21
+
22
+ # Full mode - comprehensive review including spec compliance
23
+ /flow-quality [REQ-ID] --full
24
+ ```
25
+
26
+ ## Modes
27
+
28
+ ### Quick Mode (Default)
29
+
30
+ Fast programmatic verification using quality-gates.yml:
31
+
32
+ 1. **Lint Check** - `npm run lint`
33
+ 2. **Type Check** - `npm run typecheck`
34
+ 3. **Unit Tests** - `npm test`
35
+
36
+ **Use Case**: Rapid iteration during development, CI/CD pipelines.
37
+
38
+ **Duration**: ~1-2 minutes
39
+
40
+ ### Full Mode (`--full`)
41
+
42
+ Comprehensive review including:
43
+
44
+ 1. **Programmatic Checks** (same as quick mode)
45
+ 2. **Spec Compliance Review** - Verify implementation matches PRD/TECH_DESIGN
46
+ 3. **Code Quality Review** - Structure, patterns, Constitution compliance
47
+ 4. **Security Scan** - `npm audit`, secret detection
48
+ 5. **Integration Tests** - `npm run test:integration` (if available)
49
+
50
+ **Use Case**: Before PR creation, milestone completion.
51
+
52
+ **Duration**: ~5-10 minutes
53
+
54
+ ## Entry Gate
55
+
56
+ ```yaml
57
+ prerequisites:
58
+ - development_complete: true
59
+ - TASKS.md: All tasks marked [x]
60
+ - Tests: All passing
61
+ ```
62
+
63
+ ## Exit Gate
64
+
65
+ ### Quick Mode
66
+ ```yaml
67
+ exit_criteria:
68
+ - lint: pass
69
+ - typecheck: pass
70
+ - tests: pass
71
+ ```
72
+
73
+ ### Full Mode
74
+ ```yaml
75
+ exit_criteria:
76
+ - lint: pass
77
+ - typecheck: pass
78
+ - tests: pass
79
+ - spec_review: PASS
80
+ - code_quality: PASS
81
+ - security: no high-severity issues
82
+ ```
83
+
84
+ ## Output
85
+
86
+ ### Quick Mode
87
+ ```
88
+ ✅ Quality Gate PASSED (Quick Mode)
89
+
90
+ ✓ Lint Check
91
+ ✓ Type Check
92
+ ✓ Unit Tests (42 passed)
93
+
94
+ Duration: 1m 23s
95
+ ```
96
+
97
+ ### Full Mode
98
+ ```
99
+ ✅ Quality Gate PASSED (Full Mode)
100
+
101
+ Programmatic Checks:
102
+ ✓ Lint Check
103
+ ✓ Type Check
104
+ ✓ Unit Tests (42 passed)
105
+ ✓ Integration Tests (8 passed)
106
+
107
+ Reviews:
108
+ ✓ Spec Compliance: PASS
109
+ ✓ Code Quality: PASS
110
+ ✓ Security: No issues
111
+
112
+ Reports Generated:
113
+ - SPEC_REVIEW.md
114
+ - CODE_QUALITY_REVIEW.md
115
+ - SECURITY_REPORT.md
116
+
117
+ Duration: 7m 45s
118
+ ```
119
+
120
+ ## Integration
121
+
122
+ ### With flow-dev
123
+
124
+ After `/flow-dev` completes, the orchestrator recommends:
125
+ ```
126
+ status: "development_complete"
127
+ → Recommend: /flow-quality (quick verification)
128
+ → Alternative: /flow-quality --full (comprehensive review)
129
+ ```
130
+
131
+ ### With flow-release
132
+
133
+ `/flow-release` requires quality gate to pass:
134
+ ```yaml
135
+ flow-release:
136
+ prerequisites:
137
+ - quality_complete: true
138
+ ```
139
+
140
+ ## Deprecation Notice
141
+
142
+ The following commands are deprecated in v3.0:
143
+
144
+ - `/flow-review` → Use `/flow-quality --full`
145
+ - `/flow-qa` → Use `/flow-quality --full`
146
+
147
+ These commands still work for backward compatibility but will show a deprecation warning.
148
+
149
+ ## Scripts
150
+
151
+ - `.claude/scripts/flow-quality-quick.sh` - Quick verification
152
+ - `.claude/scripts/flow-quality-full.sh` - Full verification
153
+ - `.claude/scripts/run-quality-gates.sh` - Core gate execution
154
+
155
+ ## Related
156
+
157
+ - **Config**: `.claude/config/quality-gates.yml`
158
+ - **Error Log**: `ERROR_LOG.md` (errors recorded here)
159
+ - **Orchestrator**: Updates `orchestration_status.json` on completion
@@ -0,0 +1,186 @@
1
+ ---
2
+ name: flow-spec
3
+ description: 'Unified specification phase: PRD → Tech+UI (parallel) → Epic/Tasks. Usage: /flow-spec "REQ-123" [--skip-tech] [--skip-ui]'
4
+ scripts:
5
+ prereq: .claude/scripts/check-prerequisites.sh
6
+ validate_research: .claude/scripts/validate-research.sh
7
+ validate_constitution: .claude/scripts/validate-constitution.sh
8
+ ---
9
+
10
+ # Flow-Spec - 统一规格阶段命令
11
+
12
+ > **v4.1 新增**: 合并 flow-prd/flow-tech/flow-ui/flow-epic 为单一命令
13
+
14
+ ## User Input
15
+
16
+ ```text
17
+ $ARGUMENTS = "REQ_ID [--skip-tech] [--skip-ui]"
18
+ ```
19
+
20
+ 若未提供 REQ_ID 则根据当前分支或 `DEVFLOW_REQ_ID` 自动解析。
21
+
22
+ ## 命令格式
23
+
24
+ ```bash
25
+ # Full Mode (默认) - PRD + Tech + UI + Epic
26
+ /flow-spec "REQ-123"
27
+
28
+ # Quick Mode (小需求) - PRD + Epic only
29
+ /flow-spec "REQ-123" --skip-tech --skip-ui
30
+
31
+ # Backend Only - PRD + Tech + Epic
32
+ /flow-spec "REQ-123" --skip-ui
33
+
34
+ # Frontend Only - PRD + UI + Epic
35
+ /flow-spec "REQ-123" --skip-tech
36
+ ```
37
+
38
+ ## Mode Matrix
39
+
40
+ | Mode | Flags | Agents | Output |
41
+ |------|-------|--------|--------|
42
+ | Full | (default) | PRD + Tech + UI + Epic | PRD.md, TECH_DESIGN.md, UI_PROTOTYPE.html, EPIC.md, TASKS.md |
43
+ | Quick | `--skip-tech --skip-ui` | PRD + Epic | PRD.md, EPIC.md, TASKS.md |
44
+ | Backend | `--skip-ui` | PRD + Tech + Epic | PRD.md, TECH_DESIGN.md, EPIC.md, TASKS.md |
45
+ | Frontend | `--skip-tech` | PRD + UI + Epic | PRD.md, UI_PROTOTYPE.html, EPIC.md, TASKS.md |
46
+
47
+ ## 执行流程
48
+
49
+ **加载 Skill 指令**:
50
+ ```
51
+ → 读取 .claude/skills/workflow/flow-spec/SKILL.md
52
+ → 按 SKILL.md 中定义的 Execution Flow 执行
53
+ ```
54
+
55
+ ### 阶段 1: Entry Gate
56
+
57
+ ```yaml
58
+ Prerequisites:
59
+ 1. REQ_ID 解析:
60
+ - 从参数获取
61
+ - 或从当前分支推断 (feature/REQ-XXX-*)
62
+ - 或从 orchestration_status.json 获取
63
+
64
+ 2. BRAINSTORM.md 存在:
65
+ - 路径: devflow/requirements/${REQ_ID}/BRAINSTORM.md
66
+ - 必须包含: 需求描述、目标用户、核心功能
67
+
68
+ 3. Research 完成:
69
+ - 路径: devflow/requirements/${REQ_ID}/research/research.md
70
+ - 无 TODO/PLACEHOLDER
71
+
72
+ 4. Status Check:
73
+ - orchestration_status.status ∈ {"initialized", "spec_failed"}
74
+
75
+ 5. Constitution Gate:
76
+ - 读取 BRAINSTORM.md 验证需求边界
77
+ ```
78
+
79
+ ### 阶段 2: PRD Generation (Sequential)
80
+
81
+ ```yaml
82
+ Agent: prd-writer (research-type)
83
+ Input:
84
+ - BRAINSTORM.md
85
+ - research/research.md
86
+ - research/internal/codebase-overview.md
87
+
88
+ Output:
89
+ - PRD.md
90
+
91
+ Rules:
92
+ - ANTI-EXPANSION: 未提及 → [NEEDS CLARIFICATION]
93
+ - NO TECH DETAILS: 只关注 WHAT/WHY
94
+ - STORY INDEPENDENCE: 每个故事有独立测试
95
+ ```
96
+
97
+ ### 阶段 3: Tech + UI (Parallel)
98
+
99
+ ```yaml
100
+ Parallel Execution:
101
+ tech-architect (if !--skip-tech):
102
+ Input: PRD.md, research/codebase-overview.md
103
+ Output: TECH_DESIGN.md, data-model.md, contracts/
104
+
105
+ ui-designer (if !--skip-ui AND UI detected):
106
+ Input: PRD.md, STYLE.md (optional)
107
+ Output: UI_PROTOTYPE.html, ui_design_strategy.md
108
+
109
+ Method:
110
+ - 使用 Task tool 并行调用两个 agent
111
+ - 等待两者完成后进入 Stage 4
112
+ ```
113
+
114
+ ### 阶段 4: Epic Generation (Sequential)
115
+
116
+ ```yaml
117
+ Agent: planner (research-type)
118
+ Input:
119
+ - PRD.md
120
+ - TECH_DESIGN.md (if exists)
121
+ - UI_PROTOTYPE.html (if exists)
122
+
123
+ Output:
124
+ - EPIC.md
125
+ - TASKS.md
126
+
127
+ Rules:
128
+ - TDD Order: Phase 2 (Tests) → Phase 3 (Implementation)
129
+ - Bite-Sized Tasks: 每个 step 2-5 分钟
130
+ - Phase -1 Gates: Simplicity, Anti-Abstraction, Integration-First
131
+ ```
132
+
133
+ ### 阶段 5: Exit Gate
134
+
135
+ ```yaml
136
+ File Checks:
137
+ - [ ] PRD.md exists, no {{PLACEHOLDER}}
138
+ - [ ] TECH_DESIGN.md exists (if !--skip-tech)
139
+ - [ ] UI_PROTOTYPE.html exists (if !--skip-ui AND UI detected)
140
+ - [ ] EPIC.md exists, no {{PLACEHOLDER}}
141
+ - [ ] TASKS.md exists, TDD order correct
142
+
143
+ Status Update:
144
+ - orchestration_status.status = "spec_complete"
145
+ - orchestration_status.phase = "spec"
146
+ ```
147
+
148
+ ## 输出
149
+
150
+ ```
151
+ devflow/requirements/${REQ_ID}/
152
+ ├── PRD.md # Always
153
+ ├── TECH_DESIGN.md # If !--skip-tech
154
+ ├── data-model.md # If !--skip-tech
155
+ ├── contracts/openapi.yaml # If !--skip-tech
156
+ ├── UI_PROTOTYPE.html # If !--skip-ui AND UI detected
157
+ ├── EPIC.md # Always
158
+ ├── TASKS.md # Always
159
+ └── orchestration_status.json # Updated
160
+ ```
161
+
162
+ ## 错误处理
163
+
164
+ - **Entry Gate 失败**: 返回具体缺失项,指导用户运行 `/flow-init`
165
+ - **PRD 生成失败**: status = "spec_failed",可重试
166
+ - **Tech/UI 失败**: 继续执行,标记为 skipped
167
+ - **Epic 失败**: status = "spec_failed",可用 `--from=epic` 重试
168
+
169
+ ## 下一步
170
+
171
+ ```bash
172
+ /flow-dev "${REQ_ID}"
173
+ ```
174
+
175
+ ## Agent References
176
+
177
+ | Agent | Purpose | Location |
178
+ |-------|---------|----------|
179
+ | prd-writer | PRD 生成 | `.claude/agents/prd-writer.md` |
180
+ | tech-architect | 技术设计 | `.claude/agents/tech-architect.md` |
181
+ | ui-designer | UI 原型 | `.claude/agents/ui-designer.md` |
182
+ | planner | Epic/Tasks | `.claude/agents/planner.md` |
183
+
184
+ ## 详细指令
185
+
186
+ 完整执行逻辑见: `.claude/skills/workflow/flow-spec/SKILL.md`