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(cli): suggested cd lines survive any path [I7]
Corey Olson85f0f5d839c5
diff --git a/src/cli.js b/src/cli.jsindex 8cad69d8..cfb25173 100644--- a/src/cli.js+++ b/src/cli.js@@ -205,7 +205,16 @@ const briefArg = (io, values) => textArg(io, values, 'brief');* @param {string} root* @returns {string}*/-const cdTo = (root) => `cd ${/[\s'"$]/.test(root) ? JSON.stringify(root) : root} &&`;+const shellWord = (text) => (/^[\w@%+=:,./-]+$/.test(text) ? text : `'${text.replaceAll("'", "'\\''")}'`);++/**+ * `cd <folder> &&`, the folder quoted for any POSIX shell: single quotes, so a space, a quote or a+ * dollar sign in the path reaches cd as written (I7).+ *+ * @param {string} root+ * @returns {string}+ */+const cdTo = (root) => `cd ${shellWord(root)} &&`;/*** Verifying from the main checkout files the verdict as the coordinator's (V9). An agent whose@@ -555,10 +564,9 @@ function worktreeFor(io, lane, route) {io.say(` ${cdTo(root)} pullboard inbox`);io.say(` ${cdTo(root)} pullboard next`);// A subagent inherits the instructions of the session that launched it, often another repo's (I7).- const folder = /[\s'"$]/.test(root) ? JSON.stringify(root) : root;io.say('For a subagent working here, begin its prompt with:');- io.say(` You are ${id}, in the ${lane} lane. Work only in ${folder}, and start every command with ${cdTo(root)}`);- io.say(` Read ${folder.replace(/"?$/, '/AGENTS.md$&')} first. Its rules govern this work, over any other repo's instructions you were given.`);+ io.say(` You are ${id}, in the ${lane} lane. Work only in ${shellWord(root)}, and start every command with ${cdTo(root)}`);+ io.say(` Read ${shellWord(join(root, 'AGENTS.md'))} first. Its rules govern this work, over any other repo's instructions you were given.`);return 0;}diff --git a/test/e2e.test.js b/test/e2e.test.jsindex aebcc004..b3643587 100644--- a/test/e2e.test.js+++ b/test/e2e.test.js@@ -853,7 +853,7 @@ test('submit names the item and the way out when a cited row was retired after ttest('worktree prints the opening lines of a subagent\'s prompt, with its folder and identity [I7]', () => {const box = sandbox();- const repo = join(box.dir, 'my app');+ const repo = join(box.dir, "my app's $PULLBOARD_PATH_PROBE");mkdirSync(repo);box.git(repo, 'init', '-q', '-b', 'main');box.run(repo, 'init');@@ -862,8 +862,13 @@ test('worktree prints the opening lines of a subagent\'s prompt, with its folderbox.git(repo, 'add', '-A');box.git(repo, 'commit', '-q', '-m', 'chore: set up pullboard');const made = box.run(repo, 'worktree', 'web').out;- const folder = join(box.dir, 'my app-web-1');+ const folder = join(box.dir, "my app's $PULLBOARD_PATH_PROBE-web-1");+ const quoted = `'${folder.replaceAll("'", "'\\''")}'`;assert.match(made, /For a subagent working here, begin its prompt with:\n/);- assert.ok(made.includes(` You are web-1, in the web lane. Work only in "${folder}", and start every command with cd "${folder}" &&\n`), made);- assert.ok(made.includes(` Read "${folder}/AGENTS.md" first. Its rules govern this work, over any other repo's instructions you were given.\n`), made);+ assert.ok(made.includes(` You are web-1, in the web lane. Work only in ${quoted}, and start every command with cd ${quoted} &&\n`), made);+ assert.ok(made.includes(` Read '${folder.replaceAll("'", "'\\''")}/AGENTS.md' first. Its rules govern this work, over any other repo's instructions you were given.\n`), made);+ // Pasted into a shell as printed, the line enters the real folder: nothing in the path expands.+ const cdLine = /start every command with (cd .+ &&)\n/.exec(made)[1];+ const entered = spawnSync('sh', ['-c', `${cdLine} pwd`], { env: { ...box.env, PULLBOARD_PATH_PROBE: 'elsewhere' }, encoding: 'utf8' });+ assert.equal(entered.stdout.trim(), folder);});