feat(state): add programmatic gates for STATE.md consistency (#1647)
* feat(state): add programmatic gates for STATE.md consistency Adds four enforcement gates to prevent STATE.md drift: - `state validate`: detects drift between STATE.md and filesystem - `state sync`: reconstructs STATE.md from actual project state - `state planned-phase`: records state after plan-phase completes - Performance Metrics update in `phase complete` Also fixes ghost `state update-position` command reference in execute-phase.md (command didn't exist in CLI dispatcher). Closes #1627 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(state): By Phase table regex ate next section when table body was empty The lazy [\s\S]*? with a $ lookahead in byPhaseTablePattern would match past blank lines and capture the next ## section header as table body when no data rows existed. Replaced with a precise row-matching pattern ((?:[ \t]*\|[^\n]*\n)*) that only captures pipe-delimited lines. Added regression assertion to verify row placement. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -511,11 +511,9 @@ Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZAT
|
||||
node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap update-plan-progress "${PHASE_NUMBER}" "${PLAN_ID}" completed
|
||||
done
|
||||
|
||||
# Update STATE.md position to reflect the last completed plan in this wave
|
||||
node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state update-position --phase "${PHASE_NUMBER}" --plan "${LAST_PLAN_ID}"
|
||||
```
|
||||
|
||||
Where `WAVE_PLAN_IDS` is the space-separated list of plan IDs that completed in this wave, and `LAST_PLAN_ID` is the last plan ID in the wave (used to set current position).
|
||||
Where `WAVE_PLAN_IDS` is the space-separated list of plan IDs that completed in this wave.
|
||||
|
||||
**If `workflow.use_worktrees` is `false`:** Sequential agents already updated STATE.md and ROADMAP.md themselves — skip this step.
|
||||
|
||||
|
||||
@@ -869,6 +869,16 @@ Options:
|
||||
|
||||
If `TEXT_MODE` is true, present as a plain-text numbered list (options already shown in the block above). Otherwise use AskUserQuestion to present the options.
|
||||
|
||||
## 13b. Record Planning Completion in STATE.md
|
||||
|
||||
After plans pass all gates, record that planning is complete so STATE.md reflects the new phase status:
|
||||
|
||||
```bash
|
||||
node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state planned-phase --phase "${PHASE_NUMBER}" --name "${PHASE_NAME}" --plans "${PLAN_COUNT}"
|
||||
```
|
||||
|
||||
This updates STATUS to "Ready to execute", sets the correct plan count, and timestamps Last Activity.
|
||||
|
||||
## 14. Present Final Status
|
||||
|
||||
Route to `<offer_next>` OR `auto_advance` depending on flags/config.
|
||||
|
||||
Reference in New Issue
Block a user