claude-code-workflow 7.2.29 → 7.2.30

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 (124) hide show
  1. package/.ccw/workflows/cli-templates/schemas/plan-overview-base-schema.json +2 -2
  2. package/.ccw/workflows/cli-templates/schemas/task-schema.json +14 -7
  3. package/.claude/agents/action-planning-agent.md +7 -4
  4. package/.claude/agents/cli-explore-agent.md +77 -63
  5. package/.claude/agents/cli-lite-planning-agent.md +11 -10
  6. package/.claude/agents/issue-plan-agent.md +421 -426
  7. package/.claude/commands/workflow/spec/setup.md +1 -1
  8. package/.claude/skills/ccw-chain/SKILL.md +119 -0
  9. package/.claude/skills/ccw-chain/chains/ccw-cycle.json +21 -0
  10. package/.claude/skills/ccw-chain/chains/ccw-exploration.json +47 -0
  11. package/.claude/skills/ccw-chain/chains/ccw-issue.json +33 -0
  12. package/.claude/skills/ccw-chain/chains/ccw-lightweight.json +57 -0
  13. package/.claude/skills/ccw-chain/chains/ccw-main.json +52 -0
  14. package/.claude/skills/ccw-chain/chains/ccw-standard.json +39 -0
  15. package/.claude/skills/ccw-chain/chains/ccw-team.json +10 -0
  16. package/.claude/skills/ccw-chain/chains/ccw-with-file.json +31 -0
  17. package/.claude/skills/ccw-chain/phases/analyze-with-file.md +788 -0
  18. package/.claude/skills/ccw-chain/phases/brainstorm/SKILL.md +408 -0
  19. package/.claude/skills/ccw-chain/phases/brainstorm/phases/01-mode-routing.md +207 -0
  20. package/.claude/skills/ccw-chain/phases/brainstorm/phases/02-artifacts.md +567 -0
  21. package/.claude/skills/ccw-chain/phases/brainstorm/phases/03-role-analysis.md +748 -0
  22. package/.claude/skills/ccw-chain/phases/brainstorm/phases/04-synthesis.md +827 -0
  23. package/.claude/skills/ccw-chain/phases/brainstorm-with-file.md +482 -0
  24. package/.claude/skills/ccw-chain/phases/collaborative-plan-with-file.md +639 -0
  25. package/.claude/skills/ccw-chain/phases/debug-with-file.md +656 -0
  26. package/.claude/skills/ccw-chain/phases/integration-test-cycle.md +936 -0
  27. package/.claude/skills/ccw-chain/phases/issue-convert-to-plan.md +720 -0
  28. package/.claude/skills/ccw-chain/phases/issue-discover.md +483 -0
  29. package/.claude/skills/ccw-chain/phases/issue-execute.md +629 -0
  30. package/.claude/skills/ccw-chain/phases/issue-from-brainstorm.md +382 -0
  31. package/.claude/skills/ccw-chain/phases/issue-plan.md +343 -0
  32. package/.claude/skills/ccw-chain/phases/issue-queue.md +464 -0
  33. package/.claude/skills/ccw-chain/phases/refactor-cycle.md +852 -0
  34. package/.claude/skills/ccw-chain/phases/review-cycle/SKILL.md +132 -0
  35. package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-fix.md +760 -0
  36. package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-module.md +764 -0
  37. package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-session.md +775 -0
  38. package/.claude/skills/ccw-chain/phases/roadmap-with-file.md +544 -0
  39. package/.claude/skills/ccw-chain/phases/spec-generator/SKILL.md +338 -0
  40. package/.claude/skills/ccw-chain/phases/spec-generator/phases/01-5-requirement-clarification.md +404 -0
  41. package/.claude/skills/ccw-chain/phases/spec-generator/phases/01-discovery.md +257 -0
  42. package/.claude/skills/ccw-chain/phases/spec-generator/phases/02-product-brief.md +274 -0
  43. package/.claude/skills/ccw-chain/phases/spec-generator/phases/03-requirements.md +184 -0
  44. package/.claude/skills/ccw-chain/phases/spec-generator/phases/04-architecture.md +248 -0
  45. package/.claude/skills/ccw-chain/phases/spec-generator/phases/05-epics-stories.md +178 -0
  46. package/.claude/skills/ccw-chain/phases/spec-generator/phases/06-5-auto-fix.md +144 -0
  47. package/.claude/skills/ccw-chain/phases/spec-generator/phases/06-readiness-check.md +480 -0
  48. package/.claude/skills/ccw-chain/phases/team-planex.md +123 -0
  49. package/.claude/skills/ccw-chain/phases/ui-design-explore-auto.md +678 -0
  50. package/.claude/skills/ccw-chain/phases/unified-execute-with-file.md +870 -0
  51. package/.claude/skills/ccw-chain/phases/workflow-execute/SKILL.md +625 -0
  52. package/.claude/skills/ccw-chain/phases/workflow-execute/phases/06-review.md +215 -0
  53. package/.claude/skills/ccw-chain/phases/workflow-lite-plan.md +616 -0
  54. package/.claude/skills/ccw-chain/phases/workflow-multi-cli-plan.md +424 -0
  55. package/.claude/skills/ccw-chain/phases/workflow-plan/SKILL.md +466 -0
  56. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/01-session-discovery.md +99 -0
  57. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/02-context-gathering.md +338 -0
  58. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/03-conflict-resolution.md +422 -0
  59. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/04-task-generation.md +440 -0
  60. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/05-plan-verify.md +395 -0
  61. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/06-replan.md +594 -0
  62. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/SKILL.md +527 -0
  63. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/01-session-discovery.md +57 -0
  64. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/02-context-gathering.md +407 -0
  65. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/03-test-coverage-analysis.md +172 -0
  66. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/04-conflict-resolution.md +426 -0
  67. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/05-tdd-task-generation.md +473 -0
  68. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/06-tdd-structure-validation.md +189 -0
  69. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/07-tdd-verify.md +635 -0
  70. package/.claude/skills/ccw-chain/phases/workflow-test-fix/SKILL.md +482 -0
  71. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/01-session-start.md +60 -0
  72. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/02-test-context-gather.md +493 -0
  73. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/03-test-concept-enhanced.md +150 -0
  74. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/04-test-task-generate.md +346 -0
  75. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/05-test-cycle-execute.md +538 -0
  76. package/.claude/skills/ccw-chain/specs/auto-mode.md +47 -0
  77. package/.claude/skills/ccw-chain/specs/intent-patterns.md +60 -0
  78. package/.claude/skills/chain-loader/SKILL.md +78 -0
  79. package/.claude/skills/chain-loader/phases/01-analyze-skill.md +53 -0
  80. package/.claude/skills/chain-loader/phases/02-design-graph.md +73 -0
  81. package/.claude/skills/chain-loader/phases/03-generate-validate.md +75 -0
  82. package/.claude/skills/chain-loader/specs/chain-schema.md +99 -0
  83. package/.claude/skills/chain-loader/specs/design-patterns.md +99 -0
  84. package/.claude/skills/chain-loader/templates/chain-json.md +63 -0
  85. package/.claude/skills/review-cycle/phases/review-module.md +764 -764
  86. package/.claude/skills/review-cycle/phases/review-session.md +775 -775
  87. package/.claude/skills/workflow-multi-cli-plan/SKILL.md +2 -2
  88. package/.claude/skills/workflow-plan/phases/03-conflict-resolution.md +422 -422
  89. package/.claude/skills/workflow-plan/phases/05-plan-verify.md +395 -395
  90. package/.claude/skills/workflow-tdd-plan/phases/02-context-gathering.md +407 -407
  91. package/.claude/skills/workflow-tdd-plan/phases/04-conflict-resolution.md +426 -426
  92. package/.claude/skills/workflow-test-fix/phases/02-test-context-gather.md +493 -493
  93. package/README.md +14 -0
  94. package/ccw/dist/core/routes/litellm-api-routes.d.ts.map +1 -1
  95. package/ccw/dist/core/routes/litellm-api-routes.js +0 -23
  96. package/ccw/dist/core/routes/litellm-api-routes.js.map +1 -1
  97. package/ccw/dist/tools/chain-loader.d.ts +10 -0
  98. package/ccw/dist/tools/chain-loader.d.ts.map +1 -0
  99. package/ccw/dist/tools/chain-loader.js +642 -0
  100. package/ccw/dist/tools/chain-loader.js.map +1 -0
  101. package/ccw/dist/tools/index.d.ts.map +1 -1
  102. package/ccw/dist/tools/index.js +2 -0
  103. package/ccw/dist/tools/index.js.map +1 -1
  104. package/ccw/dist/tools/json-builder.js +20 -0
  105. package/ccw/dist/tools/json-builder.js.map +1 -1
  106. package/ccw/dist/types/chain-types.d.ts +72 -0
  107. package/ccw/dist/types/chain-types.d.ts.map +1 -0
  108. package/ccw/dist/types/chain-types.js +5 -0
  109. package/ccw/dist/types/chain-types.js.map +1 -0
  110. package/ccw/scripts/prepublish-clean.mjs +0 -1
  111. package/package.json +1 -3
  112. package/ccw-litellm/README.md +0 -180
  113. package/ccw-litellm/pyproject.toml +0 -35
  114. package/ccw-litellm/src/ccw_litellm/__init__.py +0 -47
  115. package/ccw-litellm/src/ccw_litellm/cli.py +0 -108
  116. package/ccw-litellm/src/ccw_litellm/clients/__init__.py +0 -12
  117. package/ccw-litellm/src/ccw_litellm/clients/litellm_embedder.py +0 -270
  118. package/ccw-litellm/src/ccw_litellm/clients/litellm_llm.py +0 -198
  119. package/ccw-litellm/src/ccw_litellm/config/__init__.py +0 -22
  120. package/ccw-litellm/src/ccw_litellm/config/loader.py +0 -343
  121. package/ccw-litellm/src/ccw_litellm/config/models.py +0 -162
  122. package/ccw-litellm/src/ccw_litellm/interfaces/__init__.py +0 -14
  123. package/ccw-litellm/src/ccw_litellm/interfaces/embedder.py +0 -52
  124. package/ccw-litellm/src/ccw_litellm/interfaces/llm.py +0 -45
@@ -0,0 +1,482 @@
1
+ ---
2
+ name: workflow-test-fix
3
+ description: Unified test-fix pipeline combining test generation (session, context, analysis, task gen) with iterative test-cycle execution (adaptive strategy, progressive testing, CLI fallback). Triggers on "workflow-test-fix", "test fix workflow".
4
+ allowed-tools: Skill, Agent, AskUserQuestion, TaskCreate, TaskUpdate, TaskList, Read, Write, Edit, Bash, Glob, Grep
5
+ ---
6
+
7
+ <purpose>
8
+ Unified test-fix orchestrator that combines **test planning generation** (Phase 1-4) with **iterative test-cycle execution** (Phase 5) into a single end-to-end pipeline. Creates test sessions with progressive L0-L3 test layers, generates test tasks, then executes them with adaptive fix cycles until pass rate >= 95% or max iterations reached. Triggered via skill name routing for full pipeline or execute-only modes.
9
+ </purpose>
10
+
11
+ <process>
12
+
13
+ ## 1. Architecture Overview
14
+
15
+ ```
16
+ ┌───────────────────────────────────────────────────────────────────────────┐
17
+ │ Workflow Test Fix Orchestrator (SKILL.md) │
18
+ │ → Pure coordinator: Route entry point, track progress, pass context │
19
+ │ → Five phases: Session → Context → Analysis → TaskGen → Execution │
20
+ └──────────────────────────────────┬────────────────────────────────────────┘
21
+
22
+ ┌────────────┬────────────┬──────┴──────┬────────────┬────────────┐
23
+ ↓ ↓ ↓ ↓ ↓
24
+ ┌──────────┐┌──────────┐┌──────────┐┌──────────┐ ┌──────────────┐
25
+ │ Phase 1 ││ Phase 2 ││ Phase 3 ││ Phase 4 │ │ Phase 5 │
26
+ │ Session ││ Context ││ Analysis ││ Task Gen │ │ Test Cycle │
27
+ │ Start ││ Gather ││ Enhanced ││ Generate │ │ Execute │
28
+ │ ││ ││ ││ │ │ │
29
+ │ Input ││ Coverage ││ Gemini ││ IMPL_PLAN│ │ 1. Discovery│
30
+ │ Detect + ││ or Code ││ L0-L3 ││ IMPL-* │ │ 2. Execute │
31
+ │ Session ││ Scan ││ AI Issue ││ TODO_LIST│ │ 3. Fix Loop │
32
+ │ Create ││ ││ ││ │ │ 4. Complete │
33
+ └────┬─────┘└────┬─────┘└────┬─────┘└────┬─────┘ └──────────────┘
34
+ │ │ │ │ ↑
35
+ │testSessionId │ │ │
36
+ └──→────────┘contextPath│ │ │
37
+ └──→───────┘AnalysisRes│ │
38
+ └──→──────┘ testSessionId │
39
+ └──→──(Summary)──→┘
40
+
41
+ Task Pipeline (generated in Phase 4, executed in Phase 5):
42
+ ┌──────────────┐ ┌─────────────────┐ ┌─────────────────┐ ┌──────────────┐
43
+ │ IMPL-001 │──→│ IMPL-001.3 │──→│ IMPL-001.5 │──→│ IMPL-002 │
44
+ │ Test Gen │ │ Code Validate │ │ Quality Gate │ │ Test & Fix │
45
+ │ L1-L3 │ │ L0 + AI Issues │ │ Coverage 80%+ │ │ Max N iter │
46
+ │@code-developer│ │ @test-fix-agent │ │ @test-fix-agent │ │@test-fix-agent│
47
+ └──────────────┘ └─────────────────┘ └─────────────────┘ └──────────────┘
48
+ ```
49
+
50
+ ## 2. Key Design Principles
51
+
52
+ 1. **Unified Pipeline**: Generation and execution are one continuous workflow - no manual handoff
53
+ 2. **Pure Orchestrator**: SKILL.md coordinates only - delegates all execution detail to phase files
54
+ 3. **Auto-Continue**: Phase 1→2→3→4→(Summary)→5 automatically
55
+ 4. **Task Attachment/Collapse**: Sub-tasks attached during phase execution, collapsed after completion
56
+ 5. **Progressive Phase Loading**: Phase docs read **only** when that phase executes, not upfront
57
+ 6. **Adaptive Strategy**: Fix loop auto-selects strategy (conservative/aggressive/surgical) based on iteration context
58
+ 7. **Quality Gate**: Pass rate >= 95% (criticality-aware) terminates the fix loop
59
+ 8. **Phase File Hygiene**: Phase files reference `workflowPreferences.*` for preferences, no CLI flag parsing
60
+
61
+ ## 3. Usage
62
+
63
+ Full pipeline and execute-only modes are triggered by skill name routing (see Mode Detection). Workflow preferences (auto mode) are collected interactively via AskUserQuestion before dispatching to phases.
64
+
65
+ **Full pipeline** (workflow-test-fix): Task description or session ID as arguments → interactive preference collection → generate + execute pipeline
66
+ **Execute only** (workflow-test-fix): Auto-discovers active session → interactive preference collection → execution loop
67
+
68
+ ## 4. Interactive Preference Collection
69
+
70
+ Before dispatching to phase execution, collect workflow preferences via AskUserQuestion:
71
+
72
+ ```javascript
73
+ // ★ 统一 auto mode 检测:-y/--yes 从 $ARGUMENTS 或 ccw 传播
74
+ const autoYes = /\b(-y|--yes)\b/.test($ARGUMENTS)
75
+
76
+ if (autoYes) {
77
+ // 自动模式:跳过所有询问,使用默认值
78
+ workflowPreferences = { autoYes: true }
79
+ } else {
80
+ const prefResponse = AskUserQuestion({
81
+ questions: [
82
+ {
83
+ question: "是否跳过所有确认步骤(自动模式)?",
84
+ header: "Auto Mode",
85
+ multiSelect: false,
86
+ options: [
87
+ { label: "Interactive (Recommended)", description: "交互模式,包含确认步骤" },
88
+ { label: "Auto", description: "跳过所有确认,自动执行" }
89
+ ]
90
+ }
91
+ ]
92
+ })
93
+
94
+ workflowPreferences = {
95
+ autoYes: prefResponse.autoMode === 'Auto'
96
+ }
97
+ }
98
+ ```
99
+
100
+ **workflowPreferences** is passed to phase execution as context variable, referenced as `workflowPreferences.autoYes` within phases.
101
+
102
+ ## 5. Compact Recovery (Phase Persistence)
103
+
104
+ Multi-phase test-fix pipeline (Phase 1-5) spans long conversations, especially Phase 5 fix loops. Uses **双重保险**: TodoWrite 跟踪 active phase 保护其不被压缩,sentinel 作为兜底。
105
+
106
+ > **⚠️ COMPACT DIRECTIVE**: Context compression MUST check TodoWrite phase status.
107
+ > The phase currently marked `in_progress` is the active execution phase — preserve its FULL content.
108
+ > Only compress phases marked `completed` or `pending`.
109
+
110
+ ## 6. Execution Flow
111
+
112
+ ```
113
+ Entry Point Detection:
114
+ ├─ /workflow-test-fix → Full Pipeline (Phase 1→2→3→4→Summary→5)
115
+ └─ /workflow-test-fix → Execution Only (Phase 5)
116
+
117
+ Phase 1: Session Start (session-start)
118
+ └─ Read("phases/01-session-start.md")
119
+ ├─ Step 1.0: Detect input mode (session | prompt)
120
+ ├─ Step 1.1: Create test session → testSessionId
121
+ └─ Output: testSessionId, MODE
122
+
123
+ Phase 2: Test Context Gather (test-context-gather)
124
+ └─ Read("phases/02-test-context-gather.md")
125
+ ├─ Step 1.2: Gather test context → contextPath
126
+ └─ Output: contextPath
127
+
128
+ Phase 3: Test Concept Enhanced (test-concept-enhanced)
129
+ └─ Read("phases/03-test-concept-enhanced.md")
130
+ ├─ Step 1.3: Test analysis (Gemini) → TEST_ANALYSIS_RESULTS.md
131
+ └─ Output: TEST_ANALYSIS_RESULTS.md
132
+
133
+ Phase 4: Test Task Generate (test-task-generate)
134
+ └─ Read("phases/04-test-task-generate.md")
135
+ ├─ Step 1.4: Generate test tasks → IMPL_PLAN.md, IMPL-*.json, TODO_LIST.md
136
+ └─ Output: testSessionId, 4+ task JSONs
137
+
138
+ Summary Output (inline after Phase 4):
139
+ └─ Display summary, auto-continue to Phase 5
140
+
141
+ Phase 5: Test Cycle Execution (test-cycle-execute)
142
+ └─ Read("phases/05-test-cycle-execute.md")
143
+ ├─ Step 2.1: Discovery (load session, tasks, iteration state)
144
+ ├─ Step 2.2: Execute initial tasks (IMPL-001 → 001.3 → 001.5 → 002)
145
+ ├─ Step 2.3: Fix loop (if pass_rate < 95%)
146
+ │ ├─ Select strategy: conservative/aggressive/surgical
147
+ │ ├─ Generate fix task via @cli-planning-agent
148
+ │ ├─ Execute fix via @test-fix-agent
149
+ │ └─ Re-test → loop or exit
150
+ └─ Step 2.4: Completion (summary, session archive)
151
+ └─ Output: final pass_rate, summary
152
+ ```
153
+
154
+ **Phase Reference Documents** (read on-demand when phase executes):
155
+
156
+ | Phase | Document | Purpose | Compact |
157
+ |-------|----------|---------|---------|
158
+ | 1 | phases/01-session-start.md | Detect input mode, create test session | TodoWrite 驱动 |
159
+ | 2 | phases/02-test-context-gather.md | Gather test context (coverage/codebase) | TodoWrite 驱动 |
160
+ | 3 | phases/03-test-concept-enhanced.md | Gemini analysis, L0-L3 test requirements | TodoWrite 驱动 |
161
+ | 4 | phases/04-test-task-generate.md | Generate task JSONs and IMPL_PLAN.md | TodoWrite 驱动 |
162
+ | 5 | phases/05-test-cycle-execute.md | Execute tasks, iterative fix cycles, completion | TodoWrite 驱动 + 🔄 sentinel |
163
+
164
+ **Compact Rules**:
165
+ 1. **TodoWrite `in_progress`** → 保留完整内容,禁止压缩
166
+ 2. **TodoWrite `completed`** → 可压缩为摘要
167
+ 3. **🔄 sentinel fallback** → Phase 5 包含 compact sentinel;若 compact 后仅存 sentinel 而无完整 Step 协议,必须立即 `Read("phases/05-test-cycle-execute.md")` 恢复
168
+
169
+ ## 7. Core Rules
170
+
171
+ 1. **Start Immediately**: First action is TaskCreate initialization, second action is Phase 1 (or Phase 5 for execute-only entry)
172
+ 2. **No Preliminary Analysis**: Do not read files or gather context before starting the phase
173
+ 3. **Parse Every Output**: Extract required data from each step output for next step
174
+ 4. **Auto-Continue**: Phase 1→2→3→4→(Summary)→5 automatically (for full pipeline entry)
175
+ 5. **Track Progress**: Update TaskCreate/TaskUpdate dynamically with task attachment/collapse pattern
176
+ 6. **Task Attachment Model**: Sub-tasks **attached** during phase, **collapsed** after completion
177
+ 7. **DO NOT STOP**: Continuous workflow until quality gate met or max iterations reached
178
+ 8. **Progressive Loading**: Read phase doc ONLY when that phase is about to execute
179
+ 9. **Entry Point Routing**: `workflow-test-fix` skill → Phase 1-5; `workflow-test-fix` skill → Phase 5 only
180
+
181
+ ## 8. Input Processing
182
+
183
+ ### test-fix-gen Entry (Full Pipeline)
184
+ ```
185
+ User input → Detect type:
186
+ ├─ Starts with "WFS-" → MODE=session, sourceSessionId=input
187
+ ├─ Ends with ".md" → MODE=prompt, description=Read(input)
188
+ └─ Otherwise → MODE=prompt, description=input
189
+ ```
190
+
191
+ ### test-cycle-execute Entry (Phase 5 Only)
192
+ ```
193
+ Arguments → Parse flags:
194
+ ├─ --resume-session="WFS-xxx" → sessionId=WFS-xxx
195
+ ├─ --max-iterations=N → maxIterations=N (default: 10)
196
+ └─ (no args) → auto-discover active test session
197
+ ```
198
+
199
+ ## 9. Data Flow
200
+
201
+ ```
202
+ User Input (session ID | description | file path)
203
+
204
+ [Detect Mode: session | prompt]
205
+
206
+ Phase 1: Session Start ─────────────────────────────────────────
207
+ ↓ 1.0+1.1: session:start → testSessionId, MODE
208
+
209
+ Phase 2: Test Context Gather ────────────────────────────────────
210
+ ↓ 1.2: test-context-gather/context-gather → contextPath
211
+
212
+ Phase 3: Test Concept Enhanced ──────────────────────────────────
213
+ ↓ 1.3: test-concept-enhanced → TEST_ANALYSIS_RESULTS.md
214
+
215
+ Phase 4: Test Task Generate ─────────────────────────────────────
216
+ ↓ 1.4: test-task-generate → IMPL_PLAN.md, IMPL-*.json, TODO_LIST.md
217
+
218
+ Summary Output (inline) ─────────────────────────────────────────
219
+ ↓ Display summary with next step
220
+
221
+ Phase 5: Test Cycle Execution ───────────────────────────────────
222
+ ↓ 2.1: Load session + tasks + iteration state
223
+ ↓ 2.2: Execute IMPL-001 → 001.3 → 001.5 → 002
224
+ ↓ 2.3: Fix loop (analyze → fix → retest) until pass_rate >= 95%
225
+ ↓ 2.4: Completion → summary → session archive
226
+ ```
227
+
228
+ ## 10. Summary Output (after Phase 4)
229
+
230
+ After Phase 4 completes, display the following summary before auto-continuing to Phase 5:
231
+
232
+ ```
233
+ Test-fix workflow created successfully!
234
+
235
+ Input: [original input]
236
+ Mode: [Session|Prompt]
237
+ Test Session: [testSessionId]
238
+
239
+ Tasks Created:
240
+ - IMPL-001: Test Understanding & Generation (@code-developer)
241
+ - IMPL-001.3: Code Validation Gate - AI Error Detection (@test-fix-agent)
242
+ - IMPL-001.5: Test Quality Gate - Static Analysis & Coverage (@test-fix-agent)
243
+ - IMPL-002: Test Execution & Fix Cycle (@test-fix-agent)
244
+
245
+ Quality Thresholds:
246
+ - Code Validation: Zero CRITICAL issues, zero compilation errors
247
+ - Minimum Coverage: 80% line, 70% branch
248
+ - Static Analysis: Zero critical anti-patterns
249
+ - Max Fix Iterations: 5
250
+
251
+ Review artifacts:
252
+ - Test plan: .workflow/[testSessionId]/IMPL_PLAN.md
253
+ - Task list: .workflow/[testSessionId]/TODO_LIST.md
254
+ - Analysis: .workflow/[testSessionId]/.process/TEST_ANALYSIS_RESULTS.md
255
+ ```
256
+
257
+ **CRITICAL - Next Step**: Auto-continue to Phase 5: Test Cycle Execution.
258
+ Pass `testSessionId` to Phase 5 for test execution pipeline. Do NOT wait for user confirmation — the unified pipeline continues automatically.
259
+
260
+ ## 11. Test Strategy Overview
261
+
262
+ Progressive Test Layers (L0-L3):
263
+
264
+ | Layer | Name | Focus |
265
+ |-------|------|-------|
266
+ | **L0** | Static Analysis | Compilation, imports, types, AI code issues |
267
+ | **L1** | Unit Tests | Function/class behavior (happy/negative/edge cases) |
268
+ | **L2** | Integration Tests | Component interactions, API contracts, failure modes |
269
+ | **L3** | E2E Tests | User journeys, critical paths (optional) |
270
+
271
+ **Quality Thresholds**:
272
+ - Code Validation (IMPL-001.3): Zero CRITICAL issues, zero compilation errors
273
+ - Minimum Coverage: 80% line, 70% branch
274
+ - Static Analysis (IMPL-001.5): Zero critical anti-patterns
275
+ - Pass Rate Gate: >= 95% (criticality-aware) or 100%
276
+ - Max Fix Iterations: 10 (default, adjustable)
277
+
278
+ ## 12. Strategy Engine (Phase 5)
279
+
280
+ | Strategy | Trigger | Behavior |
281
+ |----------|---------|----------|
282
+ | **Conservative** | Iteration 1-2 (default) | Single targeted fix, full validation |
283
+ | **Aggressive** | Pass rate >80% + similar failures | Batch fix related issues |
284
+ | **Surgical** | Regression detected (pass rate drops >10%) | Minimal changes, rollback focus |
285
+
286
+ Selection logic and CLI fallback chain (Gemini → Qwen → Codex) are detailed in Phase 5.
287
+
288
+ ## 13. Agent Roles
289
+
290
+ | Agent | Used In | Responsibility |
291
+ |-------|---------|---------------|
292
+ | **Orchestrator** | All phases | Route entry, track progress, pass context |
293
+ | **@code-developer** | Phase 5 (IMPL-001) | Test generation (L1-L3) |
294
+ | **@test-fix-agent** | Phase 5 | Test execution, code fixes, criticality assignment |
295
+ | **@cli-planning-agent** | Phase 5 (fix loop) | CLI analysis, root cause extraction, fix task generation |
296
+
297
+ ## 14. TodoWrite Pattern
298
+
299
+ **Core Concept**: Dynamic task tracking with attachment/collapse for real-time visibility.
300
+
301
+ > **Implementation Note**: Phase files use `TodoWrite` syntax to describe the conceptual tracking pattern. At runtime, these are implemented via `TaskCreate/TaskUpdate/TaskList` tools from the allowed-tools list. Map `TodoWrite` examples as follows:
302
+ > - Initial list creation → `TaskCreate` for each item
303
+ > - Status changes → `TaskUpdate({ taskId, status })`
304
+ > - Sub-task attachment → `TaskCreate` + `TaskUpdate({ addBlockedBy })`
305
+ > - Sub-task collapse → `TaskUpdate({ status: "completed" })` + `TaskUpdate({ status: "deleted" })` for collapsed sub-items
306
+
307
+ ### Full Pipeline (Phase 1-5)
308
+
309
+ ```json
310
+ [
311
+ {"content": "Phase 1: Session Start", "status": "in_progress"},
312
+ {"content": "Phase 2: Test Context Gather", "status": "pending"},
313
+ {"content": "Phase 3: Test Analysis (Gemini)", "status": "pending"},
314
+ {"content": "Phase 4: Test Task Generate", "status": "pending"},
315
+ {"content": "Phase 5: Test Cycle Execution", "status": "pending"}
316
+ ]
317
+ ```
318
+
319
+ ### Phase 1-4 Collapsed → Phase 5 Active
320
+
321
+ ```json
322
+ [
323
+ {"content": "Phase 1: Session Start", "status": "completed"},
324
+ {"content": "Phase 2: Test Context Gather", "status": "completed"},
325
+ {"content": "Phase 3: Test Analysis (Gemini)", "status": "completed"},
326
+ {"content": "Phase 4: Test Task Generate", "status": "completed"},
327
+ {"content": "Phase 5: Test Cycle Execution", "status": "in_progress"},
328
+ {"content": " → Execute IMPL-001 [code-developer]", "status": "in_progress"},
329
+ {"content": " → Execute IMPL-001.3 [test-fix-agent]", "status": "pending"},
330
+ {"content": " → Execute IMPL-001.5 [test-fix-agent]", "status": "pending"},
331
+ {"content": " → Execute IMPL-002 [test-fix-agent]", "status": "pending"},
332
+ {"content": " → Fix Loop", "status": "pending"}
333
+ ]
334
+ ```
335
+
336
+ ### Fix Loop Iterations
337
+
338
+ ```json
339
+ [
340
+ {"content": "Phase 1-4: Test Generation", "status": "completed"},
341
+ {"content": "Phase 5: Test Cycle Execution", "status": "in_progress"},
342
+ {"content": " → Initial tasks", "status": "completed"},
343
+ {"content": " → Iteration 1: Initial test (pass: 70%, conservative)", "status": "completed"},
344
+ {"content": " → Iteration 2: Fix validation (pass: 82%, conservative)", "status": "completed"},
345
+ {"content": " → Iteration 3: Batch fix (pass: 89%, aggressive)", "status": "in_progress"}
346
+ ]
347
+ ```
348
+
349
+ ## 15. Session File Structure
350
+
351
+ ```
352
+ .workflow/active/WFS-test-{session}/
353
+ ├── workflow-session.json # Session metadata
354
+ ├── IMPL_PLAN.md # Test generation and execution strategy
355
+ ├── TODO_LIST.md # Task checklist
356
+ ├── .task/
357
+ │ ├── IMPL-001.json # Test understanding & generation
358
+ │ ├── IMPL-001.3-validation.json # Code validation gate
359
+ │ ├── IMPL-001.5-review.json # Test quality gate
360
+ │ ├── IMPL-002.json # Test execution & fix cycle
361
+ │ └── IMPL-fix-{N}.json # Generated fix tasks (Phase 5 fix loop)
362
+ ├── .process/
363
+ │ ├── [test-]context-package.json # Context and coverage analysis
364
+ │ ├── TEST_ANALYSIS_RESULTS.md # Test requirements (L0-L3)
365
+ │ ├── iteration-state.json # Current iteration + strategy + stuck tests
366
+ │ ├── test-results.json # Latest results (pass_rate, criticality)
367
+ │ ├── test-output.log # Full test output
368
+ │ ├── fix-history.json # All fix attempts
369
+ │ ├── iteration-{N}-analysis.md # CLI analysis report
370
+ │ └── iteration-{N}-cli-output.txt
371
+ └── .summaries/
372
+ └── iteration-summaries/
373
+ ```
374
+
375
+ ## 16. Error Handling
376
+
377
+ ### Phase 1-4 (Generation)
378
+
379
+ | Phase | Error Condition | Action |
380
+ |-------|----------------|--------|
381
+ | 1: Session Start | Source session not found (session mode) | Return error with session ID |
382
+ | 1: Session Start | No completed IMPL tasks (session mode) | Return error, source incomplete |
383
+ | 2: Context Gather | Context gathering failed | Return error, check source artifacts |
384
+ | 3: Analysis | Gemini analysis failed | Return error, check context package |
385
+ | 4: Task Gen | Task generation failed | Retry once, then return error |
386
+
387
+ ### Phase 5 (Execution)
388
+
389
+ | Scenario | Action |
390
+ |----------|--------|
391
+ | Test execution error | Log, retry with error context |
392
+ | CLI analysis failure | Fallback: Gemini → Qwen → Codex → manual |
393
+ | Agent execution error | Save state, retry with simplified context |
394
+ | Max iterations reached | Generate failure report, mark blocked |
395
+ | Regression detected | Rollback last fix, switch to surgical strategy |
396
+ | Stuck tests detected | Continue with alternative strategy, document |
397
+
398
+ ## 17. Commit Strategy (Phase 5)
399
+
400
+ Automatic commits at key checkpoints:
401
+ 1. **After successful iteration** (pass rate increased): `test-cycle: iteration N - strategy (pass: old% → new%)`
402
+ 2. **Before rollback** (regression detected): `test-cycle: rollback iteration N - regression detected`
403
+
404
+ ## 18. Completion Conditions
405
+
406
+ | Condition | Pass Rate | Action |
407
+ |-----------|-----------|--------|
408
+ | **Full Success** | 100% | Auto-complete session |
409
+ | **Partial Success** | >= 95%, all failures low criticality | Auto-approve with review note |
410
+ | **Failure** | < 95% after max iterations | Failure report, mark blocked |
411
+
412
+ ## 19. Post-Completion Expansion
413
+
414
+ **Auto-sync**: Execute `/workflow:session:sync -y "{summary}"` to update specs/*.md + project-tech.
415
+
416
+ After completion, ask user if they want to expand into issues (test/enhance/refactor/doc). Selected items call `/issue:new "{summary} - {dimension}"`.
417
+
418
+ ## 20. Coordinator Checklist
419
+
420
+ ### Phase 1 (session-start)
421
+ - [ ] Detect input type (session ID / description / file path)
422
+ - [ ] Initialize TaskCreate before any execution
423
+ - [ ] Read("phases/01-session-start.md"), execute Steps 1.0 + 1.1
424
+ - [ ] Parse testSessionId from step output, store in memory
425
+
426
+ ### Phase 2 (test-context-gather)
427
+ - [ ] Read("phases/02-test-context-gather.md"), execute Step 1.2
428
+ - [ ] Parse contextPath from step output, store in memory
429
+
430
+ ### Phase 3 (test-concept-enhanced)
431
+ - [ ] Read("phases/03-test-concept-enhanced.md"), execute Step 1.3
432
+ - [ ] Verify TEST_ANALYSIS_RESULTS.md created
433
+
434
+ ### Phase 4 (test-task-generate)
435
+ - [ ] Read("phases/04-test-task-generate.md"), execute Step 1.4
436
+ - [ ] Verify all Phase 1-4 outputs (4 task JSONs, IMPL_PLAN.md, TODO_LIST.md)
437
+ - [ ] Display Summary output (inline)
438
+ - [ ] Collapse Phase 1-4 tasks, auto-continue to Phase 5
439
+
440
+ ### Phase 5 (test-cycle-execute)
441
+ - [ ] Read("phases/05-test-cycle-execute.md")
442
+ - [ ] Load session, tasks, iteration state
443
+ - [ ] Execute initial tasks sequentially
444
+ - [ ] Calculate pass rate from test-results.json
445
+ - [ ] If pass_rate < 95%: Enter fix loop
446
+ - [ ] Track iteration count, stuck tests, regression
447
+ - [ ] If pass_rate >= 95% or max iterations: Complete
448
+ - [ ] Generate completion summary
449
+ - [ ] Offer post-completion expansion
450
+
451
+ ## 21. Related Skills
452
+
453
+ **Prerequisite Skills**:
454
+ - `workflow-plan` skill or `workflow-execute` skill - Complete implementation (Session Mode source)
455
+ - None for Prompt Mode
456
+
457
+ **Follow-up Skills**:
458
+ - Display session status inline - Review workflow state
459
+ - `review-cycle` skill - Post-implementation review
460
+ - `/issue:new` - Create follow-up issues
461
+
462
+ </process>
463
+
464
+ <auto_mode>
465
+ When `-y` or `--yes` is detected in $ARGUMENTS or propagated via ccw:
466
+ - Skip all AskUserQuestion confirmations
467
+ - Use default values for all workflow preferences (`workflowPreferences = { autoYes: true }`)
468
+ - Auto-continue through all phases without user interaction
469
+ - Phase 1→2→3→4→Summary→5 executes as a fully automatic pipeline
470
+ </auto_mode>
471
+
472
+ <success_criteria>
473
+ - [ ] Input type correctly detected (session ID / description / file path)
474
+ - [ ] All 5 phases execute in sequence (full pipeline) or Phase 5 only (execute-only)
475
+ - [ ] Phase documents loaded progressively via Read() only when phase executes
476
+ - [ ] TaskCreate/TaskUpdate tracking maintained throughout with attachment/collapse pattern
477
+ - [ ] All phase outputs parsed and passed to subsequent phases (testSessionId, contextPath, etc.)
478
+ - [ ] Summary displayed after Phase 4 with all task and threshold details
479
+ - [ ] Phase 5 fix loop iterates with adaptive strategy until pass rate >= 95% or max iterations
480
+ - [ ] Completion summary generated with final pass rate and session archived
481
+ - [ ] Post-completion expansion offered to user
482
+ </success_criteria>
@@ -0,0 +1,60 @@
1
+ # Phase 1: Session Start (session-start)
2
+
3
+ Detect input mode and create test workflow session.
4
+
5
+ ## Objective
6
+
7
+ - Detect input mode (session ID vs description)
8
+ - Create test workflow session with appropriate metadata
9
+
10
+ ## Execution
11
+
12
+ ### Step 1.0: Detect Input Mode
13
+
14
+ ```
15
+ // Automatic mode detection based on input pattern
16
+ if (input.startsWith("WFS-")) {
17
+ MODE = "session"
18
+ // Load source session to preserve original task description
19
+ Read(".workflow/active/[sourceSessionId]/workflow-session.json")
20
+ } else {
21
+ MODE = "prompt"
22
+ }
23
+ ```
24
+
25
+ ### Step 1.1: Create Test Session
26
+
27
+ ```
28
+ // Session Mode - preserve original task description
29
+ Skill(skill="workflow:session:start", args="--type test --new \"Test validation for [sourceSessionId]: [originalTaskDescription]\"")
30
+
31
+ // Prompt Mode - use user's description directly
32
+ Skill(skill="workflow:session:start", args="--type test --new \"Test generation for: [description]\"")
33
+ ```
34
+
35
+ **Parse Output**:
36
+ - Extract: `SESSION_ID: WFS-test-[slug]` (store as `testSessionId`)
37
+
38
+ **Validation**:
39
+ - Session Mode: Source session `.workflow/active/[sourceSessionId]/` exists with completed IMPL tasks
40
+ - Both Modes: New test session directory created with metadata
41
+
42
+ **TodoWrite**: Mark step 1.1 completed, step 1.2 in_progress
43
+
44
+ ### Session Metadata
45
+
46
+ **File**: `workflow-session.json`
47
+
48
+ | Mode | Fields |
49
+ |------|--------|
50
+ | **Session** | `type: "test"`, `source_session_id: "[sourceId]"` |
51
+ | **Prompt** | `type: "test"` (no source_session_id) |
52
+
53
+ ## Output
54
+
55
+ - **Variable**: `testSessionId` (WFS-test-xxx)
56
+ - **Variable**: `MODE` (session | prompt)
57
+
58
+ ## Next Phase
59
+
60
+ Continue to [Phase 2: Test Context Gather](02-test-context-gather.md).