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(spec): show sign-off notes and evidence [S14,S15,S16]
Corey Olsone4f438188d3c
diff --git a/src/cli.js b/src/cli.jsindex 3ec196e6..c8667a9d 100644--- a/src/cli.js+++ b/src/cli.js@@ -43,6 +43,7 @@ import { parseProblems, sweepItems } from './sweep.js';import { renderSpecView } from './view.js';import { tour } from './tour.js';import { forgetProject, registerProject } from './projects.js';+import { citedTestFiles, rowEvidence, rowStage } from './evidence.js';import { serveView } from './serve.js';const PACKAGE = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));@@ -115,6 +116,7 @@ Specpullboard spec check lint SPEC.md and PRACTICE.mdpullboard spec view [--out file] the spec, open questions, sign-offs and practice as one pagepullboard spec show <id> | unmet [--must] | signoff <ids> --by <initials>+ signoff: --note "what was checked" stays with the receiptRole guidespullboard prompt decompose|plan|signoff|review|verify how to do each role; Claude Code gets them as skills@@ -1317,6 +1319,14 @@ function citations(ctx, { ids, since }) {return cited;}+/** Current board evidence, with each item's accepting receipts included once. */+function specProof(ctx) {+ return withBoard(ctx, (board) => {+ const items = store.listItems(board, { all: true });+ return { items, verdicts: items.flatMap((item) => store.verdictsFor(board, item.item_id)) };+ });+}+/*** The spec commands: JSON rows, check, view, show, unmet, signoff.*@@ -1380,17 +1390,34 @@ function specCommand(io, { first, second, rest, values }) {if (row.gate) io.say(`gate: ${row.gate}`);if (row.serves.length) io.say(`serves: ${row.serves.join(', ')}`);io.say(`signed: ${standing.met.map((entry) => `${entry.by} ${entry.on}`).join(', ') || 'no'}${standing.stale.length ? `; stale: ${standing.stale.length}` : ''}`);+ for (const entry of [...standing.met, ...standing.stale]) if (entry.note) io.say(`note (${entry.by}): ${entry.note}`);return 0;}if (first === 'unmet') {const rows = unmetRows(spec.rows, signoffs, { mustOnly: values.must });- rows.forEach((row) => io.say(`${row.id} [${row.tier || 'no tier'}] ${row.text}`));+ const proof = specProof(ctx);+ const testFiles = citedTestFiles(ctx.info.root);+ const by = standings(spec.rows, signoffs);+ rows.forEach((row) => io.say(`${row.id} [${row.tier || 'no tier'}] ${row.text} — ${rowStage(by.get(row.id), rowEvidence(ctx.info.root, row.id, { ...proof, testFiles }))}`));io.say(`${rows.length} approved rows without a current sign-off`);return 0;}if (first === 'signoff') {const ids = [second, ...rest].filter(Boolean).flatMap((text) => idList(text));- const count = signOff(ctx.info.root, spec, { ids, by: values.by ?? '', on: new Date().toISOString().slice(0, 10) });+ if (!ids.length) throw new Refused('USAGE', 'pullboard spec signoff <ids> --by <name> [--note "what was checked"]');+ const invalid = ids.filter((id) => spec.rows.find((row) => row.id === id)?.status !== 'approved');+ if (invalid.length) throw new Refused('CANNOT_SIGN', `${invalid.join(', ')}: only approved rows in this spec are signed`);+ const proof = specProof(ctx);+ const testFiles = citedTestFiles(ctx.info.root);+ const evidence = ids.map((id) => ({ id, ...rowEvidence(ctx.info.root, id, { ...proof, testFiles }) }));+ const missing = evidence.filter((row) => !row.files.length && !row.verified.length).map((row) => row.id);+ if (missing.length) throw new Refused('NO_EVIDENCE', `${missing.join(', ')} has no evidence; build it or cite its id in a test first`);+ for (const row of evidence) {+ io.say(`evidence for ${row.id}:`);+ for (const file of row.files) io.say(` test: ${file}`);+ for (const item of row.verified) io.say(` verified #${item.id}: ${item.note || '(no accepting note)'}`);+ }+ const count = signOff(ctx.info.root, spec, { ids, by: values.by ?? '', on: new Date().toISOString().slice(0, 10), note: values.note ?? '' });io.say(`signed ${count} rows as ${values.by}; commit .pullboard/signoffs.jsonl`);return 0;}diff --git a/src/spec.js b/src/spec.jsindex 1c85b4e9..9bbca550 100644--- a/src/spec.js+++ b/src/spec.js@@ -287,10 +287,10 @@ export function unmetRows(rows, signoffs, { mustOnly = false } = {}) {** @param {string} root* @param {ReturnType<typeof parseSpec>} spec- * @param {{ ids: string[], by: string, on: string }} signoff+ * @param {{ ids: string[], by: string, on: string, note?: string }} signoff* @returns {number} How many rows were signed.*/-export function signOff(root, spec, { ids, by, on }) {+export function signOff(root, spec, { ids, by, on, note = '' }) {if (!SIGNER_RE.test(by)) {throw new Refused('BAD_SIGNER', 'sign with initials or a first name: --by CO');}@@ -303,7 +303,7 @@ export function signOff(root, spec, { ids, by, on }) {if (problems.length) throw new Refused('CANNOT_SIGN', problems.join('; '));const file = join(root, SIGNOFFS_FILE);mkdirSync(dirname(file), { recursive: true });- const lines = ids.map((id) => JSON.stringify({ id, by, on, text: byId.get(id).text }));+ const lines = ids.map((id) => JSON.stringify({ id, by, on, text: byId.get(id).text, ...(note ? { note } : {}) }));appendFileSync(file, `${lines.join('\n')}\n`);return ids.length;}diff --git a/src/view.js b/src/view.jsindex a7bba5ee..86efdc16 100644--- a/src/view.js+++ b/src/view.js@@ -27,10 +27,12 @@ function signoffCell(row, by) {const standing = by.get(row.id);if (standing?.met.length) {const names = standing.met.map((entry) => `${esc(entry.by)} ${esc(entry.on)}`).join(', ');- return { html: `<span class="so so-met">signed ${names}</span>`, state: 'met' };+ const notes = standing.met.filter((entry) => entry.note).map((entry) => `<div>${esc(entry.by)}: ${esc(entry.note).replaceAll('\n', '<br>')}</div>`).join('');+ return { html: `<span class="so so-met">signed ${names}</span>${notes}`, state: 'met' };}if (standing?.stale.length) {- return { html: '<span class="so so-stale">stale: text changed since sign-off</span>', state: 'stale' };+ const notes = standing.stale.filter((entry) => entry.note).map((entry) => `<div>${esc(entry.by)}: ${esc(entry.note).replaceAll('\n', '<br>')}</div>`).join('');+ return { html: `<span class="so so-stale">stale: text changed since sign-off</span>${notes}`, state: 'stale' };}return { html: '<span class="so so-open">not signed</span>', state: 'open' };}diff --git a/test/spec.test.js b/test/spec.test.jsindex fe9bfd6e..22705608 100644--- a/test/spec.test.js+++ b/test/spec.test.js@@ -3,7 +3,7 @@*/import assert from 'node:assert/strict';import { execFileSync, spawnSync } from 'node:child_process';-import { mkdtempSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'node:fs';+import { existsSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';import { join, resolve } from 'node:path';import { test } from 'node:test';@@ -16,6 +16,7 @@ import {parseSpec,permanenceProblems,readSignoffs,+ SIGNOFFS_FILE,signOff,standings,unmetRows,@@ -182,19 +183,20 @@ function specBox(t, { specName = 'SPEC.md', practiceName = 'PRACTICE.md', practiPULLBOARD_HOME: join(root, '.home'),};const git = (...args) => execFileSync('git', args, { cwd: root, env, stdio: 'pipe', encoding: 'utf8' });- const run = (...args) => spawnSync(process.execPath, [resolve(import.meta.dirname, '../bin/pullboard.js'), 'spec', ...args], { cwd: root, env, encoding: 'utf8' });+ const command = (...args) => spawnSync(process.execPath, [resolve(import.meta.dirname, '../bin/pullboard.js'), ...args], { cwd: root, env, encoding: 'utf8' });+ const run = (...args) => command('spec', ...args);git('init', '-q', '-b', 'main');const init = spawnSync(process.execPath, [resolve(import.meta.dirname, '../bin/pullboard.js'), 'init'], { cwd: root, env, encoding: 'utf8' });assert.equal(init.status, 0, init.stderr);const config = JSON.parse(readFileSync(join(root, 'pullboard.json'), 'utf8'));- writeFileSync(join(root, 'pullboard.json'), JSON.stringify({ ...config, spec: specName, practice: practiceName }));+ writeFileSync(join(root, 'pullboard.json'), JSON.stringify({ ...config, spec: specName, practice: practiceName, gate: 'true', lanes: { review: { owns: [] } } }));rmSync(join(root, 'SPEC.md'), { force: true });rmSync(join(root, 'PRACTICE.md'), { force: true });writeFileSync(join(root, specName), SPEC);if (practice !== undefined) writeFileSync(join(root, practiceName), practice);git('add', '-A');git('commit', '-q', '-m', 'chore: a spec');- return { root, run, git, specName, practiceName };+ return { root, run, command, env, git, specName, practiceName };}test('spec --json emits one versioned document with every field, including empty fields [S13]', (t) => {@@ -265,3 +267,55 @@ test('warning-only specs keep spec-check success while JSON stays a single documassert.equal(shown.status, 0, shown.stderr);assert.equal(JSON.parse(shown.stdout).rows.length, 5);});++test('signoff prints cited tests, preserves its note and escapes that note in the spec view [S14, S15]', (t) => {+ const box = specBox(t);+ mkdirSync(join(box.root, 'test'));+ writeFileSync(join(box.root, 'test', 'greeting.test.js'), "import { test } from 'node:test';\ntest('greeting [G1]', () => {});\n");+ box.git('add', 'test/greeting.test.js');+ box.git('commit', '-q', '-m', 'test: cite the greeting');+ const note = 'checked <img> & empty names\nwith the local greeting test';+ const signed = box.run('signoff', 'G1', '--by', 'CO', '--note', note);+ assert.equal(signed.status, 0, signed.stderr);+ assert.match(signed.stdout, /evidence for G1:\n test: test\/greeting.test.js/);+ assert.ok(signed.stdout.indexOf('evidence for') < signed.stdout.indexOf('signed 1 rows'));+ assert.equal(readSignoffs(box.root)[0].note, note);+ assert.ok(box.run('show', 'G1').stdout.includes(note));+ const htmlFile = join(box.root, 'spec.html');+ const view = box.run('view', '--out', htmlFile);+ assert.equal(view.status, 0, view.stderr);+ const html = readFileSync(htmlFile, 'utf8');+ assert.match(html, /checked <img> & empty names<br>with the local greeting test/);+ assert.doesNotMatch(html, /<img>/);+});++test('signoff refuses missing evidence atomically, and unmet shows every stage through a verified item [S14, S15, S16]', (t) => {+ const box = specBox(t);+ const failed = box.run('signoff', 'G1', '--by', 'CO', '--note', 'I looked');+ assert.equal(failed.status, 1);+ assert.match(failed.stderr, /NO_EVIDENCE.*G1.*build it or cite its id in a test first/);+ assert.equal(existsSync(join(box.root, SIGNOFFS_FILE)), false);+ assert.match(box.run('unmet').stdout, /G1 \[must\].*— no evidence/);+ const added = box.command('add', 'coordinator', 'Greeting', '--specs', 'G1');+ assert.equal(added.status, 0, added.stderr);+ assert.match(box.run('unmet').stdout, /G1 \[must\].*— building/);+ assert.equal(box.command('claim', '1').status, 0);+ const submitted = box.command('submit', '1');+ assert.equal(submitted.status, 0, submitted.stderr);+ assert.match(box.run('unmet').stdout, /G1 \[must\].*— awaiting a verdict/);+ const made = box.command('worktree', 'review');+ assert.equal(made.status, 0, made.stderr);+ const review = /^made (.+) on branch/m.exec(made.stdout)[1];+ const acceptedNote = 'checked greeting in the private fixture\nsecond line stays in the receipt';+ const accepted = spawnSync(process.execPath, [resolve(import.meta.dirname, '../bin/pullboard.js'), 'verify', '1', 'accept', '--note', acceptedNote], { cwd: review, env: box.env, encoding: 'utf8' });+ assert.equal(accepted.status, 0, `${accepted.stdout}${accepted.stderr}`);+ assert.match(box.run('unmet').stdout, /G1 \[must\].*— verified and ready to sign/);+ const signed = box.run('signoff', 'G1', '--by', 'CO', '--note', 'checked the accepting verdict');+ assert.equal(signed.status, 0, signed.stderr);+ assert.match(signed.stdout, /verified #1: checked greeting in the private fixture/);+ assert.doesNotMatch(signed.stdout, /second line stays in the receipt/);+ assert.doesNotMatch(box.run('unmet').stdout, /G1 \[must\]/);+ writeFileSync(join(box.root, box.specName), SPEC.replace('Same file twice is a no-op.', 'Same file twice stays a no-op.'));+ assert.match(box.run('unmet').stdout, /G1 \[must\].*— stale/);+ assert.match(box.run('show', 'G1').stdout, /checked the accepting verdict/);+});