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(init): init --blueprint reads its blueprint once [I1,S1]
Corey Olson1740927b1bdd
diff --git a/src/cli.js b/src/cli.jsindex 40c6af8c..be9616d2 100644--- a/src/cli.js+++ b/src/cli.js@@ -1584,7 +1584,7 @@ function setupCommands(io, { first, values }) {// A named blueprint is read and checked before anything is written, so an unknown name// or a broken file or a URL leaves the repository untouched (#678). Past that, init adds the// blueprint exactly as pullboard blueprint add does, through the same function.- const blueprint = values.blueprint === undefined ? null : readBlueprint(values.blueprint, info.root);+ const blueprint = values.blueprint === undefined ? null : readBlueprint(values.blueprint, io.cwd);const model = optionalModel(values.model);const linked = relayLinked(info.root);const ctx = linked && model !== undefined ? context(io) : null;@@ -1612,7 +1612,7 @@ function setupCommands(io, { first, values }) {{ lane: COORDINATOR, path: info.root, model },]));// init --blueprint: the same add as pullboard blueprint add, in the same command (#678).- const added = blueprint ? await addBlueprintHere(io, values.blueprint, { report: false }) : null;+ const added = blueprint ? await addBlueprintHere(io, values.blueprint, { report: false, blueprint }) : null;io.result?.({ root: info.root, notes, ...(added ? { blueprint: { name: added.blueprint.name, title: added.blueprint.title,section: added.section, waiting: added.rows.length, items: added.items.length, gate: added.gate, checksNotRun: added.checksNotRun } } : {}) });const staging = notes.at(-1)?.startsWith('git add -f -- ') ? notes.at(-1) : null;@@ -2195,15 +2195,16 @@ function reportSubmission(ctx, id, commit, gate) {/*** Add a blueprint to the board of the checkout io.cwd names, exactly as pullboard blueprint add* does; init --blueprint calls it after setting up the repo. With report false it prints nothing- * and leaves the command's JSON result to the caller.+ * and leaves the command's JSON result to the caller. A caller that already read the blueprint+ * passes it, so the file is read once: init checks it before writing anything and must add the+ * very blueprint it checked.** @param {any} io- * @param {string} reference - A bundled blueprint name or a path to a blueprint file.- * @param {{ report?: boolean }} [options]+ * @param {string} reference - A bundled blueprint name or a path to a blueprint file, relative to io.cwd.+ * @param {{ report?: boolean, blueprint?: ReturnType<typeof readBlueprint> }} [options]* @returns {Promise<BlueprintAdded>}*/-export async function addBlueprintHere(io, reference, { report = true } = {}) {- const blueprint = readBlueprint(reference, io.cwd);+export async function addBlueprintHere(io, reference, { report = true, blueprint = readBlueprint(reference, io.cwd) } = {}) {const ctx = context(io);return await withBoard(ctx, async (board) => await addBlueprint(ctx, board, whoAmI(ctx, board), blueprint, { report }));}diff --git a/test/blueprint.test.js b/test/blueprint.test.jsindex 7f28a19c..e053e8d6 100644--- a/test/blueprint.test.js+++ b/test/blueprint.test.js@@ -257,9 +257,10 @@ function emptyRepo() {});const repo = join(dir, 'repo');mkdirSync(repo);- const run = (...args) => runFixtureChild(process.execPath, [BIN, ...args], { cwd: repo, env, encoding: 'utf8' });+ const runIn = (cwd, ...args) => runFixtureChild(process.execPath, [BIN, ...args], { cwd, env, encoding: 'utf8' });+ const run = (...args) => runIn(repo, ...args);runFixtureGit(['init', '-q', '-b', 'main'], { cwd: repo, env });- return { dir, repo, run };+ return { dir, repo, run, runIn };}test('init --blueprint starts a board from a blueprint [I1,S1]', () => {@@ -315,6 +316,16 @@ test('init --blueprint starts a board from a blueprint [I1,S1]', () => {assert.equal(starter.item_check_baseline ?? null, null, 'no check baseline was started');rmSync(outside, { recursive: true, force: true });+ // Run from a subdirectory, a relative path names a file there: init reads it once, before+ // writing anything, and adds that very blueprint.+ const nested = emptyRepo();+ mkdirSync(join(nested.repo, 'plans'));+ writeFileSync(join(nested.repo, 'plans', 'local.json'), JSON.stringify({ ...PUBLISHED, name: 'local', title: 'Local plan' }));+ const fromSub = nested.runIn(join(nested.repo, 'plans'), 'init', '--blueprint', 'local.json');+ assert.equal(fromSub.status, 0, fromSub.stdout + fromSub.stderr);+ assert.match(fromSub.stdout, /added the Local plan blueprint:/u, 'the file next to the caller is the one added');+ assert.equal((JSON.parse(nested.run('list', '--json').stdout).items ?? []).length, PUBLISHED.items.length);+// Plain init is unchanged: no blueprint section, no items, no summary line.const plain = emptyRepo();const initialized = plain.run('init');