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
feat(blueprint): starter items land in a build lane [S1,I1]
Corey Olsond878eed588f8
diff --git a/docs/api.md b/docs/api.mdindex 75ddc138..f07860ea 100644--- a/docs/api.md+++ b/docs/api.md@@ -114,7 +114,7 @@ For example: `flow: review wait average 61 min (1 measured; > 60 min); bottlenec| `spec view` | `version:number`, `path:string` || `spec show` | `version:number`, `row:object`, `standing:object` || `spec draft` | `version:number`, `id:string`, `row:object` |-| `blueprint add` | `version:number`, `blueprint:object`, `section:string`, `rows:array`, `items:array`, `gate:string\|null` |+| `blueprint add` | `version:number`, `blueprint:object`, `section:string`, `rows:array`, `items:array`, `gate:string\|null`, `proposedLanes:array` || `spec unmet` | `version:number`, `rows:array` || `spec signoff` | `version:number`, `count:number`, `by:string`, `ids:array`, `evidence:array` || `spec signers` | `version:number`, `added:boolean`, `by:string`, `path:string`, `initial:boolean` |diff --git a/src/cli.js b/src/cli.jsindex 807016f8..d7edd671 100644--- a/src/cli.js+++ b/src/cli.js@@ -32,7 +32,7 @@ import {pushesTrunk,unwiredHookProblems,} from './hooks.js';-import { detectGate, initRepo, proposeLanes } from './init.js';+import { detectGate, initRepo, proposeLanes, starterLane, starterLaneNotes } from './init.js';import { lifecycleMarkdown } from './machine.js';import { HELP, VERSION } from './help.js';import { defaultViewPort } from './view-port.js';@@ -1671,7 +1671,7 @@ function setupCommands(io, { first, second, rest = [], values }) {(staging ? notes.slice(0, -1) : notes).forEach((note) => io.say(note));if (added) {io.say(`added the ${added.blueprint.title} blueprint: ${added.rows.length} ${added.rows.length === 1 ? 'row waits' : 'rows wait'} for your approval in SPEC.md (${added.section}), `- + `${added.items.length} starter ${added.items.length === 1 ? 'item' : 'items'} filed${added.gate ? `, gate set to ${added.gate}` : ''}`);+ + `${added.items.length} starter ${added.items.length === 1 ? 'item' : 'items'} filed${added.proposedLanes.length ? ` in the ${added.proposedLanes.map((lane) => lane.name).join(' and ')} lane, proposed above and not written until the person accepts` : ''}${added.gate ? `, gate set to ${added.gate}` : ''}`);if (added.checksNotRun.length) io.say(` checks stored, not run: ${added.checksNotRun.map((id) => `#${id}`).join(', ')}; no check baseline ran, so read each check before work starts: pullboard show <id>`);}if (await registerProjectAndLink(info.root, new Date(), loadConfig(info.root), io)) io.say('registered this project on this machine, so pullboard view lists it');@@ -2326,6 +2326,7 @@ export async function addBlueprintHere(io, reference, { report = true, blueprint* @property {string | null} gate - The gate set in pullboard.json, or null when it was left alone.* @property {boolean} marked - This blueprint version was already on the board, so nothing was added.* @property {number[]} checksNotRun - New items that carry a check; no check baseline ran for them.+ * @property {{ name: string, owns: string[] }[]} proposedLanes - Proposed, unwritten lanes new starters were filed in.*//**@@ -2354,8 +2355,11 @@ async function addBlueprint(ctx, board, me, blueprint, { report = true } = {}) {existingItems: store.listItems(board, { all: true }).map((item) => ({ id: item.item_id, title: item.item_title, specIds: item.item_spec_ids ? item.item_spec_ids.split(',') : [] })),gate: String(JSON.parse(configSource).gate ?? '') });// Every starter is checked before anything is written, so a refusal leaves the board as it was.- const starters = plan.items.map((entry) => ({ key: entry.key, afterKeys: entry.after, item: { by: me.id,- lane: entry.lane && entry.lane !== COORDINATOR && isLane(ctx.config, entry.lane) ? entry.lane : COORDINATOR,+ // Starters go to a build lane, never the coordinator's; a proposed lane is named, not written (#732).+ const proposals = proposeLanes(ctx.info.root, ctx.config);+ const lanes = plan.items.map((entry) => starterLane(entry.lane, ctx.config, proposals));+ const proposedLanes = proposals.filter((lane) => lanes.some((placed) => placed.proposal === lane));+ const starters = plan.items.map((entry, index) => ({ key: entry.key, afterKeys: entry.after, item: { by: me.id, lane: lanes[index].lane,title: entry.title, criterion: entry.criterion, specIds: entry.specIds, parentId: null, after: [], brief: entry.brief, route: entry.route,...(entry.check === undefined ? {} : { check: entry.check }) } }));// The same checks pullboard add uses, before anything is written. A blueprint's item check is@@ -2398,7 +2402,7 @@ async function addBlueprint(ctx, board, me, blueprint, { report = true } = {}) {if (plan.specAfter !== source && !files.some((file) => file.file === ctx.config.spec)) files.unshift({ file: ctx.config.spec });const rows = plan.rows.map(({ key, id, status, text }) => ({ key, id, status, text }));const summary = { blueprint: { name: blueprint.name, title: blueprint.title, version: blueprint.version },- section: plan.section.name, rows, items: added, gate: plan.gate, marked: plan.marked,+ section: plan.section.name, rows, items: added, gate: plan.gate, marked: plan.marked, proposedLanes: added.length ? proposedLanes : [],// Item checks are stored and never run during add; the caller tells the reader so.checksNotRun: added.filter((item) => item.check).map((item) => item.id) };io.result?.(summary);@@ -2411,6 +2415,7 @@ async function addBlueprint(ctx, board, me, blueprint, { report = true } = {}) {for (const item of added) io.say(` #${item.id} open ${item.title}${item.specIds.length ? ` cites ${item.specIds.join(', ')}` : ''}${item.after.length ? ` waits on #${item.after.join(', #')}` : ''}`);const checked = added.filter((item) => item.check);if (checked.length) io.say(` checks stored, not run: ${checked.map((item) => `#${item.id}`).join(', ')}; no check baseline ran during add, so read each check before work starts: pullboard show <id>`);+ for (const note of starterLaneNotes(summary.proposedLanes)) io.say(` ${note}`);if (plan.gate) io.say(` gate set in ${CONFIG_FILE}: ${plan.gate}`);const changed = files.map((file) => file.file);io.say(`next: the person approves the rows in pullboard view or with pullboard spec approve <ids>${changed.length ? `; commit ${changed.join(' and ')}` : ''}`);diff --git a/src/init.js b/src/init.jsindex 9b87486d..e591a8aa 100644--- a/src/init.js+++ b/src/init.js@@ -96,6 +96,44 @@ export function proposeLanes(root, config = loadConfig(root)) {return [{ name: taken.has('app') ? 'app-1' : 'app', owns: folders.length ? folders.map((folder) => `${folder}/`) : ['app/'] }];}+/**+ * The lane a blueprint starter is filed in (I1, S1). A starter is built in a build lane, never the+ * coordinator lane: the coordinator verifies and merges, and nothing moves an item between lanes,+ * so a starter filed there had to be withdrawn and filed again (blueprint trial, finding 3). In+ * order: the starter's own lane when it exists or is proposed, else the first declared lane that+ * owns folders, else the first lane init proposes. A proposed lane is used by name and never+ * written: the person accepts it with its `pullboard lane add` command, and the starters are+ * waiting in it from then on.+ *+ * @param {string | undefined} wanted - The lane the blueprint names for this starter, if any.+ * @param {any} config - The repo's config.+ * @param {{ name: string, owns: string[] }[]} proposals - The lanes init proposes, from proposeLanes.+ * @returns {{ lane: string, proposal: { name: string, owns: string[] } | null }}+ */+export function starterLane(wanted, config, proposals) {+ const proposalFor = (name) => proposals.find((lane) => lane.name === name) ?? null;+ if (wanted && wanted !== COORDINATOR && (Object.hasOwn(config.lanes, wanted) || proposalFor(wanted))) {+ return { lane: wanted, proposal: Object.hasOwn(config.lanes, wanted) ? null : proposalFor(wanted) };+ }+ const built = Object.entries(config.lanes).find(([name, lane]) => name !== COORDINATOR && lane.owns.length);+ if (built) return { lane: built[0], proposal: null };+ // proposeLanes always proposes one lane when no lane owns a folder, so this is never empty.+ return { lane: proposals[0].name, proposal: proposals[0] };+}++/**+ * The lines blueprint add prints when its starters went into a proposed lane: where they are,+ * and the one command that accepts the lane.+ *+ * @param {{ name: string, owns: string[] }[]} proposed - The proposed lanes starters were filed in.+ * @returns {string[]}+ */+export function starterLaneNotes(proposed) {+ if (!proposed.length) return [];+ const [, accept] = laneProposalNotes(proposed);+ return [`starter items filed in the ${proposed.map((lane) => lane.name).join(' and ')} lane, proposed, not written until the person accepts`, accept];+}+/*** Quote one word for a POSIX shell when it needs quoting.*diff --git a/test/blueprint.test.js b/test/blueprint.test.jsindex f74ff6ca..810e4058 100644--- a/test/blueprint.test.js+++ b/test/blueprint.test.js@@ -496,6 +496,57 @@ test('blueprint add files a blueprint as drafts and runs nothing it supplies [S1}});+test('starter items land in a build lane, never the coordinator lane [S1,I1]', () => {+ const lanesOf = (box) => (JSON.parse(box.run('list', '--all', '--json').stdout).items ?? []).map((item) => item.item_lane);+ const configLanes = (box) => JSON.parse(readFileSync(join(box.repo, 'pullboard.json'), 'utf8')).lanes ?? {};++ // A fresh init with a blueprint: init proposes the app lane and the starters are filed in it.+ // The proposal stays unwritten until the person runs the command init prints.+ const fresh = emptyRepo();+ const started = fresh.run('init', '--blueprint', 'web-app');+ assert.equal(started.status, 0, started.stdout + started.stderr);+ assert.deepEqual(lanesOf(fresh), Array(PUBLISHED.items.length).fill('app'), 'init files every starter in the lane it proposes');+ assert.match(started.stdout, /starter items filed in the app lane, proposed above and not written until the person accepts/u, 'init says the lane is a proposal');+ assert.match(started.stdout, /to accept, run: pullboard lane add app --owns app\//u, 'init prints the command that accepts it');+ assert.deepEqual(Object.keys(configLanes(fresh)).filter((name) => name === 'app'), [], 'the proposed lane is not written');+ const accepted = fresh.run('lane', 'add', 'app', '--owns', 'app/');+ assert.equal(accepted.status, 0, accepted.stdout + accepted.stderr);+ assert.equal((JSON.parse(fresh.run('list', 'app', '--json').stdout).items ?? []).length, PUBLISHED.items.length, 'once accepted, the lane lists its starters');++ // A board with a lane pullboard lane add made: starters go to it, and a starter's own lane is+ // kept when that lane exists. A coordinator or missing lane in the blueprint is never used.+ const laned = freshBoard();+ for (const [name, owns] of [['web', 'web/'], ['docs', 'docs/']]) {+ const made = laned.run('lane', 'add', name, '--owns', owns);+ assert.equal(made.status, 0, made.stdout + made.stderr);+ }+ const own = ['docs', 'no-such-lane', 'coordinator'];+ writeFileSync(join(laned.repo, 'own-lanes.json'), `${JSON.stringify({ ...PUBLISHED, name: 'own-lanes',+ items: PUBLISHED.items.map((item, index) => ({ ...item, lane: own[index] })) })}\n`);+ const placed = json(laned, 'blueprint', 'add', 'own-lanes.json');+ const placedLanes = placed.items.map((item) => item.lane);+ assert.equal(placedLanes[0], 'docs', 'a starter keeps its own lane when that lane exists');+ assert.equal(placedLanes[1], 'web', 'a starter naming a missing lane goes to the first lane pullboard lane add made');+ assert.equal(placedLanes[2], 'web', 'a blueprint\'s coordinator lane is never used');+ assert.deepEqual(placed.proposedLanes, [], 'nothing is proposed when a build lane exists');+ assert.deepEqual(lanesOf(laned).filter((lane) => lane === 'coordinator'), [], 'no starter lands in the coordinator lane');++ // A board with no build lane, only a verifier lane that owns no folders: blueprint add proposes+ // one, files the starters in it and says so.+ const bare = freshBoard({ lanes: { tests: { owns: [] } } });+ const before = readFileSync(join(bare.repo, 'pullboard.json'), 'utf8');+ const proposed = json(bare, 'blueprint', 'add', 'web-app');+ assert.deepEqual(proposed.items.map((item) => item.lane), Array(PUBLISHED.items.length).fill('app'), 'starters go to the proposed lane');+ assert.deepEqual(proposed.proposedLanes, [{ name: 'app', owns: ['app/'] }], 'the result names the proposal');+ assert.equal(JSON.parse(readFileSync(join(bare.repo, 'pullboard.json'), 'utf8')).lanes?.app, undefined, 'the proposal is not written');+ assert.equal(JSON.stringify(JSON.parse(readFileSync(join(bare.repo, 'pullboard.json'), 'utf8')).lanes), JSON.stringify(JSON.parse(before).lanes), 'pullboard.json keeps its lanes');+ const again = freshBoard();+ const said = again.run('blueprint', 'add', 'web-app');+ assert.equal(said.status, 0, said.stdout + said.stderr);+ assert.match(said.stdout, /starter items filed in the app lane, proposed, not written until the person accepts/u, 'blueprint add says the lane is a proposal');+ assert.match(said.stdout, /to accept, run: pullboard lane add app --owns app\//u, 'blueprint add prints the command that accepts it');+});+const e2e = createE2eHelpers();after(e2e.cleanup);