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(blueprint): store starter checks unrun and refuse URLs [S1,I1]
Corey Olsonb632876fa855
diff --git a/src/blueprints.js b/src/blueprints.jsindex 136cb859..4d2980e7 100644--- a/src/blueprints.js+++ b/src/blueprints.js@@ -22,6 +22,8 @@* An item's route is light, mid or strong (strong when left out), as pullboard add takes it. Its* brief, criterion and check pass through to add unchanged, so a light or mid item is filed when it* carries what add requires for that route and refused with add's own refusal when it does not.+ * A check is stored on the item and never run during add: no check baseline starts, so nothing a+ * blueprint supplies executes. A blueprint is read from the bundled set or a local path, never a URL.** Rule and question keys ("W1", "Q1") are unique within the file; an item cites them by key and* waits on other items by their keys. On a board they get real ids from the section's prefix.@@ -65,6 +67,10 @@ export function bundledBlueprints() {export function readBlueprint(reference, cwd) {const text = String(reference ?? '').trim();if (!text) throw new Refused('USAGE', `name a blueprint: pullboard blueprint add <name or file>; bundled: ${bundledBlueprints().join(', ')}`);+ // Only the bundled set or a local file: nothing is fetched from a URL (P5).+ if (/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(text)) {+ throw new Refused('BLUEPRINT_URL', `a blueprint is read from the bundled set or a local file, never a URL; download ${text} yourself, read it, then run pullboard blueprint add <file>`);+ }const bundled = NAME_RE.test(text) && bundledBlueprints().includes(text);const file = bundled ? resolve(BUNDLED_DIR, `${text}.json`) : resolve(cwd, text);if (!bundled && !existsSync(file)) {diff --git a/src/cli.js b/src/cli.jsindex 009cacd0..e108832a 100644--- a/src/cli.js+++ b/src/cli.js@@ -2200,9 +2200,10 @@ export async function addBlueprintHere(io, reference, { report = true } = {}) {* @property {{ name: string, title: string, version: number }} blueprint* @property {string} section - The SPEC.md section heading the rows are in.* @property {{ key: string, id: string, status: string, text: string }[]} rows - New rows; each waits for the person.- * @property {{ id: number, key: string, title: string, lane: string, specIds: string[], after: number[] }[]} items - New open items.+ * @property {{ id: number, key: string, title: string, lane: string, specIds: string[], after: number[], check?: string }[]} items - New open items.* @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.*//**@@ -2235,11 +2236,9 @@ async function addBlueprint(ctx, board, me, blueprint, { report = true } = {}) {lane: entry.lane && entry.lane !== COORDINATOR && isLane(ctx.config, entry.lane) ? entry.lane : COORDINATOR,title: entry.title, criterion: entry.criterion, specIds: entry.specIds, parentId: null, after: [], brief: entry.brief, route: entry.route,...(entry.check === undefined ? {} : { check: entry.check }) } }));- for (const { item } of starters) {- // The same checks and check baseline pullboard add uses, before anything is written.- const { command } = store.validateItemAddition(board, item);- if (command) item.checkBaseline = prepareCheckBaseline(ctx.info.root, command);- }+ // The same checks pullboard add uses, before anything is written. A blueprint's item check is+ // stored, never run: no check baseline starts during add, so nothing a blueprint supplies executes.+ for (const { item } of starters) store.validateItemAddition(board, item);const files = [];if (plan.specRows !== source) files.push({ file: ctx.config.spec, before: source, after: plan.specRows });if (plan.gate) {@@ -2256,9 +2255,8 @@ async function addBlueprint(ctx, board, me, blueprint, { report = true } = {}) {for (const { key, afterKeys, item } of starters) {item.after = afterKeys.map((before) => byKey[before]).filter(Boolean);const id = await ordered(ctx, board, 'addItem', [item]);- if (item.checkBaseline?.result === 'pending') await launchBaseline(ctx, board, id, item.checkBaseline);byKey[key] = id;- added.push({ id, key, title: item.title, lane: item.lane, specIds: item.specIds, after: item.after });+ added.push({ id, key, title: item.title, lane: item.lane, specIds: item.specIds, after: item.after, ...(item.check ? { check: item.check } : {}) });}} catch (error) {// Items already added stay on the board; with no marker yet, a retry adds only what is missing.@@ -2272,7 +2270,9 @@ 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,+ // 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);if (plan.marked) {io.say(`${blueprint.title} (version ${blueprint.version}) is already on this board; nothing added`);@@ -2281,6 +2281,8 @@ async function addBlueprint(ctx, board, me, blueprint, { report = true } = {}) {io.say(`added ${blueprint.title} (version ${blueprint.version}) as drafts in ${ctx.config.spec}, section ${plan.section.name}`);for (const row of rows) io.say(` ${row.id} ${row.status} ${row.text}`);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>`);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/test/blueprint.test.js b/test/blueprint.test.jsindex 5431ef33..d33ba216 100644--- a/test/blueprint.test.js+++ b/test/blueprint.test.js@@ -1,6 +1,6 @@/** pullboard blueprint add: a blueprint lands on a board as drafts, once [S1,I1]. */import assert from 'node:assert/strict';-import { chmodSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';+import { chmodSync, existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';import { join, resolve } from 'node:path';import { after, test } from 'node:test';@@ -237,3 +237,28 @@ test('blueprint add files a blueprint as drafts after an add stopped part way [Sassert.equal(readFileSync(join(box.repo, 'SPEC.md'), 'utf8'), finished, 'the finished marker replaces the under-way one');assert.equal(json(box, 'blueprint', 'add', 'web-app').items.length, 0, 'and then a repeat adds nothing');});++test('blueprint add files a blueprint as drafts and runs nothing it supplies [S1,I1]', () => {+ // A starter's check is stored on the item, but no check baseline starts: add executes nothing+ // from a blueprint, and says so. A blueprint is never read from a URL.+ const box = freshBoard({ gate: 'true' });+ const marker = join(box.dir, 'check-ran');+ const brief = 'Files:\n- web/index.html\nTest:\n- test/home.test.js asserts the page loads';+ const check = `touch '${marker}'`;+ writeFileSync(join(box.repo, 'checked.json'), `${JSON.stringify({ ...PUBLISHED, name: 'checked',+ items: [{ key: '1', title: 'Checked starter', cites: ['W1'], route: 'light', brief, criterion: 'The page loads.', check }] })}\n`);+ const added = json(box, 'blueprint', 'add', 'checked.json');+ const id = added.items[0].id;+ const item = json(box, 'show', String(id));+ assert.equal(item.item_check, check, 'the check is stored unchanged');+ assert.equal(item.item_check_baseline ?? null, null, 'no check baseline was started');+ assert.equal(existsSync(marker), false, 'the check command never ran');+ assert.deepEqual(added.checksNotRun, [id], 'the summary names the checks that were not run');+ const text = box.run('blueprint', 'add', 'checked.json');+ assert.match(text.stdout, /already on this board/u);+ for (const url of ['https://pullboard.dev/blueprints/web-app.json', 'file:///tmp/web-app.json']) {+ const refused = box.run('blueprint', 'add', url, '--json');+ assert.equal(refused.status, 1, refused.stdout + refused.stderr);+ assert.equal(JSON.parse(refused.stdout).error.code, 'BLUEPRINT_URL');+ }+});