Skip to content

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.

Merge accepted #695 onto current local main

Corey Olsonc5ffc7e37e80
diff --cc src/agent-session.js
index be9704bf,edbfbf6b..f8ad03b2
--- a/src/agent-session.js
+++ b/src/agent-session.js
@@@ -1,7 -1,12 +1,18 @@@
/** A checkout belongs to one local agent session; bindings never enter the shared board [B3,B7]. */
import { createHash } from 'node:crypto';
- import { existsSync, readdirSync, readFileSync, realpathSync, renameSync, writeFileSync } from 'node:fs';
- import { dirname, join, resolve } from 'node:path';
+ import {
+ existsSync,
++ readdirSync,
+ readFileSync,
++ realpathSync,
+ renameSync,
+ writeFileSync,
+ } from 'node:fs';
-import { join } from 'node:path';
++import {
++ dirname,
++ join,
++ resolve,
++} from 'node:path';
import { takeResource } from './resources.js';
import { Refused } from './refused.js';
diff --cc src/browser-slot-guard.js
index cc5407a1,f8d33b40..c5d33822
--- a/src/browser-slot-guard.js
+++ b/src/browser-slot-guard.js
@@@ -14,15 -14,21 +14,24 @@@
* Without the marker, importing this module changes nothing.
*/
import childProcess from 'node:child_process';
- import { statSync, realpathSync } from 'node:fs';
+ import {
+ statSync,
+ realpathSync,
+ } from 'node:fs';
import { syncBuiltinESMExports } from 'node:module';
- import { basename, delimiter, isAbsolute, relative, resolve } from 'node:path';
+ import {
+ basename,
+ delimiter,
+ isAbsolute,
+ relative,
+ resolve,
+ } from 'node:path';
-import { promisify } from 'node:util';
import { Refused } from './refused.js';
+// The util ESM facade evaluates lazy exports, including diff, which opens stderr on Node 24.
+// A child may share that descriptor with stdout; keep its pipe mode unchanged when preloading us.
+const { promisify } = process.getBuiltinModule('node:util');
+
/** The marker the runner sets in a test file's process: held, none, or unset when the setting is off. */
export const BROWSER_SLOT_ENV = 'PULLBOARD_TEST_BROWSER_SLOT';
/** Install paths test/chrome-fixture.js's findChromeExecutable looks in, besides PULLBOARD_CHROME. */
diff --cc src/cli.js
index fedacbbd,d0ee6e3e..19c8dde6
--- a/src/cli.js
+++ b/src/cli.js
@@@ -2,26 -2,115 +2,117 @@@
* The pullboard command line: every command, bound to who is asking (B3, R3). The main checkout is the
* coordinator; every other worktree is the agent that joined from it.
*/
- import { createHash, randomUUID } from 'node:crypto';
- import { spawn, spawnSync } from 'node:child_process';
- import { appendFileSync, existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, writeFileSync } from 'node:fs';
- import { hostname, loadavg } from 'node:os';
- import { basename, dirname, isAbsolute, join, relative, resolve } from 'node:path';
+ import {
+ createHash,
+ randomUUID,
+ } from 'node:crypto';
+ import {
+ spawn,
+ spawnSync,
+ } from 'node:child_process';
+ import {
+ appendFileSync,
+ existsSync,
+ mkdirSync,
+ readFileSync,
+ realpathSync,
+ writeFileSync,
+ } from 'node:fs';
+ import { loadavg } from 'node:os';
+ import {
+ basename,
+ dirname,
+ isAbsolute,
+ join,
+ relative,
+ resolve,
+ } from 'node:path';
import { performance } from 'node:perf_hooks';
- import { pathToFileURL } from 'node:url';
+ import {
+ fileURLToPath,
+ pathToFileURL,
+ } from 'node:url';
import { parseArgs } from 'node:util';
import * as store from './board.js';
- import { CONFIG_FILE, COORDINATOR, DOCTRINE_FILE, LEGACY_DOCTRINE_FILE, loadConfig } from './config.js';
+ import {
+ CONFIG_FILE,
+ COORDINATOR,
+ DOCTRINE_FILE,
+ LEGACY_DOCTRINE_FILE,
+ loadConfig,
+ } from './config.js';
import { displayAgentName } from './agent-names.js';
- import { doctrineHistory, loadDoctrine } from './doctrine.js';
- import { agentDoctrine, proposeDoctrine, resumeDoctrineNotes, staleDoctrineRows } from './doctrine-rulings.js';
- import { checkRulesAt, doctrineReport, hasSubmitRules, holdDoctrine, ruleLine } from './doctrine-checks.js';
- import { AGENT_SESSION_IDS, agentSessionDigest, requirePersonChannel } from './person.js';
- import { bindLocalSession, localSessionMatches, localSessionSeats } from './agent-session.js';
- import { decisionAnswer, decisionProjection, handAnsweredQuestions, pendingAnswers, planRowApply, prepareRowDecisions, restoreRowApply, writeRowApply } from './row-decisions.js';
- import { digestOf, gateReport, refuseSandboxBlocked, runGate, runProfiledShell, runSubmitGate, submitGateReport, timingDigest, withGateSlot } from './gate.js';
- import { checkNeedsBrowser, explicitCheckFiles } from './browser-admission.js';
- import { bareWorktreeFinding, codeIsFromMain, contains, differFromHead, git, gitChildEnv, headCommit, headTree, invalidateGitFacts, isClean, mainCheckout, patchId, repoInfo, resolveCommit, tryGit, untracked, withGitFacts } from './git.js';
+ import {
+ doctrineHistory,
+ loadDoctrine,
+ } from './doctrine.js';
+ import {
+ agentDoctrine,
+ proposeDoctrine,
+ resumeDoctrineNotes,
+ staleDoctrineRows,
+ } from './doctrine-rulings.js';
+ import {
+ checkRulesAt,
+ doctrineReport,
+ hasSubmitRules,
+ holdDoctrine,
+ ruleLine,
+ } from './doctrine-checks.js';
+ import {
++ AGENT_SESSION_IDS,
+ agentSessionDigest,
+ requirePersonChannel,
+ } from './person.js';
+ import {
+ bindLocalSession,
+ localSessionMatches,
++ localSessionSeats,
+ } from './agent-session.js';
+ import {
+ decisionAnswer,
+ decisionProjection,
+ handAnsweredQuestions,
+ pendingAnswers,
+ planRowApply,
+ prepareRowDecisions,
+ restoreRowApply,
+ writeRowApply,
+ } from './row-decisions.js';
+ import {
+ digestOf,
+ gateReport,
+ refuseSandboxBlocked,
+ runGate,
+ runProfiledShell,
+ runSubmitGate,
+ submitGateReport,
+ timingDigest,
+ withGateSlot,
+ } from './gate.js';
+ import {
+ checkNeedsBrowser,
+ explicitCheckFiles,
+ } from './browser-admission.js';
+ import {
+ bareWorktreeFinding,
+ codeIsFromMain,
+ contains,
+ differFromHead,
+ git,
+ gitChildEnv,
+ headCommit,
+ headTree,
+ invalidateGitFacts,
+ isClean,
+ mainCheckout,
+ patchId,
+ repoInfo,
+ resolveCommit,
+ tryGit,
+ untracked,
+ withGitFacts,
+ } from './git.js';
import {
FIX_NOTE,
applyFixers,
@@@ -62,25 -187,83 +189,89 @@@ import
standings,
unmetRows,
} from './spec.js';
- import { answerQuestion, bundledBlueprints, landBlueprint, planBlueprint, readBlueprint, repoAnswers, saveBlueprint } from './blueprints.js';
+ import {
+ answerQuestion,
+ bundledBlueprints,
+ landBlueprint,
+ planBlueprint,
+ readBlueprint,
+ repoAnswers,
+ saveBlueprint,
+ } from './blueprints.js';
import { briefFiles } from './brief.js';
- import { commitFirst, commitOwnerLines, commitOwners, coordinatorInbox, coordinatorInboxLines, inboxFirst } from './resume.js';
- import { checkBaseline, prepareCheckBaseline, refuseCheckSyntax, sayCheckBaseline } from './check-baseline.js';
- import { checkAcceptCommand, refuseClaimProvesNothing, refuseProvesNothing } from './check-accept.js';
- import { retryCheckBaselines, startCheckBaseline } from './check-baseline-worker.js';
- import { compareMainFailures, mainRedMessage, mainRedReworkItems } from './main-red.js';
+ import {
+ commitFirst,
+ commitOwnerLines,
+ commitOwners,
+ coordinatorInbox,
+ coordinatorInboxLines,
+ inboxFirst,
+ } from './resume.js';
+ import {
+ checkBaseline,
+ prepareCheckBaseline,
+ refuseCheckSyntax,
+ sayCheckBaseline,
+ } from './check-baseline.js';
+ import {
+ checkAcceptCommand,
+ refuseClaimProvesNothing,
+ refuseProvesNothing,
+ } from './check-accept.js';
+ import {
+ retryCheckBaselines,
+ startCheckBaseline,
+ } from './check-baseline-worker.js';
+ import {
+ compareMainFailures,
+ mainRedMessage,
+ mainRedReworkItems,
+ } from './main-red.js';
import { runItems } from './run.js';
- import { parseProblems, sweepItems } from './sweep.js';
+ import {
+ parseProblems,
+ sweepItems,
+ } from './sweep.js';
import { renderSpecView } from './view.js';
import { tour } from './tour.js';
- import { commandOutput, refusalDocument } from './json.js';
- import { forgetProject, listApiProjects, registerProjectAndLink, registeredProjectRootsSnapshot } from './projects.js';
+ import {
+ commandOutput,
+ refusalDocument,
+ } from './json.js';
+ import {
+ forgetProject,
+ listApiProjects,
+ registerProjectAndLink,
+ registeredProjectRootsSnapshot,
+ } from './projects.js';
import { milestoneRoadmap } from './roadmap.js';
- import { listResources, memoryVerdict, readMachineMemory, runnerResourceStatus } from './resources.js';
- import { citedTestFiles, rowEvidence, rowStage } from './evidence.js';
- import { exportView, serveView } from './serve.js';
- import { forgetView, portHolder, rememberView, runningView } from './view-session.js';
- import { backgroundViewLine, keepViewRunning, launchBackgroundView, reportView } from './background-view.js';
+ import {
+ listResources,
+ memoryVerdict,
+ readMachineMemory,
+ runnerResourceStatus,
+ } from './resources.js';
+ import {
+ citedTestFiles,
+ rowEvidence,
+ rowStage,
+ } from './evidence.js';
+ import {
+ exportView,
+ serveView,
+ } from './serve.js';
+ import {
+ forgetView,
+ portHolder,
+ rememberView,
+ runningView,
+ } from './view-session.js';
++import {
++ backgroundViewLine,
++ keepViewRunning,
++ launchBackgroundView,
++ reportView,
++} from './background-view.js';
import { serveApi } from './api.js';
import { watchCommand } from './watch.js';
import { serveMcp } from './mcp.js';
diff --cc src/machine-commands.js
index 00000000,a0eab642..1c86f552
mode 000000,100644..100644
--- a/src/machine-commands.js
+++ b/src/machine-commands.js
@@@ -1,0 -1,70 +1,71 @@@
+ /**
+ * Machine-wide commands that need no board (Q1): pullboard settings reads or sets this machine's
+ * gate and browser capacity, and pullboard runner add registers SSH test capacity.
+ */
+ import { Refused } from './refused.js';
+ import {
+ addRunner,
+ gateQueueSettings,
+ gateShortSlots,
+ loadMachineSettings,
+ memoryFloorMB,
+ relayOfferEnabled,
+ setBrowserSlots,
+ setGateShortSlots,
+ setGateSlots,
+ } from './settings.js';
+
+ /** Read or update machine-wide gate capacity. */
+ export function settingsCommand(io, { first, second, rest }) {
+ if (!first && !second && !rest.length) {
+ const settings = loadMachineSettings();
+ const queue = gateQueueSettings();
+ // The result names the queue order in effect, defaults included; the file keeps only what was set.
+ const offerAtInit = relayOfferEnabled();
+ const shortSlots = gateShortSlots();
+ io.result?.({ settings: { ...settings, gate: { ...settings.gate, queue: { ...settings.gate?.queue, ...queue }, shortSlots }, relay: { ...settings.relay, offerAtInit } }, memoryFloorMB: memoryFloorMB() });
+ io.say(`gateSlots: ${settings.gateSlots}`);
+ io.say(`browserSlots: ${settings.browserSlots}`);
+ io.say(`gate.queue.reviewsFirst: ${queue.reviewsFirst}${queue.reviewsFirst ? '' : ' (landings first, then arrival order)'}`);
+ io.say(`gate.queue.currentReleaseFirst: ${queue.currentReleaseFirst}${queue.currentReleaseFirst ? '' : ' (release priority is off)'}`);
+ io.say(`gate.queue.agingMinutes: ${queue.agingMinutes}${queue.reviewsFirst || queue.currentReleaseFirst ? '' : ' (used only while reviewsFirst or currentReleaseFirst is true)'}`);
+ io.say(`gate.memoryFloorMB: ${memoryFloorMB() ?? 'off (the gate queue does not wait for memory)'}`);
++ io.say(`view.background: ${settings.view?.background !== false}${settings.view?.background === false ? ' (init and resume leave the view to you)' : ' (init and resume keep pullboard view running for pullboard.dev)'}`);
+ io.say(`relay.offerAtInit: ${offerAtInit}${offerAtInit ? ' (init asks once to share your boards with your phone)' : ' (init stays quiet about sharing)'}`);
+ io.say(`gate.shortSlots: ${shortSlots}${shortSlots ? '' : ' (off; runs that name their test files wait for a gate slot)'}`);
+ return 0;
+ }
+ if (!['gateSlots', 'browserSlots', 'gate.shortSlots'].includes(first) || !second || rest.length) {
+ throw new Refused('USAGE', 'pullboard settings gateSlots <n> | browserSlots <n> | gate.shortSlots <n>');
+ }
+ if (first === 'gate.shortSlots') {
+ if (!/^(?:0|[1-9]\d*)$/u.test(second) || !Number.isSafeInteger(Number(second))) {
+ throw new Refused('BAD_SHORT_SLOTS', 'gate.shortSlots must be a whole number, 0 or more; run pullboard settings gate.shortSlots <n>');
+ }
+ const settings = setGateShortSlots(Number(second));
+ io.result?.({ settings });
+ io.say(`gate.shortSlots set to ${settings.gate.shortSlots}`);
+ return 0;
+ }
+ if (!/^[1-9]\d*$/u.test(second) || !Number.isSafeInteger(Number(second))) {
+ if (first === 'gateSlots') throw new Refused('USAGE', 'pullboard settings gateSlots <positive integer>');
+ throw new Refused(first === 'browserSlots' ? 'BAD_BROWSER_SLOTS' : 'BAD_GATE_SLOTS', `${first} must be a positive integer; run pullboard settings ${first} <n>`);
+ }
+ const settings = first === 'browserSlots' ? setBrowserSlots(Number(second)) : setGateSlots(Number(second));
+ io.result?.({ settings });
+ io.say(`${first} set to ${settings[first]}`);
+ return 0;
+ }
+
+ /** Register machine-level SSH capacity without requiring a board identity or a runner account. */
+ export function runnerCommand(io, { first, second, rest, values }) {
+ if (first !== 'add' || !second || rest.length || !/^[1-9]\d*$/u.test(values.slots ?? '')
+ || !/^(?:0|[1-9]\d*)$/u.test(values.browser ?? '')) {
+ throw new Refused('USAGE', 'pullboard runner add <ssh-host> --slots <positive integer> --browser <integer from zero through slots>');
+ }
+ const runner = addRunner({ host: second, slots: Number(values.slots), browser: Number(values.browser),
+ ...(values.node !== undefined ? { node: values.node } : {}), ...(values.root !== undefined ? { root: values.root } : {}) });
+ io.result?.({ runner });
+ io.say(`registered runner ${runner.host}: ${runner.slots} slots, ${runner.browser} browser`);
+ return 0;
+ }
diff --cc test/cli-help.test.js
index c72c00aa,a93bfc6d..ada26cf8
--- a/test/cli-help.test.js
+++ b/test/cli-help.test.js
@@@ -1,11 -1,17 +1,25 @@@
+ /** @pullboard-test-input source-tree */
/** The layered CLI help stays short, command-specific, and in parity with its declaration [N37,I1]. */
import assert from 'node:assert/strict';
- import { chmodSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
-import { mkdtempSync, readdirSync, readFileSync, rmSync } from 'node:fs';
++import {
++ chmodSync,
++ mkdirSync,
++ mkdtempSync,
++ readdirSync,
++ readFileSync,
++ rmSync,
++ writeFileSync,
++} from 'node:fs';
import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
-import { runFixtureChild } from './fixture-child.js';
+import { runFixtureChild, runFixtureGit } from './fixture-child.js';
import { after, test } from 'node:test';
import { HELP, resultCommands } from '../src/cli.js';
+ import * as helpDeclaration from '../src/help.js';
+ import { importStyleViolations } from './import-style-helpers.js';
+ import { pathToFileURL } from 'node:url';
+ import { loadConfig } from '../src/config.js';
+ import { laneOf } from '../src/lanes.js';
const BIN = resolve(import.meta.dirname, '../bin/pullboard.js');
const sandboxes = [];