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
Merge remote-tracking branch 'origin/main' into core/725-claude
Corey Olson1d3ff37d7e6e
diff --cc src/blueprints/test-reliability.jsonindex 6dbaf9d4,264e9e75..08ec79f0--- a/src/blueprints/test-reliability.json+++ b/src/blueprints/test-reliability.json@@@ -9,9 -9,14 +9,14 @@@"prefix": "TR","rules": [{ "key": "TR1", "text": "No test waits on the wall clock or a fixed sleep.", "why": "a test that sleeps is slow on an idle machine and flaky on a busy one." },- { "key": "TR2", "text": "A flake is pinned on a change only after a run without it.", "why": "a test that fails under load looks like a broken change until it fails without that change too." }+ { "key": "TR2", "text": "A flake is pinned on a change only after a run without it.", "why": "a test that fails under load looks like a broken change until it fails without that change too." },+ { "key": "TR3", "text": "A flake fix is proven by repeated runs.", "why": "a flaky test already passes some of the time, so one green run after a fix proves nothing; only a run of passes shows the flake is gone.", "tier": "must", "gate": "the whole test suite, run as many times in a row as the run count question says, every run passing" }],"questions": [- { "key": "Q1", "ask": "Tests run with", "choices": ["node:test", "Vitest", "Jest", "Mocha", "pytest", "Something else"], "detect": "test-runner" }- { "key": "Q1", "ask": "Tests run with", "choices": ["Vitest", "Jest", "pytest", "Something else"], "default": "Vitest" },++ { "key": "Q1", "ask": "Tests run with", "choices": ["node:test", "Vitest", "Jest", "Mocha", "pytest", "Something else"], "detect": "test-runner" },+ { "key": "Q2", "ask": "A flake fix passes this many runs in a row", "choices": ["5", "10", "20"], "default": "10" }+ ],+ "items": [+ { "key": "1", "title": "Find a flaky test and make it deterministic", "cites": ["TR1", "TR2"], "criterion": "A test that failed in repeated runs of the unchanged suite is found, named in the submit note, and fixed so the suite passes ten runs in a row with no sleep or wall-clock wait. Before the fix, ten repeated runs of npm test fail at least once.", "brief": "Files:\n- the flaky test and the code it waits on\nTest:\n- run npm test twenty times with nothing changed to find a test that fails some of the time (TR2)\n- replace its sleep or wall-clock wait with a fake clock or an awaited event (TR1), then run the check", "check": "set -e; for run in 1 2 3 4 5 6 7 8 9 10; do npm test; done" }]}diff --cc src/blueprints/web-app.jsonindex 42a80984,8dc703d5..d46cf609--- a/src/blueprints/web-app.json+++ b/src/blueprints/web-app.json@@@ -14,10 -14,11 +14,11 @@@{ "key": "W3", "text": "Every page works at phone width before it ships.", "why": "a page that only works on a laptop is a bug nobody reports." },{ "key": "W4", "text": "Secrets never appear in code, logs or commits.", "why": "a key pushed once stays public, even after you delete it." },{ "key": "W5", "text": "A new dependency comes with a one-line reason.", "why": "every package you add is code you now maintain." },- { "key": "W6", "text": "An error a person sees says what to do next.", "why": "\"something went wrong\" is a support ticket waiting to happen." }+ { "key": "W6", "text": "An error a person sees says what to do next.", "why": "\"something went wrong\" is a support ticket waiting to happen." },+ { "key": "W7", "text": "Tests bind a local port, so a sandboxed agent asks the person instead of rewriting the tests.", "why": "a test rewritten into a fake passes inside the sandbox and proves nothing about the real server.", "tier": "must", "gate": "review" }],"questions": [- { "key": "Q1", "ask": "The app is built with", "choices": ["Next.js", "SvelteKit", "Rails", "Something else"], "default": "Next.js" },+ { "key": "Q1", "ask": "The app is built with", "choices": ["Next.js", "SvelteKit", "Rails", "Something else"], "detect": "framework" },{ "key": "Q2", "ask": "It deploys to", "choices": ["Vercel", "Netlify", "Fly.io", "My own server"], "default": "Vercel" },{ "key": "Q3", "ask": "People sign in with", "choices": ["Email links", "Passwords", "Google", "No sign-in yet"], "default": "Email links" },{ "key": "Q4", "ask": "A change is done when", "choices": ["It runs on a preview link", "Its tests pass", "I have looked at it"], "default": "It runs on a preview link" }diff --cc src/cli.jsindex bde7d379,3c5fb08f..589dfc87--- a/src/cli.js+++ b/src/cli.js@@@ -58,8 -60,9 +60,9 @@@ importstandings,unmetRows,} from './spec.js';- import { bundledBlueprints, landBlueprint, planBlueprint, readBlueprint, repoAnswers, saveBlueprint } from './blueprints.js';-import { answerQuestion, bundledBlueprints, planBlueprint, readBlueprint, saveBlueprint } from './blueprints.js';++import { answerQuestion, bundledBlueprints, landBlueprint, planBlueprint, readBlueprint, repoAnswers, 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 { compareMainFailures, mainRedMessage, mainRedReworkItems } from './main-red.js';diff --cc test/blueprint.test.jsindex 3aca9441,470e247b..d8a50622--- a/test/blueprint.test.js+++ b/test/blueprint.test.js@@@ -390,70 -556,69 +556,133 @@@ test('blueprint add files a blueprint a}});+/** The text of the one pending row in the repo's SPEC.md whose question starts with the ask. */+function pendingQuestion(repo, ask) {+ const rows = parseSpec(readFileSync(join(repo, 'SPEC.md'), 'utf8')).rows.filter((row) => row.status === 'pending' && row.text.startsWith(`${ask}: `));+ assert.equal(rows.length, 1, `one pending "${ask}" row`);+ return rows[0].text;+}++const RUNNERS = 'Choices: node:test, Vitest, Jest, Mocha, pytest, Something else.';+const FRAMEWORKS = 'Choices: Next.js, SvelteKit, Rails, Something else.';++test('a question defaults from the repo it lands in [S1,I1]', () => {+ const runners = readBlueprint('test-reliability', import.meta.dirname).questions[0].choices;+ assert.ok(['node:test', 'Mocha', 'Vitest', 'Jest', 'pytest'].every((choice) => runners.includes(choice)), 'the test-runner question offers node:test and Mocha besides Vitest, Jest and pytest');++ // init --blueprint in a node --test project: the test runner is read from scripts.test.+ const node = emptyRepo();+ writeFileSync(join(node.repo, 'package.json'), `${JSON.stringify({ name: 'app', scripts: { test: 'node --test test/' } })}\n`);+ const started = node.run('init', '--blueprint', 'test-reliability');+ assert.equal(started.status, 0, started.stdout + started.stderr);+ assert.equal(pendingQuestion(node.repo, 'Tests run with'), `Tests run with: node:test. ${RUNNERS}`, 'a node --test project defaults to node:test');++ // blueprint add in a Next.js project: the framework is read from dependencies.+ const next = freshBoard();+ writeFileSync(join(next.repo, 'package.json'), `${JSON.stringify({ name: 'web', dependencies: { next: '15.0.0', react: '19.0.0' } })}\n`);+ next.git('add', '-A');+ next.git('commit', '-q', '-m', 'chore: a Next.js app');+ json(next, 'blueprint', 'add', 'web-app');+ assert.equal(pendingQuestion(next.repo, 'The app is built with'), `The app is built with: Next.js. ${FRAMEWORKS}`, 'a Next.js project defaults to Next.js');++ // No test script: one test runner among devDependencies is the answer.+ const mocha = freshBoard();+ writeFileSync(join(mocha.repo, 'package.json'), `${JSON.stringify({ name: 'lib', devDependencies: { mocha: '10.0.0' } })}\n`);+ mocha.git('add', '-A');+ mocha.git('commit', '-q', '-m', 'chore: a Mocha library');+ json(mocha, 'blueprint', 'add', 'test-reliability');+ assert.equal(pendingQuestion(mocha.repo, 'Tests run with'), `Tests run with: Mocha. ${RUNNERS}`, 'a devDependency names the test runner');++ // A detected answer the question does not offer is never used: the blueprint's own default stands.+ const narrow = { ...PUBLISHED, name: 'narrow', title: 'Narrow', prefix: 'NAR', items: [],+ questions: [{ key: 'Q1', ask: 'Its runner is', choices: ['Vitest', 'Jest'], default: 'Jest', detect: 'test-runner' }] };+ writeFileSync(join(mocha.repo, 'narrow.json'), `${JSON.stringify(narrow)}\n`);+ json(mocha, 'blueprint', 'add', 'narrow.json');+ assert.equal(pendingQuestion(mocha.repo, 'Its runner is'), 'Its runner is: Jest. Choices: Vitest, Jest.', 'an answer outside the choices is never used');+});++test('a question with nothing to read has no default [S1,I1]', () => {+ // No package.json at all, and one that names nothing a question asks about.+ const bare = emptyRepo();+ const started = bare.run('init', '--blueprint', 'test-reliability');+ assert.equal(started.status, 0, started.stdout + started.stderr);+ assert.equal(pendingQuestion(bare.repo, 'Tests run with'), `Tests run with: (choose one). ${RUNNERS}`, 'no package.json leaves the test runner unanswered');+ const plain = freshBoard();+ writeFileSync(join(plain.repo, 'package.json'), `${JSON.stringify({ name: 'web', scripts: { test: 'make check' }, dependencies: { express: '5.0.0' } })}\n`);+ plain.git('add', '-A');+ plain.git('commit', '-q', '-m', 'chore: an app with nothing to read');+ json(plain, 'blueprint', 'add', 'web-app');+ assert.equal(pendingQuestion(plain.repo, 'The app is built with'), `The app is built with: (choose one). ${FRAMEWORKS}`, 'no known framework leaves the question unanswered');+ // A blueprint without a default for a question it cannot detect is valid and files the same way.+ const own = { ...PUBLISHED, name: 'own', title: 'Own', prefix: 'OWN', items: [], questions: [{ key: 'Q1', ask: 'Its colour is', choices: ['Red', 'Blue'] }] };+ writeFileSync(join(plain.repo, 'own.json'), `${JSON.stringify(own)}\n`);+ json(plain, 'blueprint', 'add', 'own.json');+ assert.equal(pendingQuestion(plain.repo, 'Its colour is'), 'Its colour is: (choose one). Choices: Red, Blue.');+});++ 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 blueprint that names an existing lane owning no folders, a verifier lane: that lane builds+ // nothing, so every starter goes to the first build lane, and add says so.+ const verifier = freshBoard({ lanes: { tests: { owns: [] } } });+ const web = verifier.run('lane', 'add', 'web', '--owns', 'web/');+ assert.equal(web.status, 0, web.stdout + web.stderr);+ writeFileSync(join(verifier.repo, 'verifier-lane.json'), `${JSON.stringify({ ...PUBLISHED, name: 'verifier-lane',+ items: PUBLISHED.items.map((item) => ({ ...item, lane: 'tests' })) })}\n`);+ const moved = verifier.run('blueprint', 'add', 'verifier-lane.json');+ assert.equal(moved.status, 0, moved.stdout + moved.stderr);+ assert.deepEqual(lanesOf(verifier), Array(PUBLISHED.items.length).fill('web'), 'a starter naming a lane that owns no folders goes to the first build lane');+ assert.match(moved.stdout, /asked for the tests lane, which owns no folders, so (?:it is|they are) filed in the web lane/u, 'add says the named lane was not used');++ // 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);