Expand description
Workflow state persistence helpers.
State is per-phase: each active phase persists to
.devflow/state-{phase:02}.json (mirroring the per-phase lock naming), so
devflow parallel sibling phases never clobber one another
(13-DEFERRED-CR-03). A legacy single-slot .devflow/state.json from an
older binary is migrated to its per-phase name on first read.
Enums§
- Workflow
Error - Errors produced while reading or writing workflow state.
Functions§
- clear_
state - Remove a phase’s persisted state if present.
- devflow_
dir - Return the
.devflowdirectory for a project. - ensure_
devflow_ dir - Create
dir(and any missing parents), then self-protect any.devflowdirectory found in its path by writing<that-dir>/.gitignorecontaining*— so a downstream user’s routinegit add . && git commitnever sweeps DevFlow’s runtime artifacts (agent stdout, gate context, state) into their repository, independent of whether their own root.gitignorementions.devflowat all (closes 19a-WR-01, 19-CONTEXT.md D-14). - list_
states - Enumerate every active phase state, sorted by phase number.
- load_
state - Load workflow state for a phase from
.devflow/state-{NN}.json. - remove_
corrupt_ legacy_ state - Delete a legacy
state.jsonthat cannot be parsed — and therefore can never be migrated by [migrate_legacy_state] or matched byclear_state’s phase check (14-CR-04). Ordinary reads deliberately leave such a file in place; only the operator-driven reset (recover --clean) is sanctioned to call this. Returns whether a file was removed. - save_
state - Save workflow state to
.devflow/state-{NN}.json, keyed bystate.phase. - state_
path - Return the persisted state path for a phase of a project.