Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.
JavaScript agentic-codingai-agentsai-governanceautonomous-agentsclaude-codeclicode-reviewcodexcoding-agentsdeveloper-toolsgit-hooksllmlocal-firstmulti-agentsoftware-factoryspec-driven-developmentverificationvibe-coding
fix(gate): match uncommitted setup, not refusal text [I1,C7]
Corey Olson64d420be457e
diff --git a/src/cli.js b/src/cli.jsindex 729e40fd..ea8e9eac 100644--- a/src/cli.js+++ b/src/cli.js@@ -3362,9 +3362,12 @@ async function runCommand(argv, io) {&& existsSync(join(ctx.info.root, CONFIG_FILE))) {throw new Refused('NO_POLICY', `${CONFIG_FILE} is not committed; add and commit the initialized project before running the gate: git add ${CONFIG_FILE}`);}- if (error instanceof Refused && error.code === 'NO_POLICY'- && error.message === 'the committed coordinator policy or claim base is missing; restore its Git objects or ask the coordinator to refreeze the item') {- const setup = uncommittedPolicySetup(ctx.info);+ // Refused prefixes its message with the code, so match the condition itself, not the text:+ // pullboard.json on disk but absent from the primary checkout's commit. Any other+ // missing policy or claim base keeps its own refusal.+ if (error instanceof Refused && error.code === 'NO_POLICY') {+ let setup = null;+ try { setup = uncommittedPolicySetup(ctx.info); } catch { /* Report the original refusal below. */ }if (setup) {const files = setup.files.map(shellWord).join(' ');throw new Refused('NO_POLICY', `${CONFIG_FILE} and Pullboard's initialized setup files are uncommitted; commit them before running the gate: ${setup.stage} && git commit -q -m "chore: set up pullboard" -- ${files}`);diff --git a/test/gate.test.js b/test/gate.test.jsindex 970d6bb2..827af3f6 100644--- a/test/gate.test.js+++ b/test/gate.test.js@@ -135,6 +135,25 @@ test('gate after init in an existing repo says to commit the init files [I1,C7]'assert.match(message, /&& git commit -q -m "chore: set up pullboard"/u, 'the refusal explains the needed commit');for (const path of ['SPEC.md', 'DOCTRINE.md']) assert.ok(message.includes(path), message);assert.ok(!message.includes('README.md'), 'unrelated existing files are not included in the staging command');++ // The command the refusal prints is the one that fixes it.+ const fix = message.slice(message.indexOf('commit them before running the gate: ') + 'commit them before running the gate: '.length);+ // init installs hooks that call `pullboard`; a person has it installed, so the fixture provides it.+ const shims = join(dir, 'bin');+ mkdirSync(shims);+ writeFileSync(join(shims, 'pullboard'), `#!/bin/sh\nexec ${JSON.stringify(process.execPath)} ${JSON.stringify(BIN)} "$@"\n`, { mode: 0o755 });+ const applied = runFixtureChild('/bin/sh', ['-c', fix], { cwd: repo, env: { ...env, PATH: `${shims}:${env.PATH ?? ''}` }, encoding: 'utf8' });+ assert.equal(applied.status, 0, `${applied.stdout}${applied.stderr}`);+ const afterFix = run('gate', '--json');+ assert.notEqual(afterFix.stdout ? JSON.parse(afterFix.stdout).error?.code : undefined, 'NO_POLICY', 'the printed commit lets the gate read its policy');++ // A policy missing for any other reason keeps its own refusal.+ git('switch', '-q', '--detach', 'HEAD');+ const detached = run('gate', '--json');+ assert.equal(detached.status, 1);+ const otherMissing = JSON.parse(detached.stdout).error;+ assert.equal(otherMissing.code, 'NO_POLICY');+ assert.doesNotMatch(otherMissing.message, /uncommitted/u, 'a committed config never gets the commit-your-setup message');});test('a digest keeps the failures and the end within its cap, however long one line is [V10]', () => {