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(digest): the briefing names stuck work and who moves it [A2,N26]
Corey Olson9ef8ce3e266a
diff --git a/src/digest.js b/src/digest.jsindex feec5491..d7628947 100644--- a/src/digest.js+++ b/src/digest.js@@ -10,6 +10,7 @@ import { closeSync, existsSync, fsyncSync, openSync, readSync, realpathSync, renimport { basename, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';import { setTimeout as pause } from 'node:timers/promises';import { milestones, openBoardReadOnly } from './board.js';+import { healthReport } from './health.js';import { secretsIn } from './hooks.js';import { Refused } from './refused.js';@@ -75,15 +76,16 @@ function section(title, entries, total, budget, empty) {* Read one consistent snapshot of the board at `file` and render the briefing.** @param {string} file the board's SQLite file- * @param {{ name?: string, now?: Date }} [options]+ * @param {{ name?: string, now?: Date, root?: string, config?: any }} [options] root and config let+ * pullboard health's stuck findings join the briefing* @returns {{ markdown: string, sequence: number, sections: { title: string, shown: number, total: number }[], bytes: number }}*/-export function readDigest(file, { name = 'this project', now = new Date() } = {}) {+export function readDigest(file, { name = 'this project', now = new Date(), root, config } = {}) {if (!existsSync(file)) throw new Refused('NO_BOARD', 'this repository has no board yet; run pullboard init in the main checkout first');const db = openBoardReadOnly(file);try {db.exec('BEGIN DEFERRED');- const result = render(db, { name, now });+ const result = render(db, { name, now, root, config });db.exec('COMMIT');return result;} finally { db.close(); }@@ -93,9 +95,9 @@ export function readDigest(file, { name = 'this project', now = new Date() } = {* Render the briefing from an open read-only connection inside one read transaction.** @param {any} db- * @param {{ name: string, now: Date }} options+ * @param {{ name: string, now: Date, root?: string, config?: any }} options*/-function render(db, { name, now }) {+function render(db, { name, now, root, config }) {const cut = { count: 0 };const at = now.toISOString();/** One field of board text, bounded. */@@ -178,8 +180,14 @@ function render(db, { name, now }) {// Releases still in progress come first, in roadmap order; then the most recently finished..sort((a, b) => (a.finished - b.finished) || (a.finished ? b.order - a.order : a.order - b.order)).map((row) => row.entry);+ // The same findings as pullboard health, read in this transaction: what is stuck and who moves it.+ const health = root ? healthReport({ db, root, config, now }) : { stuck: [] };+ /** Who moves a stuck finding next, in plain words. */+ const owner = ({ role, who }) => (role === 'person' ? 'you' : role === 'coordinator' ? 'the coordinator' : who ? `${text(who, 80)} (${role})` : `a ${role}`);+ const stuck = health.stuck.map((entry) => `- ${entry.item ? label(entry.item) : text(entry.subject, 60)}: ${text(entry.title, 240)}, since ${text(entry.since, 40)}: ${text(entry.why, 400)}\n Next, ${owner(entry.owner)}: ${text(entry.next, 300)}`);const sections = [- section('Open work', open.slice(0, ROW_LIMIT).map(work), open.length, 10_000, 'Nothing is open.'),+ section('Stuck and who moves it', stuck, stuck.length, 4_000, 'Nothing is stuck.'),+ section('Open work', open.slice(0, ROW_LIMIT).map(work), open.length, 8_000, 'Nothing is open.'),section('Blocked work', blocked.slice(0, ROW_LIMIT).map(work), blocked.length, 6_000, 'Nothing is blocked.'),section('In review', review.slice(0, ROW_LIMIT).map((item) => `- ${label(item.item_id)}, built by ${text(item.item_built_by ?? item.item_owner, 80)}: waits for a second agent to verify it.`), review.length, 3_000, 'Nothing waits for review.'),section('Recent decisions and answers', decisions.map((row) => row.entry), decisionTotal, 7_000, 'No decisions are recorded yet.'),@@ -192,7 +200,7 @@ function render(db, { name, now }) {const glance = [`- ${landed} items landed and ${accepted} are accepted and wait to land.`,`- ${review.length} wait for review, ${open.length} are open and ${blocked.length} are blocked.`,- `- ${sections[5].total} questions wait on you.`,+ `- ${sections[6].total} questions wait on you, and ${health.stuck.length} things are stuck.`,].join('\n');const left = [...sections.filter((entry) => entry.shown < entry.total).map((entry) => `- ${entry.title}: ${entry.shown} of ${entry.total} shown.`),@@ -274,9 +282,9 @@ export function writeDigest(path, markdown, commonDir) {** @param {string} file* @param {string} path- * @param {{ name: string, commonDir: string, signal: AbortSignal, interval?: number, onWrite?: (result: any) => void }} options+ * @param {{ name: string, root?: string, config?: any, commonDir: string, signal: AbortSignal, interval?: number, onWrite?: (result: any) => void }} options*/-export async function watchDigest(file, path, { name, commonDir, signal, interval = 250, onWrite = () => {} }) {+export async function watchDigest(file, path, { name, root, config, commonDir, signal, interval = 250, onWrite = () => {} }) {let db;let identity;let seen = -1;@@ -293,7 +301,7 @@ export async function watchDigest(file, path, { name, commonDir, signal, interva}const version = db.prepare('PRAGMA data_version').get().data_version;if (version !== seen) {- const result = readDigest(file, { name });+ const result = readDigest(file, { name, root, config });onWrite({ ...result, path: writeDigest(path, result.markdown, commonDir) });seen = version;}@@ -308,7 +316,7 @@ export async function watchDigest(file, path, { name, commonDir, signal, interva** @param {any} io* @param {{ first?: string, second?: string, rest: string[], values: Record<string, any> }} args- * @param {{ info: { commonDir: string }, config: { name?: string }, file: string }} ctx+ * @param {{ info: { root: string, commonDir: string }, config: { name?: string }, file: string }} ctx* @returns {Promise<number>}*/export async function digestCommand(io, { first, second, rest, values }, ctx) {@@ -324,12 +332,12 @@ export async function digestCommand(io, { first, second, rest, values }, ctx) {process.once('SIGINT', stop);process.once('SIGTERM', stop);try {- await watchDigest(ctx.file, out, { name, commonDir: ctx.info.commonDir, signal: controller.signal,+ await watchDigest(ctx.file, out, { name, root: ctx.info.root, config: ctx.config, commonDir: ctx.info.commonDir, signal: controller.signal,onWrite: (result) => io.say(`wrote the briefing to ${result.path} (board move ${result.sequence}); Ctrl-C stops watching`) });} finally { process.off('SIGINT', stop); process.off('SIGTERM', stop); }return 0;}- const result = readDigest(ctx.file, { name });+ const result = readDigest(ctx.file, { name, root: ctx.info.root, config: ctx.config });const path = out === undefined ? undefined : writeDigest(out, result.markdown, ctx.info.commonDir);io.result?.({ markdown: result.markdown, bytes: result.bytes, sequence: result.sequence, sections: result.sections, ...(path ? { path } : {}) });io.say(path ? `wrote the briefing to ${path}; share that file with any chat assistant` : result.markdown.trimEnd());diff --git a/test/digest.test.js b/test/digest.test.jsindex 66c7ab3c..a776be95 100644--- a/test/digest.test.js+++ b/test/digest.test.js@@ -18,7 +18,7 @@ const BIN = resolve(import.meta.dirname, '../bin/pullboard.js');* A real repository with its own board in a private temporary folder, so the developer's registry* and board are never read or touched.*/-function fixture(t, name) {+function fixture(t, name, extra = {}) {const dir = mkdtempSync(join(tmpdir(), 'pullboard-digest-'));t.after(() => rmSync(dir, { recursive: true, force: true }));const repo = join(dir, 'repo');@@ -30,7 +30,7 @@ function fixture(t, name) {for (const marker of [...AGENT_SHELL_MARKERS, ...SSH_SHELL_MARKERS]) delete env[marker];delete env.PULLBOARD_RELAY_TOKEN;runFixtureGit(['init', '-q', '-b', 'main'], { cwd: repo, env });- writeFileSync(join(repo, 'pullboard.json'), JSON.stringify({ name, spec: 'SPEC.md', gate: 'true', lanes: { web: { owns: ['web/'] } } }));+ writeFileSync(join(repo, 'pullboard.json'), JSON.stringify({ name, spec: 'SPEC.md', gate: 'true', lanes: { web: { owns: ['web/'] } }, ...extra }));writeFileSync(join(repo, 'SPEC.md'), '# Fixture\n\n## G · Goals\n- G1 [approved, must] Keep the board. | gate: true\n');runFixtureGit(['add', '-A'], { cwd: repo, env });runFixtureGit(['commit', '-q', '-m', 'chore: start the digest fixture'], { cwd: repo, env });@@ -78,7 +78,8 @@ function sectionOf(markdown, title) {}test('the digest is a readable briefing of one board [A2,N26]', (t) => {- const box = fixture(t, 'Briefing project');+ // A zero stuck threshold makes pullboard health's findings appear on a board made seconds ago.+ const box = fixture(t, 'Briefing project', { health: { stuck: '0m', holds: '0m', release: '1d' } });const other = fixture(t, 'Other private project');add(other.board, 'Other board private item');store.shout(other.board, { from: 'web-1', to: 'coordinator', text: 'Other board shout to its coordinator', lanes: ['web'] });@@ -127,7 +128,8 @@ test('the digest is a readable briefing of one board [A2,N26]', (t) => {assert.match(shouts, /web-2, .*: The upload review is next in my queue/u);assert.ok(shouts.indexOf('upload review') < shouts.indexOf('[redacted secret]'), 'the latest shout comes first');assert.match(sectionOf(markdown, 'Milestones'), /First release: planned; 2 items, 0 landed, 0 accepted, 0 in review, 2 open\.\n {2}Uploads that work/u);- assert.match(sectionOf(markdown, 'At a glance'), /1 questions wait on you/u);+ assert.match(sectionOf(markdown, 'At a glance'), /1 questions wait on you, and [1-9]\d* things are stuck/u);+ assert.match(sectionOf(markdown, 'Stuck and who moves it'), /- decision #\d+: .*\n {2}Next, you: /u);assert.equal(markdown.includes(planted), false, 'a secret never reaches the briefing');assert.equal(markdown.includes('ghp_'), false, 'no part of the secret survives');@@ -143,7 +145,7 @@ test('the digest is a readable briefing of one board [A2,N26]', (t) => {/** The briefing from its first section on; the header carries the time it was read. */const body = (text) => text.slice(text.indexOf('## At a glance')).trimEnd();assert.equal(body(json.markdown), body(markdown), 'the JSON result carries the same briefing');- assert.deepEqual(json.sections.map((entry) => entry.title), ['Open work', 'Blocked work', 'In review', 'Recent decisions and answers',+ assert.deepEqual(json.sections.map((entry) => entry.title), ['Stuck and who moves it', 'Open work', 'Blocked work', 'In review', 'Recent decisions and answers','Recent verdicts', 'Questions waiting on you', 'Latest shouts to the coordinator', 'Milestones']);const out = join(box.dir, 'briefing.md');