Single autonomy-control surface (--gates) added to ultrabrief, ultraresearch,
ultraplan, and ultraexecute. When present, sets gates_mode = true and
re-enables approval pauses at every phase boundary + every wave for
high-stakes runs. When absent (default in auto), the chain runs continuously
to the main-merge gate (which always pauses regardless of --gates — that
boundary is the one always-on safety stop).
ultrabrief: pause after auto-mode confirmation; emit brief-approved event
ultraresearch: pause after each topic completes
ultraplan: pause after Phases 5, 7, 9
ultraexecute: pause after each wave's worktrees finish, before merge-back,
AND before the main-merge gate (MAIN_MERGE_GATE)
All four commands invoke the autonomy-gate state machine via the CLI shim
node lib/util/autonomy-gate.mjs (built in S8). Test pin in
tests/lib/gates-flag-coverage.test.mjs locks the contract.
Also wires the brief-approved stats emission into ultrabrief Phase 5 auto
path (was the SC4 wiring requirement from plan-v2 Step 11).
48 lines
1.6 KiB
JavaScript
48 lines
1.6 KiB
JavaScript
// tests/lib/gates-flag-coverage.test.mjs
|
|
// Step 11 (plan-v2) — pin that all four pipeline commands document the
|
|
// --gates autonomy-control flag and consume the autonomy-gate state
|
|
// machine via the lib/util/autonomy-gate.mjs CLI shim.
|
|
|
|
import { test } from 'node:test';
|
|
import { strict as assert } from 'node:assert';
|
|
import { readFileSync } from 'node:fs';
|
|
import { dirname, join } from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
const ROOT = join(HERE, '..', '..');
|
|
|
|
function read(rel) { return readFileSync(join(ROOT, rel), 'utf-8'); }
|
|
|
|
const COMMANDS = [
|
|
'commands/ultrabrief-local.md',
|
|
'commands/ultraresearch-local.md',
|
|
'commands/ultraplan-local.md',
|
|
'commands/ultraexecute-local.md',
|
|
];
|
|
|
|
for (const cmdPath of COMMANDS) {
|
|
test(`${cmdPath} documents the --gates flag`, () => {
|
|
const text = read(cmdPath);
|
|
assert.ok(
|
|
text.includes('--gates'),
|
|
`${cmdPath} should document the --gates autonomy-control flag (Step 11)`,
|
|
);
|
|
});
|
|
|
|
test(`${cmdPath} wires the autonomy-gate.mjs CLI shim`, () => {
|
|
const text = read(cmdPath);
|
|
assert.ok(
|
|
text.includes('autonomy-gate.mjs'),
|
|
`${cmdPath} should reference lib/util/autonomy-gate.mjs as the state-machine implementation`,
|
|
);
|
|
});
|
|
}
|
|
|
|
test('commands/ultraexecute-local.md mentions MAIN_MERGE_GATE', () => {
|
|
const text = read('commands/ultraexecute-local.md');
|
|
assert.ok(
|
|
text.includes('MAIN_MERGE_GATE'),
|
|
'commands/ultraexecute-local.md should name MAIN_MERGE_GATE — the only boundary that always pauses regardless of --gates',
|
|
);
|
|
});
|