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): preserve text in gate or status revisions [P6,B23]
Corey Olsone0eda5ec28d2
diff --git a/src/commands/spec.js b/src/commands/spec.jsindex 93a5d1d3..189f4a87 100644--- a/src/commands/spec.js+++ b/src/commands/spec.js@@ -163,7 +163,7 @@ export async function specCommand(io, { first, second, rest, values }) {if (second && /\|\s*gate\s*:/iu.test(second)) {throw new Refused('INLINE_GATE', 'move the gate after the requirement as --gate "<check>"');}- if (!second?.trim() || rest.length || /[\r\n|]/u.test(second)) {+ if (rest.length || (second !== undefined && (!second.trim() || /[\r\n|]/u.test(second)))) {throw new Refused('USAGE', 'give one nonempty, single-line requirement: pullboard spec draft "<text>"');}if (values.gate !== undefined && (!values.gate.trim() || /[\r\n|]/u.test(values.gate))) {@@ -172,7 +172,7 @@ export async function specCommand(io, { first, second, rest, values }) {if (values.revises !== undefined) {if (values.doctrine || values.aim || values.section || values.source) throw new Refused('FLAG_NOT_ALLOWED', 'a revision keeps the approved row\'s section and tier; use --revises with text, --gate, --status and --reason');const drafts = hookRead(ctx, board => store.rowDrafts(board)) ?? [];- const row = planSpecRevision(ctx.info.root, ctx.config, { revises: values.revises, text: second.trim(),+ const row = planSpecRevision(ctx.info.root, ctx.config, { revises: values.revises, text: second?.trim(),gate: values.gate?.trim(), status: values.status, reason: values.reason,taken: [...drafts.map(draft => draft.id), ...trunkRowIds(ctx.info.root, primaryCheckoutRoot(ctx.info), ctx.config)] });const entry = await reserveRow(ctx, row, false);@@ -180,6 +180,7 @@ export async function specCommand(io, { first, second, rest, values }) {io.say(entry.id);return 0;}+ if (!second?.trim()) throw new Refused('USAGE', 'give one nonempty requirement: pullboard spec draft "<text>"');if (values.status !== undefined || values.reason !== undefined) throw new Refused('FLAG_NOT_ALLOWED', '--status and --reason belong to spec draft --revises <id>');if (values.doctrine) {if (typeof values.source !== 'string' || !values.source.trim() || /[\r\n|]/u.test(values.source)) {diff --git a/src/spec-revisions.js b/src/spec-revisions.jsindex 8ae74cc3..8196f3be 100644--- a/src/spec-revisions.js+++ b/src/spec-revisions.js@@ -36,15 +36,16 @@ export function planSpecRevision(root, config, { revises, text, gate, status, reconst wanted = status ?? row.status;if (!STATUSES.includes(wanted)) throw new Refused('SPEC_REVISION', `unknown status ${wanted}; use one of ${STATUSES.join(', ')}`);const nextGate = gate ?? row.gate;+ const nextText = text ?? row.text;let replacement = source.replace(/\[[a-z]+(?=,|\])/u, () => `[${wanted}`)- .replace(/(\]\s+)[^|]*/u, (_, start) => `${start}${text} `);+ .replace(/(\]\s+)[^|]*/u, (_, start) => `${start}${nextText} `);replacement = /\|\s*gate\s*:/u.test(replacement)? replacement.replace(/(\|\s*gate\s*:\s*)[^|]*/u, (_, start) => `${start}${nextGate} `): `${replacement.trimEnd()} | gate: ${nextGate}`;replacement = replacement.trimEnd();if (replacement === source) throw new Refused('SPEC_REVISION', 'the proposed row is unchanged; give new text, gate or status');const prefix = /^([A-Z][A-Z0-9]*?)\d+(?:\.\d+)*$/u.exec(revises)?.[1];- const plan = draftRow(root, config, { target: 'spec', text, gate: nextGate, tier: row.tier, section: prefix, taken, write: false });+ const plan = draftRow(root, config, { target: 'spec', text: nextText, gate: nextGate, tier: row.tier, section: prefix, taken, write: false });return { ...plan.row, target: 'spec', revises, file: config.spec, source, replacement, status: wanted, reason: reason.trim() };}diff --git a/test/spec-revise.test.js b/test/spec-revise.test.jsindex 535ec372..7433c3ff 100644--- a/test/spec-revise.test.js+++ b/test/spec-revise.test.js@@ -87,6 +87,10 @@ test('[P6,B23,N39] revisions require a reason and stale proposals cannot changeconst box = fixtures.project('true');assert.notEqual(box.run(box.web, 'spec', 'draft', 'Missing reason.', '--revises', 'G1').code, 0);assert.notEqual(box.run(box.web, 'spec', 'draft', 'Missing target.', '--revises', 'G99', '--reason', 'No such row.').code, 0);+ const statusOnly = JSON.parse(succeeds(box.run(box.web, 'spec', 'draft', '--revises', 'G1', '--status', 'retired', '--reason', 'Consider retirement.', '--json')).out);+ const statusNeed = personNeedsState(box.repo).needs.find(entry => entry.id === statusOnly.id);+ assert.equal(statusNeed.proposed.text, 'The page renders.', 'omitted text preserves the approved wording');+ succeeds(box.run(box.repo, 'spec', 'decline', statusOnly.id, '--reason', 'Keep it.'));const first = JSON.parse(succeeds(box.run(box.web, 'spec', 'draft', 'An obsolete proposal.', '--revises', 'G1', '--reason', 'First idea.', '--json')).out);const second = JSON.parse(succeeds(box.run(box.web, 'spec', 'draft', 'The replacement the person chooses.', '--revises', 'G1', '--reason', 'Better idea.', '--json')).out);succeeds(box.run(box.repo, 'spec', 'approve', second.id));