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
@@ -0,0 +1,195 @@
1
+ ---
2
+ name: dev-implementer
3
+ description: Execute development tasks following TDD Iron Law with implementation planning.
4
+ tools: Read, Write, Grep, Glob
5
+ model: inherit
6
+ ---
7
+
8
+ You are a development implementation specialist with **MANDATORY TDD IRON LAW ENFORCEMENT**.
9
+
10
+ ## ⚠️ CRITICAL: TDD IRON LAW
11
+
12
+ ```
13
+ NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
14
+ ```
15
+
16
+ ### TDD Checkpoint
17
+
18
+ ```yaml
19
+ ⚠️ TEST VERIFICATION CHECKPOINT:
20
+ 1. 运行所有 Phase 2 测试
21
+ 2. 验证所有新测试 FAIL
22
+ 3. 只有全部 FAIL 后才能进入 Phase 3
23
+ 4. 如果已经写了实现代码 → DELETE 重来
24
+ ```
25
+
26
+ ## Your Role
27
+
28
+ - **Primary**: Execute individual tasks from TASKS.md following TDD sequence
29
+ - **Output**: Implementation code + IMPLEMENTATION_PLAN.md for each task
30
+ - **Enforce**: TDD Iron Law - tests MUST fail before implementation
31
+ - **Track**: Update task status and log progress
32
+
33
+ ## Rules Integration
34
+
35
+ You MUST follow these rules during implementation:
36
+
37
+ 1. **TDD Sequence**:
38
+ - Read task DoD (Definition of Done)
39
+ - Write failing test FIRST
40
+ - Verify test fails
41
+ - Write minimal implementation to pass
42
+ - Refactor while keeping tests green
43
+ - Commit
44
+
45
+ 2. **Code Quality**:
46
+ - No partial implementations (Article I)
47
+ - Reuse existing code (Article II)
48
+ - No hardcoded secrets (Article III)
49
+ - Proper resource cleanup (Article IV)
50
+ - No dead code (Article V)
51
+
52
+ 3. **File Operations**:
53
+ - Use exact file paths from TASKS.md
54
+ - Follow existing code patterns
55
+ - Maintain consistent naming conventions
56
+
57
+ ## Input Context
58
+
59
+ When executing a task, you receive:
60
+ - **REQ_ID**: Requirement identifier
61
+ - **TASK_ID**: Task identifier (T001, T002, etc.)
62
+ - **TASKS.md**: Full task list with DoD
63
+ - **TECH_DESIGN.md**: Technical design reference
64
+ - **PRD.md**: Product requirements reference
65
+
66
+ ## Execution Flow
67
+
68
+ ### Stage 1: Task Analysis
69
+
70
+ ```yaml
71
+ 1. Read TASKS.md and locate task by TASK_ID
72
+ 2. Extract:
73
+ - Task description
74
+ - File paths
75
+ - DoD criteria
76
+ - Dependencies
77
+ - [P] parallel flag
78
+ - [US#] user story reference
79
+ 3. Read related context:
80
+ - TECH_DESIGN.md for technical details
81
+ - PRD.md for acceptance criteria
82
+ - Existing code for patterns
83
+ ```
84
+
85
+ ### Stage 2: Implementation Planning
86
+
87
+ ```yaml
88
+ 1. Create IMPLEMENTATION_PLAN.md in tasks/ directory
89
+ 2. Document:
90
+ - Approach
91
+ - Files to modify
92
+ - Test strategy
93
+ - Implementation steps
94
+ - Verification commands
95
+ ```
96
+
97
+ ### Stage 3: TDD Execution
98
+
99
+ ```yaml
100
+ Phase 2 (Tests First):
101
+ 1. Write test file
102
+ 2. Run test → MUST FAIL
103
+ 3. If test passes → ERROR (invalid test)
104
+ 4. Log test creation
105
+
106
+ Phase 3 (Implementation):
107
+ 1. Write minimal code to pass test
108
+ 2. Run test → MUST PASS
109
+ 3. Refactor if needed
110
+ 4. Run test again → MUST PASS
111
+ 5. Log implementation
112
+ ```
113
+
114
+ ### Stage 4: Verification
115
+
116
+ ```yaml
117
+ 1. Run all related tests
118
+ 2. Check coverage
119
+ 3. Verify DoD criteria met
120
+ 4. Update TASKS.md (mark [x])
121
+ 5. Log completion
122
+ ```
123
+
124
+ ## Output Structure
125
+
126
+ ```
127
+ devflow/requirements/${REQ_ID}/tasks/
128
+ ├── IMPLEMENTATION_PLAN.md # Overall implementation plan
129
+ ├── T001_plan.md # Task-specific plan
130
+ ├── T002_plan.md
131
+ └── ...
132
+ ```
133
+
134
+ ## Error Handling
135
+
136
+ ```yaml
137
+ Test Failure:
138
+ 1. Log error to ERROR_LOG.md
139
+ 2. Analyze root cause
140
+ 3. Fix and retry
141
+ 4. If persistent → escalate
142
+
143
+ Implementation Failure:
144
+ 1. Log error with full context
145
+ 2. Check dependencies
146
+ 3. Review TECH_DESIGN.md
147
+ 4. Retry with adjusted approach
148
+ ```
149
+
150
+ ## Constitution Compliance
151
+
152
+ For each task, verify:
153
+ - [ ] Article I: Complete implementation, no placeholders
154
+ - [ ] Article II: Reused existing code where possible
155
+ - [ ] Article III: No hardcoded secrets
156
+ - [ ] Article IV: Resources properly managed
157
+ - [ ] Article V: No dead code introduced
158
+ - [ ] Article VI: TDD sequence followed
159
+
160
+ ## Attention Refresh Protocols
161
+
162
+ | Protocol | Trigger | Action |
163
+ |----------|---------|--------|
164
+ | Protocol 2 | Task start | Read TASKS.md T### + DoD |
165
+ | Protocol 3 | Iteration start | Read TASKS.md + ERROR_LOG |
166
+ | Protocol 4 | After error | Read ERROR_LOG.md |
167
+
168
+ ## Quality Criteria
169
+
170
+ - **TDD Compliance**: Tests written and failing before implementation
171
+ - **Code Coverage**: ≥80% for new code
172
+ - **No Placeholders**: All code complete and functional
173
+ - **Documentation**: Implementation plan documented
174
+ - **Verification**: All DoD criteria met
175
+
176
+ ## Process Summary
177
+
178
+ ```
179
+ 1. Read task from TASKS.md
180
+ 2. Create implementation plan
181
+ 3. Write failing test (Phase 2)
182
+ 4. Verify test fails
183
+ 5. Write implementation (Phase 3)
184
+ 6. Verify test passes
185
+ 7. Update task status
186
+ 8. Log completion
187
+ ```
188
+
189
+ ## Context Requirements
190
+
191
+ - Read `orchestration_status.json` for project state
192
+ - Read `TECH_DESIGN.md` for technical specifications
193
+ - Read `PRD.md` for acceptance criteria
194
+ - Read existing code for patterns and conventions
195
+ - Update `EXECUTION_LOG.md` with progress
@@ -1,11 +1,14 @@
1
1
  ---
2
2
  name: flow-archive
3
- description: 'Archive completed/deprecated requirements. Usage: /flow-archive "REQ-123" or /flow-archive --list'
3
+ description: 'Archive completed/deprecated requirements with Delta Specs support. Usage: /flow:archive "REQ-123" or /flow:archive --list'
4
+ version: 4.5.0
4
5
  scripts:
5
6
  archive: .claude/scripts/archive-requirement.sh
6
7
  ---
7
8
 
8
- # Flow-Archive - 需求归档命令
9
+ # /flow:archive - 需求归档命令 (v4.5)
10
+
11
+ > **[PROTOCOL]**: 变更时更新此头部,然后检查 CLAUDE.md
9
12
 
10
13
  ## User Input
11
14
  ```text
@@ -15,10 +18,10 @@ $ARGUMENTS = "REQ_ID?" | "--list" | "--restore REQ_ID"
15
18
 
16
19
  ## 命令格式
17
20
  ```text
18
- /flow-archive "REQ-123" # 归档已完成需求
19
- /flow-archive "REQ-123" --reason deprecated # 标记为废弃归档
20
- /flow-archive --list # 列出所有归档
21
- /flow-archive "REQ-123" --restore # 恢复归档需求
21
+ /flow:archive "REQ-123" # 归档已完成需求
22
+ /flow:archive "REQ-123" --reason deprecated # 标记为废弃归档
23
+ /flow:archive --list # 列出所有归档
24
+ /flow:archive "REQ-123" --restore # 恢复归档需求
22
25
  ```
23
26
 
24
27
  ### 参数说明
@@ -221,11 +224,43 @@ ERROR: 无效的归档原因: cancelled
221
224
  ## 与其他命令的关系
222
225
 
223
226
  ```text
224
- /flow-init → /flow-prd → /flow-epic → /flow-dev → /flow-qa → /flow-release
225
-
226
- /flow-archive ← 工作流终点
227
-
228
- devflow/archive/{YYYY-MM}/
227
+ /flow:init → /flow:spec → /flow:dev → /flow:quality → /flow:release
228
+
229
+ /flow:archive ← 工作流终点
230
+
231
+ devflow/archive/{YYYY-MM}/
232
+ ```
233
+
234
+ ## Delta Specs 集成 (v4.5)
235
+
236
+ 归档时自动处理 Delta Specs:
237
+
238
+ ### 归档前检查
239
+ - 检测 `deltas/` 目录中的 Delta Specs
240
+ - 警告未应用的 Delta Specs (status != "applied")
241
+ - 建议先运行 `/flow:delta apply REQ-XXX --all`
242
+
243
+ ### 归档内容
244
+ ```
245
+ devflow/archive/{YYYY-MM}/{REQ_ID}/
246
+ ├── PRD.md # 主规格文档
247
+ ├── deltas/ # Delta Specs (完整保留)
248
+ │ ├── 2026-02-01-add-2fa/
249
+ │ │ ├── delta.md
250
+ │ │ └── tasks.md
251
+ │ └── ...
252
+ ├── orchestration_status.json # 包含 deltaCount 字段
253
+ └── ...
254
+ ```
255
+
256
+ ### 状态文件增强
257
+ ```json
258
+ {
259
+ "status": "archived",
260
+ "archivedReason": "completed",
261
+ "deltaCount": 3,
262
+ "archivedAt": "2026-02-07T10:00:00+08:00"
263
+ }
229
264
  ```
230
265
 
231
266
  ## 脚本集成
@@ -0,0 +1,150 @@
1
+ ---
2
+ name: flow-context
3
+ description: Manage staged context injection for agents (RM-015)
4
+ version: 3.0.0
5
+ ---
6
+
7
+ # /flow-context
8
+
9
+ > **[PROTOCOL]**: 变更时更新此头部,然后检查 CLAUDE.md
10
+
11
+ ## Purpose
12
+
13
+ Manage context injection configuration for CC-DevFlow agents.
14
+ Each agent type has a JSONL file defining what context to load.
15
+
16
+ ## Usage
17
+
18
+ ```bash
19
+ # Initialize context directory for a requirement
20
+ /flow-context init [REQ-ID] [--type backend|frontend|fullstack]
21
+
22
+ # Add entry to context file
23
+ /flow-context add [agent] [path] [purpose] [--optional]
24
+
25
+ # List current context configuration
26
+ /flow-context list [agent]
27
+
28
+ # Validate context paths exist
29
+ /flow-context validate [REQ-ID]
30
+ ```
31
+
32
+ ## Subcommands
33
+
34
+ ### init
35
+
36
+ Initialize context directory with templates.
37
+
38
+ ```bash
39
+ /flow-context init REQ-007 --type backend
40
+ ```
41
+
42
+ Creates:
43
+ - `devflow/requirements/REQ-007/context/`
44
+ - Copies templates from `.claude/docs/templates/context/*.jsonl.template`
45
+ - Customizes based on `--type` (backend removes frontend specs, etc.)
46
+
47
+ ### add
48
+
49
+ Add an entry to a context JSONL file.
50
+
51
+ ```bash
52
+ /flow-context add dev "src/utils/auth.ts" "Authentication utilities" --optional
53
+ ```
54
+
55
+ Appends to `context/dev.jsonl`:
56
+ ```json
57
+ {"type": "file", "path": "src/utils/auth.ts", "purpose": "Authentication utilities", "optional": true}
58
+ ```
59
+
60
+ ### list
61
+
62
+ Show current context configuration.
63
+
64
+ ```bash
65
+ /flow-context list dev
66
+ ```
67
+
68
+ Output:
69
+ ```
70
+ Context for 'dev' agent (REQ-007):
71
+
72
+ 1. [file] TASKS.md - Current task list and progress
73
+ 2. [file] EPIC.md - Epic overview and phases
74
+ 3. [file] TECH_DESIGN.md - Technical implementation guide
75
+ 4. [file] ERROR_LOG.md - Previous errors to avoid (optional)
76
+ 5. [spec] devflow/spec/frontend/style.md - Frontend style guide (optional)
77
+
78
+ Total: 5 entries (3 required, 2 optional)
79
+ ```
80
+
81
+ ### validate
82
+
83
+ Validate all context paths exist.
84
+
85
+ ```bash
86
+ /flow-context validate REQ-007
87
+ ```
88
+
89
+ Output:
90
+ ```
91
+ Validating context for REQ-007...
92
+
93
+ ✓ dev.jsonl: 5/5 paths valid
94
+ ✓ epic.jsonl: 4/4 paths valid
95
+ ✗ review.jsonl: 3/4 paths valid
96
+ - Missing: contracts/api.yaml
97
+
98
+ Overall: 12/13 paths valid (92%)
99
+ ```
100
+
101
+ ## Integration
102
+
103
+ ### With flow-init
104
+
105
+ When `/flow-init` creates a new requirement, it automatically runs:
106
+ ```bash
107
+ /flow-context init {REQ-ID} --type {detected-type}
108
+ ```
109
+
110
+ ### With Agent Invocation
111
+
112
+ The `inject-agent-context.ts` hook automatically:
113
+ 1. Detects current REQ-ID from environment or git branch
114
+ 2. Reads `context/{agent}.jsonl`
115
+ 3. Injects resolved content into agent prompt
116
+
117
+ ## Context Entry Format
118
+
119
+ ```jsonl
120
+ {"type": "file", "path": "PRD.md", "purpose": "Product requirements"}
121
+ {"type": "directory", "path": "contracts/", "purpose": "API contracts", "depth": 2}
122
+ {"type": "spec", "path": "devflow/spec/backend/api.md", "purpose": "API conventions"}
123
+ ```
124
+
125
+ ### Entry Types
126
+
127
+ | Type | Path Resolution | Use Case |
128
+ |------|-----------------|----------|
129
+ | `file` | Relative to requirement dir | Requirement-specific files |
130
+ | `directory` | Relative to requirement dir | Load all files in directory |
131
+ | `spec` | Relative to project root | Project-level specifications |
132
+
133
+ ### Optional Entries
134
+
135
+ Add `"optional": true` for files that may not exist:
136
+ ```json
137
+ {"type": "file", "path": "ERROR_LOG.md", "purpose": "Previous errors", "optional": true}
138
+ ```
139
+
140
+ ## Scripts
141
+
142
+ - `.claude/scripts/flow-context-init.sh` - Initialize context directory
143
+ - `.claude/scripts/flow-context-add.sh` - Add entry to JSONL
144
+ - `.claude/scripts/flow-context-validate.sh` - Validate paths
145
+
146
+ ## Related
147
+
148
+ - **Hook**: `.claude/hooks/inject-agent-context.ts`
149
+ - **Types**: `.claude/hooks/types/context-injection.d.ts`
150
+ - **Templates**: `.claude/docs/templates/context/*.jsonl.template`
@@ -0,0 +1,245 @@
1
+ ---
2
+ name: flow-delta
3
+ description: Manage delta specs for incremental requirement tracking (RM-017)
4
+ version: 4.0.0
5
+ ---
6
+
7
+ # /flow:delta
8
+
9
+ > **[PROTOCOL]**: 变更时更新此头部,然后检查 CLAUDE.md
10
+
11
+ ## Purpose
12
+
13
+ Manage incremental specification changes (delta specs) for tracking requirement evolution.
14
+ Delta specs capture ADDED/MODIFIED/REMOVED/RENAMED changes that are later applied to the SSOT.
15
+
16
+ 借鉴 OpenSpec 的 Delta Specs 设计,实现增量规格管理。
17
+
18
+ ## Usage
19
+
20
+ ```bash
21
+ # Create a new delta spec
22
+ /flow:delta create "REQ-123" "add-2fa"
23
+
24
+ # List all deltas for a requirement
25
+ /flow:delta list "REQ-123"
26
+
27
+ # Apply delta to main specs (PRD.md)
28
+ /flow:delta apply "REQ-123" "add-2fa"
29
+
30
+ # Check delta status
31
+ /flow:delta status "REQ-123" "add-2fa"
32
+ ```
33
+
34
+ ## Subcommands
35
+
36
+ ### create
37
+
38
+ Create a new delta spec for a requirement.
39
+
40
+ ```bash
41
+ /flow:delta create "REQ-123" "add-2fa"
42
+ ```
43
+
44
+ Creates:
45
+ ```
46
+ devflow/requirements/REQ-123/
47
+ └── deltas/
48
+ └── {YYYY-MM-DD}-add-2fa/
49
+ ├── delta.md
50
+ └── tasks.md
51
+ ```
52
+
53
+ **Process**:
54
+ 1. Validate REQ-ID exists
55
+ 2. Generate delta_id: `{YYYY-MM-DD}-{slug}`
56
+ 3. Create directory structure
57
+ 4. Generate delta.md from template
58
+ 5. Generate tasks.md for delta-specific tasks
59
+
60
+ ### list
61
+
62
+ List all deltas for a requirement.
63
+
64
+ ```bash
65
+ /flow:delta list "REQ-123"
66
+ ```
67
+
68
+ **Output**:
69
+ ```
70
+ Deltas for REQ-123:
71
+ 1. 2026-02-01-add-2fa [approved] Add 2FA support
72
+ 2. 2026-02-05-fix-login [draft] Fix login timeout
73
+ 3. 2026-02-07-add-oauth [review] Add OAuth providers
74
+
75
+ Total: 3 deltas (1 approved, 1 draft, 1 review)
76
+ ```
77
+
78
+ ### apply
79
+
80
+ Apply a delta to the main PRD.md specification.
81
+
82
+ ```bash
83
+ /flow:delta apply "REQ-123" "add-2fa"
84
+ ```
85
+
86
+ **Process**:
87
+ 1. Parse delta.md using delta-parser.ts
88
+ 2. Validate delta status is "approved"
89
+ 3. Apply changes to PRD.md:
90
+ - RENAMED: Rename requirement headers
91
+ - REMOVED: Remove requirement blocks
92
+ - MODIFIED: Replace requirement content
93
+ - ADDED: Append new requirements
94
+ 4. Update delta status to "applied"
95
+ 5. Move to archive/
96
+
97
+ **Validation**:
98
+ - Delta must be in "approved" status
99
+ - No duplicate requirements in ADDED
100
+ - MODIFIED/REMOVED targets must exist
101
+ - RENAMED source must exist, target must not
102
+
103
+ ### status
104
+
105
+ Check the status of a specific delta.
106
+
107
+ ```bash
108
+ /flow:delta status "REQ-123" "add-2fa"
109
+ ```
110
+
111
+ **Output**:
112
+ ```
113
+ Delta: 2026-02-01-add-2fa
114
+ Status: approved
115
+ Created: 2026-02-01T10:00:00Z
116
+
117
+ Changes:
118
+ ADDED: 2 requirements
119
+ MODIFIED: 1 requirement
120
+ REMOVED: 0 requirements
121
+ RENAMED: 1 requirement
122
+
123
+ Validation:
124
+ ✓ All ADDED requirements are unique
125
+ ✓ All MODIFIED targets exist
126
+ ✓ All RENAMED sources exist
127
+ ✓ Ready to apply
128
+ ```
129
+
130
+ ## Delta Spec Format
131
+
132
+ ```markdown
133
+ ---
134
+ delta_id: "2026-02-01-add-2fa"
135
+ req_id: "REQ-123"
136
+ title: "Add 2FA Support"
137
+ created_at: "2026-02-01T10:00:00Z"
138
+ status: "draft|review|approved|applied"
139
+ ---
140
+
141
+ # Delta: Add 2FA Support
142
+
143
+ ## Summary
144
+ Brief description of changes.
145
+
146
+ ## ADDED Requirements
147
+
148
+ ### Requirement: Two-Factor Authentication
149
+ Description of the new requirement.
150
+
151
+ #### Scenario: Enable 2FA
152
+ - GIVEN user is logged in
153
+ - WHEN user enables 2FA
154
+ - THEN system generates QR code
155
+
156
+ ## MODIFIED Requirements
157
+
158
+ ### Requirement: User Login
159
+ New description.
160
+ (Previously: old description)
161
+
162
+ ## REMOVED Requirements
163
+
164
+ ### Requirement: Legacy Session
165
+ **Reason**: Replaced by JWT
166
+ **Migration**: Run migration script
167
+
168
+ ## RENAMED Requirements
169
+
170
+ - FROM: Old Name
171
+ - TO: New Name
172
+ ```
173
+
174
+ ## Status Workflow
175
+
176
+ ```
177
+ draft → review → approved → applied
178
+ │ │ │
179
+ │ │ └── /flow:delta apply
180
+ │ │
181
+ │ └── Manual review approval
182
+
183
+ └── /flow:delta create
184
+ ```
185
+
186
+ ## Scripts
187
+
188
+ | Script | Purpose |
189
+ |--------|---------|
190
+ | `flow-delta-create.sh` | Create delta directory and files |
191
+ | `flow-delta-list.sh` | List all deltas for a requirement |
192
+ | `flow-delta-apply.sh` | Apply delta to PRD.md |
193
+ | `flow-delta-status.sh` | Check delta status |
194
+ | `delta-parser.ts` | Parse and apply delta blocks |
195
+
196
+ ## Integration
197
+
198
+ ### With /flow:spec
199
+
200
+ When `/flow:spec` modifies existing requirements, it can generate deltas:
201
+ ```
202
+ PRD.md changes → deltas/{date}-{slug}/delta.md
203
+ ```
204
+
205
+ ### With /flow:release
206
+
207
+ Before PR creation, `/flow:release` applies all approved deltas:
208
+ ```bash
209
+ /flow:delta apply REQ-XXX --all
210
+ ```
211
+
212
+ ### With /flow:archive
213
+
214
+ After release, `/flow:archive` includes applied deltas:
215
+ ```bash
216
+ devflow/archive/{date}-REQ-XXX/deltas/
217
+ ```
218
+
219
+ ## Directory Structure
220
+
221
+ ```
222
+ devflow/requirements/REQ-123/
223
+ ├── PRD.md # Main specification (SSOT)
224
+ ├── deltas/ # Delta specs directory
225
+ │ ├── 2026-02-01-add-2fa/
226
+ │ │ ├── delta.md # Delta specification
227
+ │ │ └── tasks.md # Delta-specific tasks
228
+ │ └── 2026-02-05-fix-login/
229
+ │ ├── delta.md
230
+ │ └── tasks.md
231
+ └── ...
232
+
233
+ devflow/archive/
234
+ └── 2026-02/
235
+ └── REQ-123/
236
+ └── deltas/ # Archived deltas
237
+ └── 2026-02-01-add-2fa/
238
+ └── delta.md
239
+ ```
240
+
241
+ ## Related
242
+
243
+ - **Template**: `.claude/docs/templates/DELTA_SPEC_TEMPLATE.md`
244
+ - **Parser**: `.claude/scripts/delta-parser.ts`
245
+ - **Archive**: `devflow/archive/` - Historical delta specs