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:
@@ -85,18 +85,11 @@ describe('execute-phase worktree: shared artifact ownership (#1571)', () => {
|
||||
);
|
||||
});
|
||||
|
||||
test('post-wave orchestrator runs state update-position after completing a wave in worktree mode', () => {
|
||||
test('ghost state update-position command removed from post-wave section (#1627)', () => {
|
||||
const content = fs.readFileSync(WORKFLOW_PATH, 'utf-8');
|
||||
assert.ok(
|
||||
content.includes('state update-position'),
|
||||
'post-wave section should contain orchestrator-owned state update-position command'
|
||||
);
|
||||
// Confirm it appears after the worktree agent block
|
||||
const stateUpdateIdx = content.lastIndexOf('state update-position');
|
||||
const worktreeAgentEnd = content.indexOf('**Sequential mode**');
|
||||
assert.ok(
|
||||
stateUpdateIdx > worktreeAgentEnd,
|
||||
'state update-position must appear after the worktree agent block (orchestrator-owned, post-wave)'
|
||||
!content.includes('state update-position'),
|
||||
'state update-position was a ghost reference (command never existed in CLI dispatcher) — should be removed'
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user