-
-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Context
Phase 33 — project.md Decomposition. commands/project.md is 1979 lines. The 5-signal state detection logic (P/R/S/M/G signals → 6 state classes: Fresh, GSD-Only, GSD-Mid-Exec, Aligned, Diverged, Extend) is used by or needed by multiple commands (status.md, milestone.md, sync.md) but is buried inside project.md. Extracting it as workflows/detect-state.md makes it independently readable and reusable without touching all of project.md.
What Already Exists
commands/project.md(1979 lines) — contains<step name="detect_state">at line 66, approximately 180 lines covering 5-signal detection, state class derivation, and routing decisions- The 5 signals: P (.mgw/project.json exists), R (ROADMAP.md exists), S (GitHub milestones exist), M (maps-to links in cross-refs.json), G (GSD phase state exists)
- The 6 state classes: Fresh, GSD-Only, GSD-Mid-Exec, Aligned, Diverged, Extend
commands/status.md(526 lines),commands/sync.md(243 lines),commands/milestone.md(952 lines) — all perform ad-hoc state detection inline rather than delegating- No
workflows/directory exists yet — this issue creates it
Description
Extract the detect_state step from commands/project.md into a standalone reusable workflow file at workflows/detect-state.md. After extraction, project.md references it via @workflows/detect-state.md rather than containing the logic inline.
Technical Approach
- Create
workflows/directory - Create
workflows/detect-state.mdcontaining the extracted step with clear input/output contract documented at the top - In project.md, replace the inline detect_state step body with
@workflows/detect-state.mdreference - Document the output contract: sets STATE_CLASS variable with one of the 6 values for downstream steps to branch on
- Do NOT extract other steps in this issue — only detect_state
Done When
-
workflows/detect-state.mdexists with the 5-signal detection logic, input contract (reads .mgw/, ROADMAP.md, GitHub milestones), and output contract (STATE_CLASS ∈ {Fresh, GSD-Only, GSD-Mid-Exec, Aligned, Diverged, Extend}) -
commands/project.mdreferences@workflows/detect-state.mdat the detect_state step location instead of containing the logic inline -
commands/project.mdline count is reduced by ~170 lines (from ~1979 to ~1810) - The extracted workflow is self-contained — readable without project.md context
-
workflows/directory exists and is tracked in git
GSD Route
Quick task (mgw:run → quick path) or GSD plan-phase for Phase 33.
Phase Context
Phase 33 of 36 — project.md Decomposition. Runs independently (no deps on 32/34). Issues: #135 (this), #136 (blocked on #135), #137 (blocked on #136).
Depends on
Nothing within Phase 33 — first extraction, unblocks #136.