|
| 1 | +--- |
| 2 | +description: Execute issue queue tasks sequentially with git commit after each task |
| 3 | +argument-hint: "[--dry-run]" |
| 4 | +--- |
| 5 | + |
| 6 | +# Issue Execute (Codex Version) |
| 7 | + |
| 8 | +## Core Principle |
| 9 | + |
| 10 | +**Serial Execution**: Execute tasks ONE BY ONE from the issue queue. Complete each task fully (implement → test → commit) before moving to next. Continue autonomously until ALL tasks complete or queue is empty. |
| 11 | + |
| 12 | +## Execution Flow |
| 13 | + |
| 14 | +``` |
| 15 | +INIT: Fetch first task via ccw issue next |
| 16 | +
|
| 17 | +WHILE task exists: |
| 18 | + 1. Receive task JSON from ccw issue next |
| 19 | + 2. Execute full lifecycle: |
| 20 | + - IMPLEMENT: Follow task.implementation steps |
| 21 | + - TEST: Run task.test commands |
| 22 | + - VERIFY: Check task.acceptance criteria |
| 23 | + - COMMIT: Stage files, commit with task.commit.message_template |
| 24 | + 3. Report completion via ccw issue complete <queue_id> |
| 25 | + 4. Fetch next task via ccw issue next |
| 26 | +
|
| 27 | +WHEN queue empty: |
| 28 | + Output final summary |
| 29 | +``` |
| 30 | + |
| 31 | +## Step 1: Fetch First Task |
| 32 | + |
| 33 | +Run this command to get your first task: |
| 34 | + |
| 35 | +```bash |
| 36 | +ccw issue next |
| 37 | +``` |
| 38 | + |
| 39 | +This returns JSON with the full task definition: |
| 40 | +- `queue_id`: Unique ID for queue tracking (e.g., "Q-001") |
| 41 | +- `issue_id`: Parent issue ID (e.g., "ISSUE-20251227-001") |
| 42 | +- `task`: Full task definition with implementation steps |
| 43 | +- `context`: Relevant files and patterns |
| 44 | +- `execution_hints`: Timing and executor hints |
| 45 | + |
| 46 | +If response contains `{ "status": "empty" }`, all tasks are complete - skip to final summary. |
| 47 | + |
| 48 | +## Step 2: Parse Task Response |
| 49 | + |
| 50 | +Expected task structure: |
| 51 | + |
| 52 | +```json |
| 53 | +{ |
| 54 | + "queue_id": "Q-001", |
| 55 | + "issue_id": "ISSUE-20251227-001", |
| 56 | + "solution_id": "SOL-001", |
| 57 | + "task": { |
| 58 | + "id": "T1", |
| 59 | + "title": "Task title", |
| 60 | + "scope": "src/module/", |
| 61 | + "action": "Create|Modify|Fix|Refactor", |
| 62 | + "description": "What to do", |
| 63 | + "modification_points": [ |
| 64 | + { "file": "path/to/file.ts", "target": "function name", "change": "description" } |
| 65 | + ], |
| 66 | + "implementation": [ |
| 67 | + "Step 1: Do this", |
| 68 | + "Step 2: Do that" |
| 69 | + ], |
| 70 | + "test": { |
| 71 | + "commands": ["npm test -- --filter=xxx"], |
| 72 | + "unit": "Unit test requirements", |
| 73 | + "integration": "Integration test requirements (optional)" |
| 74 | + }, |
| 75 | + "acceptance": [ |
| 76 | + "Criterion 1: Must pass", |
| 77 | + "Criterion 2: Must verify" |
| 78 | + ], |
| 79 | + "commit": { |
| 80 | + "message_template": "feat(scope): description" |
| 81 | + } |
| 82 | + }, |
| 83 | + "context": { |
| 84 | + "relevant_files": ["path/to/reference.ts"], |
| 85 | + "patterns": "Follow existing pattern in xxx" |
| 86 | + } |
| 87 | +} |
| 88 | +``` |
| 89 | + |
| 90 | +## Step 3: Execute Task Lifecycle |
| 91 | + |
| 92 | +### Phase A: IMPLEMENT |
| 93 | + |
| 94 | +1. Read all `context.relevant_files` to understand existing patterns |
| 95 | +2. Follow `task.implementation` steps in order |
| 96 | +3. Apply changes to `task.modification_points` files |
| 97 | +4. Follow `context.patterns` for code style consistency |
| 98 | + |
| 99 | +**Output format:** |
| 100 | +``` |
| 101 | +## Implementing: [task.title] |
| 102 | +
|
| 103 | +**Scope**: [task.scope] |
| 104 | +**Action**: [task.action] |
| 105 | +
|
| 106 | +**Steps**: |
| 107 | +1. ✓ [implementation step 1] |
| 108 | +2. ✓ [implementation step 2] |
| 109 | +... |
| 110 | +
|
| 111 | +**Files Modified**: |
| 112 | +- path/to/file1.ts |
| 113 | +- path/to/file2.ts |
| 114 | +``` |
| 115 | + |
| 116 | +### Phase B: TEST |
| 117 | + |
| 118 | +1. Run all commands in `task.test.commands` |
| 119 | +2. Verify unit tests pass (`task.test.unit`) |
| 120 | +3. Run integration tests if specified (`task.test.integration`) |
| 121 | + |
| 122 | +**If tests fail**: Fix the code and re-run. Do NOT proceed until tests pass. |
| 123 | + |
| 124 | +**Output format:** |
| 125 | +``` |
| 126 | +## Testing: [task.title] |
| 127 | +
|
| 128 | +**Test Results**: |
| 129 | +- [x] Unit tests: PASSED |
| 130 | +- [x] Integration tests: PASSED (or N/A) |
| 131 | +``` |
| 132 | + |
| 133 | +### Phase C: VERIFY |
| 134 | + |
| 135 | +Check all `task.acceptance` criteria are met: |
| 136 | + |
| 137 | +``` |
| 138 | +## Verifying: [task.title] |
| 139 | +
|
| 140 | +**Acceptance Criteria**: |
| 141 | +- [x] Criterion 1: Verified |
| 142 | +- [x] Criterion 2: Verified |
| 143 | +... |
| 144 | +
|
| 145 | +All criteria met: YES |
| 146 | +``` |
| 147 | + |
| 148 | +**If any criterion fails**: Go back to IMPLEMENT phase and fix. |
| 149 | + |
| 150 | +### Phase D: COMMIT |
| 151 | + |
| 152 | +After all phases pass, commit the changes: |
| 153 | + |
| 154 | +```bash |
| 155 | +# Stage all modified files |
| 156 | +git add path/to/file1.ts path/to/file2.ts ... |
| 157 | + |
| 158 | +# Commit with task message template |
| 159 | +git commit -m "$(cat <<'EOF' |
| 160 | +[task.commit.message_template] |
| 161 | +
|
| 162 | +Queue-ID: [queue_id] |
| 163 | +Issue-ID: [issue_id] |
| 164 | +Task-ID: [task.id] |
| 165 | +EOF |
| 166 | +)" |
| 167 | +``` |
| 168 | + |
| 169 | +**Output format:** |
| 170 | +``` |
| 171 | +## Committed: [task.title] |
| 172 | +
|
| 173 | +**Commit**: [commit hash] |
| 174 | +**Message**: [commit message] |
| 175 | +**Files**: N files changed |
| 176 | +``` |
| 177 | + |
| 178 | +## Step 4: Report Completion |
| 179 | + |
| 180 | +After commit succeeds, report to queue system: |
| 181 | + |
| 182 | +```bash |
| 183 | +ccw issue complete [queue_id] --result '{ |
| 184 | + "files_modified": ["path1", "path2"], |
| 185 | + "tests_passed": true, |
| 186 | + "acceptance_passed": true, |
| 187 | + "committed": true, |
| 188 | + "commit_hash": "[actual hash]", |
| 189 | + "summary": "[What was accomplished]" |
| 190 | +}' |
| 191 | +``` |
| 192 | + |
| 193 | +**If task failed and cannot be fixed:** |
| 194 | + |
| 195 | +```bash |
| 196 | +ccw issue fail [queue_id] --reason "Phase [X] failed: [details]" |
| 197 | +``` |
| 198 | + |
| 199 | +## Step 5: Continue to Next Task |
| 200 | + |
| 201 | +Immediately fetch the next task: |
| 202 | + |
| 203 | +```bash |
| 204 | +ccw issue next |
| 205 | +``` |
| 206 | + |
| 207 | +**Output progress:** |
| 208 | +``` |
| 209 | +✓ [N/M] Completed: [queue_id] - [task.title] |
| 210 | +→ Fetching next task... |
| 211 | +``` |
| 212 | + |
| 213 | +**DO NOT STOP.** Return to Step 2 and continue until queue is empty. |
| 214 | + |
| 215 | +## Final Summary |
| 216 | + |
| 217 | +When `ccw issue next` returns `{ "status": "empty" }`: |
| 218 | + |
| 219 | +```markdown |
| 220 | +## Issue Queue Execution Complete |
| 221 | + |
| 222 | +**Total Tasks Executed**: N |
| 223 | +**All Commits**: |
| 224 | +| # | Queue ID | Task | Commit | |
| 225 | +|---|----------|------|--------| |
| 226 | +| 1 | Q-001 | Task title | abc123 | |
| 227 | +| 2 | Q-002 | Task title | def456 | |
| 228 | + |
| 229 | +**Files Modified**: |
| 230 | +- path/to/file1.ts |
| 231 | +- path/to/file2.ts |
| 232 | + |
| 233 | +**Summary**: |
| 234 | +[Overall what was accomplished] |
| 235 | +``` |
| 236 | + |
| 237 | +## Execution Rules |
| 238 | + |
| 239 | +1. **Never stop mid-queue** - Continue until queue is empty |
| 240 | +2. **One task at a time** - Fully complete (including commit) before moving on |
| 241 | +3. **Tests MUST pass** - Do not proceed to commit if tests fail |
| 242 | +4. **Commit after each task** - Each task gets its own commit |
| 243 | +5. **Self-verify** - All acceptance criteria must pass before commit |
| 244 | +6. **Report accurately** - Use ccw issue complete/fail after each task |
| 245 | +7. **Handle failures gracefully** - If a task fails, report via ccw issue fail and continue to next |
| 246 | + |
| 247 | +## Error Handling |
| 248 | + |
| 249 | +| Situation | Action | |
| 250 | +|-----------|--------| |
| 251 | +| ccw issue next returns empty | All done - output final summary | |
| 252 | +| Tests fail | Fix code, re-run tests | |
| 253 | +| Verification fails | Go back to implement phase | |
| 254 | +| Git commit fails | Check staging, retry commit | |
| 255 | +| ccw issue complete fails | Log error, continue to next task | |
| 256 | +| Unrecoverable error | Call ccw issue fail, continue to next | |
| 257 | + |
| 258 | +## Start Execution |
| 259 | + |
| 260 | +Begin by running: |
| 261 | + |
| 262 | +```bash |
| 263 | +ccw issue next |
| 264 | +``` |
| 265 | + |
| 266 | +Then follow the lifecycle for each task until queue is empty. |
0 commit comments