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.

Merge remote-tracking branch 'origin/main' into core/734-claude

Corey Olson956a43737537
diff --cc docs/api.md
index a4908eda,8dbfe183..a73e5819
--- a/docs/api.md
+++ b/docs/api.md
@@@ -115,9 -123,8 +123,9 @@@ For example: `flow: review wait averag
| `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` |
+ | `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 --cc src/cli.js
index c3241304,3c5fb08f..5359405e
--- a/src/cli.js
+++ b/src/cli.js
@@@ -61,9 -62,9 +62,10 @@@ import
} from './spec.js';
import { answerQuestion, bundledBlueprints, planBlueprint, readBlueprint, saveBlueprint } from './blueprints.js';
import { briefFiles } from './brief.js';
+ import { commitFirst, commitOwnerLines, commitOwners, coordinatorInbox, coordinatorInboxLines, inboxFirst } from './resume.js';
import { checkBaseline, prepareCheckBaseline, sayCheckBaseline } from './check-baseline.js';
import { retryCheckBaselines, startCheckBaseline } from './check-baseline-worker.js';
+import { blueprintRowIds, 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';
@@@ -1681,12 -1683,11 +1686,13 @@@ function setupCommands(io, { first, sec
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}` : ''}`);
+ + `${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}` : ''}`);
+ for (const note of askedLaneNotes(added.items, loadConfig(info.root))) io.say(` ${note}`);
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()
diff --cc src/json.js
index ee60f363,15e14d21..60fbc14d
--- a/src/json.js
+++ b/src/json.js
@@@ -77,9 -77,8 +77,9 @@@ 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' }),
+ 'blueprint add': shape({ blueprint: 'object', section: 'string', rows: 'array', items: 'array', gate: 'string|null', proposedLanes: 'array' }),
'spec unmet': shape({ rows: 'array' }),
'spec signoff': shape({ count: 'number', by: 'string', ids: 'array', evidence: 'array' }),
'spec signers': shape({ added: 'boolean', by: 'string', path: 'string', initial: 'boolean' }),
diff --cc test/blueprint.test.js
index 9ddfe05f,470e247b..6873ccba
--- a/test/blueprint.test.js
+++ b/test/blueprint.test.js
@@@ -350,84 -350,69 +350,144 @@@ test('blueprint add files a blueprint a
...PUBLISHED.rules.map((entry) => [entry.key, 'draft']), ...PUBLISHED.questions.map((entry) => [entry.key, 'pending'])]);
const spec = parseSpec(readFileSync(file, 'utf8'));
assert.deepEqual(spec.rows.filter((row) => row.status === 'approved').map((row) => row.id), ['A1', 'A2']);
- assert.equal(spec.rows.filter((row) => row.section === 'A · Web app').length, 12);
+ assert.equal(spec.rows.filter((row) => row.section === 'A · Web app').length, 13);
+ });
+
+ test('bundled blueprint rows carry their checks [S1,I1]', async () => {
+ // Imported here so the file's import lines stay as they are for the items editing them now.
+ const { questionText, ruleText, saveBlueprint } = await import('../src/blueprints.js');
+ const rule = (blueprint, key) => blueprint.rules.find((entry) => entry.key === key);
+ const library = readBlueprint('library', process.cwd());
+ const reliability = readBlueprint('test-reliability', process.cwd());
+ const web = readBlueprint('web-app', process.cwd());
+
+ // library: a row for the changelog its summary promises, with a reason and a gate.
+ assert.match(library.summary, /changelog/u);
+ const changelog = library.rules.filter((entry) => /\bchangelog\b/u.test(entry.text));
+ assert.equal(changelog.length, 1, 'library files one rule for the changelog it promises');
+ assert.ok(changelog[0].why.trim() && changelog[0].gate.trim(), 'the changelog rule gives a reason and names a gate');
+
+ // LIB1 and LIB2 carry a machine check: a test file their own starter's check runs, not review.
+ for (const key of ['LIB1', 'LIB2']) {
+ const { gate } = rule(library, key);
+ assert.match(gate, /^test\/[\w.-]+\.test\.js$/u, `${key} names a test file as its gate, a machine check`);
+ assert.ok(library.items.some((item) => item.cites.includes(key) && item.check.includes(gate)), `${key}'s gate is a test its own starter's check runs`);
+ }
+ // LIB1 keeps its card text and says what holds before 1.0.
+ assert.equal(rule(library, 'LIB1').text, 'A breaking change bumps the major version.');
+ assert.match(ruleText(rule(library, 'LIB1')), /before 1\.0[^.]*\bminor\b/u, 'LIB1 says a breaking change bumps the minor version before 1.0');
+
+ // test-reliability: a flake fix is proven by repeated runs, with a question for the run count.
+ const proven = reliability.rules.find((entry) => entry.text === 'A flake fix is proven by repeated runs.');
+ assert.ok(proven, 'test-reliability carries "A flake fix is proven by repeated runs."');
+ assert.match(proven.gate, /\brun\b.*\bin a row\b/u, 'the flake-fix rule is gated on the repeated runs themselves');
+ const runs = reliability.questions.find((entry) => /\bruns in a row\b/u.test(entry.ask));
+ assert.ok(runs, 'test-reliability asks how many runs in a row prove a flake fix');
+ assert.ok(runs.choices.length <= 12 && runs.choices.every((choice) => /^\d+$/u.test(choice)), 'the run count choices are whole numbers, 12 or fewer');
+ assert.match(proven.gate, /run count question/u, 'the flake-fix gate points at the run count question');
+
+ // web-app: its tests bind a local port, so a sandboxed agent asks the person, never rewrites them.
+ const port = web.rules.filter((entry) => /\blocal port\b/u.test(entry.text));
+ assert.equal(port.length, 1, 'web-app says its tests bind a local port');
+ assert.match(port[0].text, /sandbox[^.]*asks the person instead of rewriting the tests/u, 'a sandboxed agent asks the person instead of rewriting the tests');
+
+ // Every row marked must names a gate, in every bundled file, so an approved row passes spec check.
+ for (const name of bundledBlueprints()) {
+ const raw = JSON.parse(readFileSync(resolve(import.meta.dirname, `../src/blueprints/${name}.json`), 'utf8'));
+ for (const entry of raw.rules ?? []) {
+ if (entry.tier !== 'must') continue;
+ assert.ok(typeof entry.gate === 'string' && entry.gate.trim(), `${name} ${entry.key} is marked must and names a gate`);
+ assert.doesNotMatch(entry.gate, UNSAFE_CHECK, `${name} ${entry.key}'s gate runs nothing unsafe`);
+ }
+ }
+
+ // The new and changed rows round-trip through blueprint save exactly as written. Save keeps a
+ // question only when its row reads back one way, so the run count's default sits between choices.
+ const rows = [
+ ...[rule(library, 'LIB1'), rule(library, 'LIB2'), changelog[0], proven, port[0]].map((entry, index) => `- R${index + 1} [approved, must] ${ruleText(entry)} | gate: review`),
+ `- R9 [approved, must] ${questionText(runs)} | gate: review`,
+ ];
+ const saved = saveBlueprint(parseSpec(`# Spec\n\n## R · Rows\n\n${rows.join('\n')}\n`), { names: [] });
+ assert.deepEqual(saved.left, [], 'no new or changed row is left out of a save');
+ assert.deepEqual(saved.blueprint.questions.map(({ ask, choices, default: answer }) => ({ ask, choices, default: answer })), [{ ask: runs.ask, choices: runs.choices, default: runs.default }]);
+ assert.equal(saved.blueprint.rules.length, 5);
});
+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, even with an older unrelated item
+ // filed under a starter's title that cites no blueprint row (review 12394).
+ const box = freshBoard();
+ const decoy = json(box, 'add', 'coordinator', PUBLISHED.items[0].title).item;
+ assert.equal(decoy.item_spec_ids ?? '', '', 'the unrelated item cites no row');
+ 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.
+ const firstAdd = json(box, 'blueprint', 'add', 'web-app');
+ assert.equal(firstAdd.items.length, PUBLISHED.items.length, 'the add files every starter');
+ 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 names the item its add filed, never the unrelated same-title item.
+ 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 own = firstAdd.items.find((entry) => entry.key === item.key);
+ assert.ok(own && own.id !== decoy.item_id, `${item.title} was filed by the add as its own item`);
+ assert.notEqual(filed[index].id, decoy.item_id, `${item.title} never names the unrelated item #${decoy.item_id}`);
+ assert.deepEqual([filed[index].title, filed[index].filed, filed[index].id, filed[index].status], [item.title, true, own.id, 'open']);
+ assert.ok(filedText.includes(` #${own.id} open ${item.title}`), `${item.title} shows its id:\n${filedText.join('\n')}`);
+ }
+ assert.ok(!filedText.some((line) => line.startsWith(` #${decoy.item_id} `)), `the unrelated item is never listed:\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.