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): find the main root with a separate git dir [I1,C7]
Corey Olson04d071a56d6e
diff --git a/src/cli.js b/src/cli.jsindex ea8e9eac..8d6c0727 100644--- a/src/cli.js+++ b/src/cli.js@@ -1726,7 +1726,11 @@ function uncommittedPolicySetup(info) {const committedConfig = tryGit(info.root, ['ls-tree', '-z', primary.commit, '--', `:(literal)${CONFIG_FILE}`]);if (committedConfig.status !== 0 || committedConfig.stdout) return null;- const mainRoot = resolve(info.commonDir, '..');+ // The primary checkout is info.root when the gate runs there. From a linked worktree, the+ // common directory's parent is the primary checkout only for a plain .git directory: with+ // git init --separate-git-dir it is unrelated, so report the original refusal instead.+ const mainRoot = info.isMain ? info.root : basename(info.commonDir) === '.git' ? resolve(info.commonDir, '..') : null;+ if (!mainRoot) return null;let config;try { config = loadConfig(mainRoot); }catch { return null; }diff --git a/test/gate.test.js b/test/gate.test.jsindex 827af3f6..3afd5b28 100644--- a/test/gate.test.js+++ b/test/gate.test.js@@ -154,6 +154,24 @@ test('gate after init in an existing repo says to commit the init files [I1,C7]'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');++ // Git metadata kept outside the project (git init --separate-git-dir) gets the same advice.+ const separate = join(dir, 'separate');+ mkdirSync(separate);+ const separateGit = (...args) => runFixtureGit(args, { cwd: separate, env });+ const separateRun = (...args) => runFixtureChild(process.execPath, [BIN, ...args], { cwd: separate, env, encoding: 'utf8' });+ separateGit('init', '-q', '-b', 'main', '--separate-git-dir', join(dir, 'separate-metadata'));+ writeFileSync(join(separate, 'README.md'), '# Existing repository\n');+ separateGit('add', 'README.md');+ separateGit('commit', '-q', '-m', 'chore: create existing repository');+ assert.equal(separateRun('init', '--model', 'Test Coordinator').status, 0);+ const separateRefused = separateRun('gate', '--json');+ assert.equal(separateRefused.status, 1);+ const separateRefusal = JSON.parse(separateRefused.stdout).error;+ assert.equal(separateRefusal.code, 'NO_POLICY');+ assert.match(separateRefusal.message, /pullboard\.json and Pullboard's initialized setup files are uncommitted/u,+ 'a separate Git directory still gets the commit-your-setup message');+ assert.ok(separateRefusal.message.includes('SPEC.md') && !separateRefusal.message.includes('README.md'), separateRefusal.message);});test('a digest keeps the failures and the end within its cap, however long one line is [V10]', () => {