refactor(issue/queue): simplify Phase 1 and Phase 5 with semantic descriptions

- Replace complex JavaScript code in Phase 1 with semantic bullet points
- Simplify Phase 5 validation code to semantic description
- Add Quality Checklist for completion verification
- Consistent style with plan.md optimizations

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
catlog22
2025-12-29 19:41:32 +08:00
parent df34ef38d9
commit a27f76abcb

View File

@@ -199,64 +199,29 @@ Phase 5: Queue Output
### Phase 1: Solution Loading ### Phase 1: Solution Loading
**NOTE**: Execute code directly. DO NOT pre-read solution files - Bash cat handles all reading. **Data Loading:**
- Load `issues.jsonl` and filter issues with `status === 'planned'` and `bound_solution_id`
- If no planned issues found → display message, suggest `/issue:plan`
```javascript **Solution Collection** (for each planned issue):
// Load issues.jsonl - Read `solutions/{issue-id}.jsonl`
const issuesPath = '.workflow/issues/issues.jsonl'; - Find bound solution by `bound_solution_id`
const allIssues = Bash(`cat "${issuesPath}" 2>/dev/null || echo ''`) - If bound solution not found → warn and skip issue
.split('\n') - Extract `files_touched` from all task `modification_points`
.filter(line => line.trim())
.map(line => JSON.parse(line));
// Filter issues with bound solutions **Build Solution Objects:**
const plannedIssues = allIssues.filter(i => ```json
i.status === 'planned' && i.bound_solution_id {
); "issue_id": "ISS-xxx",
"solution_id": "SOL-ISS-xxx-1",
if (plannedIssues.length === 0) { "task_count": 3,
console.log('No issues with bound solutions found.'); "files_touched": ["src/auth.ts", "src/utils.ts"],
console.log('Run /issue:plan first to create and bind solutions.'); "priority": "medium"
return;
} }
// Load bound solutions (not individual tasks)
const allSolutions = [];
for (const issue of plannedIssues) {
const solPath = `.workflow/issues/solutions/${issue.id}.jsonl`;
const solutions = Bash(`cat "${solPath}" 2>/dev/null || echo ''`)
.split('\n')
.filter(line => line.trim())
.map(line => JSON.parse(line));
// Find bound solution
const boundSol = solutions.find(s => s.id === issue.bound_solution_id);
if (!boundSol) {
console.log(`⚠ Bound solution ${issue.bound_solution_id} not found for ${issue.id}`);
continue;
}
// Collect all files touched by this solution
const filesTouched = new Set();
for (const task of boundSol.tasks || []) {
for (const mp of task.modification_points || []) {
filesTouched.add(mp.file);
}
}
allSolutions.push({
issue_id: issue.id,
solution_id: issue.bound_solution_id,
task_count: boundSol.tasks?.length || 0,
files_touched: Array.from(filesTouched),
priority: issue.priority || 'medium'
});
}
console.log(`Loaded ${allSolutions.length} solutions from ${plannedIssues.length} issues`);
``` ```
**Output:** Array of solution objects ready for agent processing
### Phase 2-4: Agent-Driven Queue Formation ### Phase 2-4: Agent-Driven Queue Formation
```javascript ```javascript
@@ -331,32 +296,16 @@ const summary = JSON.parse(result);
### Phase 5: Validation & Status Update ### Phase 5: Validation & Status Update
```javascript **Validation:**
const queuePath = `.workflow/issues/queues/${queueId}.json`; - Verify queue file exists at `queues/{queue-id}.json`
- Check `solutions` array is non-empty → abort if empty
// 1. Validate queue has solutions **Status Update:**
const solCount = Bash(`jq ".solutions | length" "${queuePath}"`).trim(); - Update each queued issue status to `queued` via `ccw issue update <id> --status queued`
if (!solCount || solCount === '0') {
console.error(`✗ Queue has no solutions. Aborting.`);
return;
}
// 2. Update issue statuses **Summary Output:**
for (const id of summary.issues_queued) { - Display queue ID, solution count, task count, issue IDs
Bash(`ccw issue update ${id} --status queued`); - Show next step: `/issue:execute`
}
// 3. Summary
console.log(`
## Queue: ${summary.queue_id}
- Solutions: ${summary.total_solutions}
- Tasks: ${summary.total_tasks}
- Issues: ${summary.issues_queued.join(', ')}
Next: /issue:execute
`);
```
## Error Handling ## Error Handling
@@ -371,6 +320,18 @@ Next: /issue:execute
| **No entry points (all have deps)** | Auto-fix: Clear depends_on for first item | | **No entry points (all have deps)** | Auto-fix: Clear depends_on for first item |
| **Queue file missing solutions** | Abort with error, agent must regenerate | | **Queue file missing solutions** | Abort with error, agent must regenerate |
## Quality Checklist
Before completing, verify:
- [ ] All planned issues with `bound_solution_id` are included
- [ ] Queue JSON written to `queues/{queue-id}.json`
- [ ] Index updated in `queues/index.json` with `active_queue_id`
- [ ] No circular dependencies in solution DAG
- [ ] File conflicts resolved with rationale
- [ ] Parallel groups have no file overlaps
- [ ] Issue statuses updated to `queued`
## Related Commands ## Related Commands
- `/issue:plan` - Plan issues and bind solutions - `/issue:plan` - Plan issues and bind solutions