claude-code-workflow 7.2.30 → 7.3.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 (183) hide show
  1. package/.claude/commands/workflow-skill.md +130 -0
  2. package/.claude/skills/ccw-chain/SKILL.md +44 -71
  3. package/.claude/skills/ccw-chain/chains/ccw-cycle.json +13 -3
  4. package/.claude/skills/ccw-chain/chains/ccw-exploration.json +33 -22
  5. package/.claude/skills/ccw-chain/chains/ccw-issue.json +23 -12
  6. package/.claude/skills/ccw-chain/chains/ccw-lightweight.json +23 -9
  7. package/.claude/skills/ccw-chain/chains/ccw-main.json +15 -2
  8. package/.claude/skills/ccw-chain/chains/ccw-standard.json +28 -16
  9. package/.claude/skills/ccw-chain/chains/ccw-team.json +7 -2
  10. package/.claude/skills/ccw-chain/chains/ccw-with-file.json +25 -9
  11. package/.claude/skills/chain-loader/phases/01-analyze-skill.md +53 -53
  12. package/.claude/skills/chain-loader/specs/chain-schema.md +30 -3
  13. package/.claude/skills/chain-loader/templates/chain-json.md +63 -63
  14. package/.claude/skills/workflow-plan/SKILL.md +1 -0
  15. package/.claude/skills/workflow-plan/phases/01-session-discovery.md +19 -2
  16. package/.claude/skills/workflow-plan/phases/02-context-gathering.md +2 -2
  17. package/.claude/skills/workflow-plan/phases/04-task-generation.md +9 -1
  18. package/.codex/skills/analyze-with-file/SKILL.md +383 -134
  19. package/.codex/skills/brainstorm/SKILL.md +3 -3
  20. package/.codex/skills/brainstorm-with-file/SKILL.md +208 -88
  21. package/.codex/skills/clean/SKILL.md +1 -1
  22. package/.codex/skills/csv-wave-pipeline/SKILL.md +2 -2
  23. package/.codex/skills/investigate/orchestrator.md +24 -0
  24. package/.codex/skills/issue-discover/SKILL.md +374 -361
  25. package/.codex/skills/issue-discover/phases/01-issue-new.md +1 -1
  26. package/.codex/skills/issue-discover/phases/02-discover.md +2 -2
  27. package/.codex/skills/issue-discover/phases/03-discover-by-prompt.md +1 -1
  28. package/.codex/skills/issue-discover/phases/04-quick-execute.md +2 -2
  29. package/.codex/skills/parallel-dev-cycle/SKILL.md +44 -37
  30. package/.codex/skills/project-documentation-workflow/SKILL.md +1 -1
  31. package/.codex/skills/review-cycle/SKILL.md +31 -12
  32. package/.codex/skills/roadmap-with-file/SKILL.md +141 -133
  33. package/.codex/skills/security-audit/orchestrator.md +29 -0
  34. package/.codex/skills/session-sync/SKILL.md +1 -1
  35. package/.codex/skills/ship/orchestrator.md +24 -0
  36. package/.codex/skills/spec-add/SKILL.md +5 -5
  37. package/.codex/skills/spec-generator/SKILL.md +33 -2
  38. package/.codex/skills/spec-generator/phases/01-5-requirement-clarification.md +3 -3
  39. package/.codex/skills/spec-generator/phases/01-discovery.md +1 -1
  40. package/.codex/skills/spec-generator/phases/02-product-brief.md +1 -1
  41. package/.codex/skills/spec-generator/phases/03-requirements.md +1 -1
  42. package/.codex/skills/spec-generator/phases/04-architecture.md +1 -1
  43. package/.codex/skills/spec-generator/phases/05-epics-stories.md +1 -1
  44. package/.codex/skills/spec-generator/phases/06-readiness-check.md +1 -1
  45. package/.codex/skills/spec-generator/phases/07-issue-export.md +1 -1
  46. package/.codex/skills/spec-setup/SKILL.md +669 -669
  47. package/.codex/skills/team-arch-opt/specs/team-config.json +1 -1
  48. package/.codex/skills/team-brainstorm/SKILL.md +259 -259
  49. package/.codex/skills/team-coordinate/SKILL.md +359 -359
  50. package/.codex/skills/team-coordinate/roles/coordinator/commands/monitor.md +1 -1
  51. package/.codex/skills/team-designer/SKILL.md +27 -1
  52. package/.codex/skills/team-designer/phases/01-requirements-analysis.md +2 -2
  53. package/.codex/skills/team-designer/phases/02-scaffold-generation.md +1 -1
  54. package/.codex/skills/team-designer/phases/04-validation.md +1 -1
  55. package/.codex/skills/team-executor/SKILL.md +218 -218
  56. package/.codex/skills/team-frontend/SKILL.md +227 -227
  57. package/.codex/skills/team-frontend-debug/SKILL.md +278 -278
  58. package/.codex/skills/team-frontend-debug/roles/coordinator/commands/analyze.md +2 -2
  59. package/.codex/skills/team-interactive-craft/SKILL.md +220 -220
  60. package/.codex/skills/team-interactive-craft/roles/coordinator/role.md +209 -209
  61. package/.codex/skills/team-issue/SKILL.md +269 -269
  62. package/.codex/skills/team-issue/roles/coordinator/role.md +1 -1
  63. package/.codex/skills/team-lifecycle-v4/SKILL.md +305 -305
  64. package/.codex/skills/team-motion-design/SKILL.md +222 -222
  65. package/.codex/skills/team-motion-design/roles/coordinator/role.md +210 -210
  66. package/.codex/skills/team-perf-opt/SKILL.md +258 -258
  67. package/.codex/skills/team-perf-opt/specs/team-config.json +1 -1
  68. package/.codex/skills/team-planex/SKILL.md +216 -216
  69. package/.codex/skills/team-quality-assurance/SKILL.md +229 -229
  70. package/.codex/skills/team-review/SKILL.md +227 -227
  71. package/.codex/skills/team-roadmap-dev/SKILL.md +238 -238
  72. package/.codex/skills/team-roadmap-dev/roles/coordinator/commands/roadmap-discuss.md +5 -5
  73. package/.codex/skills/team-tech-debt/SKILL.md +206 -206
  74. package/.codex/skills/team-tech-debt/roles/coordinator/commands/monitor.md +1 -1
  75. package/.codex/skills/team-testing/SKILL.md +237 -237
  76. package/.codex/skills/team-ui-polish/SKILL.md +218 -218
  77. package/.codex/skills/team-ui-polish/roles/coordinator/role.md +213 -213
  78. package/.codex/skills/team-uidesign/SKILL.md +219 -219
  79. package/.codex/skills/team-uidesign/roles/coordinator/role.md +2 -2
  80. package/.codex/skills/team-ultra-analyze/SKILL.md +260 -260
  81. package/.codex/skills/team-ultra-analyze/roles/coordinator/commands/monitor.md +1 -1
  82. package/.codex/skills/team-ultra-analyze/roles/coordinator/role.md +1 -1
  83. package/.codex/skills/team-ux-improve/SKILL.md +227 -227
  84. package/.codex/skills/team-ux-improve/roles/coordinator/role.md +1 -1
  85. package/.codex/skills/team-ux-improve/specs/team-config.json +1 -1
  86. package/.codex/skills/team-visual-a11y/SKILL.md +319 -319
  87. package/.codex/skills/team-visual-a11y/roles/coordinator/role.md +213 -213
  88. package/.codex/skills/workflow-execute/SKILL.md +5 -5
  89. package/.codex/skills/workflow-lite-planex/SKILL.md +3 -3
  90. package/.codex/skills/workflow-plan/SKILL.md +3 -3
  91. package/.codex/skills/workflow-tdd-plan/SKILL.md +4 -4
  92. package/.codex/skills/workflow-test-fix-cycle/SKILL.md +403 -402
  93. package/ccw/dist/cli.d.ts.map +1 -1
  94. package/ccw/dist/cli.js +16 -0
  95. package/ccw/dist/cli.js.map +1 -1
  96. package/ccw/dist/commands/chain-loader.d.ts +2 -0
  97. package/ccw/dist/commands/chain-loader.d.ts.map +1 -0
  98. package/ccw/dist/commands/chain-loader.js +11 -0
  99. package/ccw/dist/commands/chain-loader.js.map +1 -0
  100. package/ccw/dist/commands/install.d.ts.map +1 -1
  101. package/ccw/dist/commands/install.js +52 -1
  102. package/ccw/dist/commands/install.js.map +1 -1
  103. package/ccw/dist/commands/launcher.d.ts +2 -0
  104. package/ccw/dist/commands/launcher.d.ts.map +1 -0
  105. package/ccw/dist/commands/launcher.js +434 -0
  106. package/ccw/dist/commands/launcher.js.map +1 -0
  107. package/ccw/dist/tools/chain-loader.d.ts.map +1 -1
  108. package/ccw/dist/tools/chain-loader.js +457 -45
  109. package/ccw/dist/tools/chain-loader.js.map +1 -1
  110. package/ccw/dist/tools/skill-context-loader.d.ts.map +1 -1
  111. package/ccw/dist/tools/skill-context-loader.js +12 -26
  112. package/ccw/dist/tools/skill-context-loader.js.map +1 -1
  113. package/ccw/dist/types/chain-types.d.ts +41 -1
  114. package/ccw/dist/types/chain-types.d.ts.map +1 -1
  115. package/ccw/dist/utils/chain-visualizer.d.ts +13 -0
  116. package/ccw/dist/utils/chain-visualizer.d.ts.map +1 -0
  117. package/ccw/dist/utils/chain-visualizer.js +164 -0
  118. package/ccw/dist/utils/chain-visualizer.js.map +1 -0
  119. package/package.json +1 -1
  120. package/.claude/commands/cli/cli-init.md +0 -441
  121. package/.claude/commands/cli/codex-review.md +0 -361
  122. package/.claude/commands/flow-create.md +0 -663
  123. package/.claude/skills/ccw-chain/phases/analyze-with-file.md +0 -788
  124. package/.claude/skills/ccw-chain/phases/brainstorm/SKILL.md +0 -408
  125. package/.claude/skills/ccw-chain/phases/brainstorm/phases/01-mode-routing.md +0 -207
  126. package/.claude/skills/ccw-chain/phases/brainstorm/phases/02-artifacts.md +0 -567
  127. package/.claude/skills/ccw-chain/phases/brainstorm/phases/03-role-analysis.md +0 -748
  128. package/.claude/skills/ccw-chain/phases/brainstorm/phases/04-synthesis.md +0 -827
  129. package/.claude/skills/ccw-chain/phases/brainstorm-with-file.md +0 -482
  130. package/.claude/skills/ccw-chain/phases/collaborative-plan-with-file.md +0 -639
  131. package/.claude/skills/ccw-chain/phases/debug-with-file.md +0 -656
  132. package/.claude/skills/ccw-chain/phases/integration-test-cycle.md +0 -936
  133. package/.claude/skills/ccw-chain/phases/issue-convert-to-plan.md +0 -720
  134. package/.claude/skills/ccw-chain/phases/issue-discover.md +0 -483
  135. package/.claude/skills/ccw-chain/phases/issue-execute.md +0 -629
  136. package/.claude/skills/ccw-chain/phases/issue-from-brainstorm.md +0 -382
  137. package/.claude/skills/ccw-chain/phases/issue-plan.md +0 -343
  138. package/.claude/skills/ccw-chain/phases/issue-queue.md +0 -464
  139. package/.claude/skills/ccw-chain/phases/refactor-cycle.md +0 -852
  140. package/.claude/skills/ccw-chain/phases/review-cycle/SKILL.md +0 -132
  141. package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-fix.md +0 -760
  142. package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-module.md +0 -764
  143. package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-session.md +0 -775
  144. package/.claude/skills/ccw-chain/phases/roadmap-with-file.md +0 -544
  145. package/.claude/skills/ccw-chain/phases/spec-generator/SKILL.md +0 -338
  146. package/.claude/skills/ccw-chain/phases/spec-generator/phases/01-5-requirement-clarification.md +0 -404
  147. package/.claude/skills/ccw-chain/phases/spec-generator/phases/01-discovery.md +0 -257
  148. package/.claude/skills/ccw-chain/phases/spec-generator/phases/02-product-brief.md +0 -274
  149. package/.claude/skills/ccw-chain/phases/spec-generator/phases/03-requirements.md +0 -184
  150. package/.claude/skills/ccw-chain/phases/spec-generator/phases/04-architecture.md +0 -248
  151. package/.claude/skills/ccw-chain/phases/spec-generator/phases/05-epics-stories.md +0 -178
  152. package/.claude/skills/ccw-chain/phases/spec-generator/phases/06-5-auto-fix.md +0 -144
  153. package/.claude/skills/ccw-chain/phases/spec-generator/phases/06-readiness-check.md +0 -480
  154. package/.claude/skills/ccw-chain/phases/team-planex.md +0 -123
  155. package/.claude/skills/ccw-chain/phases/ui-design-explore-auto.md +0 -678
  156. package/.claude/skills/ccw-chain/phases/unified-execute-with-file.md +0 -870
  157. package/.claude/skills/ccw-chain/phases/workflow-execute/SKILL.md +0 -625
  158. package/.claude/skills/ccw-chain/phases/workflow-execute/phases/06-review.md +0 -215
  159. package/.claude/skills/ccw-chain/phases/workflow-lite-plan.md +0 -616
  160. package/.claude/skills/ccw-chain/phases/workflow-multi-cli-plan.md +0 -424
  161. package/.claude/skills/ccw-chain/phases/workflow-plan/SKILL.md +0 -466
  162. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/01-session-discovery.md +0 -99
  163. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/02-context-gathering.md +0 -338
  164. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/03-conflict-resolution.md +0 -422
  165. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/04-task-generation.md +0 -440
  166. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/05-plan-verify.md +0 -395
  167. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/06-replan.md +0 -594
  168. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/SKILL.md +0 -527
  169. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/01-session-discovery.md +0 -57
  170. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/02-context-gathering.md +0 -407
  171. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/03-test-coverage-analysis.md +0 -172
  172. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/04-conflict-resolution.md +0 -426
  173. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/05-tdd-task-generation.md +0 -473
  174. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/06-tdd-structure-validation.md +0 -189
  175. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/07-tdd-verify.md +0 -635
  176. package/.claude/skills/ccw-chain/phases/workflow-test-fix/SKILL.md +0 -482
  177. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/01-session-start.md +0 -60
  178. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/02-test-context-gather.md +0 -493
  179. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/03-test-concept-enhanced.md +0 -150
  180. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/04-test-task-generate.md +0 -346
  181. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/05-test-cycle-execute.md +0 -538
  182. package/.claude/skills/ccw-chain/specs/intent-patterns.md +0 -60
  183. package/.claude/skills/team-edict.zip +0 -0
@@ -1,629 +0,0 @@
1
- ---
2
- name: execute
3
- description: Execute queue with DAG-based parallel orchestration (one commit per solution)
4
- argument-hint: "[-y|--yes] --queue <queue-id> [--worktree [<existing-path>]]"
5
- allowed-tools: TodoWrite(*), Bash(*), Read(*), AskUserQuestion(*)
6
- ---
7
-
8
- ## Auto Mode
9
-
10
- When `--yes` or `-y`: Auto-confirm execution, use recommended settings.
11
-
12
- # Issue Execute Command (/issue:execute)
13
-
14
- ## Overview
15
-
16
- Minimal orchestrator that dispatches **solution IDs** to executors. Each executor receives a complete solution with all its tasks.
17
-
18
- **Design Principles:**
19
- - `queue dag` → returns parallel batches with solution IDs (S-1, S-2, ...)
20
- - `detail <id>` → READ-ONLY solution fetch (returns full solution with all tasks)
21
- - `done <id>` → update solution completion status
22
- - No race conditions: status changes only via `done`
23
- - **Executor handles all tasks within a solution sequentially**
24
- - **Single worktree for entire queue**: One worktree isolates ALL queue execution from main workspace
25
-
26
- ## Queue ID Requirement (MANDATORY)
27
-
28
- **Queue ID is REQUIRED.** You MUST specify which queue to execute via `--queue <queue-id>`.
29
-
30
- ### If Queue ID Not Provided
31
-
32
- When `--queue` parameter is missing, you MUST:
33
-
34
- 1. **List available queues** by running:
35
- ```javascript
36
- const result = Bash('ccw issue queue list --brief --json');
37
- const index = JSON.parse(result);
38
- ```
39
-
40
- 2. **Display available queues** to user:
41
- ```
42
- Available Queues:
43
- ID Status Progress Issues
44
- -----------------------------------------------------------
45
- → QUE-20251215-001 active 3/10 ISS-001, ISS-002
46
- QUE-20251210-002 active 0/5 ISS-003
47
- QUE-20251205-003 completed 8/8 ISS-004
48
- ```
49
-
50
- 3. **Stop and ask user** to specify which queue to execute:
51
- ```javascript
52
- AskUserQuestion({
53
- questions: [{
54
- question: "Which queue would you like to execute?",
55
- header: "Queue",
56
- multiSelect: false,
57
- options: index.queues
58
- .filter(q => q.status === 'active')
59
- .map(q => ({
60
- label: q.id,
61
- description: `${q.status}, ${q.completed_solutions || 0}/${q.total_solutions || 0} completed, Issues: ${q.issue_ids.join(', ')}`
62
- }))
63
- }]
64
- })
65
- ```
66
-
67
- 4. **After user selection**, continue execution with the selected queue ID.
68
-
69
- **DO NOT auto-select queues.** Explicit user confirmation is required to prevent accidental execution of wrong queue.
70
-
71
- ## Usage
72
-
73
- ```bash
74
- /issue:execute --queue QUE-xxx # Execute specific queue (REQUIRED)
75
- /issue:execute --queue QUE-xxx --worktree # Execute in isolated worktree
76
- /issue:execute --queue QUE-xxx --worktree /path/to/existing/worktree # Resume
77
- ```
78
-
79
- **Parallelism**: Determined automatically by task dependency DAG (no manual control)
80
- **Executor & Dry-run**: Selected via interactive prompt (AskUserQuestion)
81
- **Worktree**: Creates ONE worktree for the entire queue execution (not per-solution)
82
-
83
- **⭐ Recommended Executor**: **Codex** - Best for long-running autonomous work (2hr timeout), supports background execution and full write access
84
-
85
- **Worktree Options**:
86
- - `--worktree` - Create a new worktree with timestamp-based name
87
- - `--worktree <existing-path>` - Resume in an existing worktree (for recovery/continuation)
88
-
89
- **Resume**: Use `git worktree list` to find existing worktrees from interrupted executions
90
-
91
- ## Execution Flow
92
-
93
- ```
94
- Phase 0: Validate Queue ID (REQUIRED)
95
- ├─ If --queue provided → use specified queue
96
- ├─ If --queue missing → list queues, prompt user to select
97
- └─ Store QUEUE_ID for all subsequent commands
98
-
99
- Phase 0.5 (if --worktree): Setup Queue Worktree
100
- ├─ Create ONE worktree for entire queue: .ccw/worktrees/queue-<timestamp>
101
- ├─ All subsequent execution happens in this worktree
102
- └─ Main workspace remains clean and untouched
103
-
104
- Phase 1: Get DAG & User Selection
105
- ├─ ccw issue queue dag --queue ${QUEUE_ID} → { parallel_batches: [["S-1","S-2"], ["S-3"]] }
106
- └─ AskUserQuestion → executor type (codex|gemini|agent), dry-run mode, worktree mode
107
-
108
- Phase 2: Dispatch Parallel Batch (DAG-driven)
109
- ├─ Parallelism determined by DAG (no manual limit)
110
- ├─ All executors work in the SAME worktree (or main if no worktree)
111
- ├─ For each solution ID in batch (parallel - all at once):
112
- │ ├─ Executor calls: ccw issue detail <id> (READ-ONLY)
113
- │ ├─ Executor gets FULL SOLUTION with all tasks
114
- │ ├─ Executor implements all tasks sequentially (T1 → T2 → T3)
115
- │ ├─ Executor tests + verifies each task
116
- │ ├─ Executor commits ONCE per solution (with formatted summary)
117
- │ └─ Executor calls: ccw issue done <id>
118
- └─ Wait for batch completion
119
-
120
- Phase 3: Next Batch (repeat Phase 2)
121
- └─ ccw issue queue dag → check for newly-ready solutions
122
-
123
- Phase 4 (if --worktree): Worktree Completion
124
- ├─ All batches complete → prompt for merge strategy
125
- └─ Options: Create PR / Merge to main / Keep branch
126
- ```
127
-
128
- ## Implementation
129
-
130
- ### Phase 0: Validate Queue ID
131
-
132
- ```javascript
133
- // Check if --queue was provided
134
- let QUEUE_ID = args.queue;
135
-
136
- if (!QUEUE_ID) {
137
- // List available queues
138
- const listResult = Bash('ccw issue queue list --brief --json').trim();
139
- const index = JSON.parse(listResult);
140
-
141
- if (index.queues.length === 0) {
142
- console.log('No queues found. Use /issue:queue to create one first.');
143
- return;
144
- }
145
-
146
- // Filter active queues only
147
- const activeQueues = index.queues.filter(q => q.status === 'active');
148
-
149
- if (activeQueues.length === 0) {
150
- console.log('No active queues found.');
151
- console.log('Available queues:', index.queues.map(q => `${q.id} (${q.status})`).join(', '));
152
- return;
153
- }
154
-
155
- // Auto mode: auto-select if exactly one active queue
156
- if (autoYes && activeQueues.length === 1) {
157
- QUEUE_ID = activeQueues[0].id;
158
- console.log(`Auto-selected queue: ${QUEUE_ID}`);
159
- } else {
160
-
161
- // Display and prompt user
162
- console.log('\nAvailable Queues:');
163
- console.log('ID'.padEnd(22) + 'Status'.padEnd(12) + 'Progress'.padEnd(12) + 'Issues');
164
- console.log('-'.repeat(70));
165
- for (const q of index.queues) {
166
- const marker = q.id === index.active_queue_id ? '→ ' : ' ';
167
- console.log(marker + q.id.padEnd(20) + q.status.padEnd(12) +
168
- `${q.completed_solutions || 0}/${q.total_solutions || 0}`.padEnd(12) +
169
- q.issue_ids.join(', '));
170
- }
171
-
172
- const answer = AskUserQuestion({
173
- questions: [{
174
- question: "Which queue would you like to execute?",
175
- header: "Queue",
176
- multiSelect: false,
177
- options: activeQueues.map(q => ({
178
- label: q.id,
179
- description: `${q.completed_solutions || 0}/${q.total_solutions || 0} completed, Issues: ${q.issue_ids.join(', ')}`
180
- }))
181
- }]
182
- });
183
-
184
- QUEUE_ID = answer['Queue'];
185
- } // end else (multi-queue prompt)
186
- }
187
-
188
- console.log(`\n## Executing Queue: ${QUEUE_ID}\n`);
189
- ```
190
-
191
- ### Phase 1: Get DAG & User Selection
192
-
193
- ```javascript
194
- // Get dependency graph and parallel batches (QUEUE_ID required)
195
- const dagJson = Bash(`ccw issue queue dag --queue ${QUEUE_ID}`).trim();
196
- const dag = JSON.parse(dagJson);
197
-
198
- if (dag.error || dag.ready_count === 0) {
199
- console.log(dag.error || 'No solutions ready for execution');
200
- console.log('Use /issue:queue to form a queue first');
201
- return;
202
- }
203
-
204
- console.log(`
205
- ## Queue DAG (Solution-Level)
206
-
207
- - Total Solutions: ${dag.total}
208
- - Ready: ${dag.ready_count}
209
- - Completed: ${dag.completed_count}
210
- - Parallel in batch 1: ${dag.parallel_batches[0]?.length || 0}
211
- `);
212
-
213
- // Auto mode: use recommended defaults (Codex + Execute + Worktree)
214
- if (autoYes) {
215
- var executor = 'codex';
216
- var isDryRun = false;
217
- var useWorktree = true;
218
- } else {
219
-
220
- // Interactive selection via AskUserQuestion
221
- const answer = AskUserQuestion({
222
- questions: [
223
- {
224
- question: 'Select executor type:',
225
- header: 'Executor',
226
- multiSelect: false,
227
- options: [
228
- { label: 'Codex (Recommended)', description: 'Autonomous coding with full write access' },
229
- { label: 'Gemini', description: 'Large context analysis and implementation' },
230
- { label: 'Agent', description: 'Claude Code sub-agent for complex tasks' }
231
- ]
232
- },
233
- {
234
- question: 'Execution mode:',
235
- header: 'Mode',
236
- multiSelect: false,
237
- options: [
238
- { label: 'Execute (Recommended)', description: 'Run all ready solutions' },
239
- { label: 'Dry-run', description: 'Show DAG and batches without executing' }
240
- ]
241
- },
242
- {
243
- question: 'Use git worktree for queue isolation?',
244
- header: 'Worktree',
245
- multiSelect: false,
246
- options: [
247
- { label: 'Yes (Recommended)', description: 'Create ONE worktree for entire queue - main stays clean' },
248
- { label: 'No', description: 'Work directly in current directory' }
249
- ]
250
- }
251
- ]
252
- });
253
-
254
- var executor = answer['Executor'].toLowerCase().split(' ')[0]; // codex|gemini|agent
255
- var isDryRun = answer['Mode'].includes('Dry-run');
256
- var useWorktree = answer['Worktree'].includes('Yes');
257
- } // end else (interactive selection)
258
-
259
- // Dry run mode
260
- if (isDryRun) {
261
- console.log('### Parallel Batches (Dry-run):\n');
262
- dag.parallel_batches.forEach((batch, i) => {
263
- console.log(`Batch ${i + 1}: ${batch.join(', ')}`);
264
- });
265
- return;
266
- }
267
- ```
268
-
269
- ### Phase 0 & 2: Setup Queue Worktree & Dispatch
270
-
271
- ```javascript
272
- // Parallelism determined by DAG - no manual limit
273
- // All solutions in same batch have NO file conflicts and can run in parallel
274
- const batch = dag.parallel_batches[0] || [];
275
-
276
- // Initialize TodoWrite
277
- TodoWrite({
278
- todos: batch.map(id => ({
279
- content: `Execute solution ${id}`,
280
- status: 'pending',
281
- activeForm: `Executing solution ${id}`
282
- }))
283
- });
284
-
285
- console.log(`\n### Executing Solutions (DAG batch 1): ${batch.join(', ')}`);
286
-
287
- // Parse existing worktree path from args if provided
288
- // Example: --worktree /path/to/existing/worktree
289
- const existingWorktree = args.worktree && typeof args.worktree === 'string' ? args.worktree : null;
290
-
291
- // Setup ONE worktree for entire queue (not per-solution)
292
- let worktreePath = null;
293
- let worktreeBranch = null;
294
-
295
- if (useWorktree) {
296
- const repoRoot = Bash('git rev-parse --show-toplevel').trim();
297
- const worktreeBase = `${repoRoot}/.ccw/worktrees`;
298
- Bash(`mkdir -p "${worktreeBase}"`);
299
- Bash('git worktree prune'); // Cleanup stale worktrees
300
-
301
- if (existingWorktree) {
302
- // Resume mode: Use existing worktree
303
- worktreePath = existingWorktree;
304
- worktreeBranch = Bash(`git -C "${worktreePath}" branch --show-current`).trim();
305
- console.log(`Resuming in existing worktree: ${worktreePath} (branch: ${worktreeBranch})`);
306
- } else {
307
- // Create mode: ONE worktree for the entire queue
308
- const timestamp = new Date().toISOString().replace(/[-:T]/g, '').slice(0, 14);
309
- worktreeBranch = `queue-exec-${dag.queue_id || timestamp}`;
310
- worktreePath = `${worktreeBase}/${worktreeBranch}`;
311
- Bash(`git worktree add "${worktreePath}" -b "${worktreeBranch}"`);
312
- console.log(`Created queue worktree: ${worktreePath}`);
313
- }
314
- }
315
-
316
- // Launch ALL solutions in batch in parallel (DAG guarantees no conflicts)
317
- // All executors work in the SAME worktree (or main if no worktree)
318
- const executions = batch.map(solutionId => {
319
- updateTodo(solutionId, 'in_progress');
320
- return dispatchExecutor(solutionId, executor, worktreePath);
321
- });
322
-
323
- await Promise.all(executions);
324
- batch.forEach(id => updateTodo(id, 'completed'));
325
- ```
326
-
327
- ### Executor Dispatch
328
-
329
- ```javascript
330
- // worktreePath: path to shared worktree (null if not using worktree)
331
- function dispatchExecutor(solutionId, executorType, worktreePath = null) {
332
- // If worktree is provided, executor works in that directory
333
- // No per-solution worktree creation - ONE worktree for entire queue
334
-
335
- // Pre-defined values (replaced at dispatch time, NOT by executor)
336
- const SOLUTION_ID = solutionId;
337
- const WORK_DIR = worktreePath || null;
338
-
339
- // Build prompt without markdown code blocks to avoid escaping issues
340
- const prompt = `
341
- ## Execute Solution: ${SOLUTION_ID}
342
- ${WORK_DIR ? `Working Directory: ${WORK_DIR}` : ''}
343
-
344
- ### Step 1: Get Solution Details
345
- Run this command to get the full solution with all tasks:
346
- ccw issue detail ${SOLUTION_ID}
347
-
348
- ### Step 2: Execute All Tasks Sequentially
349
- The detail command returns a FULL SOLUTION with all tasks.
350
- Execute each task in order (T1 → T2 → T3 → ...):
351
-
352
- For each task:
353
- - Follow task.implementation steps
354
- - Run task.test commands
355
- - Verify task.convergence criteria
356
- - Do NOT commit after each task
357
-
358
- ### Step 3: Commit Solution (Once)
359
- After ALL tasks pass, commit once with clean conventional format.
360
-
361
- Command:
362
- git add -A
363
- git commit -m "<type>(<scope>): <brief description>"
364
-
365
- Examples:
366
- git commit -m "feat(auth): add token refresh mechanism"
367
- git commit -m "fix(payment): resolve timeout in checkout flow"
368
- git commit -m "refactor(api): simplify error handling"
369
-
370
- Replace <type> with: feat|fix|refactor|docs|test|chore
371
- Replace <scope> with: affected module name
372
- Replace <description> with: brief summary (NO solution/issue IDs)
373
-
374
- ### Step 4: Report Completion
375
- On success, run:
376
- ccw issue done ${SOLUTION_ID} --result '{
377
- "solution_id": "<solution-id>",
378
- "issue_id": "<issue-id>",
379
- "commit": {
380
- "hash": "<commit-hash>",
381
- "type": "<commit-type>",
382
- "scope": "<commit-scope>",
383
- "message": "<commit-message>"
384
- },
385
- "analysis": {
386
- "risk": "<low|medium|high>",
387
- "impact": "<low|medium|high>",
388
- "complexity": "<low|medium|high>"
389
- },
390
- "tasks_completed": [
391
- {"id": "T1", "title": "...", "action": "...", "scope": "..."},
392
- {"id": "T2", "title": "...", "action": "...", "scope": "..."}
393
- ],
394
- "files_modified": ["<file1>", "<file2>"],
395
- "tests_passed": true,
396
- "verification": {
397
- "all_tests_passed": true,
398
- "convergence_criteria_met": true,
399
- "regression_checked": true
400
- },
401
- "summary": "<brief description of accomplishment>"
402
- }'
403
-
404
- On failure, run:
405
- ccw issue done ${SOLUTION_ID} --fail --reason '{
406
- "task_id": "<TX>",
407
- "error_type": "<test_failure|build_error|other>",
408
- "message": "<error details>",
409
- "files_attempted": ["<file1>", "<file2>"],
410
- "commit": null
411
- }'
412
-
413
- ### Important Notes
414
- - Do NOT cleanup worktree - it is shared by all solutions in the queue
415
- - Replace all <placeholder> values with actual values from your execution
416
- `;
417
-
418
- // For CLI tools, pass --cd to set working directory
419
- const cdOption = worktreePath ? ` --cd "${worktreePath}"` : '';
420
-
421
- if (executorType === 'codex') {
422
- return Bash(
423
- `ccw cli -p "${escapePrompt(prompt)}" --tool codex --mode write --id exec-${solutionId}${cdOption}`,
424
- { timeout: 7200000, run_in_background: true } // 2hr for full solution
425
- );
426
- } else if (executorType === 'gemini') {
427
- return Bash(
428
- `ccw cli -p "${escapePrompt(prompt)}" --tool gemini --mode write --id exec-${solutionId}${cdOption}`,
429
- { timeout: 3600000, run_in_background: true }
430
- );
431
- } else {
432
- return Agent({
433
- subagent_type: 'code-developer',
434
- run_in_background: false,
435
- description: `Execute solution ${solutionId}`,
436
- prompt: worktreePath ? `Working directory: ${worktreePath}\n\n${prompt}` : prompt
437
- });
438
- }
439
- }
440
- ```
441
-
442
- ### Phase 3: Check Next Batch
443
-
444
- ```javascript
445
- // Refresh DAG after batch completes (use same QUEUE_ID)
446
- const refreshedDag = JSON.parse(Bash(`ccw issue queue dag --queue ${QUEUE_ID}`).trim());
447
-
448
- console.log(`
449
- ## Batch Complete
450
-
451
- - Solutions Completed: ${refreshedDag.completed_count}/${refreshedDag.total}
452
- - Next ready: ${refreshedDag.ready_count}
453
- `);
454
-
455
- if (refreshedDag.ready_count > 0) {
456
- console.log(`Run \`/issue:execute --queue ${QUEUE_ID}\` again for next batch.`);
457
- // Note: If resuming, pass existing worktree path:
458
- // /issue:execute --queue ${QUEUE_ID} --worktree <worktreePath>
459
- }
460
- ```
461
-
462
- ### Phase 4: Worktree Completion (after ALL batches)
463
-
464
- ```javascript
465
- // Only run when ALL solutions completed AND using worktree
466
- if (useWorktree && refreshedDag.ready_count === 0 && refreshedDag.completed_count === refreshedDag.total) {
467
- console.log('\n## All Solutions Completed - Worktree Cleanup');
468
-
469
- // Auto mode: Create PR (recommended)
470
- if (autoYes) {
471
- var mergeAction = 'Create PR';
472
- } else {
473
- const answer = AskUserQuestion({
474
- questions: [{
475
- question: `Queue complete. What to do with worktree branch "${worktreeBranch}"?`,
476
- header: 'Merge',
477
- multiSelect: false,
478
- options: [
479
- { label: 'Create PR (Recommended)', description: 'Push branch and create pull request' },
480
- { label: 'Merge to main', description: 'Merge all commits and cleanup worktree' },
481
- { label: 'Keep branch', description: 'Cleanup worktree, keep branch for manual handling' }
482
- ]
483
- }]
484
- });
485
- var mergeAction = answer['Merge'];
486
- }
487
-
488
- const repoRoot = Bash('git rev-parse --show-toplevel').trim();
489
-
490
- if (mergeAction.includes('Create PR')) {
491
- Bash(`git -C "${worktreePath}" push -u origin "${worktreeBranch}"`);
492
- Bash(`gh pr create --title "Queue ${dag.queue_id}" --body "Issue queue execution - all solutions completed" --head "${worktreeBranch}"`);
493
- Bash(`git worktree remove "${worktreePath}"`);
494
- console.log(`PR created for branch: ${worktreeBranch}`);
495
- } else if (mergeAction.includes('Merge to main')) {
496
- // Check main is clean
497
- const mainDirty = Bash('git status --porcelain').trim();
498
- if (mainDirty) {
499
- console.log('Warning: Main has uncommitted changes. Falling back to PR.');
500
- Bash(`git -C "${worktreePath}" push -u origin "${worktreeBranch}"`);
501
- Bash(`gh pr create --title "Queue ${dag.queue_id}" --body "Issue queue execution (main had uncommitted changes)" --head "${worktreeBranch}"`);
502
- } else {
503
- Bash(`git merge --no-ff "${worktreeBranch}" -m "Merge queue ${dag.queue_id}"`);
504
- Bash(`git branch -d "${worktreeBranch}"`);
505
- }
506
- Bash(`git worktree remove "${worktreePath}"`);
507
- } else {
508
- Bash(`git worktree remove "${worktreePath}"`);
509
- console.log(`Branch ${worktreeBranch} kept for manual handling`);
510
- }
511
- }
512
- ```
513
-
514
- ## Parallel Execution Model
515
-
516
- ```
517
- ┌─────────────────────────────────────────────────────────────────┐
518
- │ Orchestrator │
519
- ├─────────────────────────────────────────────────────────────────┤
520
- │ 0. Validate QUEUE_ID (required, or prompt user to select) │
521
- │ │
522
- │ 0.5 (if --worktree) Create ONE worktree for entire queue │
523
- │ → .ccw/worktrees/queue-exec-<queue-id> │
524
- │ │
525
- │ 1. ccw issue queue dag --queue ${QUEUE_ID} │
526
- │ → { parallel_batches: [["S-1","S-2"], ["S-3"]] } │
527
- │ │
528
- │ 2. Dispatch batch 1 (parallel, SAME worktree): │
529
- │ ┌──────────────────────────────────────────────────────┐ │
530
- │ │ Shared Queue Worktree (or main) │ │
531
- │ │ ┌──────────────────┐ ┌──────────────────┐ │ │
532
- │ │ │ Executor 1 │ │ Executor 2 │ │ │
533
- │ │ │ detail S-1 │ │ detail S-2 │ │ │
534
- │ │ │ [T1→T2→T3] │ │ [T1→T2] │ │ │
535
- │ │ │ commit S-1 │ │ commit S-2 │ │ │
536
- │ │ │ done S-1 │ │ done S-2 │ │ │
537
- │ │ └──────────────────┘ └──────────────────┘ │ │
538
- │ └──────────────────────────────────────────────────────┘ │
539
- │ │
540
- │ 3. ccw issue queue dag (refresh) │
541
- │ → S-3 now ready → dispatch batch 2 (same worktree) │
542
- │ │
543
- │ 4. (if --worktree) ALL batches complete → cleanup worktree │
544
- │ → Prompt: Create PR / Merge to main / Keep branch │
545
- └─────────────────────────────────────────────────────────────────┘
546
- ```
547
-
548
- **Why this works for parallel:**
549
- - **ONE worktree for entire queue** → all solutions share same isolated workspace
550
- - `detail <id>` is READ-ONLY → no race conditions
551
- - Each executor handles **all tasks within a solution** sequentially
552
- - **One commit per solution** with formatted summary (not per-task)
553
- - `done <id>` updates only its own solution status
554
- - `queue dag` recalculates ready solutions after each batch
555
- - Solutions in same batch have NO file conflicts (DAG guarantees)
556
- - **Main workspace stays clean** until merge/PR decision
557
-
558
- ## CLI Endpoint Contract
559
-
560
- ### `ccw issue queue list --brief --json`
561
- Returns queue index for selection (used when --queue not provided):
562
- ```json
563
- {
564
- "active_queue_id": "QUE-20251215-001",
565
- "queues": [
566
- { "id": "QUE-20251215-001", "status": "active", "issue_ids": ["ISS-001"], "total_solutions": 5, "completed_solutions": 2 }
567
- ]
568
- }
569
- ```
570
-
571
- ### `ccw issue queue dag --queue <queue-id>`
572
- Returns dependency graph with parallel batches (solution-level, **--queue required**):
573
- ```json
574
- {
575
- "queue_id": "QUE-...",
576
- "total": 3,
577
- "ready_count": 2,
578
- "completed_count": 0,
579
- "nodes": [
580
- { "id": "S-1", "issue_id": "ISS-xxx", "status": "pending", "ready": true, "task_count": 3 },
581
- { "id": "S-2", "issue_id": "ISS-yyy", "status": "pending", "ready": true, "task_count": 2 },
582
- { "id": "S-3", "issue_id": "ISS-zzz", "status": "pending", "ready": false, "depends_on": ["S-1"] }
583
- ],
584
- "parallel_batches": [["S-1", "S-2"], ["S-3"]]
585
- }
586
- ```
587
-
588
- ### `ccw issue detail <item_id>`
589
- Returns FULL SOLUTION with all tasks (READ-ONLY):
590
- ```json
591
- {
592
- "item_id": "S-1",
593
- "issue_id": "ISS-xxx",
594
- "solution_id": "SOL-xxx",
595
- "status": "pending",
596
- "solution": {
597
- "id": "SOL-xxx",
598
- "approach": "...",
599
- "tasks": [
600
- { "id": "T1", "title": "...", "implementation": [...], "test": {...} },
601
- { "id": "T2", "title": "...", "implementation": [...], "test": {...} },
602
- { "id": "T3", "title": "...", "implementation": [...], "test": {...} }
603
- ],
604
- "exploration_context": { "relevant_files": [...] }
605
- },
606
- "execution_hints": { "executor": "codex", "estimated_minutes": 180 }
607
- }
608
- ```
609
-
610
- ### `ccw issue done <item_id>`
611
- Marks solution completed/failed, updates queue state, checks for queue completion.
612
-
613
- ## Error Handling
614
-
615
- | Error | Resolution |
616
- |-------|------------|
617
- | No queue | Run /issue:queue first |
618
- | No ready solutions | Dependencies blocked, check DAG |
619
- | Executor timeout | Solution not marked done, can retry |
620
- | Solution failure | Use `ccw issue retry` to reset |
621
- | Partial task failure | Executor reports which task failed via `done --fail` |
622
-
623
- ## Related Commands
624
-
625
- - `/issue:plan` - Plan issues with solutions
626
- - `/issue:queue` - Form execution queue
627
- - `ccw issue queue dag` - View dependency graph
628
- - `ccw issue detail <id>` - View task details
629
- - `ccw issue retry` - Reset failed tasks