feat(execute-phase): support wave-specific execution

This commit is contained in:
Colin
2026-03-17 11:18:33 -04:00
parent 4915d28f98
commit ad8b58b676
5 changed files with 170 additions and 7 deletions

View File

@@ -12,6 +12,16 @@ Read STATE.md before any operation to load project context.
<process>
<step name="parse_args" priority="first">
Parse `$ARGUMENTS` before loading any context:
- First positional token → `PHASE_ARG`
- Optional `--wave N` → `WAVE_FILTER`
- Optional `--gaps-only` keeps its current meaning
If `--wave` is absent, preserve the current behavior of executing all incomplete waves in the phase.
</step>
<step name="initialize" priority="first">
Load all context in one call:
@@ -71,13 +81,19 @@ PLAN_INDEX=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phase-plan-ind
Parse JSON for: `phase`, `plans[]` (each with `id`, `wave`, `autonomous`, `objective`, `files_modified`, `task_count`, `has_summary`), `waves` (map of wave number → plan IDs), `incomplete`, `has_checkpoints`.
**Filtering:** Skip plans where `has_summary: true`. If `--gaps-only`: also skip non-gap_closure plans. If all filtered: "No matching incomplete plans" → exit.
**Filtering:** Skip plans where `has_summary: true`. If `--gaps-only`: also skip non-gap_closure plans. If `WAVE_FILTER` is set: also skip plans whose `wave` does not equal `WAVE_FILTER`.
**Wave safety check:** If `WAVE_FILTER` is set and there are still incomplete plans in any lower wave that match the current execution mode, STOP and tell the user to finish earlier waves first. Do not let Wave 2+ execute while prerequisite earlier-wave plans remain incomplete.
If all filtered: "No matching incomplete plans" → exit.
Report:
```
## Execution Plan
**Phase {X}: {Name}** — {total_plans} plans across {wave_count} waves
**Phase {X}: {Name}** — {total_plans} matching plans across {wave_count} wave(s)
{If WAVE_FILTER is set: `Wave filter active: executing only Wave {WAVE_FILTER}`.}
| Wave | Plans | What it builds |
|------|-------|----------------|
@@ -87,7 +103,7 @@ Report:
</step>
<step name="execute_waves">
Execute each wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`, sequential if `false`.
Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`, sequential if `false`.
**For each wave:**
@@ -278,6 +294,37 @@ After all waves:
```
</step>
<step name="handle_partial_wave_execution">
If `WAVE_FILTER` was used, re-run plan discovery after execution:
```bash
POST_PLAN_INDEX=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phase-plan-index "${PHASE_NUMBER}")
```
Apply the same "incomplete" filtering rules as earlier:
- ignore plans with `has_summary: true`
- if `--gaps-only`, only consider `gap_closure: true` plans
**If incomplete plans still remain anywhere in the phase:**
- STOP here
- Do NOT run phase verification
- Do NOT mark the phase complete in ROADMAP/STATE
- Present:
```markdown
## Wave {WAVE_FILTER} Complete
Selected wave finished successfully. This phase still has incomplete plans, so phase-level verification and completion were intentionally skipped.
/gsd:execute-phase {phase} # Continue remaining waves
/gsd:execute-phase {phase} --wave {next} # Run the next wave explicitly
```
**If no incomplete plans remain after the selected wave finishes:**
- continue with the normal phase-level verification and completion flow below
- this means the selected wave happened to be the last remaining work in the phase
</step>
<step name="close_parent_artifacts">
**For decimal/polish phases only (X.Y pattern):** Close the feedback loop by resolving parent UAT and debug artifacts.