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(cli): show keeps earlier verdicts to one line [N30]
Corey Olsond1618dad0c58
diff --git a/src/cli.js b/src/cli.jsindex 820091d6..e68814c9 100644--- a/src/cli.js+++ b/src/cli.js@@ -78,7 +78,8 @@ Work$PULLBOARD_ATTEMPT, $PULLBOARD_TIER); green work is submitted, red escalated[--agent-light "..."] [--agent-mid "..."] [--agent-strong "..."] a command per tierpullboard list [lane] [--all] [--route light|mid|strong] open and active items; --all adds closed ones- pullboard show <id> an item, the criterion frozen at claim, its verdicts+ pullboard show <id> [--history] an item, the criterion frozen at claim, its verdicts: the latest in full,+ earlier ones as one line; --history prints every note in fullpullboard next [--wait <minutes>] claim the next item in your lane that is free to startpullboard next --verify name the next submitted item you can checkpullboard check [id] run your item's check, the command that proves it (the project gate is pullboard gate)@@ -154,6 +155,7 @@ const OPTIONS = {all: { type: 'boolean' },must: { type: 'boolean' },json: { type: 'boolean' },+ history: { type: 'boolean' },help: { type: 'boolean', short: 'h' },version: { type: 'boolean', short: 'v' },};@@ -334,6 +336,23 @@ function whoAmI(ctx, board) {*/const freezer = (ctx) => (item) => frozenCriterion(loadSpec(ctx.info.root, ctx.config), item);+/** How many characters of an earlier verdict's note show prints (N30). */+const NOTE_LINE = 120;++/**+ * A note's first line, cut to NOTE_LINE characters with … marking the cut. A line ends at any line+ * break, CRLF included, and characters are counted as a reader sees them, so a cut never splits an+ * emoji or an accented letter.+ *+ * @param {string} note+ * @returns {string}+ */+function firstLineOf(note) {+ const line = note.split(/\r\n|[\n\r\u2028\u2029]/)[0];+ const characters = [...new Intl.Segmenter(undefined, { granularity: 'grapheme' }).segment(line)];+ return characters.length > NOTE_LINE ? `${characters.slice(0, NOTE_LINE).map((part) => part.segment).join('')}…` : line;+}+/*** One item on one line: id, status and holder, lane, title, spec ids.*@@ -681,7 +700,12 @@ function readCommands(io, { first, values }) {frozen.rows.forEach((row) => io.say(` ${row.id}: ${row.text}${row.gate ? ` | gate: ${row.gate}` : ''}`));}if (item.item_commit) io.say(`submitted by ${item.item_built_by} at ${item.item_commit}`);- verdicts.forEach((verdict) => io.say(`${verdict.verdict_decision} ${verdict.verdict_reason} by ${verdict.verdict_by} at ${verdict.verdict_commit.slice(0, 12)}${verdict.verdict_note ? `: ${verdict.verdict_note}` : ''}`));+ // Earlier verdicts as one line each, so an item sent back several times stays short to read+ // (N30); --history prints every note in full.+ const verdictLine = (verdict) => `${verdict.verdict_decision} ${verdict.verdict_reason} by ${verdict.verdict_by} at ${verdict.verdict_commit.slice(0, 12)}`;+ const notes = verdicts.map((verdict, index) => (values.history || index === verdicts.length - 1 ? verdict.verdict_note : firstLineOf(verdict.verdict_note)));+ verdicts.forEach((verdict, index) => io.say(`${verdictLine(verdict)}${notes[index] ? `: ${notes[index]}` : ''}`));+ if (notes.some((note, index) => note !== verdicts[index].verdict_note)) io.say(`(earlier verdicts shortened; every note in full: pullboard show ${id} --history)`);if (item.item_merged_commit) io.say(`merged as ${item.item_merged_commit}`);if (item.item_withdrawn_reason) io.say(`withdrawn: ${item.item_withdrawn_reason}`);return 0;diff --git a/test/show.test.js b/test/show.test.jsnew file mode 100644index 00000000..f0c49190--- /dev/null+++ b/test/show.test.js@@ -0,0 +1,114 @@+/**+ * show stays short to read (N30): the latest verdict in full, each earlier one as a line, and every+ * note in full on --history or --json.+ */+import assert from 'node:assert/strict';+import { execFileSync, spawnSync } from 'node:child_process';+import { mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join, resolve } from 'node:path';+import { after, test } from 'node:test';+import * as store from '../src/board.js';+import { loadConfig } from '../src/config.js';+import { frozenCriterion, loadSpec } from '../src/spec.js';++const BIN = resolve(import.meta.dirname, '../bin/pullboard.js');+const dirs = [];+after(() => {+ for (const dir of dirs) rmSync(dir, { recursive: true, force: true });+});++/** A family emoji: five code points, eight UTF-16 units, one character to a reader. */+const FAMILY = String.fromCodePoint(0x1f468, 0x200d, 0x1f469, 0x200d, 0x1f467);++/** 119 plain characters, so the emoji after them is the 120th, the last one show keeps. */+const LEAD = `First reject: ${'the empty name crashes '.repeat(5)}`.slice(0, 119);++const NOTES = [+ `${LEAD}${FAMILY} and the line keeps going past the cut.\nRepro: greet("") throws.\nFix: guard the empty case.`,+ 'Second reject: the guard returns undefined.\r\nRepro: greet("") is undefined.\r\nFix: return a default.',+ 'Accept: greet("") now says hello, stranger.\nBroke it by removing the default; the test went red.\nRestored; green.',+];++/** An earlier note of exactly 120 characters on one line: printed whole, with nothing to hint at. */+const EXACT = `Too slow: ${'x'.repeat(110)}`;++test('show prints the latest verdict in full and earlier ones as one line; --history and --json print every note [N30]', () => {+ const dir = realpathSync(mkdtempSync(join(tmpdir(), 'pullboard-show-')));+ dirs.push(dir);+ const repo = join(dir, 'repo');+ mkdirSync(repo);+ const env = {+ ...process.env,+ GIT_CONFIG_GLOBAL: '/dev/null',+ GIT_CONFIG_NOSYSTEM: '1',+ GIT_AUTHOR_NAME: 'Test Agent',+ GIT_AUTHOR_EMAIL: '[email protected]',+ GIT_COMMITTER_NAME: 'Test Agent',+ GIT_COMMITTER_EMAIL: '[email protected]',+ PULLBOARD_HOME: join(dir, 'home'),+ };+ execFileSync('git', ['init', '-q', '-b', 'main'], { cwd: repo, env });+ writeFileSync(join(repo, 'pullboard.json'), JSON.stringify({ gate: 'true', lanes: { web: { owns: ['web/'] } } }));+ writeFileSync(join(repo, 'SPEC.md'), '# Demo\n\n## G · Goals\n- G1 [approved, must] It greets. | gate: test\n');+ execFileSync('git', ['add', '-A'], { cwd: repo, env });+ execFileSync('git', ['commit', '-q', '-m', 'chore: a spec'], { cwd: repo, env });++ const freeze = (item) => frozenCriterion(loadSpec(repo, loadConfig(repo)), item);+ const board = store.openBoard(join(repo, '.git', 'pullboard', 'board.sqlite'));+ try {+ store.register(board, { lane: 'coordinator', path: repo });+ store.register(board, { lane: 'web', path: join(dir, 'web-1') });+ store.register(board, { lane: 'web', path: join(dir, 'web-2') });+ /**+ * Builds an item through one round per note: every round but the last is sent back.+ *+ * @param {string} title+ * @param {string[]} notes+ * @param {string[]} letters - Each round's commit, as one letter repeated.+ */+ const rounds = (title, notes, letters) => {+ const id = store.addItem(board, { by: 'coordinator', lane: 'web', title, criterion: 'greet("") says hello, stranger', specIds: ['G1'] });+ notes.forEach((note, round) => {+ const commit = letters[round].repeat(40);+ store.claim(board, id, { agentId: 'web-1', lane: 'web', leaseMs: 7_200_000, freeze });+ store.submit(board, id, { agentId: 'web-1', commit, tree: 't' });+ const decision = round < notes.length - 1 ? 'REJECT' : 'ACCEPT';+ const reason = decision === 'REJECT' ? 'TEST_FAILURE' : undefined;+ store.verify(board, id, { agentId: 'web-2', decision, reason, note, head: commit, digest: freeze(store.getItem(board, id)).digest, policy: 'any' });+ });+ };+ rounds('Greet', NOTES, ['a', 'b', 'c']);+ rounds('Greet fast', [EXACT, 'Accept: fast now.'], ['d', 'e']);+ } finally {+ store.closeBoard(board);+ }++ const run = (...args) => spawnSync(process.execPath, [BIN, ...args], { cwd: repo, env, encoding: 'utf8' });+ const plain = run('show', '1');+ assert.equal(plain.status, 0, plain.stderr);+ const verdictLines = plain.stdout.split('\n').filter((line) => /^(REJECT|ACCEPT) /.test(line));+ assert.deepEqual(verdictLines.slice(0, 2), [+ `REJECT TEST_FAILURE by web-2 at aaaaaaaaaaaa: ${LEAD}${FAMILY}…`,+ 'REJECT TEST_FAILURE by web-2 at bbbbbbbbbbbb: Second reject: the guard returns undefined.',+ ], 'earlier verdicts are one line each: decision, reason, verifier, commit, the note\'s first line cut at 120 characters');+ assert.ok(plain.stdout.includes(`ACCEPT CRITERION_MET by web-2 at cccccccccccc: ${NOTES[2]}`), 'the latest verdict keeps its full note');+ for (const later of ['keeps going past the cut', 'Repro: greet("") throws.', 'Repro: greet("") is undefined.']) {+ assert.ok(!plain.stdout.includes(later), `an earlier note's cut and later lines are left out: ${later}`);+ }+ assert.match(plain.stdout, /every note in full: pullboard show 1 --history/);++ const history = run('show', '1', '--history');+ assert.equal(history.status, 0, history.stderr);+ for (const note of NOTES) assert.ok(history.stdout.includes(note), `--history prints: ${note.slice(0, 40)}`);+ assert.doesNotMatch(history.stdout, /earlier verdicts shortened/);+ assert.ok(plain.stdout.length < history.stdout.length, 'the plain output is the shorter one');++ const json = JSON.parse(run('show', '1', '--json').stdout);+ assert.deepEqual(json.verdicts.map((verdict) => verdict.verdict_note), NOTES, '--json carries every note in full');++ const whole = run('show', '2');+ assert.equal(whole.status, 0, whole.stderr);+ assert.ok(whole.stdout.includes(`REJECT TEST_FAILURE by web-2 at dddddddddddd: ${EXACT}\n`), 'a first line of exactly 120 characters is printed whole');+ assert.doesNotMatch(whole.stdout, /earlier verdicts shortened/, 'no hint when no earlier note was shortened');+});