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(init): init offers to share with your phone in one Enter [H17,H5]
Corey Olsond898a70e3eb4
diff --git a/src/cli.js b/src/cli.jsindex 3c5fb08f..4a5c1b42 100644--- a/src/cli.js+++ b/src/cli.js@@ -87,9 +87,9 @@ 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 { addRunner, browserFreeChecksEnabled, gateQueueSettings, loadMachineSettings, memoryFloorMB, setBrowserSlots, setGateSlots } from './settings.js';+import { addRunner, browserFreeChecksEnabled, gateQueueSettings, loadMachineSettings, memoryFloorMB, relayOfferEnabled, setBrowserSlots, setGateSlots } from './settings.js';import { formatSnapshotLimit, pendingSnapshotSize, pendingCheckpointProblem, relayCommandReceipt, relayCommandReceiptReported, relayLinked, relayOff, relayOn, relayOperation, relayRecover, relayRecovered, relayRevoke, relayStatus, relayTokens, syncRelay } from './relay.js';-import { autoLinkProject, relayOnAll, revokeRelayDevice, unlinkedRelayProjects } from './relay-setup.js';+import { autoLinkProject, offerRelayAtInit, relayOnAllCommand, revokeRelayDevice, unlinkedRelayProjects } from './relay-setup.js';import { readRelayMachine } from './relay-machine.js';import { relayJoin, relayPair } from './relay-pairing-client.js';import { executePersonRequests } from './relay-request-execution.js';@@ -1694,7 +1694,7 @@ function setupCommands(io, { first, second, rest = [], values }) {? 'Next: run pullboard resume now to continue setup in this session; the new skills load next session, and setup does not need them.': 'Next: ask your agent to set up Pullboard here; in Claude Code, start a new session first so it loads the Pullboard skills.');if (staging) io.say(`To commit Pullboard's files: ${staging}`);- return 0;+ return await offerRelayAtInit(info.root, io);},lane: () => {if (first !== 'add' || !second || rest.length || values.owns === undefined) {@@ -3240,13 +3240,15 @@ function settingsCommand(io, { first, second, rest }) {const settings = loadMachineSettings();const queue = gateQueueSettings();// The result names the queue order in effect, defaults included; the file keeps only what was set.- io.result?.({ settings: { ...settings, gate: { ...settings.gate, queue: { ...settings.gate?.queue, ...queue } } }, memoryFloorMB: memoryFloorMB() });+ const offerAtInit = relayOfferEnabled();+ io.result?.({ settings: { ...settings, gate: { ...settings.gate, queue: { ...settings.gate?.queue, ...queue } }, 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(`relay.offerAtInit: ${offerAtInit}${offerAtInit ? ' (init asks once to share your boards with your phone)' : ' (init stays quiet about sharing)'}`);return 0;}if (!['gateSlots', 'browserSlots'].includes(first) || !second || rest.length) {@@ -3785,21 +3787,7 @@ async function runCommand(argv, io) {}if (values.all) {if (first !== 'on' || second || rest.length) throw new Refused('USAGE', 'pullboard relay on --all [--url <address>]');- const controller = new AbortController();- const cancelSignIn = () => controller.abort();- process.once('SIGINT', cancelSignIn);- process.once('SIGTERM', cancelSignIn);- let result;- try { result = await relayOnAll(values.url, io, { signal: controller.signal }); }- finally { process.off('SIGINT', cancelSignIn); process.off('SIGTERM', cancelSignIn); }- io.result?.(result);- if (result.outcome) {- io.say(result.outcome === 'declined' ? 'GitHub sign-in was declined; no boards were linked.'- : result.outcome === 'expired' ? 'GitHub device sign-in expired; no boards were linked.'- : 'GitHub device sign-in was cancelled; no boards were linked.');- return 1;- }- return result.failed.length ? 1 : 0;+ return await relayOnAllCommand(values.url, io);}if (['tokens', 'revoke'].includes(first)) {if (rest.length || values.url || (first === 'tokens' && second) || (first === 'revoke' && !second)) {diff --git a/src/init.js b/src/init.jsindex 01242641..a91ece3f 100644--- a/src/init.js+++ b/src/init.js@@ -13,6 +13,7 @@ import { CONFIG_FILE, COORDINATOR, doctrineFile, loadConfig } from './config.js'import { loadDoctrine } from './doctrine.js';import { installHooks } from './hooks.js';import { Refused } from './refused.js';+import { AGENT_SHELL_MARKERS, remoteShell } from './person.js';import { installSkills } from './skills.js';import { AGENTS_END, AGENTS_START, agentsBlock, configTemplate, practiceTemplate, specTemplate } from './templates.js';@@ -440,3 +441,54 @@ export function initRepo({ info, openBoardHere, register, closeBoard, model }) {if (written.length) notes.push(`git add -f -- ${written.map((path) => `'${path.replaceAll("'", "'\\''")}'`).join(' ')}`);return notes;}++/** The one command that shares every board on this computer with the phone and pullboard.dev. */+export const RELAY_ON_ALL = 'pullboard relay on --all';++/** The question init asks a person at the end of setup; Enter means yes. */+export const RELAY_OFFER_QUESTION = 'See this board on your phone and pullboard.dev? Sign in with GitHub [Y/n] ';++/** The line init prints when it does not ask, or when the person answers no. */+export const RELAY_LATER = `To see your boards on your phone and pullboard.dev later, run ${RELAY_ON_ALL}`;++/**+ * Tell whether this run is under continuous integration. CI services set CI, usually to true;+ * an explicit false or 0 is a person saying it is not.+ *+ * @param {Record<string, string | undefined>} environment+ * @returns {boolean}+ */+function continuousIntegration(environment) {+ const value = String(environment.CI ?? '').trim().toLowerCase();+ return value !== '' && value !== 'false' && value !== '0';+}++/**+ * What init does about sharing with the phone at its end (H5, H17, B26): 'ask' the person,+ * 'print' the command for later, or 'none'. Sign-in is the person's alone, so the question is+ * asked only at a person's own terminal: an agent shell is never asked even when its stdin is a+ * terminal, and neither is CI, an SSH shell (relay on --all refuses there) or a run without a+ * terminal on both stdin and stdout, so nothing ever waits on an answer no one can give. Those+ * runs print the command instead. With the machine setting off, or once this board is linked or+ * this machine already shares its boards, init says nothing about it.+ *+ * @param {{ enabled: boolean, shared: boolean, environment?: Record<string, string | undefined>, stdin?: { isTTY?: boolean }, stdout?: { isTTY?: boolean } }} facts+ * @returns {'ask' | 'print' | 'none'}+ */+export function relayOfferAtInit({ enabled, shared, environment = process.env, stdin, stdout }) {+ if (!enabled || shared) return 'none';+ if (AGENT_SHELL_MARKERS.some((name) => Boolean(environment[name]))) return 'print';+ if (continuousIntegration(environment) || remoteShell(environment)) return 'print';+ return stdin?.isTTY && stdout?.isTTY ? 'ask' : 'print';+}++/**+ * Whether an answer to the sharing question is yes: Enter, y or yes. No answer at all, as when+ * the terminal closes, is no.+ *+ * @param {string | null} answer+ * @returns {boolean}+ */+export function acceptsRelayOffer(answer) {+ return answer !== null && ['', 'y', 'yes'].includes(answer.trim().toLowerCase());+}diff --git a/src/relay-setup.js b/src/relay-setup.jsindex ef931dbf..355f7e90 100644--- a/src/relay-setup.js+++ b/src/relay-setup.js@@ -1,6 +1,7 @@/** Set up a machine once, enroll its phone in the foreground and link later registrations [H5,H17]. */import { join } from 'node:path';import { randomUUID } from 'node:crypto';+import { createInterface } from 'node:readline';import * as store from './board.js';import { phoneProposal, publishPhoneApproval, warnPhoneApproval } from './relay-phone.js';import { openApproval, restoreLinkReply } from './relay-approval.js';@@ -8,8 +9,10 @@ import { requirePersonChannel } from './person.js';import { codeIsFromMain, repoInfo } from './git.js';import { listApiProjects } from './projects.js';import { acceptDeviceEnrollment, beginDeviceEnrollment, readRelayMachine, relayMachineOwner, updateRelayMachine } from './relay-machine.js';-import { deliverDeviceWraps, relayDeviceRequest, relayMachineSignIn, relayMachineContext, relayRevokeDevice, relayOn, relayStatus, originRepository, revokeRelayPersonSession } from './relay.js';+import { deliverDeviceWraps, relayDeviceRequest, relayLinked, relayMachineSignIn, relayMachineContext, relayRevokeDevice, relayOn, relayStatus, originRepository, revokeRelayPersonSession } from './relay.js';import { terminalQr } from './qr.js';+import { RELAY_LATER, RELAY_OFFER_QUESTION, acceptsRelayOffer, relayOfferAtInit } from './init.js';+import { relayOfferEnabled } from './settings.js';import { Refused } from './refused.js';/** Return local opt-in gaps without contacting the relay or renewing a person session. */@@ -251,6 +254,70 @@ export async function relayOnAll(address, io, { signal, onPairingURL, onSignIn,return { ...result, ...pairing, autoLink: true };}+/**+ * Run pullboard relay on --all in the foreground and return its exit code [H5,H17]. Ctrl-C or+ * SIGTERM cancels the sign-in cleanly. Init's offer calls this same function, so a yes at init+ * signs in, links and pairs exactly as the command does, with the same words.+ *+ * @param {string | undefined} address - The relay to use; the machine's saved relay when omitted.+ * @param {any} io+ * @returns {Promise<number>}+ */+export async function relayOnAllCommand(address, io) {+ const controller = new AbortController();+ const cancelSignIn = () => controller.abort();+ process.once('SIGINT', cancelSignIn);+ process.once('SIGTERM', cancelSignIn);+ let result;+ try { result = await relayOnAll(address, io, { signal: controller.signal }); }+ finally { process.off('SIGINT', cancelSignIn); process.off('SIGTERM', cancelSignIn); }+ io.result?.(result);+ if (result.outcome) {+ io.say(result.outcome === 'declined' ? 'GitHub sign-in was declined; no boards were linked.'+ : result.outcome === 'expired' ? 'GitHub device sign-in expired; no boards were linked.'+ : 'GitHub device sign-in was cancelled; no boards were linked.');+ return 1;+ }+ return result.failed.length ? 1 : 0;+}++/**+ * Read one line from the person's terminal, or null when the terminal closes first. Readline runs+ * without its own terminal handling, so the terminal echoes the answer and Ctrl-C stays a signal.+ *+ * @param {any} io+ * @param {string} question+ * @returns {Promise<string | null>}+ */+function askLine(io, question) {+ return new Promise((resolve) => {+ const reader = createInterface({ input: io.stdin, output: io.stdout, terminal: false });+ let answer = null;+ reader.once('line', (line) => { answer = line; reader.close(); });+ reader.once('close', () => { io.stdin.pause?.(); resolve(answer); });+ io.stdout.write(question);+ });+}++/**+ * End init with the offer to share with the phone [H5,H17,B26]: ask a person at their own+ * terminal once, and on Enter or y run pullboard relay on --all through the same function the+ * command uses. An agent shell, CI or a run without a terminal is never asked and gets the+ * command for later; relayOfferAtInit in init.js decides which. Returns init's exit code.+ *+ * @param {string} root - The repository init just set up.+ * @param {any} io+ * @returns {Promise<number>}+ */+export async function offerRelayAtInit(root, io) {+ const shared = relayLinked(root) || readRelayMachine().autoLink;+ const offer = relayOfferAtInit({ enabled: relayOfferEnabled(), shared, stdin: io.stdin, stdout: io.stdout });+ if (offer === 'none') return 0;+ if (offer === 'ask' && acceptsRelayOffer(await askLine(io, RELAY_OFFER_QUESTION))) return await relayOnAllCommand(undefined, io);+ io.say(RELAY_LATER);+ return 0;+}+// These operations belong to this view process. No ticket, person session, or pairing URL is// serialized into the machine record or returned as part of an operation's public status.const viewSignIns = new Map();diff --git a/src/settings.js b/src/settings.jsindex b7e67c6e..4f54be2c 100644--- a/src/settings.js+++ b/src/settings.js@@ -22,6 +22,9 @@ export function loadMachineSettings() {throw new Refused('BAD_MACHINE_SETTINGS', `gate.browserFreeChecks in ${file} must be true or false`);}validateGateQueue(value, file);+ if (value.relay?.offerAtInit !== undefined && typeof value.relay.offerAtInit !== 'boolean') {+ throw new Refused('BAD_MACHINE_SETTINGS', `relay.offerAtInit in ${file} must be true or false`);+ }if (value.gate?.memoryFloorMB !== undefined && (!Number.isSafeInteger(value.gate.memoryFloorMB) || value.gate.memoryFloorMB < 0)) {throw new Refused('BAD_MACHINE_SETTINGS', `gate.memoryFloorMB in ${file} must be a whole number of megabytes, 0 or more; fix it before running Pullboard`);}@@ -58,6 +61,15 @@ export function memoryFloorMB() {return loadMachineSettings().gate?.memoryFloorMB ?? null;}+/**+ * Whether init asks the person once to share this computer's boards with their phone [H5,H17].+ * On unless the machine settings set relay.offerAtInit to false: the person asked for sharing to+ * be one Enter for new people, and a person who never wants the question turns it off here.+ */+export function relayOfferEnabled() {+ return loadMachineSettings().relay?.offerAtInit !== false;+}+/** Atomically replace machine settings without exposing a partial JSON file. */function writeMachineSettings(settings) {const file = machineSettingsFile();diff --git a/test/init-relay-offer.test.js b/test/init-relay-offer.test.jsnew file mode 100644index 00000000..54f61be6--- /dev/null+++ b/test/init-relay-offer.test.js@@ -0,0 +1,193 @@+/** Init offers a person one Enter to share with the phone; agents, CI and pipes are never asked [H5,H17,B26]. */+import assert from 'node:assert/strict';+import { existsSync, mkdirSync, writeFileSync } from 'node:fs';+import { dirname, join, resolve } from 'node:path';+import { test } from 'node:test';+import { acceptsRelayOffer, RELAY_LATER, RELAY_OFFER_QUESTION, RELAY_ON_ALL } from '../src/init.js';+import { AGENT_SHELL_MARKERS, SSH_SHELL_MARKERS } from '../src/person.js';+import { runFixtureChild, safeFixtureDiagnostic, startFixtureChild } from './fixture-child.js';+import { relayClientFixture } from './relay-client-fixture.js';++const CLI = resolve(import.meta.dirname, '../bin/pullboard.js');+const QUESTION = RELAY_OFFER_QUESTION.trim();+const EXIT_MARK = /pty-exit:(\d+)/u;++/**+ * Quote one word for /bin/sh.+ *+ * @param {string} word+ * @returns {string}+ */+const shellWord = (word) => `'${word.replaceAll("'", "'\\''")}'`;++/** Keep failure messages useful without printing a pairing link's secret or a credential. */+function safeTail(output, env) {+ return safeFixtureDiagnostic(output.replace(/#device=[^\s\x1b]+/gu, '#device=[redacted]'), env).slice(-1500);+}++/**+ * Run pullboard init under a real pseudo-terminal, as a person at a terminal would.+ *+ * There are no dependencies, so the terminal comes from the system's script(1), which macOS and+ * Linux both ship: it opens a pseudo-terminal and runs the command with it as stdin, stdout and+ * controlling terminal, so process.stdin.isTTY and process.stdout.isTTY are true and Ctrl-C is a+ * real SIGINT from the terminal. The two script(1)s take their command differently: BSD script+ * takes it as words after the log file, util-linux script takes one shell string with -c.+ * Node hands a child a socket for a pipe, and BSD script refuses a socket on its stdin, so a+ * /bin/cat pipeline gives script a real pipe to read the keys from. The inner shell prints init's+ * exit code after it, which says when to close the keyboard, so the run never waits on a guess.+ * Proven on macOS (BSD script) and in node:22.13.1-bookworm (util-linux script 2.38).+ *+ * @param {import('node:test').TestContext} t+ * @param {string} cwd+ * @param {Record<string, string>} env+ * @param {{ when: string, send: string }[]} keys - Keys to type once each text appears, in order.+ * @returns {Promise<{ code: number | null, output: string, asked: boolean }>}+ */+function initInTerminal(t, cwd, env, keys = []) {+ // The shell keeps a trap on SIGINT so Ctrl-C reaches init and still leaves the shell to print+ // init's exit code; dash, Linux's sh, would otherwise die with it. Init itself gets the default.+ const inner = `trap : INT; ${shellWord(process.execPath)} ${shellWord(CLI)} init; echo "pty-exit:$?"`;+ const script = process.platform === 'darwin' ? ['-q', '/dev/null', '/bin/sh', '-c', inner] : ['-qec', inner, '/dev/null'];+ const child = startFixtureChild('/bin/sh', ['-c', '/bin/cat | /usr/bin/script "$@"', 'sh', ...script], {+ cwd, env: { ...env, SHELL: '/bin/sh' }, stdio: ['pipe', 'pipe', 'pipe'],+ });+ t.after(() => { if (child.exitCode === null && child.signalCode === null) child.kill('SIGKILL'); });+ let output = '';+ let typed = 0;+ let closedKeyboard = false;+ /** Close the keyboard once; the terminal then reads end of input. */+ const closeKeyboard = () => { if (!closedKeyboard) { closedKeyboard = true; child.stdin.end(); } };+ child.stdout.setEncoding('utf8').on('data', (part) => {+ output += part;+ while (typed < keys.length && output.includes(keys[typed].when)) child.stdin.write(keys[typed++].send);+ // A question nobody planned to answer gets end of input, so a wrong ask fails instead of hanging.+ if (output.includes(QUESTION) && !keys.some((key) => key.when === QUESTION)) closeKeyboard();+ if (EXIT_MARK.test(output)) closeKeyboard();+ });+ return new Promise((resolveRun, reject) => {+ child.once('error', reject);+ child.once('close', () => {+ const code = EXIT_MARK.exec(output)?.[1];+ resolveRun({ code: code === undefined ? null : Number(code), output, asked: output.includes(QUESTION) });+ });+ });+}++/** Run pullboard init with no terminal at all: stdin is empty and stdout is a pipe. */+function initWithoutTerminal(cwd, env) {+ const result = runFixtureChild(process.execPath, [CLI, 'init'], { cwd, env, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] });+ return { code: result.status, output: `${result.stdout}${result.stderr}`, asked: `${result.stdout}${result.stderr}`.includes(QUESTION) };+}++/** Make a fresh committed repository with a GitHub origin beside the fixture's board. */+function freshRepository(box, name) {+ const root = join(dirname(box.root), name);+ mkdirSync(root);+ for (const args of [['init', '-q', '-b', 'main'], ['-c', 'commit.gpgsign=false', 'commit', '--allow-empty', '-q', '-m', 'fixture base'],+ ['remote', 'add', 'origin', '[email protected]:fixture/repository.git']]) {+ assert.equal(runFixtureChild('git', args, { cwd: root, env: box.env, encoding: 'utf8' }).status, 0);+ }+ return root;+}++/** The environment of the person's own terminal: no agent, SSH or CI marker. */+function personEnvironment(box) {+ const env = { ...box.env };+ for (const name of [...AGENT_SHELL_MARKERS, ...SSH_SHELL_MARKERS, 'CI']) delete env[name];+ return env;+}++/**+ * Point this machine's saved relay at the loopback relay. Init takes no relay address, and a first+ * sign-in goes to the machine's saved relay, so the fixture saves the loopback one there first;+ * nothing in these tests reaches the real relay or GitHub.+ */+function useLoopbackRelay(box) {+ const machine = resolve(import.meta.dirname, '../src/relay-machine.js');+ const source = `import { updateRelayMachine } from ${JSON.stringify(machine)};+updateRelayMachine((state) => { state.owner = { account: 'fixture-owner', url: ${JSON.stringify(box.origin)} }; });`;+ assert.equal(runFixtureChild(process.execPath, ['--input-type=module', '-e', source], { cwd: box.root, env: box.env, encoding: 'utf8' }).status, 0);+}++/** Count the sign-ins the loopback relay has started. */+const signIns = (box) => box.calls.filter((call) => call.path.startsWith('/auth/device/start')).length;++/** Whether a repository's board is linked to the relay. */+const linked = (root) => existsSync(join(root, '.git', 'pullboard', 'relay.json'));++test('a person at init shares with one Enter [H5,H17,B26]', { timeout: 240_000 }, async (t) => {+ const box = await relayClientFixture(t);+ useLoopbackRelay(box);+ const person = personEnvironment(box);++ await t.test('with relay.offerAtInit false a person is never asked [H5]', async () => {+ const settings = join(box.env.PULLBOARD_MACHINE_HOME, 'settings.json');+ mkdirSync(dirname(settings), { recursive: true });+ writeFileSync(settings, `${JSON.stringify({ relay: { offerAtInit: false } })}\n`);+ try {+ const shown = runFixtureChild(process.execPath, [CLI, 'settings'], { cwd: box.root, env: person, encoding: 'utf8' });+ assert.match(shown.stdout, /^relay\.offerAtInit: false/mu, 'pullboard settings shows the setting');+ const run = await initInTerminal(t, freshRepository(box, 'setting-off'), person);+ assert.equal(run.code, 0, `init finishes: ${safeTail(run.output, person)}`);+ assert.equal(run.asked, false, 'the setting turns the question off');+ assert.equal(run.output.includes(RELAY_ON_ALL), false, 'nothing is offered at all');+ } finally {+ writeFileSync(settings, '{}\n');+ }+ const shown = runFixtureChild(process.execPath, [CLI, 'settings'], { cwd: box.root, env: person, encoding: 'utf8' });+ assert.match(shown.stdout, /^relay\.offerAtInit: true/mu, 'the setting is on unless set to false');+ });++ await t.test('n skips and prints pullboard relay on --all for later [H5]', async () => {+ const before = signIns(box);+ const root = freshRepository(box, 'answered-no');+ const run = await initInTerminal(t, root, person, [{ when: QUESTION, send: 'n\r' }]);+ assert.equal(run.code, 0, `init finishes: ${safeTail(run.output, person)}`);+ assert.equal(run.asked, true, 'a person at a terminal is asked');+ assert.equal(run.output.split(QUESTION).length - 1, 1, 'the question is asked once');+ assert.ok(run.output.split(QUESTION)[1].includes(RELAY_LATER), 'n prints the command for later');+ assert.equal(signIns(box), before, 'n starts no sign-in');+ assert.equal(linked(root), false, 'n links nothing');+ });++ await t.test('Enter signs in, shares every board on this computer and prints the QR [H5,H17]', async () => {+ const before = signIns(box);+ const root = freshRepository(box, 'answered-enter');+ // Ctrl-C at the QR ends the wait for a phone; the boards stay linked.+ const run = await initInTerminal(t, root, person, [{ when: QUESTION, send: '\r' }, { when: '\x1b[30;47m', send: '\x03' }]);+ assert.equal(run.code, 0, `init and its sharing finish: ${safeTail(run.output, person)}`);+ assert.equal(run.output.split(QUESTION).length - 1, 1, 'the question is asked once');+ const after = run.output.split(QUESTION)[1];+ assert.match(after, /Sign in with GitHub: open \S+ and enter \S+/u, 'Enter starts the GitHub sign-in');+ assert.equal(signIns(box), before + 1, 'one sign-in, through the loopback relay');+ for (const board of [box.root, join(dirname(box.root), 'setting-off'), join(dirname(box.root), 'answered-no'), root]) {+ assert.equal(linked(board), true, `every board on this computer is linked: ${board}`);+ }+ assert.match(after, /Pair your phone once: \S+#device=/u, 'the pairing link is printed');+ assert.ok(after.includes('\x1b[30;47m') && after.includes('█'), 'the QR is printed');+ assert.equal(after.includes(RELAY_LATER), false, 'a yes is not told to run the command later');+ assert.deepEqual(['', 'y', 'Y', 'yes', ' y '].map(acceptsRelayOffer), [true, true, true, true, true], 'Enter or y is yes');+ assert.deepEqual(['n', 'no', 'later', null].map(acceptsRelayOffer), [false, false, false, false], 'anything else, or a closed terminal, is no');+ });+});++test('an agent or CI init is never asked and prints the command [H5,B26]', { timeout: 240_000 }, async (t) => {+ const box = await relayClientFixture(t);+ useLoopbackRelay(box);+ const person = personEnvironment(box);+ const before = signIns(box);+ const runs = [+ ['an agent shell, even at a terminal', () => initInTerminal(t, freshRepository(box, 'agent-terminal'), { ...person, AI_AGENT: '1' })],+ ['CI, even at a terminal', () => initInTerminal(t, freshRepository(box, 'ci-terminal'), { ...person, CI: 'true' })],+ ['an SSH shell, even at a terminal', () => initInTerminal(t, freshRepository(box, 'ssh-terminal'), { ...person, SSH_CONNECTION: '127.0.0.1 1 127.0.0.1 2' })],+ ['a run with no terminal', () => initWithoutTerminal(freshRepository(box, 'no-terminal'), person)],+ ];+ for (const [name, start] of runs) {+ const run = await start();+ assert.equal(run.code, 0, `${name}: init finishes: ${safeTail(run.output, person)}`);+ assert.equal(run.asked, false, `${name}: is never asked`);+ assert.ok(run.output.includes(RELAY_LATER), `${name}: prints pullboard relay on --all`);+ }+ assert.equal(signIns(box), before, 'no sign-in starts without the person');+});