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 main into core/4

Corey Olson93f829710342
diff --cc src/cli.js
index 5d7fe308,7efc7b16..5d01f1da
--- a/src/cli.js
+++ b/src/cli.js
@@@ -1337,22 -1366,6 +1367,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 = commandFlags;
++ 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 });
@@@ -1434,8 -1450,8 +1467,9 @@@
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.result?.({ count, by: values.by, ids, evidence });
io.say(`signed ${count} rows as ${values.by}; commit .pullboard/signoffs.jsonl`);
return 0;
}
diff --cc test/spec.test.js
index 773573c6,7811e97e..91f60883
--- a/test/spec.test.js
+++ b/test/spec.test.js
@@@ -291,64 -302,6 +302,66 @@@ test('signoff prints cited tests, prese
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 view handles --json or refuses it instead of silently ignoring it [P4]', (t) => {
++test('spec view emits JSON and refuses an unsupported flag before writing [S13, P4]', (t) => {
+ const box = specBox(t);
+ const htmlFile = join(box.root, 'requested-spec.html');
- const jsonAdapter = existsSync(resolve(import.meta.dirname, '../src/json.js'));
+ const result = box.run('view', '--json', '--out', htmlFile);
+
- if (jsonAdapter) {
- assert.equal(result.status, 0, result.stderr);
- assert.equal(result.stderr, '');
- const document = JSON.parse(result.stdout);
- assert.equal(document.version, 1);
- assert.equal(document.path, htmlFile);
- assert.ok(existsSync(htmlFile));
- return;
- }
-
- assert.equal(result.status, 1);
- assert.match(result.stderr, /FLAG_NOT_ALLOWED.*spec view does not take --json/);
- assert.equal(existsSync(htmlFile), false, 'refusal happens before creating the HTML output');
++ assert.equal(result.status, 0, result.stderr);
++ assert.equal(result.stderr, '');
++ const document = JSON.parse(result.stdout);
++ assert.equal(document.version, 1);
++ assert.equal(document.path, htmlFile);
++ assert.ok(existsSync(htmlFile));
++
++ const refusedFile = join(box.root, 'refused-spec.html');
++ const refused = box.run('view', '--json', '--must', '--out', refusedFile);
++ assert.equal(refused.status, 1);
++ assert.equal(refused.stderr, '');
++ const refusal = JSON.parse(refused.stdout);
++ assert.equal(refusal.version, 1);
++ assert.equal(refusal.error.code, 'FLAG_NOT_ALLOWED');
++ assert.match(refusal.error.message, /spec view does not take --must/);
++ assert.equal(existsSync(refusedFile), false, 'refusal happens before creating the HTML output');
+});
+
+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');