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,343 @@
1
+ ---
2
+ name: plan
3
+ description: Batch plan issue resolution using issue-plan-agent (explore + plan closed-loop)
4
+ argument-hint: "[-y|--yes] --all-pending <issue-id>[,<issue-id>,...] [--batch-size 3]"
5
+ allowed-tools: TodoWrite(*), Agent(*), Skill(*), AskUserQuestion(*), Bash(*), Read(*), Write(*)
6
+ ---
7
+
8
+ ## Auto Mode
9
+
10
+ When `--yes` or `-y`: Auto-bind solutions without confirmation, use recommended settings.
11
+
12
+ # Issue Plan Command (/issue:plan)
13
+
14
+ ## Overview
15
+
16
+ Unified planning command using **issue-plan-agent** that combines exploration and planning into a single closed-loop workflow.
17
+
18
+ **Behavior:**
19
+ - Single solution per issue → auto-bind
20
+ - Multiple solutions → return for user selection
21
+ - Agent handles file generation
22
+
23
+ ## Core Guidelines
24
+
25
+ **⚠️ Data Access Principle**: Issues and solutions files can grow very large. To avoid context overflow:
26
+
27
+ | Operation | Correct | Incorrect |
28
+ |-----------|---------|-----------|
29
+ | List issues (brief) | `ccw issue list --status pending --brief` | `Read('issues.jsonl')` |
30
+ | Read issue details | `ccw issue status <id> --json` | `Read('issues.jsonl')` |
31
+ | Update status | `ccw issue update <id> --status ...` | Direct file edit |
32
+ | Bind solution | `ccw issue bind <id> <sol-id>` | Direct file edit |
33
+
34
+ **Output Options**:
35
+ - `--brief`: JSON with minimal fields (id, title, status, priority, tags)
36
+ - `--json`: Full JSON (agent use only)
37
+
38
+ **Orchestration vs Execution**:
39
+ - **Command (orchestrator)**: Use `--brief` for minimal context
40
+ - **Agent (executor)**: Fetch full details → `ccw issue status <id> --json`
41
+
42
+ **ALWAYS** use CLI commands for CRUD operations. **NEVER** read entire `issues.jsonl` or `solutions/*.jsonl` directly.
43
+
44
+ ## Usage
45
+
46
+ ```bash
47
+ /issue:plan [<issue-id>[,<issue-id>,...]] [FLAGS]
48
+
49
+ # Examples
50
+ /issue:plan # Default: --all-pending
51
+ /issue:plan GH-123 # Single issue
52
+ /issue:plan GH-123,GH-124,GH-125 # Batch (up to 3)
53
+ /issue:plan --all-pending # All pending issues (explicit)
54
+
55
+ # Flags
56
+ --batch-size <n> Max issues per agent batch (default: 3)
57
+ ```
58
+
59
+ ## Execution Process
60
+
61
+ ```
62
+ Phase 1: Issue Loading & Intelligent Grouping
63
+ ├─ Parse input (single, comma-separated, or --all-pending)
64
+ ├─ Fetch issue metadata (ID, title, tags)
65
+ ├─ Validate issues exist (create if needed)
66
+ └─ Intelligent grouping via Gemini (semantic similarity, max 3 per batch)
67
+
68
+ Phase 2: Unified Explore + Plan (issue-plan-agent)
69
+ ├─ Launch issue-plan-agent per batch
70
+ ├─ Agent performs:
71
+ │ ├─ ACE semantic search for each issue
72
+ │ ├─ Codebase exploration (files, patterns, dependencies)
73
+ │ ├─ Solution generation with task breakdown
74
+ │ └─ Conflict detection across issues
75
+ └─ Output: solution JSON per issue
76
+
77
+ Phase 3: Solution Registration & Binding
78
+ ├─ Append solutions to solutions/{issue-id}.jsonl
79
+ ├─ Single solution per issue → auto-bind
80
+ ├─ Multiple candidates → AskUserQuestion to select
81
+ └─ Update issues.jsonl with bound_solution_id
82
+
83
+ Phase 4: Summary
84
+ ├─ Display bound solutions
85
+ ├─ Show task counts per issue
86
+ └─ Display next steps (/issue:queue)
87
+ ```
88
+
89
+ ## Implementation
90
+
91
+ ### Phase 1: Issue Loading (Brief Info Only)
92
+
93
+ ```javascript
94
+ const batchSize = flags.batchSize || 3;
95
+ let issues = []; // {id, title, tags} - brief info for grouping only
96
+
97
+ // Default to --all-pending if no input provided
98
+ const useAllPending = flags.allPending || !userInput || userInput.trim() === '';
99
+
100
+ if (useAllPending) {
101
+ // Get pending issues with brief metadata via CLI
102
+ const result = Bash(`ccw issue list --status pending,registered --json`).trim();
103
+ const parsed = result ? JSON.parse(result) : [];
104
+ issues = parsed.map(i => ({ id: i.id, title: i.title || '', tags: i.tags || [] }));
105
+
106
+ if (issues.length === 0) {
107
+ console.log('No pending issues found.');
108
+ return;
109
+ }
110
+ console.log(`Found ${issues.length} pending issues`);
111
+ } else {
112
+ // Parse comma-separated issue IDs, fetch brief metadata
113
+ const ids = userInput.includes(',')
114
+ ? userInput.split(',').map(s => s.trim())
115
+ : [userInput.trim()];
116
+
117
+ for (const id of ids) {
118
+ Bash(`ccw issue init ${id} --title "Issue ${id}" 2>/dev/null || true`);
119
+ const info = Bash(`ccw issue status ${id} --json`).trim();
120
+ const parsed = info ? JSON.parse(info) : {};
121
+ issues.push({ id, title: parsed.title || '', tags: parsed.tags || [] });
122
+ }
123
+ }
124
+ // Note: Agent fetches full issue content via `ccw issue status <id> --json`
125
+
126
+ // Intelligent grouping: Analyze issues by title/tags, group semantically similar ones
127
+ // Strategy: Same module/component, related bugs, feature clusters
128
+ // Constraint: Max ${batchSize} issues per batch
129
+
130
+ console.log(`Processing ${issues.length} issues in ${batches.length} batch(es)`);
131
+
132
+ TodoWrite({
133
+ todos: batches.map((_, i) => ({
134
+ content: `Plan batch ${i+1}`,
135
+ status: 'pending',
136
+ activeForm: `Planning batch ${i+1}`
137
+ }))
138
+ });
139
+ ```
140
+
141
+ ### Phase 2: Unified Explore + Plan (issue-plan-agent) - PARALLEL
142
+
143
+ ```javascript
144
+ Bash(`mkdir -p .workflow/issues/solutions`);
145
+ const pendingSelections = []; // Collect multi-solution issues for user selection
146
+ const agentResults = []; // Collect all agent results for conflict aggregation
147
+
148
+ // Build prompts for all batches
149
+ const agentTasks = batches.map((batch, batchIndex) => {
150
+ const issueList = batch.map(i => `- ${i.id}: ${i.title}${i.tags.length ? ` [${i.tags.join(', ')}]` : ''}`).join('\n');
151
+ const batchIds = batch.map(i => i.id);
152
+
153
+ const issuePrompt = `
154
+ ## Plan Issues
155
+
156
+ **Issues** (grouped by similarity):
157
+ ${issueList}
158
+
159
+ **Project Root**: ${process.cwd()}
160
+
161
+ ### Project Context (MANDATORY)
162
+ 1. Read: .workflow/project-tech.json (technology stack, architecture)
163
+ 2. Read: .workflow/specs/*.md (constraints and conventions)
164
+
165
+ ### Workflow
166
+ 1. Fetch issue details: ccw issue status <id> --json
167
+ 2. **Analyze failure history** (if issue.feedback exists):
168
+ - Extract failure details from issue.feedback (type='failure', stage='execute')
169
+ - Parse error_type, message, task_id, solution_id from content JSON
170
+ - Identify failure patterns: repeated errors, root causes, blockers
171
+ - **Constraint**: Avoid repeating failed approaches
172
+ 3. Load project context files
173
+ 4. Explore codebase (ACE semantic search)
174
+ 5. Plan solution with tasks (schema: solution-schema.json)
175
+ - **If previous solution failed**: Reference failure analysis in solution.approach
176
+ - Add explicit verification steps to prevent same failure mode
177
+ 6. **If github_url exists**: Add final task to comment on GitHub issue
178
+ 7. Write solution to: .workflow/issues/solutions/{issue-id}.jsonl
179
+ 8. **CRITICAL - Binding Decision**:
180
+ - Single solution → **MUST execute**: ccw issue bind <issue-id> <solution-id>
181
+ - Multiple solutions → Return pending_selection only (no bind)
182
+
183
+ ### Failure-Aware Planning Rules
184
+ - **Extract failure patterns**: Parse issue.feedback where type='failure' and stage='execute'
185
+ - **Identify root causes**: Analyze error_type (test_failure, compilation, timeout, etc.)
186
+ - **Design alternative approach**: Create solution that addresses root cause
187
+ - **Add prevention steps**: Include explicit verification to catch same error earlier
188
+ - **Document lessons**: Reference previous failures in solution.approach
189
+
190
+ ### Rules
191
+ - Solution ID format: SOL-{issue-id}-{uid} (uid: 4 random alphanumeric chars, e.g., a7x9)
192
+ - Single solution per issue → auto-bind via ccw issue bind
193
+ - Multiple solutions → register only, return pending_selection
194
+ - Tasks must have quantified convergence.criteria
195
+
196
+ ### Return Summary
197
+ {"bound":[{"issue_id":"...","solution_id":"...","task_count":N}],"pending_selection":[{"issue_id":"...","solutions":[{"id":"...","description":"...","task_count":N}]}]}
198
+ `;
199
+
200
+ return { batchIndex, batchIds, issuePrompt, batch };
201
+ });
202
+
203
+ // Launch agents in parallel (max 10 concurrent)
204
+ const MAX_PARALLEL = 10;
205
+ for (let i = 0; i < agentTasks.length; i += MAX_PARALLEL) {
206
+ const chunk = agentTasks.slice(i, i + MAX_PARALLEL);
207
+ const taskIds = [];
208
+
209
+ // Launch chunk in parallel
210
+ for (const { batchIndex, batchIds, issuePrompt, batch } of chunk) {
211
+ updateTodo(`Plan batch ${batchIndex + 1}`, 'in_progress');
212
+ const taskId = Task(
213
+ subagent_type="issue-plan-agent",
214
+ run_in_background=true,
215
+ description=`Explore & plan ${batch.length} issues: ${batchIds.join(', ')}`,
216
+ prompt=issuePrompt
217
+ );
218
+ taskIds.push({ taskId, batchIndex });
219
+ }
220
+
221
+ console.log(`Launched ${taskIds.length} agents (batch ${i/MAX_PARALLEL + 1}/${Math.ceil(agentTasks.length/MAX_PARALLEL)})...`);
222
+
223
+ // Collect results from this chunk
224
+ for (const { taskId, batchIndex } of taskIds) {
225
+ const result = TaskOutput({ task_id: taskId, block: true });
226
+
227
+ // Extract JSON from potential markdown code blocks (agent may wrap in ```json...```)
228
+ const jsonText = extractJsonFromMarkdown(result);
229
+ let summary;
230
+ try {
231
+ summary = JSON.parse(jsonText);
232
+ } catch (e) {
233
+ console.log(`⚠ Batch ${batchIndex + 1}: Failed to parse agent result, skipping`);
234
+ updateTodo(`Plan batch ${batchIndex + 1}`, 'completed');
235
+ continue;
236
+ }
237
+ agentResults.push(summary); // Store for Phase 3 conflict aggregation
238
+
239
+ // Verify binding for bound issues (agent should have executed bind)
240
+ for (const item of summary.bound || []) {
241
+ const status = JSON.parse(Bash(`ccw issue status ${item.issue_id} --json`).trim());
242
+ if (status.bound_solution_id === item.solution_id) {
243
+ console.log(`✓ ${item.issue_id}: ${item.solution_id} (${item.task_count} tasks)`);
244
+ } else {
245
+ // Fallback: agent failed to bind, execute here
246
+ Bash(`ccw issue bind ${item.issue_id} ${item.solution_id}`);
247
+ console.log(`✓ ${item.issue_id}: ${item.solution_id} (${item.task_count} tasks) [recovered]`);
248
+ }
249
+ }
250
+ // Collect pending selections for Phase 3
251
+ for (const pending of summary.pending_selection || []) {
252
+ pendingSelections.push(pending);
253
+ }
254
+ updateTodo(`Plan batch ${batchIndex + 1}`, 'completed');
255
+ }
256
+ }
257
+ ```
258
+
259
+ ### Phase 3: Solution Selection (if pending)
260
+
261
+ ```javascript
262
+ // Handle multi-solution issues
263
+ for (const pending of pendingSelections) {
264
+ if (pending.solutions.length === 0) continue;
265
+
266
+ // Auto mode: auto-bind first (highest-ranked) solution
267
+ if (autoYes) {
268
+ const solId = pending.solutions[0].id;
269
+ Bash(`ccw issue bind ${pending.issue_id} ${solId}`);
270
+ console.log(`✓ ${pending.issue_id}: ${solId} bound (auto)`);
271
+ continue;
272
+ }
273
+
274
+ const options = pending.solutions.slice(0, 4).map(sol => ({
275
+ label: `${sol.id} (${sol.task_count} tasks)`,
276
+ description: sol.description || sol.approach || 'No description'
277
+ }));
278
+
279
+ const answer = AskUserQuestion({
280
+ questions: [{
281
+ question: `Issue ${pending.issue_id}: which solution to bind?`,
282
+ header: pending.issue_id,
283
+ options: options,
284
+ multiSelect: false
285
+ }]
286
+ });
287
+
288
+ const selected = answer[Object.keys(answer)[0]];
289
+ if (!selected || selected === 'Other') continue;
290
+
291
+ const solId = selected.split(' ')[0];
292
+ Bash(`ccw issue bind ${pending.issue_id} ${solId}`);
293
+ console.log(`✓ ${pending.issue_id}: ${solId} bound`);
294
+ }
295
+ ```
296
+
297
+ ### Phase 4: Summary
298
+
299
+ ```javascript
300
+ // Count planned issues via CLI
301
+ const planned = JSON.parse(Bash(`ccw issue list --status planned --brief`) || '[]');
302
+ const plannedCount = planned.length;
303
+
304
+ console.log(`
305
+ ## Done: ${issues.length} issues → ${plannedCount} planned
306
+
307
+ Next: \`/issue:queue\` → \`/issue:execute\`
308
+ `);
309
+ ```
310
+
311
+ ## Error Handling
312
+
313
+ | Error | Resolution |
314
+ |-------|------------|
315
+ | Issue not found | Auto-create in issues.jsonl |
316
+ | ACE search fails | Agent falls back to ripgrep |
317
+ | No solutions generated | Display error, suggest manual planning |
318
+ | User cancels selection | Skip issue, continue with others |
319
+ | File conflicts | Agent detects and suggests resolution order |
320
+
321
+ ## Bash Compatibility
322
+
323
+ **Avoid**: `$(cmd)`, `$var`, `for` loops — will be escaped incorrectly
324
+
325
+ **Use**: Simple commands + `&&` chains, quote comma params `"pending,registered"`
326
+
327
+ ## Quality Checklist
328
+
329
+ Before completing, verify:
330
+
331
+ - [ ] All input issues have solutions in `solutions/{issue-id}.jsonl`
332
+ - [ ] Single solution issues are auto-bound (`bound_solution_id` set)
333
+ - [ ] Multi-solution issues returned in `pending_selection` for user choice
334
+ - [ ] Each solution has executable tasks with `files`
335
+ - [ ] Task convergence criteria are quantified (not vague)
336
+ - [ ] Conflicts detected and reported (if multiple issues touch same files)
337
+ - [ ] Issue status updated to `planned` after binding
338
+
339
+ ## Related Commands
340
+
341
+ - `/issue:queue` - Form execution queue from bound solutions
342
+ - `ccw issue list` - List all issues
343
+ - `ccw issue status` - View issue and solution details