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.

fix(spec): honor signoff notes and readonly reads [S14,P4]

Corey Olson011dda5d670c
diff --git a/src/cli.js b/src/cli.js
index c8667a9d..9391aa9d 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -1321,6 +1321,7 @@ function citations(ctx, { ids, since }) {
/** Current board evidence, with each item's accepting receipts included once. */
function specProof(ctx) {
+ if (!existsSync(ctx.file)) return { items: [], verdicts: [] };
return withBoard(ctx, (board) => {
const items = store.listItems(board, { all: true });
return { items, verdicts: items.flatMap((item) => store.verdictsFor(board, item.item_id)) };
@@ -1336,6 +1337,22 @@ function specProof(ctx) {
*/
function specCommand(io, { first, second, rest, values }) {
const ctx = context(io);
+ const commandFlags = {
+ '--json': ['json'],
+ check: ['json'],
+ view: ['out'],
+ show: [],
+ unmet: ['must'],
+ signoff: ['by', 'note', 'note-file'],
+ }[first ?? '--json'];
+ if (!commandFlags) throw new Refused('USAGE', 'use pullboard spec --json | check | view | show <id> | unmet [--must] | signoff <ids> --by <name> [--note "..."]');
+ const allowedFlags = [...new Set([...commandFlags, 'json'])];
+ for (const flag of Object.keys(values)) {
+ if (!allowedFlags.includes(flag)) {
+ const next = flag === 'must' ? 'use --must with spec unmet' : 'use a flag accepted by this spec command';
+ throw new Refused('FLAG_NOT_ALLOWED', `spec ${first ?? '--json'} does not take --${flag}; ${next}`);
+ }
+ }
const spec = loadSpec(ctx.info.root, ctx.config);
if (!spec.exists) throw new Refused('NO_SPEC', `no ${ctx.config.spec}; run: pullboard init`);
const practice = loadSpec(ctx.info.root, { ...ctx.config, spec: ctx.config.practice });
@@ -1417,7 +1434,8 @@ function specCommand(io, { first, second, rest, values }) {
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 ?? '' });
+ const note = textArg(io, values, 'note') ?? '';
+ const count = signOff(ctx.info.root, spec, { ids, by: values.by ?? '', on: new Date().toISOString().slice(0, 10), note });
io.say(`signed ${count} rows as ${values.by}; commit .pullboard/signoffs.jsonl`);
return 0;
}
diff --git a/test/spec.test.js b/test/spec.test.js
index ac663096..a38eed11 100644
--- a/test/spec.test.js
+++ b/test/spec.test.js
@@ -291,6 +291,43 @@ test('signoff prints cited tests, preserves its note and escapes that note in th
assert.doesNotMatch(html, /<img>/);
});
+test('signoff reads --note-file exactly [S14]', (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 greeting');
+ const note = 'quoted "text" with $vars and `ticks`\nand a final newline\n';
+ const file = join(box.root, 'note.txt');
+ writeFileSync(file, note);
+ const signed = box.run('signoff', 'G1', '--by', 'CO', '--note-file', file);
+ assert.equal(signed.status, 0, signed.stderr);
+ assert.equal(readSignoffs(box.root)[0].note, note);
+});
+
+test('signoff refuses a flag it does not take [P4]', (t) => {
+ const box = specBox(t);
+ const unsupported = box.run('signoff', 'G1', '--by', 'CO', '--must');
+ assert.notEqual(unsupported.status, 0, 'an option for a different spec command must not be ignored');
+ assert.match(unsupported.stderr, /FLAG_NOT_ALLOWED.*spec signoff.*--must/);
+});
+
+test('spec unmet and signoff do not create a board when reading a repo without one [S14, P4]', (t) => {
+ const box = specBox(t);
+ const boardDir = join(box.root, '.git', 'pullboard');
+ rmSync(boardDir, { recursive: true, force: true });
+ assert.equal(existsSync(boardDir), false);
+
+ const unmet = box.run('unmet');
+ assert.equal(unmet.status, 0, unmet.stderr);
+ assert.equal(existsSync(boardDir), false);
+
+ const signoff = box.run('signoff', 'G1', '--by', 'CO');
+ assert.equal(signoff.status, 1);
+ assert.match(signoff.stderr, /NO_EVIDENCE/);
+ assert.equal(existsSync(boardDir), false);
+});
+
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');