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(needs): name the pending question answer command [S1,B26]

Corey Olsonbf15ea5028ce
diff --git a/src/needs.js b/src/needs.js
index 4241e33a..59ef9a7d 100644
--- a/src/needs.js
+++ b/src/needs.js
@@ -12,7 +12,7 @@ export function personNeeds(state) {
...(state.decisions ?? []).map(ask => ({ kind: 'decision', id: ask.shout_id,
ref: name(ask.shout_from), text: ask.shout_text, what: 'decision', at: ask.shout_at })),
...rows.filter(row => row.status === 'pending').map(row => ({ kind: 'pending', id: row.id,
- ref: row.id, text: row.text, what: 'answer in SPEC.md' })),
+ ref: row.id, text: row.text, what: `pullboard spec answer ${row.id} "<choice>"` })),
...(state.holds ?? []).map(hold => ({ kind: 'hold', id: hold.hold_lane,
ref: hold.hold_lane, text: hold.hold_reason, what: 'lane held by ' + name(hold.hold_by) })),
...rigorDrafts,
diff --git a/test/needs.test.js b/test/needs.test.js
index 97d00b90..f7564b01 100644
--- a/test/needs.test.js
+++ b/test/needs.test.js
@@ -1,12 +1,13 @@
/** @pullboard-test-input source-tree */
/** One person-facing obligation builder across sessions and transports [N26,A9]. */
import assert from 'node:assert/strict';
-import { existsSync, readFileSync, writeFileSync } from 'node:fs';
+import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
import { join } from 'node:path';
import { Readable } from 'node:stream';
import { test } from 'node:test';
import { runInNewContext } from 'node:vm';
import { main } from '../src/cli.js';
+import { parseSpec } from '../src/spec.js';
import { serveMcp } from '../src/mcp.js';
import { createE2eHelpers } from './e2e-helpers.js';
@@ -70,3 +71,53 @@ test('one builder lists what needs the person [N26,A9]', async (t) => {
assert.equal(reply.result?.isError, false, JSON.stringify(reply));
assert.deepEqual(reply.result.structuredContent.needsYou, expected, 'MCP uses the same complete list');
});
+
+
+test('a pending question names pullboard spec answer [S1,B26]', async (t) => {
+ const e2e = createE2eHelpers();
+ t.after(e2e.cleanup);
+ const box = e2e.sandbox();
+ const repo = join(box.dir, 'newcomer');
+ mkdirSync(repo);
+ box.git(repo, 'init', '-q', '-b', 'main');
+ const initialized = box.run(repo, 'init', '--blueprint', 'web-app');
+ assert.equal(initialized.code, 0, initialized.err || initialized.out);
+ box.git(repo, 'add', '-A');
+ box.git(repo, 'commit', '-q', '-m', 'chore: preserve newcomer setup');
+ const file = join(repo, 'SPEC.md');
+ const source = readFileSync(file, 'utf8');
+ const question = parseSpec(source).rows.find(row => row.status === 'pending' && row.text.startsWith('The app is built with:'));
+ assert.ok(question, 'the actual web-app blueprint files its framework question');
+
+ // Reproduce the dead end invited by the old wording, then restore the exact pending source.
+ writeFileSync(file, source.replace(`- ${question.id} [pending,`, `- ${question.id} [approved,`));
+ const handEdit = box.run(repo, 'spec', 'check');
+ assert.notEqual(handEdit.code, 0);
+ assert.match(handEdit.out + handEdit.err, /pending question answered by hand/u);
+ writeFileSync(file, source);
+
+ const resumed = box.run(repo, 'resume', '--json');
+ assert.equal(resumed.code, 0, resumed.err || resumed.out);
+ const pending = JSON.parse(resumed.out).needsYou.filter(need => need.kind === 'pending');
+ assert.equal(pending.length, 4, 'all four real blueprint questions remain visible');
+ for (const need of pending) assert.equal(need.what, `pullboard spec answer ${need.id} "<choice>"`);
+ const human = box.run(repo, 'resume');
+ assert.equal(human.code, 0, human.err || human.out);
+ assert.doesNotMatch(human.out, /answer in SPEC\.md/u);
+ assert.ok(human.out.includes(`pullboard spec answer ${question.id} "<choice>"`));
+ const { personNeeds } = await import('../src/needs.js');
+ const browserBuilder = runInNewContext(`(${personNeeds.toString()})`);
+ const browserNeeds = browserBuilder({ spec: parseSpec(source).rows }).filter(need => need.kind === 'pending');
+ assert.deepEqual(JSON.parse(JSON.stringify(browserNeeds)), pending, 'the standalone browser builder gives the same commands');
+
+ const answered = box.run(repo, 'spec', 'answer', question.id, 'SvelteKit');
+ assert.equal(answered.code, 0, answered.err || answered.out);
+ assert.equal(readFileSync(file, 'utf8'), source, 'the command records the decision before changing the file');
+ const applied = box.run(repo, 'spec', 'apply');
+ assert.equal(applied.code, 0, applied.err || applied.out);
+ const row = parseSpec(readFileSync(file, 'utf8')).rows.find(row => row.id === question.id);
+ assert.equal(row.status, 'approved');
+ assert.match(row.text, /^The app is built with: SvelteKit\./u);
+ const checked = box.run(repo, 'spec', 'check');
+ assert.equal(checked.code, 0, checked.err || checked.out);
+});