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(cli): pullboard tour, a reject and its rework, scripted [N10]
Corey Olson4ef6e108e70c
diff --git a/README.md b/README.mdindex da7ed172..567c63b4 100644--- a/README.md+++ b/README.md@@ -5,6 +5,7 @@A work board, lanes, a spec and git hooks that live in your repo, for teams of coding agents. Local-first: no account, no server, no network. One SQLite file inside `.git`, zero dependencies, Node 22.13 or newer.```sh+npx @pullboard/local tour # thirty seconds: two scripted agents, a reject and its reworknpm i -D @pullboard/localnpx pullboard init```diff --git a/SPEC.md b/SPEC.mdindex f4365c7a..8b2d8dda 100644--- a/SPEC.md+++ b/SPEC.md@@ -85,7 +85,7 @@ Statuses: approved = decided · draft = proposed · pending = open question · f- N7 [draft, must] `pullboard plan` proposes lanes and items from the spec and the repo; --apply writes them.- N8 [draft, must] `pullboard run` starts configured agent commands per lane and role, under budgets and stops.- N9 [draft, aim] `pullboard report` renders spec coverage, verified items and receipts as one page.-- N10 [draft, aim] `pullboard tour` shows a reject and its rework with scripted agents in thirty seconds.+- N10 [draft, aim] `pullboard tour` shows a reject and its rework with scripted agents in thirty seconds. | gate: test/e2e.test.js- N11 [draft, aim] A git-pullboard bin, so `git pullboard <command>` works.- N12 [draft, aim] `pullboard mcp` serves the same commands as MCP tools.- N13 [approved, must] `next` names items still awaiting a verdict; a lane is done when its items are verified. | gate: test/board.test.js | serves: N2diff --git a/src/cli.js b/src/cli.jsindex 1e93382e..fb554d4d 100644--- a/src/cli.js+++ b/src/cli.js@@ -39,6 +39,7 @@ import { briefFiles } from './brief.js';import { runItems } from './run.js';import { parseProblems, sweepItems } from './sweep.js';import { renderSpecView } from './view.js';+import { tour } from './tour.js';const PACKAGE = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));export const VERSION = PACKAGE.version;@@ -47,6 +48,7 @@ export const HELP = `pullboard ${VERSION}: the local-first work board for teamsNothing ships until a second agent verifies it.Set up+ pullboard tour see it work: a reject and its rework, scripted, in thirty secondspullboard init config, SPEC.md, agent instructions, git hooks, boardpullboard worktree <lane> [--route light] make a worktree for a new agent in a lane, joined, and say what to run nextpullboard join <lane> [--route light] register the worktree you are in as an agent in a lane@@ -639,7 +641,7 @@ function readCommands(io, { first, values }) {}));const built = items.filter((item) => item.item_built_by && item.item_status !== 'withdrawn').reverse();const cell = (text) => String(text ?? '').replace(/\|/g, '/').replace(/\s+/g, ' ');- io.say(`${stats.items.verified} verified by a second agent · ${stats.items.submitted} awaiting verification · ${stats.rejected} rejections along the way`);+ io.say(`${stats.items.verified} verified by a second agent · ${stats.items.submitted} awaiting verification · ${stats.rejected} rejection${stats.rejected === 1 ? '' : 's'} along the way`);io.say('');io.say('| # | Lane | Item | Spec | Built by | Verified by | Commit | Merged |');io.say('| --- | --- | --- | --- | --- | --- | --- | --- |');@@ -1151,6 +1153,7 @@ export async function main(argv, streams) {}const args = { first, second, rest, values };try {+ if (command === 'tour') return tour(io);if (command === 'spec') return specCommand(io, args);if (command === 'prompt') {let root = io.cwd;diff --git a/src/tour.js b/src/tour.jsnew file mode 100644index 00000000..2dd7609d--- /dev/null+++ b/src/tour.js@@ -0,0 +1,172 @@+/**+ * `pullboard tour` (N10): the method in thirty seconds, on a throwaway repo. A coordinator and two+ * scripted agents run real pullboard and git commands: a builder submits work that misses an edge,+ * a second agent finds it and rejects, and the rework is accepted. No model runs and nothing leaves+ * the machine; the repo stays behind to look around in.+ */+import { spawnSync } from 'node:child_process';+import { chmodSync, mkdirSync, mkdtempSync, realpathSync, writeFileSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join } from 'node:path';+import { fileURLToPath } from 'node:url';++const BIN = fileURLToPath(new URL('../bin/pullboard.js', import.meta.url));++const SPEC = `# Greeter++## G · Goals+- G1 [approved, must] \`greet(name)\` returns "Hello, <name>!"; a blank name greets the world: "Hello, world!". | gate: src/greet.test.mjs+`;++const CONFIG = {+ gate: 'node --test',+ spec: 'SPEC.md',+ verify: 'any',+ lease: '2h',+ lanes: { app: { owns: ['src/'], specs: ['G'] }, review: { owns: [] } },+ shared: [],+};++const FIRST = 'export const greet = (name) => `Hello, ${name}!`;\n';+const FIXED = "export const greet = (name) => `Hello, ${name.trim() || 'world'}!`;\n";+const TEST = `import assert from 'node:assert/strict';+import { test } from 'node:test';+import { greet } from './greet.mjs';++test('greets by name [G1]', () => assert.equal(greet('Ada'), 'Hello, Ada!'));+`;+const EDGE_TEST = `${TEST}test('a blank name greets the world [G1]', () => assert.equal(greet(' '), 'Hello, world!'));\n`;+const TRY_EDGE = ['--input-type=module', '-e', "const { greet } = await import('./src/greet.mjs'); console.log(greet(''))"];++/**+ * Arguments as a person would type them.+ *+ * @param {string[]} args+ * @returns {string}+ */+const typed = (args) => args.map((arg) => (/[\s"'$|()]/.test(arg) ? JSON.stringify(arg) : arg)).join(' ');++/**+ * A step that did not do what the script expects, with what it printed.+ */+class TourStopped extends Error {}++/**+ * Block for a moment, so a person can read along.+ *+ * @param {number} ms+ */+function pause(ms) {+ if (ms > 0) Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);+}++/**+ * Run the tour. Pauses only when a person is watching a terminal.+ *+ * @param {{ say: (line: string) => void, stdout: any }} io+ * @returns {number}+ */+export function tour(io) {+ const pace = io.stdout.isTTY ? 1 : 0;+ const dir = realpathSync(mkdtempSync(join(tmpdir(), 'pullboard-tour-')));+ const shims = join(dir, '.bin');+ mkdirSync(shims);+ writeFileSync(join(shims, 'pullboard'), `#!/bin/sh\nexec "${process.execPath}" "${BIN}" "$@"\n`);+ chmodSync(join(shims, 'pullboard'), 0o755);+ // The person's git config stays out of it: no signing prompts, no global hooks.+ const env = { ...process.env, PATH: `${shims}:${process.env.PATH}`, GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_NOSYSTEM: '1' };+ delete env.NODE_TEST_CONTEXT;+ const repo = join(dir, 'greeter');+ const app = `${repo}-app-1`;+ const review = `${repo}-review-1`;+ const where = { coordinator: repo, 'app-1': app, 'review-1': review };++ /**+ * Run one command as an agent, show it and the lines of its output worth reading.+ */+ const run = (who, file, args, { label = `${file} ${typed(args)}`, show = /./, fails = false } = {}) => {+ pause(400 * pace);+ if (label) io.say(` ${who} $ ${label}`);+ const result = spawnSync(file, args, {+ cwd: where[who],+ encoding: 'utf8',+ env: { ...env, GIT_AUTHOR_NAME: who, GIT_AUTHOR_EMAIL: `${who}@tour.invalid`, GIT_COMMITTER_NAME: who, GIT_COMMITTER_EMAIL: `${who}@tour.invalid` },+ });+ if ((result.status === 0) === fails) {+ const said = `${result.stdout ?? ''}${result.stderr ?? ''}${result.error?.message ?? ''}`;+ throw new TourStopped(`${label || `${file} ${typed(args)}`} ${fails ? 'passed, and should have failed' : `exited ${result.status}`}\n${said}`);+ }+ for (const line of result.stdout.split('\n').filter((text) => text && show?.test(text))) io.say(` ${line.replaceAll(`${dir}/`, '')}`);+ return result.stdout.trim();+ };+ const pb = (who, args, options) => run(who, process.execPath, [BIN, ...args], { label: `pullboard ${typed(args)}`, ...options });+ const write = (who, files) => {+ for (const [path, text] of Object.entries(files)) {+ mkdirSync(join(where[who], path, '..'), { recursive: true });+ writeFileSync(join(where[who], path), text);+ }+ };+ const step = (n, text) => {+ pause(1200 * pace);+ io.say(`\n${n} ${text}`);+ };++ io.say('pullboard tour: a coordinator and two scripted agents run real commands on a throwaway repo. No model runs.');+ try {+ mkdirSync(repo);+ run('coordinator', 'git', ['init', '-q', '-b', 'main'], { label: '' });+ pb('coordinator', ['init'], { label: '', show: null });+ write('coordinator', { 'pullboard.json': `${JSON.stringify(CONFIG, null, 2)}\n`, 'SPEC.md': SPEC });+ run('coordinator', 'git', ['add', '-A'], { label: '' });+ run('coordinator', 'git', ['commit', '-q', '-m', 'chore: the greeter, on pullboard'], { label: '' });++ step(1, 'The person approved one spec row. The coordinator files it as work.');+ io.say(' G1: greet(name) returns "Hello, <name>!"; a blank name greets the world: "Hello, world!"');+ pb('coordinator', ['add', 'app', 'Greeting', '--specs', 'G1', '--criterion', 'greet() meets G1']);++ step(2, 'A builder agent gets its own worktree in the app lane and claims the next item. Its criterion freezes.');+ pb('coordinator', ['worktree', 'app'], { show: /^made /, label: 'pullboard worktree app' });+ pb('app-1', ['next'], { show: /^claimed|^criterion/ });++ step(3, 'It writes greet(), tests the happy path and submits. Its own gate is green.');+ write('app-1', { 'src/greet.mjs': FIRST, 'src/greet.test.mjs': TEST });+ run('app-1', 'git', ['add', '-A'], { label: '' });+ run('app-1', 'git', ['commit', '-q', '-m', 'feat(app): greet by name [G1]']);+ const first = pb('app-1', ['submit', '1'], { show: /^submitted/ }).match(/at ([0-9a-f]{12})/)[1];++ step(4, 'A second agent checks out exactly that commit and tries the edge the builder skipped.');+ pb('coordinator', ['worktree', 'review'], { show: /^made /, label: 'pullboard worktree review' });+ run('review-1', 'git', ['switch', '-q', '--detach', first]);+ const edge = run('review-1', process.execPath, TRY_EDGE, { label: "node -e \"greet('')\"" });+ pb('review-1', ['verify', '1', 'reject', '--reason', 'BEHAVIOR_MISMATCH', '--note', `greet('') returns "${edge}"; G1 says a blank name greets the world`]);++ step(5, "The builder's next session starts from the board, not from memory.");+ pb('app-1', ['resume'], { show: /^sent back|^next/ });++ step(6, 'It fixes the edge, adds a test that pins it, and submits a new commit.');+ pb('app-1', ['claim', '1'], { show: /^claimed/ });+ write('app-1', { 'src/greet.mjs': FIXED, 'src/greet.test.mjs': EDGE_TEST });+ run('app-1', 'git', ['commit', '-q', '-am', 'fix(app): a blank name greets the world [G1]']);+ const second = pb('app-1', ['submit', '1'], { show: /^submitted/ }).match(/at ([0-9a-f]{12})/)[1];++ step(7, 'The verifier breaks the fix on purpose, to prove the new test can fail, then restores it and accepts.');+ run('review-1', 'git', ['switch', '-q', '--detach', second]);+ write('review-1', { 'src/greet.mjs': FIRST });+ run('review-1', process.execPath, ['--test'], { label: 'node --test # with the fix removed', show: /^# (pass|fail)/, fails: true });+ run('review-1', 'git', ['checkout', '--', 'src/greet.mjs']);+ pb('review-1', ['verify', '1', 'accept', '--note', 'removed the blank-name fix: its new test failed; restored, both pass'], { show: /^verified/ });++ step(8, 'The coordinator merges it. The ledger is the receipt.');+ run('coordinator', 'git', ['merge', '-q', '--ff-only', 'app/1']);+ pb('coordinator', ['merged', '1', second]);+ pb('coordinator', ['ledger'], { show: /^\| (#|1 )|verified by a second agent/ });+ } catch (error) {+ if (!(error instanceof TourStopped)) throw error;+ io.say(`\nThe tour stopped: ${error.message.trimEnd()}`);+ io.say(`The repo is at ${repo}`);+ return 1;+ }+ io.say('\nNothing shipped until a second agent verified it.');+ io.say(`Look around: cd ${repo} && pullboard log`);+ return 0;+}diff --git a/test/e2e.test.js b/test/e2e.test.jsindex 360d0078..0f1afe8b 100644--- a/test/e2e.test.js+++ b/test/e2e.test.js@@ -611,3 +611,23 @@ test('init adds a Claude Code session hook that runs resume, and keeps every othassert.equal(bare.status, 0, 'without pullboard installed, the session still starts');assert.equal(bare.stdout, '');});++test('the tour runs a reject and its rework on a throwaway repo, in under thirty seconds [N10]', () => {+ const box = sandbox();+ const started = Date.now();+ const shown = spawnSync(process.execPath, [BIN, 'tour'], { cwd: box.dir, env: { ...box.env, TMPDIR: box.dir }, encoding: 'utf8' });+ assert.equal(shown.status, 0, `${shown.stdout}${shown.stderr}`);+ assert.ok(Date.now() - started < 30_000, 'thirty seconds');+ assert.match(shown.stdout, /review-1 \$ pullboard verify 1 reject --reason BEHAVIOR_MISMATCH/);+ assert.match(shown.stdout, /sent back: #1 BEHAVIOR_MISMATCH by review-1: greet\(''\) returns "Hello, !"/);+ assert.match(shown.stdout, /with the fix removed\n {7}# pass 1\n {7}# fail 1/);+ assert.match(shown.stdout, /verified #1: CRITERION_MET/);+ assert.match(shown.stdout, /\| 1 \| app \| Greeting \| G1 \| app-1 \| review-1 \|/);+ const repo = /Look around: cd (\S+) && pullboard log/.exec(shown.stdout)[1];+ assert.match(box.git(repo, 'log', '--format=%an %s', '-1'), /^app-1 fix\(app\): a blank name greets the world \[G1\]$/);+ const empty = join(box.dir, 'empty');+ mkdirSync(empty);+ const stopped = spawnSync(process.execPath, [BIN, 'tour'], { cwd: box.dir, env: { ...box.env, TMPDIR: box.dir, PATH: empty }, encoding: 'utf8' });+ assert.equal(stopped.status, 1);+ assert.match(stopped.stdout, /The tour stopped: git init -q -b main exited null/);+});