Skip to content

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.

feat(blueprints): blueprint commands say what they did [S1,I1]

Corey Olson8bea0bd08fee
diff --git a/docs/api.md b/docs/api.md
index 282435fa..a4908eda 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -115,6 +115,7 @@ For example: `flow: review wait average 61 min (1 measured; > 60 min); bottlenec
| `spec check` | `version:number`, `rows:array` |
| `spec view` | `version:number`, `path:string` |
| `spec show` | `version:number`, `row:object`, `standing:object` |
+| `blueprint starters` | `version:number`, `blueprint:object`, `starters:array` |
| `spec draft` | `version:number`, `id:string`, `row:object` |
| `blueprint add` | `version:number`, `blueprint:object`, `section:string`, `rows:array`, `items:array`, `gate:string\|null` |
| `spec unmet` | `version:number`, `rows:array` |
@@ -284,6 +285,8 @@ To answer a pending question row (`<ask>: <default>. Choices: a, b.`, as `bluepr
To approve new wording, the person uses `spec approve <one-id> --text "exact proposed text"`, or `spec-approve` with `args: {ids: "G1", text: "exact proposed text"}`. This records the same exact-row receipt; files wait for coordinator apply. Text must be one nonempty line without a field separator. Pre-commit checks the staged row against that person decision or a verified staged SSH sign-off; unstaged receipts cannot authorize a commit.
+`blueprint starters <name or file>` lists a blueprint's starter items and whether each is on this board. Each entry in `starters` is `{ key, title, filed, id, status }`: a filed starter is the item that carries its title, with its id and status, and an unfiled one has `id` and `status` null. It reads the board and changes nothing. A repeat `blueprint add` of a version already on the board returns `marked: true` with empty `rows` and `items`, changes no file and records no board event. `init --blueprint` adds `blueprint.marked` and `blueprint.waitingRows`, every row that waits for the person as `{ id, status, text, file }`: the blueprint's new SPEC.md rows, then each draft or pending doctrine row, such as an inherited standard rule.
+
A coordinator criterion or check correction on a live claim remains pending until its holder or the coordinator runs `pullboard refreeze <id>`. Renewal and submission refuse with `PENDING_REFREEZE` until then. This refreeze keeps the holder, lease and claim base, and returns `retainedClaim: true` in JSON.
Doctor and resume report every stale frozen item after cited text changes. Open, claimed and submitted items suggest coordinator refreeze. Verified and merged items keep their receipts, report that they shipped against the old text, and suggest adding a follow-up citing the changed row. Resume JSON includes these findings in `stale`.
diff --git a/src/blueprint-report.js b/src/blueprint-report.js
new file mode 100644
index 00000000..9d915eeb
--- /dev/null
+++ b/src/blueprint-report.js
@@ -0,0 +1,80 @@
+/** What blueprint commands report back: a blueprint's starters on this board and the rows that wait [S1,I1]. */
+
+/**
+ * @typedef {object} StarterState
+ * @property {string} key - The starter's key in the blueprint.
+ * @property {string} title - The starter's title.
+ * @property {boolean} filed - An item with this title is on the board.
+ * @property {number | null} id - The filed item's id, or null when it is not filed.
+ * @property {string | null} status - The filed item's status, or null when it is not filed.
+ */
+
+/**
+ * Each of a blueprint's starter items and whether it is on the board. A starter is filed when an
+ * item carries its title; blueprint add files a starter under its title, and the title is what a
+ * person reads in pullboard list. When several items share the title, a live one is named before a
+ * withdrawn one, then the oldest, so a starter withdrawn and filed again shows the item in work.
+ *
+ * @param {{ items: { key: string, title: string }[] }} blueprint
+ * @param {Record<string, any>[]} items - Every item on the board, as store.listItems returns them.
+ * @returns {StarterState[]}
+ */
+export function starterStates(blueprint, items) {
+ return blueprint.items.map((starter) => {
+ const title = starter.title.trim();
+ const matches = items.filter((item) => item.item_title === title)
+ .sort((a, b) => Number(a.item_status === 'withdrawn') - Number(b.item_status === 'withdrawn') || a.item_id - b.item_id);
+ const found = matches[0];
+ const status = found?.item_status ?? null;
+ return { key: starter.key, title, filed: Boolean(found), id: found?.item_id ?? null, status };
+ });
+}
+
+/**
+ * The lines pullboard blueprint starters prints: a heading with the count filed, then one line per
+ * starter that names its item id and status when it is filed.
+ *
+ * @param {{ name: string, title: string, version: number }} blueprint
+ * @param {StarterState[]} starters
+ * @returns {string[]}
+ */
+export function starterLines(blueprint, starters) {
+ const filed = starters.filter((starter) => starter.filed).length;
+ const lines = [`${blueprint.title} (version ${blueprint.version}) has ${starters.length} starter ${starters.length === 1 ? 'item' : 'items'}; ${filed} filed on this board`];
+ for (const starter of starters) {
+ lines.push(starter.filed ? ` #${starter.id} ${starter.status} ${starter.title}` : ` not filed ${starter.title}`);
+ }
+ if (filed < starters.length) lines.push(`next: file the rest with pullboard blueprint add ${blueprint.name}`);
+ return lines;
+}
+
+/**
+ * Every row that waits for the person after init --blueprint: the blueprint's new rows in SPEC.md
+ * and each doctrine row still draft or pending, such as a standard rule the repo inherits. Why the
+ * doctrine rows: init writes the doctrine file too, and a pending rule there waits for the same
+ * person, so a summary of the blueprint's rows alone hides one (the blueprint trial missed PB7).
+ *
+ * @param {{ id: string, status: string, text: string }[]} rows - The rows the blueprint added.
+ * @param {{ rows: { id: string, status: string, text: string, file?: string }[] }} doctrine - loadDoctrine's result.
+ * @param {string} specFile - The spec file's name, such as SPEC.md.
+ * @returns {{ id: string, status: string, text: string, file: string }[]}
+ */
+export function waitingRows(rows, doctrine, specFile) {
+ return [
+ ...rows.map(({ id, status, text }) => ({ id, status, text, file: specFile })),
+ ...doctrine.rows.filter((row) => ['draft', 'pending'].includes(row.status))
+ .map(({ id, status, text, file }) => ({ id, status, text, file: file ?? 'doctrine' })),
+ ];
+}
+
+/**
+ * The lines init prints for the rows that wait: a count, then one line per row with its file.
+ *
+ * @param {{ id: string, status: string, text: string, file: string }[]} waiting
+ * @returns {string[]}
+ */
+export function waitingRowLines(waiting) {
+ if (!waiting.length) return [];
+ return [` ${waiting.length} ${waiting.length === 1 ? 'row waits' : 'rows wait'} for the person:`,
+ ...waiting.map((row) => ` ${row.id} ${row.status} ${row.text} (${row.file})`)];
+}
diff --git a/src/cli.js b/src/cli.js
index 8e575399..176fad41 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -63,6 +63,7 @@ import { answerQuestion, bundledBlueprints, planBlueprint, readBlueprint, saveBl
import { briefFiles } from './brief.js';
import { checkBaseline, prepareCheckBaseline, sayCheckBaseline } from './check-baseline.js';
import { retryCheckBaselines, startCheckBaseline } from './check-baseline-worker.js';
+import { starterLines, starterStates, waitingRowLines, waitingRows } from './blueprint-report.js';
import { compareMainFailures, mainRedMessage, mainRedReworkItems } from './main-red.js';
import { runItems } from './run.js';
import { parseProblems, sweepItems } from './sweep.js';
@@ -1673,15 +1674,19 @@ function setupCommands(io, { first, second, rest = [], values }) {
]));
// Keep blueprint initialization and the person's unwritten lane proposals in the same result.
const added = blueprint ? await addBlueprintHere(io, values.blueprint, { report: false, blueprint }) : null;
+ // Every row that waits for the person, doctrine rows included, so none is missed (#734).
+ const waiting = added ? waitingRows(added.rows, loadDoctrine(info.root, loadConfig(info.root)), loadConfig(info.root).spec) : [];
io.result?.({ root: info.root, notes, proposedLanes: proposeLanes(info.root),
- ...(added ? { blueprint: { name: added.blueprint.name, title: added.blueprint.title,
+ ...(added ? { blueprint: { name: added.blueprint.name, title: added.blueprint.title, marked: added.marked, waitingRows: waiting,
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;
(staging ? notes.slice(0, -1) : notes).forEach((note) => io.say(note));
- if (added) {
+ if (added?.marked) io.say(`the ${added.blueprint.title} blueprint (version ${added.blueprint.version}) is already on this board; nothing added; see its starters with pullboard blueprint starters ${added.blueprint.name}`);
+ if (added && !added.marked) {
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}` : ''}`);
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>`);
+ waitingRowLines(waiting).forEach((line) => io.say(line));
}
if (await registerProjectAndLink(info.root, new Date(), loadConfig(info.root), io)) io.say('registered this project on this machine, so pullboard view lists it');
io.say(agentSessionDigest()
@@ -2433,7 +2438,7 @@ async function addBlueprint(ctx, board, me, blueprint, { report = true } = {}) {
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`);
+ io.say(`${blueprint.title} (version ${blueprint.version}) is already on this board; nothing added; see its starters with pullboard blueprint starters ${blueprint.name}`);
return summary;
}
io.say(`added ${blueprint.title} (version ${blueprint.version}) as drafts in ${ctx.config.spec}, section ${plan.section.name}`);
@@ -3835,6 +3840,14 @@ async function runCommand(argv, io) {
for (const entry of left) io.say(` left out ${entry.id}: ${entry.reason}`);
return 0;
}
+ if (command === 'blueprint' && first === 'starters') {
+ if (!second || rest.length) throw new Refused('USAGE', `pullboard blueprint starters <name or file>; bundled: ${bundledBlueprints().join(', ')}`);
+ const blueprint = readBlueprint(second, io.cwd);
+ const starters = withBoard(context(io), (board) => starterStates(blueprint, store.listItems(board, { all: true })));
+ io.result?.({ blueprint: { name: blueprint.name, title: blueprint.title, version: blueprint.version }, starters });
+ starterLines(blueprint, starters).forEach((line) => io.say(line));
+ return 0;
+ }
if (command === 'gate') {
const ctx = context(io);
let config;
diff --git a/src/help.js b/src/help.js
index ce71173b..9f16e8c8 100644
--- a/src/help.js
+++ b/src/help.js
@@ -163,6 +163,8 @@ Spec
bundled: web-app; nothing is approved, and a repeat adds nothing
pullboard blueprint save [file] [--name <name>] [--title "<title>"] write approved rules and answered questions as a blueprint
never items, notes, paths, emails or names; file defaults to <project>.blueprint.json
+ pullboard blueprint starters <name or file> list a blueprint's starter items and whether each is filed
+ a filed starter shows its item id and status
pullboard spec signers add [--key <path>] [--by <principal>] opt into SSH-signed sign-offs
principal defaults to Git user.email; --by overrides it
pullboard spec approve <ids> | decline <ids> --reason "why" the person's exact-row decision
@@ -192,7 +194,7 @@ const HELP_NAMES = [
'serve', 'mcp', 'relay', 'relay recover', 'resume', 'hooks', 'add', 'edit', 'escalate', 'run', 'list', 'doctor', 'skills', 'show', 'next', 'land',
'check', 'claim', 'release', 'submit', 'done', 'verify', 'fact', 'shout', 'answer', 'pass', 'decisions', 'inbox', 'export', 'import',
'sweep', 'merged', 'withdraw', 'refreeze', 'reopen', 'hold', 'stats', 'ledger', 'log', 'spec', 'spec check', 'spec view',
- 'spec show', 'spec unmet', 'spec signoff', 'spec draft', 'spec signers', 'spec signers add', 'doctrine', 'doctrine check', 'forget', 'prompt', 'gate', 'hook',
+ 'spec show', 'spec unmet', 'spec signoff', 'spec draft', 'blueprint starters', 'spec signers', 'spec signers add', 'doctrine', 'doctrine check', 'forget', 'prompt', 'gate', 'hook',
'hook pre-commit', 'hook pre-merge-commit', 'hook commit-msg', 'hook pre-push', 'view export', 'version', 'lifecycle', 'help',
'roadmap', 'milestone', 'runner', 'runner add', 'blueprint', 'blueprint add', 'blueprint save',
];
@@ -224,7 +226,7 @@ const HELP_EXAMPLES = {
'spec check': 'pullboard spec check',
doctrine: 'pullboard doctrine check', 'doctrine check': 'pullboard doctrine check',
'spec view': 'pullboard spec view', 'spec show': 'pullboard spec show G1',
- 'spec draft': 'pullboard spec draft "Describe the first requirement"',
+ 'spec draft': 'pullboard spec draft "Describe the first requirement"', 'blueprint starters': 'pullboard blueprint starters web-app',
'blueprint add': 'pullboard blueprint add web-app', 'blueprint save': 'pullboard blueprint save',
'spec unmet': 'pullboard spec unmet', 'spec signoff': 'pullboard spec signoff G1',
'spec signers add': 'pullboard spec signers add', help: 'pullboard help claim', version: 'pullboard --version',
diff --git a/src/json.js b/src/json.js
index 8bbba358..ee60f363 100644
--- a/src/json.js
+++ b/src/json.js
@@ -77,6 +77,7 @@ export const JSON_SHAPES = {
'spec check': shape({ rows: 'array' }),
'spec view': shape({ path: 'string' }),
'spec show': shape({ row: 'object', standing: 'object' }),
+ 'blueprint starters': shape({ blueprint: 'object', starters: 'array' }),
'spec draft': shape({ id: 'string', row: 'object' }),
'blueprint add': shape({ blueprint: 'object', section: 'string', rows: 'array', items: 'array', gate: 'string|null' }),
'spec unmet': shape({ rows: 'array' }),
diff --git a/src/templates.js b/src/templates.js
index c6c970c6..29d16d30 100644
--- a/src/templates.js
+++ b/src/templates.js
@@ -103,6 +103,8 @@ This repo runs on pullboard: a work board, lanes and a spec that live in git. No
**Source of truth.** \`SPEC.md\` holds every requirement as a row with an id, like \`G1.2\`. Code follows the spec. Commits cite the ids they serve: \`feat(scope): subject [G1.2]\`. Only a person approves or changes an approved row. Ids are permanent: a row the person cuts stays, marked \`wont\` (won't build), so every commit that cites it keeps its meaning. Propose each requirement with \`pullboard spec draft "<text>"\`; it returns the draft row id for the person to approve. To start from a blueprint's rules, questions and starter items, run \`pullboard blueprint add <name or file>\` (bundled: web-app); it files them all as drafts for the person to approve. Its questions file as pending rows, each with a default answer and its choices: the person answers one with \`pullboard spec answer <id> "<choice or text>"\` from the main checkout or the view, and the coordinator writes it with \`pullboard spec apply\`. Never answer a question by editing SPEC.md; spec check flags it. To share this board's approved rules and answered questions as a blueprint, run \`pullboard blueprint save [file]\`; it never writes items, notes, paths, emails or names.
+**Blueprint starters.** To see which of a blueprint's starter items are on the board, run \`pullboard blueprint starters <name or file>\`; it names each filed item's id and status. \`pullboard init --blueprint\` lists every row that waits for the person, doctrine rows included.
+
**Doctrine.** Our house rules for agentic development. This repo inherits Pullboard standard doctrine version 1. ${doctrine.repo ? doctrine.name : DOCTRINE_FILE} adds the repo's own rows, overrides a standard rule by its PB id, or declines it with a wont row and its reason as the row text: - PB7 [wont] <why>. Approved rows are in force; follow them as you would the spec. A rule with \`gate: check <command>\` and \`count: N\` holds a count that only falls: run pullboard doctrine check to see each count, and submit refuses RATCHET_ROSE when a touched rule rises or a changed file gains a problem. Lower \`count:\` in a commit when you fix problems; only the person raises it. Run pullboard spec --json to read the current merged rules. Re-run pullboard init after changing the doctrine to refresh this managed guidance.
### Current doctrine
diff --git a/test/api.test.js b/test/api.test.js
index 0dd259bc..ab21d17e 100644
--- a/test/api.test.js
+++ b/test/api.test.js
@@ -623,6 +623,8 @@ test('[A1] command results match the catalog across roots and subcommands', () =
json(box, repo, 'spec', ['view', '--out', join(box.dir, 'spec.html')], 'view');
json(box, repo, 'spec', ['show', 'G1'], 'show');
json(box, repo, 'spec', ['unmet'], 'unmet');
+ const catalogStarters = json(box, repo, 'blueprint', ['starters', 'web-app'], 'starters').starters;
+ assert.ok(catalogStarters.length && catalogStarters.every((starter) => !starter.filed && starter.id === null), 'blueprint starters lists unfiled starters with no id');
assert.equal(json(box, repo, 'spec', ['draft', 'A draft API catalogue row'], 'draft').id, 'G2');
writeFileSync(join(box.dir, 'catalog-blueprint.json'), `${JSON.stringify({ blueprint: 1, name: 'catalog', title: 'Catalog', version: 1, rules: [{ key: 'R1', text: 'A catalog rule.', why: 'the API lists it.' }] })}\n`);
assert.equal(json(box, repo, 'blueprint', ['add', join(box.dir, 'catalog-blueprint.json')], 'add').rows[0].status, 'draft');
diff --git a/test/blueprint.test.js b/test/blueprint.test.js
index b86b7fbb..50ced06b 100644
--- a/test/blueprint.test.js
+++ b/test/blueprint.test.js
@@ -353,6 +353,76 @@ test('blueprint add files a blueprint as drafts beside approved rows in its own
assert.equal(spec.rows.filter((row) => row.section === 'A · Web app').length, 12);
});
+test('blueprint commands say what they did [S1,I1]', () => {
+ // Every file's bytes outside Git's object store, and every board event, so a repeat add is proven to change nothing.
+ const snapshot = (box) => {
+ const files = readdirSync(box.repo, { recursive: true, withFileTypes: true })
+ .filter((entry) => entry.isFile())
+ .map((entry) => join(entry.parentPath, entry.name))
+ .filter((path) => !path.includes(`${join('.git', 'objects')}`) && !/board\.sqlite/u.test(path))
+ .sort()
+ .map((path) => [path, readFileSync(path).toString('base64')]);
+ return { files, events: json(box, 'log').events };
+ };
+
+ // Before any add, every starter is listed and none is filed.
+ const box = freshBoard();
+ const unfiled = json(box, 'blueprint', 'starters', 'web-app');
+ assert.deepEqual(unfiled.blueprint, { name: 'web-app', title: 'Web app', version: 1 });
+ assert.deepEqual(unfiled.starters.map((starter) => [starter.title, starter.filed, starter.id]), PUBLISHED.items.map((item) => [item.title, false, null]));
+ const unfiledText = box.run('blueprint', 'starters', 'web-app');
+ assert.equal(unfiledText.status, 0, unfiledText.stdout + unfiledText.stderr);
+ for (const item of PUBLISHED.items) assert.ok(unfiledText.stdout.split('\n').includes(` not filed ${item.title}`), `${item.title} is listed as not filed:\n${unfiledText.stdout}`);
+
+ // A second add says it is already there, and no file byte and no board event changes.
+ json(box, 'blueprint', 'add', 'web-app');
+ const before = snapshot(box);
+ const again = box.run('blueprint', 'add', 'web-app');
+ assert.equal(again.status, 0, again.stdout + again.stderr);
+ assert.match(again.stdout, /^Web app \(version 1\) is already on this board; nothing added/mu, 'a second add says so');
+ assert.match(again.stdout, /pullboard blueprint starters web-app/u, 'a second add points at its starters');
+ const repeat = json(box, 'blueprint', 'add', 'web-app');
+ assert.deepEqual([repeat.marked, repeat.rows, repeat.items, repeat.gate], [true, [], [], null]);
+ const after = snapshot(box);
+ assert.deepEqual(after.files, before.files, 'a second add changes no file bytes');
+ assert.deepEqual(after.events, before.events, 'a second add records no board event');
+
+ // Once added, each starter is filed and names its item id and status.
+ const items = json(box, 'list', '--all').items;
+ const filed = json(box, 'blueprint', 'starters', 'web-app').starters;
+ assert.equal(filed.length, PUBLISHED.items.length, 'every starter is listed');
+ const filedText = box.run('blueprint', 'starters', 'web-app').stdout.split('\n');
+ for (const [index, item] of PUBLISHED.items.entries()) {
+ const onBoard = items.find((entry) => entry.item_title === item.title);
+ assert.ok(onBoard, `${item.title} is on the board`);
+ assert.deepEqual([filed[index].title, filed[index].filed, filed[index].id, filed[index].status], [item.title, true, onBoard.item_id, 'open']);
+ assert.ok(filedText.includes(` #${onBoard.item_id} open ${item.title}`), `${item.title} shows its id:\n${filedText.join('\n')}`);
+ }
+
+ // init --blueprint lists every row that waits for the person, the inherited doctrine row PB7 included.
+ const started = emptyRepo();
+ const init = started.run('init', '--blueprint', 'web-app');
+ assert.equal(init.status, 0, init.stdout + init.stderr);
+ const waiting = JSON.parse(started.run('spec', '--json').stdout).rows.filter((row) => ['draft', 'pending'].includes(row.status));
+ const doctrineRows = waiting.filter((row) => row.file !== 'SPEC.md');
+ const specRows = waiting.filter((row) => row.file === 'SPEC.md');
+ assert.ok(doctrineRows.some((row) => row.id === 'PB7' && row.status === 'pending'), 'the standard doctrine has PB7 pending');
+ assert.equal(specRows.length, PUBLISHED.rules.length + PUBLISHED.questions.length);
+ const lines = init.stdout.split('\n');
+ for (const row of doctrineRows) assert.ok(lines.includes(` ${row.id} ${row.status} ${row.text} (${row.file})`), `init names doctrine row ${row.id}:\n${init.stdout}`);
+ for (const row of specRows) assert.ok(lines.includes(` ${row.id} ${row.status} ${row.text} (SPEC.md)`), `init names spec row ${row.id}:\n${init.stdout}`);
+ assert.ok(lines.includes(` ${waiting.length} rows wait for the person:`), `init counts every waiting row:\n${init.stdout}`);
+ const fromJson = emptyRepo().run('init', '--blueprint', 'web-app', '--json');
+ assert.equal(fromJson.status, 0, fromJson.stdout + fromJson.stderr);
+ assert.deepEqual(JSON.parse(fromJson.stdout).blueprint.waitingRows.map((row) => row.id).sort(), waiting.map((row) => row.id).sort(), 'the JSON lists the same waiting rows');
+
+ // A second init --blueprint says the blueprint is already there.
+ const reinit = started.run('init', '--blueprint', 'web-app');
+ assert.equal(reinit.status, 0, reinit.stdout + reinit.stderr);
+ assert.match(reinit.stdout, /the Web app blueprint \(version 1\) is already on this board; nothing added/u);
+ assert.doesNotMatch(reinit.stdout, /added the Web app blueprint/u);
+});
+
test('blueprint add files a blueprint as drafts after an add stopped part way [S1,I1]', () => {
// A finished add on one board gives the exact rows; a second board is left where an add stops
// after its rows and first starter: the rows and the under-way marker written, item 1 added.