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(tour): keep inherited git variables out of the tour [N10]
Corey Olsoneb58651a2b2b
diff --git a/src/tour.js b/src/tour.jsindex 2dd7609d..b62dcf84 100644--- a/src/tour.js+++ b/src/tour.js@@ -73,9 +73,10 @@ export function tour(io) {mkdirSync(shims);writeFileSync(join(shims, 'pullboard'), `#!/bin/sh\nexec "${process.execPath}" "${BIN}" "$@"\n`);chmodSync(join(shims, 'pullboard'), 0o755);- // The person's git config stays out of it: no signing prompts, no global hooks.- const env = { ...process.env, PATH: `${shims}:${process.env.PATH}`, GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_NOSYSTEM: '1' };- delete env.NODE_TEST_CONTEXT;+ // Nothing of the person's git setup reaches the tour: no config files, and no GIT_ variable, such+ // as GIT_DIR from a hook or GIT_CONFIG_COUNT pairs, which git reads as config too.+ const env = Object.fromEntries(Object.entries(process.env).filter(([name]) => !name.startsWith('GIT_') && name !== 'NODE_TEST_CONTEXT'));+ Object.assign(env, { PATH: `${shims}:${process.env.PATH}`, GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_NOSYSTEM: '1' });const repo = join(dir, 'greeter');const app = `${repo}-app-1`;const review = `${repo}-review-1`;diff --git a/test/e2e.test.js b/test/e2e.test.jsindex 400d65f8..0665d6f8 100644--- a/test/e2e.test.js+++ b/test/e2e.test.js@@ -628,6 +628,13 @@ test('the tour runs a reject and its rework on a throwaway repo, in under thirtyassert.match(shown.stdout, /\| 1 \| app \| Greeting \| G1 \| app-1 \| review-1 \|/);const repo = /Look around: cd (\S+) && pullboard log/.exec(shown.stdout)[1];assert.match(box.git(repo, 'log', '--format=%an %s', '-1'), /^app-1 fix\(app\): a blank name greets the world \[G1\]$/);+ const hooks = join(box.dir, 'ambient-hooks');+ mkdirSync(hooks);+ writeFileSync(join(hooks, 'pre-commit'), '#!/bin/sh\necho ambient hook ran >&2\nexit 1\n');+ chmodSync(join(hooks, 'pre-commit'), 0o755);+ const ambient = { ...box.env, TMPDIR: box.dir, GIT_CONFIG_COUNT: '1', GIT_CONFIG_KEY_0: 'core.hooksPath', GIT_CONFIG_VALUE_0: hooks, GIT_DIR: join(box.dir, 'elsewhere.git') };+ const isolated = spawnSync(process.execPath, [BIN, 'tour'], { cwd: box.dir, env: ambient, encoding: 'utf8' });+ assert.equal(isolated.status, 0, `git settings from the environment stay out: ${isolated.stdout}`);const empty = join(box.dir, 'empty');mkdirSync(empty);const stopped = spawnSync(process.execPath, [BIN, 'tour'], { cwd: box.dir, env: { ...box.env, TMPDIR: box.dir, PATH: empty }, encoding: 'utf8' });