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.

refactor(cli): setup row asks get a module [S1,C7]

Corey Olsondc057a7fa960
diff --git a/src/cli.js b/src/cli.js
index 94850fa7..5a74e524 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -172,6 +172,7 @@ import {
outOfLane,
} from './lanes.js';
import { Refused } from './refused.js';
+import { applyStep, personAsk } from './setup-rows.js';
import { personNeeds } from './needs.js';
import { personNeedsState } from './needs-state.js';
import { startServeSentinel } from './serve-sentinel.js';
@@ -1628,23 +1629,13 @@ function boardSetup(ctx, card, identity) {
if (!current && !recordedComplete) recordSetupState(ctx, identity, 'complete');
else if (current && !completed && !started) recordSetupState(ctx, identity, 'started');
const seat = ctx.io.callerRole() === 'seat';
- if (current?.number === 1 && !drafted.length && toApply.length) {
- const rowIds = toApply.map(row => row.id);
- const names = rowIds.join(', ');
- return { step: 1, total: 5, ...current, steps, waitingOn: 'coordinator-apply', rowIds,
- question: seat ? `The person approved ${names}; the coordinator applies them.` : `The person approved ${names}; apply them: pullboard spec apply.`, command: 'pullboard spec apply',
- afterAnswer: 'spec apply writes the person\u2019s decisions into SPEC.md; then commit SPEC.md so every worktree reads them.',
- agentNext: seat ? `ask the coordinator to apply ${names}: pullboard shout coordinator "the person approved ${names}; please run pullboard spec apply"` : 'pullboard spec apply, then commit SPEC.md' };
- }
+ if (current?.number === 1 && !drafted.length && toApply.length) return { step: 1, total: 5, ...current, steps, ...applyStep(toApply.map(row => row.id), seat) };
if (current?.number === 1 && drafted.length) {
const rowIds = drafted.map(row => row.id);
const names = rowIds.join(', ');
const command = `pullboard spec show ${rowIds[0]}`;
// A pending question takes an answer, a draft row an approval: each gets the command that decides it.
- const questions = drafted.filter(row => row.status === 'pending').map(row => row.id);
- const drafts = drafted.filter(row => row.status !== 'pending').map(row => row.id);
- const personCommand = [drafts.length ? `pullboard spec approve ${drafts.join(',')}` : '', ...questions.map(id => `pullboard spec answer ${id} "<choice>"`)].filter(Boolean).join('; ');
- const verb = !questions.length ? 'approve' : drafts.length ? 'decide' : 'answer';
+ const { personCommand, verb } = personAsk(drafted);
return { step: 1, total: 5, ...current, steps, waitingOn: 'person-approval', rowIds, ...(toApply.length ? { approvedRowIds: toApply.map(row => row.id) } : {}),
question: seat ? `Waiting for the coordinator to bring approval of ${names} to the person.` : `Waiting for the person to ${verb} ${names}.`, command,
personCommand,
diff --git a/src/setup-rows.js b/src/setup-rows.js
new file mode 100644
index 00000000..0cd64faa
--- /dev/null
+++ b/src/setup-rows.js
@@ -0,0 +1,34 @@
+/**
+ * What setup asks about spec rows (#848): a row the person has already decided waits for the
+ * coordinator's spec apply, never for the person again, and each open row gets the command that
+ * decides it, approve for a draft and answer for a pending question.
+ */
+
+/**
+ * The setup step once every open row has a person decision that spec apply has not written yet.
+ *
+ * @param {string[]} rowIds The decided rows waiting for apply.
+ * @param {boolean} seat Whether an agent seat, not the coordinator, is reading it.
+ * @returns {{waitingOn: string, rowIds: string[], question: string, command: string, afterAnswer: string, agentNext: string}}
+ */
+export function applyStep(rowIds, seat) {
+ const names = rowIds.join(', ');
+ return { waitingOn: 'coordinator-apply', rowIds,
+ question: seat ? `The person approved ${names}; the coordinator applies them.` : `The person approved ${names}; apply them: pullboard spec apply.`, command: 'pullboard spec apply',
+ afterAnswer: 'spec apply writes the person’s decisions into SPEC.md; then commit SPEC.md so every worktree reads them.',
+ agentNext: seat ? `ask the coordinator to apply ${names}: pullboard shout coordinator "the person approved ${names}; please run pullboard spec apply"` : 'pullboard spec apply, then commit SPEC.md' };
+}
+
+/**
+ * The person's command for the rows still open, and the verb that names it: approve for drafts,
+ * answer for pending questions, decide for a mix.
+ *
+ * @param {{id: string, status: string}[]} rows The open rows with no person decision.
+ * @returns {{personCommand: string, verb: string}}
+ */
+export function personAsk(rows) {
+ const questions = rows.filter(row => row.status === 'pending').map(row => row.id);
+ const drafts = rows.filter(row => row.status !== 'pending').map(row => row.id);
+ const personCommand = [drafts.length ? `pullboard spec approve ${drafts.join(',')}` : '', ...questions.map(id => `pullboard spec answer ${id} "<choice>"`)].filter(Boolean).join('; ');
+ return { personCommand, verb: !questions.length ? 'approve' : drafts.length ? 'decide' : 'answer' };
+}