claude-code-workflow 6.3.12 → 6.3.15

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 (72) hide show
  1. package/.claude/agents/issue-plan-agent.md +62 -36
  2. package/.claude/agents/issue-queue-agent.md +110 -57
  3. package/.claude/commands/issue/execute.md +53 -40
  4. package/.claude/commands/issue/new.md +226 -380
  5. package/.claude/commands/issue/plan.md +122 -125
  6. package/.claude/commands/issue/queue.md +198 -321
  7. package/.claude/skills/issue-manage/SKILL.md +63 -22
  8. package/.claude/workflows/cli-templates/schemas/discovery-finding-schema.json +3 -3
  9. package/.claude/workflows/cli-templates/schemas/issues-jsonl-schema.json +141 -168
  10. package/.claude/workflows/cli-templates/schemas/queue-schema.json +0 -5
  11. package/.claude/workflows/cli-templates/schemas/solution-schema.json +3 -2
  12. package/.codex/prompts/issue-execute.md +3 -3
  13. package/.codex/prompts/issue-plan.md +16 -19
  14. package/.codex/prompts/issue-queue.md +3 -4
  15. package/README.md +1 -0
  16. package/ccw/dist/cli.d.ts.map +1 -1
  17. package/ccw/dist/cli.js +3 -1
  18. package/ccw/dist/cli.js.map +1 -1
  19. package/ccw/dist/commands/cli.d.ts.map +1 -1
  20. package/ccw/dist/commands/cli.js +45 -3
  21. package/ccw/dist/commands/cli.js.map +1 -1
  22. package/ccw/dist/commands/issue.d.ts +3 -1
  23. package/ccw/dist/commands/issue.d.ts.map +1 -1
  24. package/ccw/dist/commands/issue.js +383 -30
  25. package/ccw/dist/commands/issue.js.map +1 -1
  26. package/ccw/dist/core/routes/issue-routes.d.ts.map +1 -1
  27. package/ccw/dist/core/routes/issue-routes.js +77 -16
  28. package/ccw/dist/core/routes/issue-routes.js.map +1 -1
  29. package/ccw/dist/tools/cli-executor.d.ts.map +1 -1
  30. package/ccw/dist/tools/cli-executor.js +117 -4
  31. package/ccw/dist/tools/cli-executor.js.map +1 -1
  32. package/ccw/dist/tools/litellm-executor.d.ts +4 -0
  33. package/ccw/dist/tools/litellm-executor.d.ts.map +1 -1
  34. package/ccw/dist/tools/litellm-executor.js +54 -1
  35. package/ccw/dist/tools/litellm-executor.js.map +1 -1
  36. package/ccw/dist/tools/ui-generate-preview.d.ts +18 -0
  37. package/ccw/dist/tools/ui-generate-preview.d.ts.map +1 -1
  38. package/ccw/dist/tools/ui-generate-preview.js +26 -10
  39. package/ccw/dist/tools/ui-generate-preview.js.map +1 -1
  40. package/ccw/src/cli.ts +3 -1
  41. package/ccw/src/commands/cli.ts +47 -3
  42. package/ccw/src/commands/issue.ts +442 -34
  43. package/ccw/src/core/routes/issue-routes.ts +82 -16
  44. package/ccw/src/tools/cli-executor.ts +125 -4
  45. package/ccw/src/tools/litellm-executor.ts +107 -24
  46. package/ccw/src/tools/ui-generate-preview.js +60 -37
  47. package/codex-lens/src/codexlens/__pycache__/config.cpython-313.pyc +0 -0
  48. package/codex-lens/src/codexlens/__pycache__/entities.cpython-313.pyc +0 -0
  49. package/codex-lens/src/codexlens/config.py +25 -2
  50. package/codex-lens/src/codexlens/entities.py +5 -1
  51. package/codex-lens/src/codexlens/indexing/__pycache__/symbol_extractor.cpython-313.pyc +0 -0
  52. package/codex-lens/src/codexlens/indexing/symbol_extractor.py +243 -243
  53. package/codex-lens/src/codexlens/parsers/__pycache__/factory.cpython-313.pyc +0 -0
  54. package/codex-lens/src/codexlens/parsers/__pycache__/treesitter_parser.cpython-313.pyc +0 -0
  55. package/codex-lens/src/codexlens/parsers/factory.py +256 -256
  56. package/codex-lens/src/codexlens/parsers/treesitter_parser.py +335 -335
  57. package/codex-lens/src/codexlens/search/__pycache__/chain_search.cpython-313.pyc +0 -0
  58. package/codex-lens/src/codexlens/search/__pycache__/hybrid_search.cpython-313.pyc +0 -0
  59. package/codex-lens/src/codexlens/search/__pycache__/ranking.cpython-313.pyc +0 -0
  60. package/codex-lens/src/codexlens/search/chain_search.py +30 -1
  61. package/codex-lens/src/codexlens/semantic/__pycache__/__init__.cpython-313.pyc +0 -0
  62. package/codex-lens/src/codexlens/semantic/__pycache__/embedder.cpython-313.pyc +0 -0
  63. package/codex-lens/src/codexlens/semantic/__pycache__/reranker.cpython-313.pyc +0 -0
  64. package/codex-lens/src/codexlens/semantic/__pycache__/vector_store.cpython-313.pyc +0 -0
  65. package/codex-lens/src/codexlens/semantic/embedder.py +6 -9
  66. package/codex-lens/src/codexlens/semantic/vector_store.py +271 -200
  67. package/codex-lens/src/codexlens/storage/__pycache__/dir_index.cpython-313.pyc +0 -0
  68. package/codex-lens/src/codexlens/storage/__pycache__/index_tree.cpython-313.pyc +0 -0
  69. package/codex-lens/src/codexlens/storage/__pycache__/sqlite_store.cpython-313.pyc +0 -0
  70. package/codex-lens/src/codexlens/storage/sqlite_store.py +184 -108
  71. package/package.json +88 -83
  72. package/.claude/commands/issue/manage.md +0 -113
@@ -11,55 +11,42 @@ allowed-tools: TodoWrite(*), Task(*), SlashCommand(*), AskUserQuestion(*), Bash(
11
11
 
12
12
  Unified planning command using **issue-plan-agent** that combines exploration and planning into a single closed-loop workflow.
13
13
 
14
- ## Output Requirements
14
+ **Behavior:**
15
+ - Single solution per issue → auto-bind
16
+ - Multiple solutions → return for user selection
17
+ - Agent handles file generation
15
18
 
16
- **Generate Files:**
17
- 1. `.workflow/issues/solutions/{issue-id}.jsonl` - Solution with tasks for each issue
19
+ ## Core Guidelines
18
20
 
19
- **Return Summary:**
20
- ```json
21
- {
22
- "bound": [{ "issue_id": "...", "solution_id": "...", "task_count": N }],
23
- "pending_selection": [{ "issue_id": "...", "solutions": [...] }],
24
- "conflicts": [{ "file": "...", "issues": [...] }]
25
- }
26
- ```
21
+ **⚠️ Data Access Principle**: Issues and solutions files can grow very large. To avoid context overflow:
27
22
 
28
- **Completion Criteria:**
29
- - [ ] Solution file generated for each issue
30
- - [ ] Single solution auto-bound via `ccw issue bind`
31
- - [ ] Multiple solutions returned for user selection
32
- - [ ] Tasks conform to schema: `cat .claude/workflows/cli-templates/schemas/solution-schema.json`
33
- - [ ] Each task has quantified `acceptance.criteria`
23
+ | Operation | Correct | Incorrect |
24
+ |-----------|---------|-----------|
25
+ | List issues (brief) | `ccw issue list --status pending --brief` | `Read('issues.jsonl')` |
26
+ | Read issue details | `ccw issue status <id> --json` | `Read('issues.jsonl')` |
27
+ | Update status | `ccw issue update <id> --status ...` | Direct file edit |
28
+ | Bind solution | `ccw issue bind <id> <sol-id>` | Direct file edit |
34
29
 
35
- ## Core Capabilities
30
+ **Output Options**:
31
+ - `--brief`: JSON with minimal fields (id, title, status, priority, tags)
32
+ - `--json`: Full JSON (agent use only)
36
33
 
37
- - **Closed-loop agent**: issue-plan-agent combines explore + plan
38
- - Batch processing: 1 agent processes 1-3 issues
39
- - ACE semantic search integrated into planning
40
- - Solution with executable tasks and delivery criteria
41
- - Automatic solution registration and binding
34
+ **Orchestration vs Execution**:
35
+ - **Command (orchestrator)**: Use `--brief` for minimal context
36
+ - **Agent (executor)**: Fetch full details → `ccw issue status <id> --json`
42
37
 
43
- ## Storage Structure (Flat JSONL)
44
-
45
- ```
46
- .workflow/issues/
47
- ├── issues.jsonl # All issues (one per line)
48
- ├── queue.json # Execution queue
49
- └── solutions/
50
- ├── {issue-id}.jsonl # Solutions for issue (one per line)
51
- └── ...
52
- ```
38
+ **ALWAYS** use CLI commands for CRUD operations. **NEVER** read entire `issues.jsonl` or `solutions/*.jsonl` directly.
53
39
 
54
40
  ## Usage
55
41
 
56
42
  ```bash
57
- /issue:plan <issue-id>[,<issue-id>,...] [FLAGS]
43
+ /issue:plan [<issue-id>[,<issue-id>,...]] [FLAGS]
58
44
 
59
45
  # Examples
46
+ /issue:plan # Default: --all-pending
60
47
  /issue:plan GH-123 # Single issue
61
48
  /issue:plan GH-123,GH-124,GH-125 # Batch (up to 3)
62
- /issue:plan --all-pending # All pending issues
49
+ /issue:plan --all-pending # All pending issues (explicit)
63
50
 
64
51
  # Flags
65
52
  --batch-size <n> Max issues per agent batch (default: 3)
@@ -97,14 +84,17 @@ Phase 4: Summary
97
84
 
98
85
  ## Implementation
99
86
 
100
- ### Phase 1: Issue Loading (ID + Title + Tags)
87
+ ### Phase 1: Issue Loading (Brief Info Only)
101
88
 
102
89
  ```javascript
103
90
  const batchSize = flags.batchSize || 3;
104
- let issues = []; // {id, title, tags}
91
+ let issues = []; // {id, title, tags} - brief info for grouping only
92
+
93
+ // Default to --all-pending if no input provided
94
+ const useAllPending = flags.allPending || !userInput || userInput.trim() === '';
105
95
 
106
- if (flags.allPending) {
107
- // Get pending issues with metadata via CLI (JSON output)
96
+ if (useAllPending) {
97
+ // Get pending issues with brief metadata via CLI
108
98
  const result = Bash(`ccw issue list --status pending,registered --json`).trim();
109
99
  const parsed = result ? JSON.parse(result) : [];
110
100
  issues = parsed.map(i => ({ id: i.id, title: i.title || '', tags: i.tags || [] }));
@@ -115,7 +105,7 @@ if (flags.allPending) {
115
105
  }
116
106
  console.log(`Found ${issues.length} pending issues`);
117
107
  } else {
118
- // Parse comma-separated issue IDs, fetch metadata
108
+ // Parse comma-separated issue IDs, fetch brief metadata
119
109
  const ids = userInput.includes(',')
120
110
  ? userInput.split(',').map(s => s.trim())
121
111
  : [userInput.trim()];
@@ -127,41 +117,48 @@ if (flags.allPending) {
127
117
  issues.push({ id, title: parsed.title || '', tags: parsed.tags || [] });
128
118
  }
129
119
  }
120
+ // Note: Agent fetches full issue content via `ccw issue status <id> --json`
121
+
122
+ // Semantic grouping via Gemini CLI (max 4 issues per group)
123
+ async function groupBySimilarityGemini(issues) {
124
+ const issueSummaries = issues.map(i => ({
125
+ id: i.id, title: i.title, tags: i.tags
126
+ }));
127
+
128
+ const prompt = `
129
+ PURPOSE: Group similar issues by semantic similarity for batch processing; maximize within-group coherence; max 4 issues per group
130
+ TASK: • Analyze issue titles/tags semantically • Identify functional/architectural clusters • Assign each issue to one group
131
+ MODE: analysis
132
+ CONTEXT: Issue metadata only
133
+ EXPECTED: JSON with groups array, each containing max 4 issue_ids, theme, rationale
134
+ RULES: $(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) | Each issue in exactly one group | Max 4 issues per group | Balance group sizes
135
+
136
+ INPUT:
137
+ ${JSON.stringify(issueSummaries, null, 2)}
138
+
139
+ OUTPUT FORMAT:
140
+ {"groups":[{"group_id":1,"theme":"...","issue_ids":["..."],"rationale":"..."}],"ungrouped":[]}
141
+ `;
130
142
 
131
- // Intelligent grouping by similarity (tags → title keywords)
132
- function groupBySimilarity(issues, maxSize) {
133
- const batches = [];
134
- const used = new Set();
135
-
136
- for (const issue of issues) {
137
- if (used.has(issue.id)) continue;
138
-
139
- const batch = [issue];
140
- used.add(issue.id);
141
- const issueTags = new Set(issue.tags);
142
- const issueWords = new Set(issue.title.toLowerCase().split(/\s+/));
143
-
144
- // Find similar issues
145
- for (const other of issues) {
146
- if (used.has(other.id) || batch.length >= maxSize) continue;
147
-
148
- // Similarity: shared tags or shared title keywords
149
- const sharedTags = other.tags.filter(t => issueTags.has(t)).length;
150
- const otherWords = other.title.toLowerCase().split(/\s+/);
151
- const sharedWords = otherWords.filter(w => issueWords.has(w) && w.length > 3).length;
143
+ const taskId = Bash({
144
+ command: `ccw cli -p "${prompt}" --tool gemini --mode analysis`,
145
+ run_in_background: true, timeout: 600000
146
+ });
147
+ const output = TaskOutput({ task_id: taskId, block: true });
152
148
 
153
- if (sharedTags > 0 || sharedWords >= 2) {
154
- batch.push(other);
155
- used.add(other.id);
156
- }
157
- }
158
- batches.push(batch);
149
+ // Extract JSON from potential markdown code blocks
150
+ function extractJsonFromMarkdown(text) {
151
+ const jsonMatch = text.match(/```json\s*\n([\s\S]*?)\n```/) ||
152
+ text.match(/```\s*\n([\s\S]*?)\n```/);
153
+ return jsonMatch ? jsonMatch[1] : text;
159
154
  }
160
- return batches;
155
+
156
+ const result = JSON.parse(extractJsonFromMarkdown(output));
157
+ return result.groups.map(g => g.issue_ids.map(id => issues.find(i => i.id === id)));
161
158
  }
162
159
 
163
- const batches = groupBySimilarity(issues, batchSize);
164
- console.log(`Processing ${issues.length} issues in ${batches.length} batch(es) (grouped by similarity)`);
160
+ const batches = await groupBySimilarityGemini(issues);
161
+ console.log(`Processing ${issues.length} issues in ${batches.length} batch(es) (max 4 issues/agent)`);
165
162
 
166
163
  TodoWrite({
167
164
  todos: batches.map((_, i) => ({
@@ -177,6 +174,7 @@ TodoWrite({
177
174
  ```javascript
178
175
  Bash(`mkdir -p .workflow/issues/solutions`);
179
176
  const pendingSelections = []; // Collect multi-solution issues for user selection
177
+ const agentResults = []; // Collect all agent results for conflict aggregation
180
178
 
181
179
  // Build prompts for all batches
182
180
  const agentTasks = batches.map((batch, batchIndex) => {
@@ -191,34 +189,26 @@ ${issueList}
191
189
 
192
190
  **Project Root**: ${process.cwd()}
193
191
 
194
- ### Project Context (MANDATORY - Read Both Files First)
195
- 1. Read: .workflow/project-tech.json (technology stack, architecture, key components)
196
- 2. Read: .workflow/project-guidelines.json (user-defined constraints and conventions)
192
+ ### Project Context (MANDATORY)
193
+ 1. Read: .workflow/project-tech.json (technology stack, architecture)
194
+ 2. Read: .workflow/project-guidelines.json (constraints and conventions)
197
195
 
198
- **CRITICAL**: All solution tasks MUST comply with constraints in project-guidelines.json
196
+ ### Workflow
197
+ 1. Fetch issue details: ccw issue status <id> --json
198
+ 2. Load project context files
199
+ 3. Explore codebase (ACE semantic search)
200
+ 4. Plan solution with tasks (schema: solution-schema.json)
201
+ 5. Write solution to: .workflow/issues/solutions/{issue-id}.jsonl
202
+ 6. Single solution → auto-bind; Multiple → return for selection
199
203
 
200
- ### Steps
201
- 1. Fetch: \`ccw issue status <id> --json\`
202
- 2. Load project context (project-tech.json + project-guidelines.json)
203
- 3. **If source=discovery**: Use discovery_context (file, line, snippet, suggested_fix) as planning hints
204
- 4. Explore (ACE) Plan solution (respecting guidelines)
205
- 5. Register & bind: \`ccw issue bind <id> --solution <file>\`
206
-
207
- ### Generate Files
208
- \`.workflow/issues/solutions/{issue-id}.jsonl\` - Solution with tasks (schema: cat .claude/workflows/cli-templates/schemas/solution-schema.json)
209
-
210
- ### Binding Rules
211
- - **Single solution**: Auto-bind via \`ccw issue bind <id> --solution <file>\`
212
- - **Multiple solutions**: Register only, return for user selection
204
+ ### Rules
205
+ - Solution ID format: SOL-{issue-id}-{seq}
206
+ - Single solution per issue → auto-bind via ccw issue bind
207
+ - Multiple solutions register only, return pending_selection
208
+ - Tasks must have quantified acceptance.criteria
213
209
 
214
210
  ### Return Summary
215
- \`\`\`json
216
- {
217
- "bound": [{ "issue_id": "...", "solution_id": "...", "task_count": N }],
218
- "pending_selection": [{ "issue_id": "...", "solutions": [{ "id": "...", "description": "...", "task_count": N }] }],
219
- "conflicts": [{ "file": "...", "issues": [...] }]
220
- }
221
- \`\`\`
211
+ {"bound":[{"issue_id":"...","solution_id":"...","task_count":N}],"pending_selection":[{"issue_id":"...","solutions":[{"id":"...","description":"...","task_count":N}]}]}
222
212
  `;
223
213
 
224
214
  return { batchIndex, batchIds, issuePrompt, batch };
@@ -247,7 +237,18 @@ for (let i = 0; i < agentTasks.length; i += MAX_PARALLEL) {
247
237
  // Collect results from this chunk
248
238
  for (const { taskId, batchIndex } of taskIds) {
249
239
  const result = TaskOutput(task_id=taskId, block=true);
250
- const summary = JSON.parse(result);
240
+
241
+ // Extract JSON from potential markdown code blocks (agent may wrap in ```json...```)
242
+ const jsonText = extractJsonFromMarkdown(result);
243
+ let summary;
244
+ try {
245
+ summary = JSON.parse(jsonText);
246
+ } catch (e) {
247
+ console.log(`⚠ Batch ${batchIndex + 1}: Failed to parse agent result, skipping`);
248
+ updateTodo(`Plan batch ${batchIndex + 1}`, 'completed');
249
+ continue;
250
+ }
251
+ agentResults.push(summary); // Store for Phase 3 conflict aggregation
251
252
 
252
253
  for (const item of summary.bound || []) {
253
254
  console.log(`✓ ${item.issue_id}: ${item.solution_id} (${item.task_count} tasks)`);
@@ -258,49 +259,33 @@ for (let i = 0; i < agentTasks.length; i += MAX_PARALLEL) {
258
259
  pendingSelections.push(pending);
259
260
  }
260
261
  if (summary.conflicts?.length > 0) {
261
- console.log(`⚠ Conflicts: ${summary.conflicts.map(c => c.file).join(', ')}`);
262
+ console.log(`⚠ Conflicts: ${summary.conflicts.length} detected (will resolve in Phase 3)`);
262
263
  }
263
264
  updateTodo(`Plan batch ${batchIndex + 1}`, 'completed');
264
265
  }
265
266
  }
266
267
  ```
267
268
 
268
- ### Phase 3: Multi-Solution Selection (MANDATORY when pendingSelections > 0)
269
+ ### Phase 3: Conflict Resolution & Solution Selection
269
270
 
270
- ```javascript
271
- // MUST trigger user selection when multiple solutions exist
272
- if (pendingSelections.length > 0) {
273
- console.log(`\n## User Selection Required: ${pendingSelections.length} issue(s) have multiple solutions\n`);
274
-
275
- const answer = AskUserQuestion({
276
- questions: pendingSelections.map(({ issue_id, solutions }) => ({
277
- question: `Select solution for ${issue_id}:`,
278
- header: issue_id,
279
- multiSelect: false,
280
- options: solutions.map(s => ({
281
- label: `${s.id} (${s.task_count} tasks)`,
282
- description: s.description
283
- }))
284
- }))
285
- });
271
+ **Conflict Handling:**
272
+ - Collect `conflicts` from all agent results
273
+ - Low/Medium severity auto-resolve with `recommended_resolution`
274
+ - High severity use `AskUserQuestion` to let user choose resolution
286
275
 
287
- // Bind user-selected solutions
288
- for (const { issue_id } of pendingSelections) {
289
- const selectedId = extractSelectedSolutionId(answer, issue_id);
290
- if (selectedId) {
291
- Bash(`ccw issue bind ${issue_id} ${selectedId}`);
292
- console.log(`✓ ${issue_id}: ${selectedId} bound`);
293
- }
294
- }
295
- }
296
- ```
276
+ **Multi-Solution Selection:**
277
+ - If `pending_selection` contains issues with multiple solutions:
278
+ - Use `AskUserQuestion` to present options (solution ID + task count + description)
279
+ - Extract selected solution ID from user response
280
+ - Verify solution file exists, recover from payload if missing
281
+ - Bind selected solution via `ccw issue bind <issue-id> <solution-id>`
297
282
 
298
283
  ### Phase 4: Summary
299
284
 
300
285
  ```javascript
301
286
  // Count planned issues via CLI
302
- const plannedIds = Bash(`ccw issue list --status planned --ids`).trim();
303
- const plannedCount = plannedIds ? plannedIds.split('\n').length : 0;
287
+ const planned = JSON.parse(Bash(`ccw issue list --status planned --brief`) || '[]');
288
+ const plannedCount = planned.length;
304
289
 
305
290
  console.log(`
306
291
  ## Done: ${issues.length} issues → ${plannedCount} planned
@@ -319,6 +304,18 @@ Next: \`/issue:queue\` → \`/issue:execute\`
319
304
  | User cancels selection | Skip issue, continue with others |
320
305
  | File conflicts | Agent detects and suggests resolution order |
321
306
 
307
+ ## Quality Checklist
308
+
309
+ Before completing, verify:
310
+
311
+ - [ ] All input issues have solutions in `solutions/{issue-id}.jsonl`
312
+ - [ ] Single solution issues are auto-bound (`bound_solution_id` set)
313
+ - [ ] Multi-solution issues returned in `pending_selection` for user choice
314
+ - [ ] Each solution has executable tasks with `modification_points`
315
+ - [ ] Task acceptance criteria are quantified (not vague)
316
+ - [ ] Conflicts detected and reported (if multiple issues touch same files)
317
+ - [ ] Issue status updated to `planned` after binding
318
+
322
319
  ## Related Commands
323
320
 
324
321
  - `/issue:queue` - Form execution queue from bound solutions