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
fix(spec): draft proposed rows correctly [S1,C7]
Corey Olsonf0b645851bec
diff --git a/src/cli.js b/src/cli.jsindex ca4f7c0e..9d9aef68 100644--- a/src/cli.js+++ b/src/cli.js@@ -175,7 +175,7 @@ function commandHelp(name) {' pullboard spec view — agent or person: write the offline spec page',' pullboard spec show <id> — agent or person: inspect one row and its sign-offs',' pullboard spec unmet — agent or person: list approved rows without current sign-off',- ' pullboard spec draft <text> [--aim] [--gate "<gate>"] — any agent: append a pending row; never approve it',+ ' pullboard spec draft <text> [--aim] [--gate "<gate>"] — any agent: append a draft row; never approve it',' pullboard spec signoff <ids> — person: sign rows with evidence',' pullboard spec signers add — person: register an SSH signing key',' pullboard spec approve <ids> — person: decide from their own terminal or Pullboard View',@@ -1138,7 +1138,7 @@ function boardSetup(ctx, card) {/** Preserve all existing configuration when recording one setup answer. */const configure = patch => `node -e ${quote(`const fs=require('node:fs');const p='pullboard.json';const c=JSON.parse(fs.readFileSync(p,'utf8'));${patch};fs.writeFileSync(p,JSON.stringify(c,null,2)+${JSON.stringify('\n')})`)}`;const steps = [- { number: 1, done: approved.length > 0, question: 'Ask the person: what are we building, and who will use it? Draft a few requirements as pending, then ask the person to approve them.',+ { number: 1, done: approved.length > 0, question: 'Ask the person: what are we building, and who will use it? Draft a few requirements, then ask the person to approve them.',command: 'pullboard spec draft "<text>"',afterAnswer: 'Record each answer with pullboard spec draft "<text>"; the person approves the returned ids in Pullboard View or runs pullboard spec approve <ids> in their own terminal; then the coordinator runs pullboard spec apply.' },{ number: 2, done: lanes.length > 0, question: `Ask the person: how should we divide the work? Suggested folders: ${folders.join(', ') || 'app/ (create it for the app)'}.`,@@ -2808,7 +2808,7 @@ async function specCommand(io, { first, second, rest, values }) {const id = `${prefix}${next}`;const tier = values.aim ? 'aim' : 'must';const gate = values.gate?.trim() ?? 'review';- const row = `- ${id} [pending, ${tier}] ${second.trim()} | gate: ${gate}`;+ const row = `- ${id} [draft, ${tier}] ${second.trim()} | gate: ${gate}`;const source = readFileSync(spec.file, 'utf8');const newline = source.includes('\r\n') ? '\r\n' : '\n';const lines = source.split(/\r?\n/u);@@ -2819,7 +2819,7 @@ async function specCommand(io, { first, second, rest, values }) {const after = lines.join(newline);writeRowApply(ctx.info.root, { records: [], files: [{ file: ctx.config.spec, before: source, after }],signoffs: { before: null, receipts: [] } });- io.result?.({ id, row: { id, status: 'pending', tier, text: second.trim(), gate, section: section.name } });+ io.result?.({ id, row: { id, status: 'draft', tier, text: second.trim(), gate, section: section.name } });io.say(id);return 0;}diff --git a/src/help.js b/src/help.jsindex 31e71a46..977ccd16 100644--- a/src/help.js+++ b/src/help.js@@ -145,7 +145,7 @@ Specpullboard spec view [--out file] the spec, open questions, sign-offs and doctrine as one pagepullboard spec show <id> | unmet [--must] | signoff <ids> [--by <principal>]signoff: --note "what was checked" stays with the receipt- pullboard spec draft <text> [--aim] [--gate "<gate>"] any agent appends a pending row; never approves it+ pullboard spec draft <text> [--aim] [--gate "<gate>"] any agent appends a draft row; never approves itDefaults to must and gate review.pullboard spec signers add [--key <path>] [--by <principal>] opt into SSH-signed sign-offsprincipal defaults to Git user.email; --by overrides itdiff --git a/src/templates.js b/src/templates.jsindex fd22c1df..4ca3e3fe 100644--- a/src/templates.js+++ b/src/templates.js@@ -100,7 +100,7 @@ On a board that is not set up, run \`pullboard resume\` first. Walk the person tThis repo runs on pullboard: a work board, lanes and a spec that live in git. Nothing ships until a second agent verifies it.-**Source of truth.** \`SPEC.md\` holds every requirement as a row with an id, like \`G1.2\`. Code follows the spec. Commits cite the ids they serve: \`feat(scope): subject [G1.2]\`. Only a person approves or changes an approved row. Ids are permanent: a row the person cuts stays, marked \`wont\` (won't build), so every commit that cites it keeps its meaning. Propose each requirement with \`pullboard spec draft "<text>"\`; it returns the pending row id for the person to approve.+**Source of truth.** \`SPEC.md\` holds every requirement as a row with an id, like \`G1.2\`. Code follows the spec. Commits cite the ids they serve: \`feat(scope): subject [G1.2]\`. Only a person approves or changes an approved row. Ids are permanent: a row the person cuts stays, marked \`wont\` (won't build), so every commit that cites it keeps its meaning. Propose each requirement with \`pullboard spec draft "<text>"\`; it returns the draft row id for the person to approve.**Doctrine.** Our house rules for agentic development. This repo inherits Pullboard standard doctrine version 1. ${doctrine.repo ? doctrine.name : DOCTRINE_FILE} adds the repo's own rows, overrides a standard rule by its PB id, or declines it with a wont row and its reason as the row text: - PB7 [wont] <why>. Approved rows are in force; follow them as you would the spec. Run pullboard spec --json to read the current merged rules. Re-run pullboard init after changing the doctrine to refresh this managed guidance.diff --git a/test/api.test.js b/test/api.test.jsindex 5cca2cb2..965afe14 100644--- a/test/api.test.js+++ b/test/api.test.js@@ -622,7 +622,7 @@ test('[A1] command results match the catalog across roots and subcommands', () =json(box, repo, 'spec', ['view', '--out', join(box.dir, 'spec.html')], 'view');json(box, repo, 'spec', ['show', 'G1'], 'show');json(box, repo, 'spec', ['unmet'], 'unmet');- assert.equal(json(box, repo, 'spec', ['draft', 'A pending API catalogue row'], 'draft').id, 'G2');+ assert.equal(json(box, repo, 'spec', ['draft', 'A draft API catalogue row'], 'draft').id, 'G2');mkdirSync(join(repo, 'test'));writeFileSync(join(repo, 'test', 'proof.test.js'), "import { test } from 'node:test';\ntest('proof [G1]', () => {});\n");box.git(repo, 'add', 'SPEC.md', 'test/proof.test.js');diff --git a/test/resume-flow.test.js b/test/resume-flow.test.jsindex 7a8c11b5..d7ca4bdc 100644--- a/test/resume-flow.test.js+++ b/test/resume-flow.test.js@@ -277,7 +277,7 @@ test('agent resume keeps its next step without a coordinator flow alert [N32,R1,assert.equal(Object.hasOwn(await box.run(['resume', '--json'], box.web), 'flow'), false);});-test('spec draft adds a pending row and resume names it [N32]', t => {+test('spec draft adds draft rows and resume names them [N32]', t => {const box = releaseFixture(t, { freshSetup: true });const initial = JSON.parse(box.run(box.repo, 'resume', '--json').stdout);assert.equal(initial.setup.step, 1);@@ -287,7 +287,7 @@ test('spec draft adds a pending row and resume names it [N32]', t => {const help = box.run(box.repo, 'help', 'spec', '--json');assert.equal(help.status, 0, help.failure || help.stderr);- assert.match(JSON.parse(help.stdout).help, /spec draft <text>.*any agent: append a pending row/u);+ assert.match(JSON.parse(help.stdout).help, /spec draft <text>.*any agent: append a draft row/u);const first = box.run(box.repo, 'spec', 'draft', 'Describe the first requirement', '--json');const second = box.run(box.repo, 'spec', 'draft', 'Describe the second requirement', '--aim', '--gate', 'node --test', '--json');@@ -295,9 +295,9 @@ test('spec draft adds a pending row and resume names it [N32]', t => {assert.equal(second.status, 0, second.failure || second.stderr);const rows = JSON.parse(box.run(box.repo, 'spec', '--json').stdout).rows;assert.deepEqual(rows.filter(row => ['G1', 'G2'].includes(row.id)).map(({ id, status, tier, text, gate }) => ({ id, status, tier, text, gate })), [- { id: 'G1', status: 'pending', tier: 'must', text: 'Describe the first requirement', gate: 'review' },- { id: 'G2', status: 'pending', tier: 'aim', text: 'Describe the second requirement', gate: 'node --test' },- ], 'draft appends two sequential pending rows with the requested defaults');+ { id: 'G1', status: 'draft', tier: 'must', text: 'Describe the first requirement', gate: 'review' },+ { id: 'G2', status: 'draft', tier: 'aim', text: 'Describe the second requirement', gate: 'node --test' },+ ], 'draft appends two sequential draft rows with the requested defaults');assert.equal(JSON.parse(first.stdout).id, 'G1');assert.equal(JSON.parse(second.stdout).id, 'G2');const beforeEmpty = readFileSync(join(box.repo, 'SPEC.md'), 'utf8');@@ -325,7 +325,7 @@ test('spec draft adds a pending row and resume names it [N32]', t => {assert.equal(JSON.parse(customDraft.stdout).id, 'G7');const updatedSpec = readFileSync(join(custom.repo, 'SPEC.md'), 'utf8');assert.equal(updatedSpec.replaceAll('\r\n', '').includes('\n'), false, 'draft preserves the source newline style');- assert.equal(updatedSpec, customSpec.replace('\r\n\r\n## N · Notes', '\r\n- G7 [pending, must] Keep line endings intact | gate: review\r\n\r\n## N · Notes'),+ assert.equal(updatedSpec, customSpec.replace('\r\n\r\n## N · Notes', '\r\n- G7 [draft, must] Keep line endings intact | gate: review\r\n\r\n## N · Notes'),'draft preserves every existing status row and inserts in the first section');});diff --git a/test/spec.test.js b/test/spec.test.jsindex a5d79b62..2fb546f6 100644--- a/test/spec.test.js+++ b/test/spec.test.js@@ -391,6 +391,32 @@ function specBox(t, { specName = 'SPEC.md', practiceName = 'PRACTICE.md', practireturn { root, run, command, env, git, specName, practiceName };}+test('a drafted row reads as draft [S1,C7]', (t) => {+ const specSource = SPEC.replace(+ '- G2 [retired] Old idea.',+ '- G2 [retired] Old idea.\n- G3 [pending, must] Still a question. | gate: review',+ );+ const box = specBox(t, { specSource });++ const drafted = box.run('draft', 'A proposed requirement');+ assert.equal(drafted.status, 0, drafted.stderr);+ assert.equal(drafted.stdout.trim(), 'G4');++ const rows = () => parseSpec(readFileSync(join(box.root, box.specName), 'utf8')).rows;+ assert.deepEqual(rows().filter((row) => ['G3', 'G4'].includes(row.id)).map(({ id, status }) => [id, status]), [+ ['G3', 'pending'],+ ['G4', 'draft'],+ ], 'the existing question stays pending and the newly drafted row is distinct');+ const approved = box.run('approve', 'G3', 'G4');+ assert.equal(approved.status, 0, approved.stderr);+ const applied = box.run('apply');+ assert.equal(applied.status, 0, applied.stderr);+ assert.deepEqual(rows().filter((row) => ['G3', 'G4'].includes(row.id)).map(({ id, status }) => [id, status]), [+ ['G3', 'approved'],+ ['G4', 'approved'],+ ], 'both an existing pending question and a newly drafted row remain approvable');+});+test('spec --json emits one versioned document with every field, including empty fields [S13]', (t) => {const box = specBox(t);const shown = box.run('--json');