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 new release headlines once per checkout [N19]
Corey Olson15e705182e35
diff --git a/package.json b/package.jsonindex 45f5e6bd..a957b97a 100644--- a/package.json+++ b/package.json@@ -23,6 +23,7 @@"src","skills","docs",+ "CHANGELOG.md","README.md","LICENSE"],diff --git a/src/changelog.js b/src/changelog.jsnew file mode 100644index 00000000..470d53c8--- /dev/null+++ b/src/changelog.js@@ -0,0 +1,35 @@+/** Released headline summaries shared by resume and the view [N19]. */+import { readFileSync } from 'node:fs';++/** Return the first headline paragraph for each release after `previous` through `current`. */+export function releaseHeadlinesBetween(previous, current) {+ if (!/^\d+\.\d+\.\d+$/u.test(previous) || !/^\d+\.\d+\.\d+$/u.test(current)) return [];+ const changelog = readFileSync(new URL('../CHANGELOG.md', import.meta.url), 'utf8');+ /** Split a numeric release into components for version comparison. */+ const parts = (version) => version.split('.').map(Number);+ /** Compare numeric version components without treating 0.8.10 as older than 0.8.9. */+ const compare = (left, right) => {+ const a = parts(left), b = parts(right);+ for (let index = 0; index < 3; index += 1) if (a[index] !== b[index]) return a[index] - b[index];+ return 0;+ };+ const releases = [];+ const sections = changelog.split(/^## \[(\d+\.\d+\.\d+)\][^\n]*\n/gmu);+ for (let index = 1; index < sections.length; index += 2) {+ const version = sections[index];+ if (compare(version, previous) <= 0 || compare(version, current) > 0) continue;+ const section = sections[index + 1] ?? '';+ const categories = new Set(['added', 'changed', 'fixed', 'removed', 'security', 'deprecated']);+ const headings = [...section.matchAll(/^### (.+)\s*$/gmu)];+ const headline = headings.find(entry => !categories.has(entry[1].trim().toLowerCase()));+ if (!headline) continue;+ const nextHeading = headings.find(entry => entry.index > headline.index);+ const afterHeadline = section.slice(headline.index + headline[0].length, nextHeading?.index);+ const paragraph = afterHeadline.trim().split(/\n\s*\n/u)[0]+ .split('\n').filter(line => line.trim() && !/^[-*] /u.test(line)).join(' ').trim();+ if (paragraph) releases.push({ version, headline: headline[1].trim(), paragraph });+ }+ /** Sort matching release summaries newest first. */+ const newestFirst = (a, b) => compare(b.version, a.version);+ return releases.sort(newestFirst);+}diff --git a/src/cli.js b/src/cli.jsindex 688d9f1a..2c35242a 100644--- a/src/cli.js+++ b/src/cli.js@@ -70,6 +70,7 @@ import { staleFrozenItems, staleItemFinding } from './approved-rows.js';import { mainPolicy, policyAt, itemPolicy, submissionPaths, frozenCheck, checkAtCommit, dependencySnapshots, requireTrunkMerge, trunkRef } from './trusted-policy.js';import { proofStats } from './stats.js';import { flowLines, flowAlertLine } from './stats-flow.js';+import { releaseHeadlinesBetween } from './changelog.js';import { exportBoard, importBoard } from './exchange.js';import { addSigner, assertRequiredSigners, defaultPrincipal, hasSignerFile } from './signature.js';import { loadMachineSettings, setGateSlots } from './settings.js';@@ -1006,6 +1007,23 @@ function coordinatorDecisionSections(board, ctx) {return { openDecisions, recentAnswers, personQuestions, shouts };}+/** Read and update this checkout's last-run version, returning only newly released headlines. */+function resumeReleaseNotes(info) {+ const record = join(info.gitDir, 'pullboard-checkout', 'resume-version');+ let previous = '';+ try { previous = readFileSync(record, 'utf8').trim(); } catch { /* First resume in this checkout. */ }+ if (!/^\d+\.\d+\.\d+$/u.test(previous)) {+ mkdirSync(dirname(record), { recursive: true });+ writeFileSync(record, `${VERSION}\n`);+ return null;+ }+ if (previous === VERSION) return null;+ const releases = releaseHeadlinesBetween(previous, VERSION);+ mkdirSync(dirname(record), { recursive: true });+ writeFileSync(record, `${VERSION}\n`);+ return releases.length ? { releases: releases.slice(0, 3), omitted: Math.max(0, releases.length - 3), notes: 'CHANGELOG.md' } : null;+}+/*** `pullboard resume` (N19): one short card that puts an agent back to work after a fresh start,* a restart or a compaction, from the board rather than from a summary.@@ -1056,6 +1074,12 @@ function resumeHere(io) {card.reviewQueue = { items: card.toVerify, awaiting: card.awaiting };}const say = (line) => io.say(line);+ const releaseNotes = card.whatsNew = resumeReleaseNotes(ctx.info);+ for (const note of (releaseNotes?.releases ?? [])) {+ say(`new in ${note.version} — ${note.headline}: ${note.paragraph}`);+ }+ if (releaseNotes?.omitted) say(`${releaseNotes.omitted} earlier release${releaseNotes.omitted === 1 ? '' : 's'} omitted; see the full notes in CHANGELOG.md`);+ else if (releaseNotes?.releases.length) say('Full release notes: CHANGELOG.md');for (const problem of card.relayProblems) say(problem.message);for (const problem of card.hookProblems) say(`${problem.message}; ${problem.next}`);const plural = (n, word) => `${n} ${word}${n === 1 ? '' : 's'}`;diff --git a/test/package.test.js b/test/package.test.jsindex 5f3a17c9..229f462c 100644--- a/test/package.test.js+++ b/test/package.test.js@@ -220,6 +220,7 @@ test('the installable package includes the single inherited doctrine file [D1]',const files = JSON.parse(packed.stdout)[0].files.map(file => file.path);assert.equal(files.filter(file => file === 'src/standard-doctrine.md').length, 1);assert.ok(files.includes('src/doctrine.js'));+ assert.ok(files.includes('CHANGELOG.md'), 'resume release headlines require the shipped changelog');});diff --git a/test/resume-flow.test.js b/test/resume-flow.test.jsindex 5155b837..b81ee16f 100644--- a/test/resume-flow.test.js+++ b/test/resume-flow.test.js@@ -1,13 +1,127 @@/** Coordinator flow alerts reuse the real Git/SQLite statistics and documented thresholds [N32,R1,R2]. */import assert from 'node:assert/strict';-import { mkdtempSync, realpathSync, rmSync, writeFileSync } from 'node:fs';+import { cpSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';import { join } from 'node:path';import { test } from 'node:test';import * as store from '../src/board.js';import { main } from '../src/cli.js';import { proofStats } from '../src/stats.js';-import { runFixtureGit } from './fixture-child.js';+import { runFixtureChild, runFixtureGit } from './fixture-child.js';++const PRIVATE_CHANGELOG = `# Changelog\n\n## [0.8.7] - 2026-10-12\n\n### A new session\n\nThe latest headline paragraph.\n\n### Added\n\n- The detailed release list is not part of the resume.\n\n## [0.8.6] - 2026-10-11\n\n### See the flow\n\nThe middle headline paragraph.\n\n### Fixed\n\n- A detailed fix.\n\n## [0.8.5] - 2026-10-10\n\n### A prettier board\n\nThe previous release.\n`;+const LONG_CHANGELOG = `# Changelog\n\n## [0.8.9] - 2026-10-14\n\n### Nine\n\nNine paragraph.\n\n## [0.8.8] - 2026-10-13\n\n### Eight\n\nEight paragraph.\n\n## [0.8.7] - 2026-10-12\n\n### Seven\n\nSeven paragraph.\n\n## [0.8.6] - 2026-10-11\n\n### Six\n\nSix paragraph.\n\n## [0.8.5] - 2026-10-10\n\n### Five\n\nFive paragraph.\n\n## [0.8.4] - 2026-10-09\n\n### Added\n\nThis category heading is not a release headline.\n`;++/** Build an isolated copy of the production CLI at a chosen release version. */+function releaseFixture(t, { previous = null, version = '0.8.7', changelog = PRIVATE_CHANGELOG } = {}) {+ const root = realpathSync(mkdtempSync(join(tmpdir(), 'pullboard-resume-release-')));+ t.after(() => rmSync(root, { recursive: true, force: true }));+ const cli = join(root, 'cli');+ const repo = join(root, 'repo');+ mkdirSync(cli);+ mkdirSync(repo);+ writeFileSync(join(repo, 'SPEC.md'), '# Release fixture\n\n## N · Resume\n- N19 [approved, must] Resume announces released headlines once per checkout. | gate: review\n');+ cpSync(join(import.meta.dirname, '../src'), join(cli, 'src'), { recursive: true });+ cpSync(join(import.meta.dirname, '../bin'), join(cli, 'bin'), { recursive: true });+ cpSync(join(import.meta.dirname, '../skills'), join(cli, 'skills'), { recursive: true });+ symlinkSync(join(cli, 'bin/pullboard.js'), join(cli, 'bin/pullboard'));+ const packageData = JSON.parse(readFileSync(join(import.meta.dirname, '../package.json'), 'utf8'));+ writeFileSync(join(cli, 'package.json'), JSON.stringify({ ...packageData, version }));+ writeFileSync(join(cli, 'CHANGELOG.md'), changelog);+ const env = { ...process.env, PATH: `${join(cli, 'bin')}:${process.env.PATH}`, PULLBOARD_HOME: join(root, 'home'), PULLBOARD_MACHINE_HOME: join(root, 'machine-home'),+ GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_NOSYSTEM: '1', GIT_AUTHOR_NAME: 'Fixture',+ GIT_AUTHOR_EMAIL: '[email protected]', GIT_COMMITTER_NAME: 'Fixture', GIT_COMMITTER_EMAIL: '[email protected]' };+ delete env.PULLBOARD_RELAY_TOKEN;+ runFixtureGit(['init', '-q', '-b', 'main'], { cwd: repo, env });+ /** Run the copied production CLI in the selected real checkout. */+ const run = (cwd, ...args) => runFixtureChild(process.execPath, [join(cli, 'bin/pullboard.js'), ...args], { cwd, env, encoding: 'utf8' });+ /** Run Git with this fixture's private identity and configuration. */+ const git = (cwd, ...args) => runFixtureGit(args, { cwd, env });+ const initialized = run(repo, 'init');+ assert.equal(initialized.status, 0, initialized.failure || initialized.stderr || initialized.stdout);+ if (previous) {+ const record = join(repo, '.git', 'pullboard-checkout', 'resume-version');+ mkdirSync(join(repo, '.git', 'pullboard-checkout'), { recursive: true });+ writeFileSync(record, `${previous}\n`);+ }+ return { root, repo, run, git, env };+}++test('resume says what is new once after an upgrade [N19]', t => {+ const box = releaseFixture(t, { previous: '0.8.5' });+ const otherCheckout = join(box.root, 'other-checkout');+ box.git(box.repo, 'add', '-A');+ box.git(box.repo, 'commit', '-q', '-m', 'chore: initialize resume release fixture [N19]');+ box.git(box.repo, 'worktree', 'add', '-q', '-b', 'other', otherCheckout);+ const lane = Object.keys(JSON.parse(readFileSync(join(box.repo, 'pullboard.json'), 'utf8')).lanes)[0];+ const joined = box.run(otherCheckout, 'join', lane, '--model', 'Fixture');+ assert.equal(joined.status, 0, joined.failure || joined.stderr || joined.stdout);+ const firstCheckoutRun = box.run(otherCheckout, 'resume');+ assert.equal(firstCheckoutRun.status, 0, firstCheckoutRun.failure || firstCheckoutRun.stderr || firstCheckoutRun.stdout);+ assert.doesNotMatch(firstCheckoutRun.stdout, /new in 0\.8\.[67]|Full release notes/u);+ const first = box.run(box.repo, 'resume');+ assert.equal(first.status, 0, first.failure || first.stderr || first.stdout);+ const text = first.stdout;+ const latest = text.indexOf('new in 0.8.7 — A new session: The latest headline paragraph.');+ const middle = text.indexOf('new in 0.8.6 — See the flow: The middle headline paragraph.');+ assert.ok(latest >= 0 && middle > latest, text);+ const fullNotes = text.indexOf('Full release notes: CHANGELOG.md');+ assert.ok(fullNotes >= 0 && fullNotes < text.indexOf('resume:'), text);+ assert.doesNotMatch(text, /detailed release list|A detailed fix|new in 0\.8\.5/u);+ const second = box.run(box.repo, 'resume');+ assert.equal(second.status, 0, second.failure || second.stderr || second.stdout);+ assert.doesNotMatch(second.stdout, /new in 0\.8\.[67]/u);+});++test('resume --json carries what is new [N19]', t => {+ const box = releaseFixture(t, { previous: '0.8.5' });+ const first = box.run(box.repo, 'resume', '--json');+ assert.equal(first.status, 0, first.failure || first.stderr || first.stdout);+ assert.deepEqual(JSON.parse(first.stdout).whatsNew, {+ releases: [+ { version: '0.8.7', headline: 'A new session', paragraph: 'The latest headline paragraph.' },+ { version: '0.8.6', headline: 'See the flow', paragraph: 'The middle headline paragraph.' },+ ], omitted: 0, notes: 'CHANGELOG.md',+ });+ const second = box.run(box.repo, 'resume', '--json');+ assert.equal(second.status, 0, second.failure || second.stderr || second.stdout);+ assert.equal(JSON.parse(second.stdout).whatsNew, null, 'JSON notes are shown once');+ const text = box.run(box.repo, 'resume');+ assert.equal(text.status, 0, text.failure || text.stderr || text.stdout);+ assert.doesNotMatch(text.stdout, /new in 0\.8\.[67]/u, 'JSON resume records the displayed notes');+ const fresh = releaseFixture(t);+ const quiet = fresh.run(fresh.repo, 'resume', '--json');+ assert.equal(quiet.status, 0, quiet.failure || quiet.stderr || quiet.stdout);+ assert.equal(JSON.parse(quiet.stdout).whatsNew, null, 'first-ever JSON resume stays quiet');+ const long = releaseFixture(t, { previous: '0.8.3', version: '0.8.9', changelog: LONG_CHANGELOG });+ const trimmed = long.run(long.repo, 'resume', '--json');+ assert.equal(trimmed.status, 0, trimmed.failure || trimmed.stderr || trimmed.stdout);+ const notes = JSON.parse(trimmed.stdout).whatsNew;+ assert.deepEqual(notes.releases.map(release => release.version), ['0.8.9', '0.8.8', '0.8.7']);+ assert.equal(notes.omitted, 2);+ assert.equal(notes.notes, 'CHANGELOG.md');+});++test('a first run records the version quietly [N19]', t => {+ const box = releaseFixture(t);+ const result = box.run(box.repo, 'resume');+ assert.equal(result.status, 0, result.failure || result.stderr || result.stdout);+ assert.doesNotMatch(result.stdout, /new in 0\.8\.[67]|Full release notes/u);+ assert.equal(readFileSync(join(box.repo, '.git', 'pullboard-checkout', 'resume-version'), 'utf8'), '0.8.7\n');+});++test('resume limits long upgrade notes and skips changelog categories as headlines [N19]', t => {+ const box = releaseFixture(t, { previous: '0.8.3', version: '0.8.9', changelog: LONG_CHANGELOG });+ const result = box.run(box.repo, 'resume');+ assert.equal(result.status, 0, result.failure || result.stderr || result.stdout);+ const text = result.stdout;+ assert.match(text, /new in 0\.8\.9 — Nine: Nine paragraph\./u);+ assert.match(text, /new in 0\.8\.8 — Eight: Eight paragraph\./u);+ assert.match(text, /new in 0\.8\.7 — Seven: Seven paragraph\./u);+ assert.doesNotMatch(text, /new in 0\.8\.6|new in 0\.8\.5|new in 0\.8\.4/u);+ assert.match(text, /2 earlier releases omitted; see the full notes in CHANGELOG\.md/u);+ assert.doesNotMatch(text, /new in 0\.8\.4 — Added/u);+});const BASE = Date.parse('2026-10-10T00:00:00Z');const MINUTE = 60_000;