claude-code-workflow 6.3.11 → 6.3.12

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.
package/.claude/CLAUDE.md CHANGED
@@ -1,33 +1,33 @@
1
- # Claude Instructions
2
-
3
- - **CLI Tools Usage**: @~/.claude/workflows/cli-tools-usage.md
4
- - **Coding Philosophy**: @~/.claude/workflows/coding-philosophy.md
5
- - **Context Requirements**: @~/.claude/workflows/context-tools.md
6
- - **File Modification**: @~/.claude/workflows/file-modification.md
7
- - **CLI Endpoints Config**: @.claude/cli-tools.json
8
-
9
- ## CLI Endpoints
10
-
11
- **Strictly follow the @.claude/cli-tools.json configuration**
12
-
13
- Available CLI endpoints are dynamically defined by the config file:
14
- - Built-in tools and their enable/disable status
15
- - Custom API endpoints registered via the Dashboard
16
- - Managed through the CCW Dashboard Status page
17
-
18
- ## Tool Execution
19
-
20
- ### Agent Calls
21
- - **Always use `run_in_background: false`** for Task tool agent calls: `Task({ subagent_type: "xxx", prompt: "...", run_in_background: false })` to ensure synchronous execution and immediate result visibility
22
- - **TaskOutput usage**: Only use `TaskOutput({ task_id: "xxx", block: false })` + sleep loop to poll completion status. NEVER read intermediate output during agent/CLI execution - wait for final result only
23
-
24
- ### CLI Tool Calls (ccw cli)
25
- - **Always use `run_in_background: true`** for Bash tool when calling ccw cli:
26
- ```
27
- Bash({ command: "ccw cli -p '...' --tool gemini", run_in_background: true })
28
- ```
29
- - **After CLI call**: If no other tasks, stop immediately - let CLI execute in background, do NOT poll with TaskOutput
30
-
31
- ## Code Diagnostics
32
-
33
- - **Prefer `mcp__ide__getDiagnostics`** for code error checking over shell-based TypeScript compilation
1
+ # Claude Instructions
2
+
3
+ - **CLI Tools Usage**: @~/.claude/workflows/cli-tools-usage.md
4
+ - **Coding Philosophy**: @~/.claude/workflows/coding-philosophy.md
5
+ - **Context Requirements**: @~/.claude/workflows/context-tools.md
6
+ - **File Modification**: @~/.claude/workflows/file-modification.md
7
+ - **CLI Endpoints Config**: @.claude/cli-tools.json
8
+
9
+ ## CLI Endpoints
10
+
11
+ **Strictly follow the @.claude/cli-tools.json configuration**
12
+
13
+ Available CLI endpoints are dynamically defined by the config file:
14
+ - Built-in tools and their enable/disable status
15
+ - Custom API endpoints registered via the Dashboard
16
+ - Managed through the CCW Dashboard Status page
17
+
18
+ ## Tool Execution
19
+
20
+ ### Agent Calls
21
+ - **Always use `run_in_background: false`** for Task tool agent calls: `Task({ subagent_type: "xxx", prompt: "...", run_in_background: false })` to ensure synchronous execution and immediate result visibility
22
+ - **TaskOutput usage**: Only use `TaskOutput({ task_id: "xxx", block: false })` + sleep loop to poll completion status. NEVER read intermediate output during agent/CLI execution - wait for final result only
23
+
24
+ ### CLI Tool Calls (ccw cli)
25
+ - **Always use `run_in_background: true`** for Bash tool when calling ccw cli:
26
+ ```
27
+ Bash({ command: "ccw cli -p '...' --tool gemini", run_in_background: true })
28
+ ```
29
+ - **After CLI call**: If no other tasks, stop immediately - let CLI execute in background, do NOT poll with TaskOutput
30
+
31
+ ## Code Diagnostics
32
+
33
+ - **Prefer `mcp__ide__getDiagnostics`** for code error checking over shell-based TypeScript compilation
@@ -329,10 +329,83 @@ const result = Task(
329
329
  const summary = JSON.parse(result);
330
330
  ```
331
331
 
332
- ### Phase 5: Summary & Status Update
332
+ ### Phase 5: Validation & Status Update
333
333
 
334
334
  ```javascript
335
- // Agent already generated queue files, use summary
335
+ // ============ VALIDATION: Prevent "next returns empty" issues ============
336
+
337
+ const queuesDir = '.workflow/issues/queues';
338
+ const indexPath = `${queuesDir}/index.json`;
339
+ const queuePath = `${queuesDir}/${queueId}.json`;
340
+
341
+ // 1. Validate index.json has active_queue_id
342
+ const indexContent = Bash(`cat "${indexPath}" 2>/dev/null || echo '{}'`);
343
+ const index = JSON.parse(indexContent);
344
+
345
+ if (index.active_queue_id !== queueId) {
346
+ console.log(`⚠ Fixing: index.json active_queue_id not set to ${queueId}`);
347
+ index.active_queue_id = queueId;
348
+ // Ensure queue entry exists in index
349
+ if (!index.queues) index.queues = [];
350
+ const existing = index.queues.find(q => q.id === queueId);
351
+ if (!existing) {
352
+ index.queues.unshift({
353
+ id: queueId,
354
+ status: 'active',
355
+ issue_ids: summary.issues_queued,
356
+ total_solutions: summary.total_solutions,
357
+ completed_solutions: 0,
358
+ created_at: new Date().toISOString()
359
+ });
360
+ }
361
+ Bash(`echo '${JSON.stringify(index, null, 2)}' > "${indexPath}"`);
362
+ console.log(`✓ Fixed: index.json updated with active_queue_id: ${queueId}`);
363
+ }
364
+
365
+ // 2. Validate queue file exists and has correct structure
366
+ const queueContent = Bash(`cat "${queuePath}" 2>/dev/null || echo '{}'`);
367
+ const queue = JSON.parse(queueContent);
368
+
369
+ if (!queue.solutions || queue.solutions.length === 0) {
370
+ console.error(`✗ ERROR: Queue file ${queuePath} has no solutions array`);
371
+ console.error(' Agent did not generate queue correctly. Aborting.');
372
+ return;
373
+ }
374
+
375
+ // 3. Validate all solutions have status: "pending" (not "queued" or other)
376
+ let statusFixed = 0;
377
+ for (const sol of queue.solutions) {
378
+ if (sol.status !== 'pending' && sol.status !== 'executing' && sol.status !== 'completed') {
379
+ console.log(`⚠ Fixing: ${sol.item_id} status "${sol.status}" → "pending"`);
380
+ sol.status = 'pending';
381
+ statusFixed++;
382
+ }
383
+ }
384
+
385
+ // 4. Validate at least one item has no dependencies (DAG entry point)
386
+ const entryPoints = queue.solutions.filter(s =>
387
+ s.status === 'pending' && (!s.depends_on || s.depends_on.length === 0)
388
+ );
389
+
390
+ if (entryPoints.length === 0) {
391
+ console.error(`✗ ERROR: No entry points found (all items have dependencies)`);
392
+ console.error(' This will cause "ccw issue next" to return empty.');
393
+ console.error(' Check depends_on fields for circular dependencies.');
394
+ // Try to fix by clearing first item's dependencies
395
+ if (queue.solutions.length > 0) {
396
+ console.log(`⚠ Fixing: Clearing depends_on for first item ${queue.solutions[0].item_id}`);
397
+ queue.solutions[0].depends_on = [];
398
+ }
399
+ }
400
+
401
+ // Write back fixed queue if any changes made
402
+ if (statusFixed > 0 || entryPoints.length === 0) {
403
+ Bash(`echo '${JSON.stringify(queue, null, 2)}' > "${queuePath}"`);
404
+ console.log(`✓ Queue file updated with ${statusFixed} status fixes`);
405
+ }
406
+
407
+ // ============ OUTPUT SUMMARY ============
408
+
336
409
  console.log(`
337
410
  ## Queue Formed: ${summary.queue_id}
338
411
 
@@ -341,15 +414,20 @@ console.log(`
341
414
  **Issues**: ${summary.issues_queued.join(', ')}
342
415
  **Groups**: ${summary.execution_groups.map(g => `${g.id}(${g.count})`).join(', ')}
343
416
  **Conflicts Resolved**: ${summary.conflicts_resolved}
417
+ **Entry Points**: ${entryPoints.length} (items ready for immediate execution)
344
418
 
345
- Next: \`/issue:execute\`
419
+ Next: \`/issue:execute\` or \`ccw issue next\`
346
420
  `);
347
421
 
348
- // Update issue statuses via CLI (use `update` for pure field changes)
349
- // Note: `queue add` has its own logic; here we only need status update
422
+ // Update issue statuses via CLI
350
423
  for (const issueId of summary.issues_queued) {
351
424
  Bash(`ccw issue update ${issueId} --status queued`);
352
425
  }
426
+
427
+ // Final verification
428
+ const verifyResult = Bash(`ccw issue queue dag 2>/dev/null | head -20`);
429
+ console.log('\n### Verification (DAG Preview):');
430
+ console.log(verifyResult);
353
431
  ```
354
432
 
355
433
  ## Error Handling
@@ -360,6 +438,10 @@ for (const issueId of summary.issues_queued) {
360
438
  | Circular dependency | List cycles, abort queue formation |
361
439
  | Unresolved conflicts | Agent resolves using ordering rules |
362
440
  | Invalid task reference | Skip and warn |
441
+ | **index.json not updated** | Auto-fix: Set active_queue_id to new queue |
442
+ | **Wrong status value** | Auto-fix: Convert non-pending status to "pending" |
443
+ | **No entry points (all have deps)** | Auto-fix: Clear depends_on for first item |
444
+ | **Queue file missing solutions** | Abort with error, agent must regenerate |
363
445
 
364
446
  ## Related Commands
365
447