fix: CRLF frontmatter parsing, duplicate cwd crash, STATE.md phase transitions (#1105)

- fix(frontmatter): handle CRLF line endings in extractFrontmatter,
  spliceFrontmatter, and parseMustHavesBlock — fixes wave parsing on
  Windows where all plans reported as wave 1 (#1085)

- fix(hooks): remove duplicate const cwd declaration in
  gsd-context-monitor.js that caused SyntaxError on every PostToolUse
  invocation (#1091, #1092, #1094)

- feat(state): add 'state begin-phase' command that updates STATUS,
  Last Activity, Current focus, Current Position, and plan counts
  when a new phase starts executing (#1102, #1103, #1104)

- docs(workflow): add state begin-phase call to execute-phase workflow
  validate_phase step so STATE.md is current from the start
This commit is contained in:
Tom Boucher
2026-03-16 15:40:21 -04:00
committed by GitHub
parent 80605d2051
commit 2842f076ea
5 changed files with 99 additions and 6 deletions

View File

@@ -14,6 +14,7 @@
* state update <field> <value> Update a STATE.md field
* state get [section] Get STATE.md content or section
* state patch --field val ... Batch update STATE.md fields
* state begin-phase --phase N --name S --plans C Update STATE.md for new phase start
* resolve-model <agent-type> Get model for agent based on profile
* find-phase <phase> Find phase directory by number
* commit <message> [--files f1 f2] Commit planning docs
@@ -243,6 +244,17 @@ async function main() {
stopped_at: stoppedIdx !== -1 ? args[stoppedIdx + 1] : null,
resume_file: resumeIdx !== -1 ? args[resumeIdx + 1] : 'None',
}, raw);
} else if (subcommand === 'begin-phase') {
const phaseIdx = args.indexOf('--phase');
const nameIdx = args.indexOf('--name');
const plansIdx = args.indexOf('--plans');
state.cmdStateBeginPhase(
cwd,
phaseIdx !== -1 ? args[phaseIdx + 1] : null,
nameIdx !== -1 ? args[nameIdx + 1] : null,
plansIdx !== -1 ? parseInt(args[plansIdx + 1], 10) : null,
raw
);
} else {
state.cmdStateLoad(cwd, raw);
}