cc-devflow 2.5.0 → 4.1.1

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 (192) hide show
  1. package/.claude/CLAUDE.md +1065 -53
  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/new.md +279 -0
  9. package/.claude/commands/flow/quality.md +159 -0
  10. package/.claude/commands/flow/spec.md +186 -0
  11. package/.claude/commands/flow/workspace.md +146 -0
  12. package/.claude/commands/{cancel-ralph.md → util/cancel-ralph.md} +1 -0
  13. package/.claude/config/quality-gates.yml +305 -0
  14. package/.claude/docs/guides/TEAM_MODE_GUIDE.md +313 -0
  15. package/.claude/docs/templates/DELTA_SPEC_TEMPLATE.md +91 -0
  16. package/.claude/docs/templates/DESIGN_DECISIONS_TEMPLATE.md +151 -0
  17. package/.claude/docs/templates/JOURNAL_TEMPLATE.md +75 -0
  18. package/.claude/docs/templates/NEW_ORCHESTRATION_TEMPLATE.md +51 -91
  19. package/.claude/docs/templates/_shared/CLAUDE.md +36 -0
  20. package/.claude/docs/templates/_shared/CONSTITUTION_CHECK.md +125 -0
  21. package/.claude/docs/templates/_shared/VALIDATION_CHECKLIST.md +187 -0
  22. package/.claude/docs/templates/_shared/YAML_FRONTMATTER.md +164 -0
  23. package/.claude/docs/templates/context/dev.jsonl.template +6 -0
  24. package/.claude/docs/templates/context/epic.jsonl.template +5 -0
  25. package/.claude/docs/templates/context/prd.jsonl.template +4 -0
  26. package/.claude/docs/templates/context/research.jsonl.template +4 -0
  27. package/.claude/docs/templates/context/review.jsonl.template +5 -0
  28. package/.claude/docs/templates/context/tech.jsonl.template +5 -0
  29. package/.claude/hooks/CLAUDE.md +342 -0
  30. package/.claude/hooks/inject-agent-context.ts +480 -0
  31. package/.claude/hooks/inject-skill-context.ts +359 -0
  32. package/.claude/hooks/ralph-loop.ts +931 -0
  33. package/.claude/hooks/task-completed-hook.ts +593 -0
  34. package/.claude/hooks/teammate-idle-hook.ts +690 -0
  35. package/.claude/hooks/types/team-types.d.ts +238 -0
  36. package/.claude/rules/devflow-conventions.md +82 -9
  37. package/.claude/scripts/archive-requirement.sh +44 -1
  38. package/.claude/scripts/common.sh +670 -3
  39. package/.claude/scripts/delta-parser.ts +527 -0
  40. package/.claude/scripts/detect-file-conflicts.sh +151 -0
  41. package/.claude/scripts/flow-context-add.sh +134 -0
  42. package/.claude/scripts/flow-context-init.sh +133 -0
  43. package/.claude/scripts/flow-context-validate.sh +144 -0
  44. package/.claude/scripts/flow-delta-apply.sh +297 -0
  45. package/.claude/scripts/flow-delta-archive.sh +71 -0
  46. package/.claude/scripts/flow-delta-create.sh +202 -0
  47. package/.claude/scripts/flow-delta-list.sh +142 -0
  48. package/.claude/scripts/flow-delta-status.sh +235 -0
  49. package/.claude/scripts/flow-quality-full.sh +184 -0
  50. package/.claude/scripts/flow-quality-quick.sh +64 -0
  51. package/.claude/scripts/flow-workspace-init.sh +117 -0
  52. package/.claude/scripts/flow-workspace-record.sh +164 -0
  53. package/.claude/scripts/flow-workspace-start.sh +88 -0
  54. package/.claude/scripts/get-workflow-status.sh +415 -0
  55. package/.claude/scripts/parse-task-dependencies.js +334 -0
  56. package/.claude/scripts/record-quality-error.sh +165 -0
  57. package/.claude/scripts/run-quality-gates.sh +242 -0
  58. package/.claude/scripts/team-dev-init.sh +319 -0
  59. package/.claude/scripts/team-state-recovery.sh +229 -0
  60. package/.claude/scripts/workflow-status.ts +433 -0
  61. package/.claude/settings.json +19 -0
  62. package/.claude/skills/cc-devflow-orchestrator/SKILL.md +85 -200
  63. package/.claude/skills/domain/using-git-worktrees/SKILL.md +252 -0
  64. package/.claude/skills/domain/using-git-worktrees/assets/SHELL_ALIASES.md +133 -0
  65. package/.claude/skills/domain/using-git-worktrees/context.jsonl +4 -0
  66. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-cleanup.sh +218 -0
  67. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-create.sh +232 -0
  68. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-list.sh +130 -0
  69. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-status.sh +140 -0
  70. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-switch.sh +70 -0
  71. package/.claude/skills/utility/skill-creator/LICENSE.txt +202 -0
  72. package/.claude/skills/utility/skill-creator/SKILL.md +356 -0
  73. package/.claude/skills/utility/skill-creator/references/output-patterns.md +82 -0
  74. package/.claude/skills/utility/skill-creator/references/workflows.md +28 -0
  75. package/.claude/skills/utility/skill-creator/scripts/init_skill.py +303 -0
  76. package/.claude/skills/utility/skill-creator/scripts/package_skill.py +110 -0
  77. package/.claude/skills/utility/skill-creator/scripts/quick_validate.py +95 -0
  78. package/.claude/skills/workflow/flow-dev/CLAUDE.md +78 -0
  79. package/.claude/skills/workflow/flow-dev/SKILL.md +96 -0
  80. package/.claude/skills/workflow/flow-dev/assets/IMPLEMENTATION_PLAN_TEMPLATE.md +71 -0
  81. package/.claude/skills/workflow/flow-dev/context.jsonl +8 -0
  82. package/.claude/skills/workflow/flow-dev/dev-implementer.jsonl +8 -0
  83. package/.claude/skills/workflow/flow-dev/scripts/entry-gate.sh +116 -0
  84. package/.claude/skills/workflow/flow-dev/scripts/exit-gate.sh +101 -0
  85. package/.claude/skills/workflow/flow-dev/scripts/task-orchestrator.sh +106 -0
  86. package/.claude/skills/workflow/flow-fix/SKILL.md +105 -0
  87. package/.claude/skills/workflow/flow-fix/context.jsonl +6 -0
  88. package/.claude/skills/workflow/flow-fix/references/bug-analyzer.md +381 -0
  89. package/.claude/skills/workflow/flow-init/SKILL.md +211 -0
  90. package/.claude/skills/workflow/flow-init/assets/BRAINSTORM_TEMPLATE.md +148 -0
  91. package/.claude/skills/workflow/flow-init/assets/INIT_FLOW_TEMPLATE.md +198 -0
  92. package/.claude/skills/workflow/flow-init/assets/RESEARCH_TEMPLATE.md +276 -0
  93. package/.claude/skills/workflow/flow-init/context.jsonl +5 -0
  94. package/.claude/skills/workflow/flow-init/references/flow-researcher.md +132 -0
  95. package/.claude/skills/workflow/flow-init/scripts/check-prerequisites.sh +240 -0
  96. package/.claude/skills/workflow/flow-init/scripts/consolidate-research.sh +182 -0
  97. package/.claude/skills/workflow/flow-init/scripts/create-requirement.sh +523 -0
  98. package/.claude/skills/workflow/flow-init/scripts/generate-research-tasks.sh +157 -0
  99. package/.claude/skills/workflow/flow-init/scripts/populate-research-tasks.sh +284 -0
  100. package/.claude/skills/workflow/flow-init/scripts/validate-research.sh +340 -0
  101. package/.claude/skills/workflow/flow-quality/SKILL.md +94 -0
  102. package/.claude/skills/workflow/flow-quality/context.jsonl +6 -0
  103. package/.claude/skills/workflow/flow-quality/references/code-quality-reviewer.md +205 -0
  104. package/.claude/skills/workflow/flow-quality/references/qa-tester.md +313 -0
  105. package/.claude/skills/workflow/flow-quality/references/security-reviewer.md +314 -0
  106. package/.claude/skills/workflow/flow-quality/references/spec-reviewer.md +221 -0
  107. package/.claude/skills/workflow/flow-release/SKILL.md +126 -0
  108. package/.claude/skills/workflow/flow-release/context.jsonl +7 -0
  109. package/.claude/skills/workflow/flow-release/references/release-manager.md +295 -0
  110. package/.claude/skills/workflow/flow-spec/CLAUDE.md +103 -0
  111. package/.claude/skills/workflow/flow-spec/SKILL.md +545 -0
  112. package/.claude/skills/workflow/flow-spec/context.jsonl +7 -0
  113. package/.claude/skills/workflow/flow-spec/scripts/entry-gate.sh +194 -0
  114. package/.claude/skills/workflow/flow-spec/scripts/exit-gate.sh +244 -0
  115. package/.claude/skills/workflow/flow-spec/scripts/parallel-orchestrator.sh +205 -0
  116. package/.claude/skills/workflow/flow-spec/scripts/team-communication.sh +353 -0
  117. package/.claude/skills/workflow/flow-spec/scripts/team-init.sh +195 -0
  118. package/.claude/skills/workflow/flow-spec/scripts/test-team-mode.sh +496 -0
  119. package/.claude/skills/workflow/flow-spec/team-config.json +165 -0
  120. package/.claude/skills/workflow.yaml +417 -0
  121. package/CHANGELOG.md +268 -0
  122. package/README.md +206 -50
  123. package/README.zh-CN.md +219 -57
  124. package/lib/compiler/CLAUDE.md +77 -46
  125. package/lib/compiler/__tests__/multi-module-emitters.test.js +508 -0
  126. package/lib/compiler/context-expander.js +179 -0
  127. package/lib/compiler/emitters/antigravity-emitter.js +195 -5
  128. package/lib/compiler/emitters/base-emitter.js +217 -2
  129. package/lib/compiler/emitters/codex-emitter.js +200 -4
  130. package/lib/compiler/emitters/cursor-emitter.js +307 -3
  131. package/lib/compiler/emitters/qwen-emitter.js +196 -4
  132. package/lib/compiler/index.js +197 -2
  133. package/lib/compiler/platforms.js +270 -21
  134. package/package.json +2 -2
  135. package/.claude/commands/flow-epic.md +0 -183
  136. package/.claude/commands/flow-init.md +0 -370
  137. package/.claude/commands/flow-new.md +0 -442
  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-release.md → flow/release.md} +0 -0
  170. /package/.claude/commands/{flow-restart.md → flow/restart.md} +0 -0
  171. /package/.claude/commands/{flow-status.md → flow/status.md} +0 -0
  172. /package/.claude/commands/{flow-update.md → flow/update.md} +0 -0
  173. /package/.claude/commands/{flow-upgrade.md → flow/upgrade.md} +0 -0
  174. /package/.claude/commands/{flow-verify.md → flow/verify.md} +0 -0
  175. /package/.claude/commands/{code-review-high.md → util/code-review.md} +0 -0
  176. /package/.claude/commands/{git-commit.md → util/git-commit.md} +0 -0
  177. /package/.claude/commands/{problem-analyzer.md → util/problem-analyzer.md} +0 -0
  178. /package/.claude/skills/{flow-attention-refresh → domain/attention-refresh}/SKILL.md +0 -0
  179. /package/.claude/skills/{flow-brainstorming → domain/brainstorming}/SKILL.md +0 -0
  180. /package/.claude/skills/{flow-debugging → domain/debugging}/SKILL.md +0 -0
  181. /package/.claude/skills/{flow-finishing-branch → domain/finishing-branch}/SKILL.md +0 -0
  182. /package/.claude/skills/{flow-receiving-review → domain/receiving-review}/SKILL.md +0 -0
  183. /package/.claude/skills/{flow-tdd → domain/tdd}/SKILL.md +0 -0
  184. /package/.claude/skills/{verification-before-completion → domain/verification}/SKILL.md +0 -0
  185. /package/.claude/skills/{constitution-guardian → guardrail/constitution-guardian}/SKILL.md +0 -0
  186. /package/.claude/skills/{devflow-tdd-enforcer → guardrail/tdd-enforcer}/SKILL.md +0 -0
  187. /package/.claude/skills/{devflow-constitution-quick-ref → utility/constitution-quick-ref}/SKILL.md +0 -0
  188. /package/.claude/skills/{devflow-file-standards → utility/file-standards}/SKILL.md +0 -0
  189. /package/.claude/skills/{fractal-docs-generator → utility/fractal-docs}/SKILL.md +0 -0
  190. /package/.claude/skills/{journey-coherence-checker → utility/journey-checker}/SKILL.md +0 -0
  191. /package/.claude/skills/{journey-coherence-checker → utility/journey-checker}/pressure-scenarios.md +0 -0
  192. /package/.claude/skills/{npm-release → utility/npm-release}/SKILL.md +0 -0
@@ -1,183 +0,0 @@
1
- ---
2
- name: flow-epic
3
- description: 'Generate Epic and Tasks breakdown. Usage: /flow-epic "REQ-123" or /flow-epic'
4
- scripts:
5
- prereq: .claude/scripts/check-prerequisites.sh
6
- setup: .claude/scripts/setup-epic.sh
7
- validate_constitution: .claude/scripts/validate-constitution.sh
8
- agent_scripts:
9
- sh: .claude/scripts/update-agent-context.sh __AGENT__
10
- ps: scripts/powershell/update-agent-context.ps1 -AgentType __AGENT__
11
- skills:
12
- tdd: .claude/skills/flow-tdd/SKILL.md
13
- ---
14
-
15
- # Flow-Epic - Epic 和任务规划命令
16
-
17
- ## Bite-Sized Tasks 原则
18
-
19
- 任务必须足够小:
20
-
21
- ```yaml
22
- Task 粒度规范:
23
- - 每个 step 2-5 分钟可完成
24
- - "Write the failing test" = 1 step
25
- - "Run it to make sure it fails" = 1 step
26
- - "Implement minimal code to pass" = 1 step
27
- - "Run tests and verify" = 1 step
28
- - "Commit" = 1 step
29
-
30
- Task 内容规范:
31
- - 精确的文件路径 (不是 "update the config")
32
- - 完整的代码片段 (不是 "add validation")
33
- - 精确的命令 + 期望输出
34
- - 明确的验收标准
35
-
36
- Bad Task Examples:
37
- ❌ "Implement user authentication"
38
- ❌ "Add validation"
39
- ❌ "Update the API"
40
-
41
- Good Task Examples:
42
- ✅ "Create src/auth/login.ts with LoginRequest interface"
43
- ✅ "Write failing test: POST /api/login returns 401 for invalid credentials"
44
- ✅ "Run npm test -- --grep 'login' and verify test fails"
45
- ✅ "Implement login handler to pass the test"
46
- ```
47
-
48
- ## User Input
49
- ```text
50
- $ARGUMENTS = "REQ_ID?"
51
- ```
52
- 空输入时根据当前分支或 `DEVFLOW_REQ_ID` 自动解析;如果无法解析必须直接报错。
53
-
54
- ## 命令格式
55
- ```text
56
- /flow-epic "REQ_ID"
57
- /flow-epic # Auto-detect from current branch
58
- ```
59
-
60
- ## 执行流程
61
-
62
- ### 阶段 1: Entry Gate
63
- ```
64
- 1. Requirement ID
65
- → Provided: use argument
66
- → Else: run {SCRIPT:prereq} --json --paths-only
67
- → Missing: ERROR "No requirement ID found."
68
-
69
- 2. 结构校验
70
- → 需求目录、EXECUTION_LOG.md、orchestration_status.json 必须存在
71
- → PRD.md 完整且无 {{PLACEHOLDER}}
72
- → 研究产物(/flow-init 输出):
73
- • research/research.md (研究摘要,Decision/Rationale/Alternatives 格式)
74
- • research/tasks.json (研究任务列表)
75
- → 技术产物(/flow-tech 输出):
76
- • TECH_DESIGN.md (技术方案总纲) ⭐ planner 必读
77
- • research/codebase-tech-analysis.md (代码库技术分析)
78
- • data-model.md (数据模型定义)
79
- • contracts/ (API 契约目录,至少 1 个文件)
80
- • quickstart.md (快速启动指南)
81
- → 状态校验:
82
- • orchestration_status.phase0_complete == true (研究阶段完成)
83
- • orchestration_status.phase1_complete == true (技术设计完成)
84
-
85
- 3. 状态检查
86
- → status ∈ {tech_design_complete, epic_generation_failed}
87
- → 已存在 EPIC.md 或 TASKS.md → WARN 并询问是否覆盖
88
-
89
- 4. Constitution Gate
90
- → Run: {SCRIPT:validate_constitution} --type prd --severity error --json
91
- → 若有 ERROR 级违规 → 停止
92
-
93
- 5. Checklist Gate (如果 checklists/ 存在)
94
- → Run: node .claude/hooks/checklist-gate.js --req-id {REQ_ID} --json
95
- → 若 status == "FAIL" 且无 --skip-gate:
96
- • ERROR: 显示完成度不足提示
97
- • 建议: "Run /flow-checklist --status to review incomplete items"
98
- → 若 --skip-gate 提供:
99
- • 验证 --reason 参数存在
100
- • Run: node .claude/hooks/checklist-gate.js --req-id {REQ_ID} --skip --reason "{reason}"
101
- • 审计日志记录到 EXECUTION_LOG.md
102
- → 若 status == "PASS" 或 "SKIPPED": 继续
103
- → 若 checklists/ 不存在: 跳过此检查 (Checklist 可选)
104
- ```
105
-
106
- ### 阶段 2: Epic/TASKS 初始化
107
- ```
108
- 1. 执行 {SCRIPT:setup} --json
109
- → 返回 EPIC_FILE, TASKS_FILE, reqId, title
110
- 2. 加载模板
111
- → EPIC_TEMPLATE.md、TASKS_TEMPLATE.md
112
- 3. 写入 orchestration_status
113
- → status = "epic_generation_in_progress"
114
- → phase = "planning"
115
- 4. EXECUTION_LOG.md 追加启动记录
116
- ```
117
-
118
- ### 阶段 3: Planner Agent
119
- ```
120
- Agent Prompt 要点:
121
- - Inputs:
122
- • PRD.md
123
- • TECH_DESIGN.md
124
- • research/research.md (决策)
125
- • data-model.md
126
- • contracts/ (OpenAPI/GraphQL)
127
- • quickstart.md (测试环境/命令)
128
- • research/codebase-tech-analysis.md
129
- • UI_PROTOTYPE.html (若存在)
130
- - Must:
131
- • 执行 Phase -1 Gates (Simplicity / Anti-Abstraction / Integration-First)
132
- • 按模板输出 EPIC.md (含 Success Metrics、Phase 2 Tests First、Complexity Tracking)
133
- • 生成单一 TASKS.md:
134
- - Phase 1 Setup → Phase 2 Foundational → Phase 3+ User Stories → Final Polish
135
- - Phase 2 列出所有 contract/integration tests(引用 contracts/ 路径)
136
- - Phase 3+ 依据 data-model 分配实体、依据 contracts 分配端点
137
- - 引用 quickstart 中的命令作为测试/验证步骤
138
- - 使用 `[US#]`、`[P]` 标签,包含精确文件路径
139
- - 插入 “⚠️ TEST VERIFICATION CHECKPOINT” 于 Phase 2 与 Phase 3 之间
140
- • Dependencies、Parallel Execution、Implementation Strategy 必须填写
141
- • Constitution Check per phase
142
- ```
143
-
144
- ### 阶段 4: Exit Gate
145
- ```
146
- 1. 文件存在
147
- → EPIC_FILE, TASKS_FILE
148
-
149
- 2. EPIC.md 结构
150
- → 包含 Technical Approach、Phase 2 Tests First、Complexity Tracking、Constitution Check
151
- → 无 {{PLACEHOLDER}}
152
-
153
- 3. TASKS.md 结构
154
- → Phase 顺序正确 (Setup → Foundational → US… → Polish)
155
- → Phase 2 在 Phase 3 前且包含 contract tests
156
- → “⚠️ TEST VERIFICATION CHECKPOINT” 位于 Phase 2 与 Phase 3 之间
157
- → 任务格式 `- [ ] T### [P?] [US#?] Description with file path`
158
-
159
- 4. 依赖覆盖
160
- → 数据模型任务与 data-model.md 一致
161
- → API 任务覆盖 contracts/
162
- → Tests 引用 quickstart 与 contracts
163
-
164
- 5. 状态更新
165
- → orchestration_status:
166
- status = "epic_complete"
167
- completedSteps append "epic"
168
- → EXECUTION_LOG.md 记录完成时间
169
- ```
170
-
171
- ## 错误处理
172
- - 缺少任一必需产物 → 直接返回 ERROR 提示回到 `/flow-tech`。
173
- - Planner 生成失败 → 标记 `epic_generation_failed`,用户可修正后重试。
174
- - Constitution 校验不通过 → 输出违规项并终止。
175
-
176
- ## 输出
177
- - `EPIC.md`: 包含范围、成功指标、TDD 阶段、复杂度跟踪。
178
- - `TASKS.md`: 单文件任务清单,按 user story 独立测试,引用 data-model、contracts、quickstart。
179
-
180
- ## 后续建议
181
- 1. 审阅任务依赖和并行策略。
182
- 2. 立即运行 `/flow-dev` 进入实现,确保 Phase 2 Tests 先落地。
183
- 3. 若新增技术栈,回到 `research/tasks.json` 更新研究状态并同步 agent context。
@@ -1,370 +0,0 @@
1
- ---
2
- name: flow-init
3
- description: 'Initialize requirement structure. Usage: /flow-init "REQ-123|Title|URLs"'
4
- scripts:
5
- create: .claude/scripts/create-requirement.sh
6
- prereq: .claude/scripts/check-prerequisites.sh
7
- research_tasks: .claude/scripts/generate-research-tasks.sh
8
- populate_tasks: .claude/scripts/populate-research-tasks.sh
9
- consolidate: .claude/scripts/consolidate-research.sh
10
- validate_research: .claude/scripts/validate-research.sh
11
- templates:
12
- flow: .claude/docs/templates/INIT_FLOW_TEMPLATE.md
13
- research: .claude/docs/templates/RESEARCH_TEMPLATE.md
14
- brainstorm: .claude/docs/templates/BRAINSTORM_TEMPLATE.md
15
- guides:
16
- troubleshoot: .claude/docs/guides/INIT_TROUBLESHOOTING.md
17
- skills:
18
- brainstorming: .claude/skills/flow-brainstorming/SKILL.md
19
- ---
20
-
21
- <!-- ============================================================
22
- 头文件引用语法规范 (Header File Reference Syntax)
23
- ============================================================
24
-
25
- 命令头文件格式:
26
- ```yaml
27
- scripts:
28
- create: .claude/scripts/create-requirement.sh
29
- templates:
30
- flow: .claude/docs/templates/INIT_FLOW_TEMPLATE.md
31
- guides:
32
- troubleshoot: .claude/docs/guides/INIT_TROUBLESHOOTING.md
33
- ```
34
-
35
- 引用语法:
36
- - {SCRIPT:create} → 执行 .claude/scripts/create-requirement.sh
37
- - {TEMPLATE:flow} → 加载 .claude/docs/templates/INIT_FLOW_TEMPLATE.md
38
- - {GUIDE:troubleshoot} → 参考 .claude/docs/guides/INIT_TROUBLESHOOTING.md
39
-
40
- 使用案例:
41
- ```markdown
42
- # 正文中遇到:
43
- → Run: {SCRIPT:create} "REQ-123" --title "User Auth"
44
- # 解释为:
45
- → 执行命令: bash .claude/scripts/create-requirement.sh "REQ-123" --title "User Auth"
46
-
47
- # 正文中遇到:
48
- → 详见 {TEMPLATE:flow} Stage 2.5
49
- # 解释为:
50
- → 打开并阅读 .claude/docs/templates/INIT_FLOW_TEMPLATE.md 中的 Stage 2.5 章节
51
-
52
- # 正文中遇到:
53
- → 遇到问题参考 {GUIDE:troubleshoot}
54
- # 解释为:
55
- → 打开并阅读 .claude/docs/guides/INIT_TROUBLESHOOTING.md
56
- ```
57
-
58
- 规则: 遇到 {TYPE:key} 占位符时,去头文件 YAML 中找对应类型的 key,获取文件路径并执行/加载。
59
- ============================================================ -->
60
-
61
- # Flow-Init - 需求初始化命令
62
-
63
- ## User Input
64
- ```text
65
- $ARGUMENTS = "REQ_ID|TITLE|PLAN_URLS?" 或 --interactive
66
- ```
67
-
68
- **格式**:
69
- - REQ_ID: `^(REQ|BUG)-[0-9]+$` (例如: REQ-123, BUG-456)
70
- - TITLE: 需求简短标题
71
- - PLAN_URLS: 计划文档URL,多个用逗号分隔 (可选)
72
-
73
- **示例**:
74
- ```
75
- /flow-init "REQ-123|User Authentication"
76
- /flow-init "REQ-124|数据导出|https://docs.example.com/export-spec.md"
77
- /flow-init --interactive
78
- ```
79
-
80
- ---
81
-
82
- ## 执行前加载
83
-
84
- **详细流程**:
85
- → 参见 `{TEMPLATE:flow}` 获取完整执行流程
86
-
87
- **研究模板**:
88
- → 参见 `{TEMPLATE:research}` 了解研究文档格式
89
-
90
- **故障排查**:
91
- → 遇到问题参考 `{GUIDE:troubleshoot}`
92
-
93
- ---
94
-
95
- ## 执行流程
96
-
97
- ### Stage 1: Entry Gate (参数验证)
98
-
99
- ```
100
- 1. 解析参数: REQ_ID|TITLE|PLAN_URLS
101
- → 验证 REQ_ID 格式: ^(REQ|BUG)-[0-9]+$
102
- → 提取 TITLE 和 PLAN_URLS
103
- → 若 TITLE 含中文/非ASCII,使用模型意译生成 BRANCH_TITLE_EN(英文语义翻译,禁止拼音/音译)
104
- → BRANCH_TITLE_EN 仅用于分支名,文档标题仍使用原始 TITLE
105
- → 若意译不确定或未生成 ASCII 结果,向用户确认英文分支标题
106
-
107
- 2. 前置条件检查
108
- → Run: {SCRIPT:prereq} --json --paths-only
109
- → 检查 Git 状态是否干净
110
- → 验证 devflow/ 目录存在
111
-
112
- 3. 目录唯一性检查
113
- → 确认 devflow/requirements/${REQ_ID}/ 不存在
114
- → 如果存在 → ERROR (使用 --force 强制覆盖)
115
-
116
- 4. 验证通过 → 继续 Stage 1.5
117
- ```
118
-
119
- ---
120
-
121
- ### Stage 1.2: Git Branch Creation
122
-
123
- ```
124
- 创建功能分支:
125
- → Requirements: feature/${REQ_ID}-${slug(BRANCH_TITLE_EN)}
126
- → Bug Fixes: bugfix/${BUG_ID}-${slug(BRANCH_TITLE_EN)}
127
-
128
- Where BRANCH_TITLE_EN = TITLE 的英文意译 (语义为准,非拼音,使用模型意译)
129
- slug() = lowercase, replace spaces/special chars with hyphens
130
- ```
131
-
132
- ---
133
-
134
- ### Stage 1.5: Context Loading (路线图与架构)
135
-
136
- **目标**: 理解需求在项目中的位置
137
-
138
- ```
139
- 检查 ROADMAP.md 和 ARCHITECTURE.md:
140
- → 如果存在: 加载上下文,展示需求位置
141
- → 如果不存在: 提示可选运行 /core-roadmap
142
-
143
- → 详见 {TEMPLATE:flow} Stage 1.5
144
- ```
145
-
146
- **输出**: 显示需求在路线图和架构中的位置 (如果可用)
147
-
148
- ---
149
-
150
- ### Stage 2: Directory Initialization
151
-
152
- ```
153
- 创建需求目录结构:
154
- → Run: {SCRIPT:create} "${REQ_ID}" --title "${TITLE}" --branch-title "${BRANCH_TITLE_EN}" --json (如有)
155
-
156
- 生成文件:
157
- - devflow/requirements/${REQ_ID}/README.md
158
- - devflow/requirements/${REQ_ID}/EXECUTION_LOG.md
159
- - devflow/requirements/${REQ_ID}/orchestration_status.json
160
- - devflow/requirements/${REQ_ID}/research/ (目录)
161
-
162
- → 详见 {TEMPLATE:flow} Stage 2
163
- ```
164
-
165
- ---
166
-
167
- ### Stage 2.3: Brainstorming (North Star Capture)
168
-
169
- **目标**: 捕捉需求的原始意图,确保后续流程有明确的「北极星」可追溯
170
-
171
- **Iron Law**: `NO FLOW EXECUTION WITHOUT BRAINSTORM ALIGNMENT`
172
-
173
- ```
174
- 触发 flow-brainstorming skill:
175
- → 参见 {SKILL:brainstorming} 了解完整流程
176
-
177
- 执行步骤:
178
- 1. Understanding the Idea
179
- → 一次问一个问题,不要压垮用户
180
- → 优先多选题,更容易回答
181
- → 理解: 目的、约束、成功标准
182
-
183
- 2. Exploring Approaches
184
- → 提出 2-3 种方案及取舍
185
- → 给出推荐方案和理由
186
- → 让用户做最终决策
187
-
188
- 3. Presenting the Design
189
- → 分段呈现设计 (200-300 字/段)
190
- → 每段后确认是否正确
191
- → 涵盖: 架构、组件、数据流、测试
192
-
193
- 4. Documentation
194
- → 使用 {TEMPLATE:brainstorm} 模板
195
- → 输出: devflow/requirements/${REQ_ID}/BRAINSTORM.md
196
- → 必须包含: 原始需求、核心问题、成功标准、方案探索、最终决策
197
-
198
- Rationalization Prevention:
199
- | Excuse | Reality |
200
- |--------|---------|
201
- | "需求已经很清楚了" | Brainstorm 确保没有遗漏假设 |
202
- | "用户赶时间" | 头脑风暴节省后续返工时间 |
203
- | "这是小需求" | 小需求也有核心问题和成功标准 |
204
-
205
- Red Flags - STOP:
206
- → 跳过问问题直接开始做
207
- → 没有记录方案取舍就选定
208
- → 没有写 BRAINSTORM.md 就进入下一阶段
209
- ```
210
-
211
- **输出**: `devflow/requirements/${REQ_ID}/BRAINSTORM.md`
212
-
213
- **验证**:
214
- - [ ] BRAINSTORM.md 存在
215
- - [ ] 包含「原始需求」章节 (用户原话)
216
- - [ ] 包含「成功标准」章节
217
- - [ ] 包含「方案探索」章节 (2-3种)
218
- - [ ] 包含「最终决策」章节
219
-
220
- ---
221
-
222
- ### Stage 2.5: Research (Subagent Mandatory)
223
-
224
- **目标**: 研究默认必跑,但将“研究型内容”隔离到 subagent,避免主会话上下文耗尽。
225
-
226
- **Iron Law**: 大内容落盘,主会话只返回「决策摘要 + 文件路径」。
227
-
228
- #### ✅ Mandatory: Call `flow-researcher` Subagent
229
-
230
- > subagent 负责内部/外部研究、落盘、任务回填、研究整合与质量验证;主 agent 只做编排与最终 Gate。
231
-
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
- }
249
- ```
250
-
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)
257
-
258
- ---
259
-
260
- ### Stage 2.6: Research Consolidation
261
-
262
- > 该阶段由 `flow-researcher` subagent 执行(包含 tasks 生成/回填/整合/校验)。
263
-
264
- 主 agent 在 Exit Gate 中只做最终验证与状态更新:
265
- - Run: `{SCRIPT:validate_research} "${REQ_DIR}" --strict`
266
- - `orchestration_status.json.phase0_complete = true`
267
-
268
- ---
269
- ### Stage 3: README Generation
270
-
271
- ```
272
- 生成工作流指南:
273
- → devflow/requirements/${REQ_ID}/README.md
274
- → 包含: 需求概述、工作流步骤、检查清单
275
- ```
276
-
277
- ---
278
-
279
- ### Stage 4: Exit Gate (5-Level Quality Check)
280
-
281
- **5层验证**:
282
-
283
- ```
284
- Level 1: File Existence Check
285
- → 验证所有必需文件已创建
286
-
287
- Level 2: Research.md Structure Validation
288
- → Run: {SCRIPT:validate_research} "${REQ_DIR}" --strict
289
- → 检查 research.md 结构
290
-
291
- Level 3: Research.md Content Quality
292
- → 无 TODO/FIXME/{{PLACEHOLDER}} 标记
293
- → 每个 Decision block 完整
294
-
295
- Level 4: Research Tasks Validation
296
- → 验证 tasks.json 格式和内容
297
-
298
- Level 5: Git & Status & Constitution
299
- → Git 分支创建成功
300
- → orchestration_status.json 正确
301
- → Constitution 符合性检查
302
-
303
- → 详见 {TEMPLATE:flow} Stage 4
304
- ```
305
-
306
- ---
307
-
308
- ## 输出产物
309
-
310
- ### Requirements
311
-
312
- ```
313
- devflow/requirements/${REQ_ID}/
314
- ├── README.md
315
- ├── BRAINSTORM.md # 需求的北极星 (Stage 2.3)
316
- ├── research/
317
- │ ├── internal/
318
- │ │ └── codebase-overview.md
319
- │ ├── mcp/
320
- │ │ └── $(date +%Y%m%d)/
321
- │ │ ├── official/
322
- │ │ ├── guides/
323
- │ │ ├── tutorials/
324
- │ │ └── examples/
325
- │ ├── research.md
326
- │ ├── research-summary.md
327
- │ └── tasks.json
328
- ├── EXECUTION_LOG.md
329
- └── orchestration_status.json
330
- ```
331
-
332
- ### Git
333
-
334
- - **Branch**: `feature/${REQ_ID}-${slug(BRANCH_TITLE_EN)}`
335
- - **Status**: orchestration_status.json.status = "initialized"
336
- - **Phase**: orchestration_status.json.phase = "planning"
337
-
338
- ---
339
-
340
- ## 错误处理
341
-
342
- **常见错误**:
343
- → 详见 `{GUIDE:troubleshoot}`
344
-
345
- **主要错误场景**:
346
- 1. Invalid REQ_ID format → 检查格式
347
- 2. REQ_ID already exists → 使用不同 ID 或 --force
348
- 3. Git status not clean → commit/stash changes
349
- 4. Research validation failed → 手动补充 research.md
350
- 5. MCP fetch failed → 继续但标记待补项
351
-
352
- **恢复步骤**:
353
- → 详见 `{GUIDE:troubleshoot}` Recovery Procedures
354
-
355
- ---
356
-
357
- ## Next Step
358
-
359
- ```
360
- /flow-prd "${REQ_ID}"
361
- ```
362
-
363
- 生成产品需求文档
364
-
365
- ---
366
-
367
- **Related Documentation**:
368
- - [INIT_FLOW_TEMPLATE.md](../.claude/docs/templates/INIT_FLOW_TEMPLATE.md) - 详细执行流程
369
- - [INIT_TROUBLESHOOTING.md](../.claude/docs/guides/INIT_TROUBLESHOOTING.md) - 故障排查指南
370
- - [RESEARCH_TEMPLATE.md](../.claude/docs/templates/RESEARCH_TEMPLATE.md) - 研究模板格式