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
fix(init): land local repos without a remote [I1,B3,H5]
Corey Olson5f31eb1f8459
diff --git a/src/commands/status.js b/src/commands/status.jsindex e0d86af2..17ff84d8 100644--- a/src/commands/status.js+++ b/src/commands/status.js@@ -9,6 +9,7 @@ import {} from '../products.js';import * as relayOutput from '../relay-output.js';import {+ originRepository,relayStatus,} from '../relay.js';import {@@ -45,6 +46,9 @@ export function run(io, { values }) {io.say(`verdicts: ${accepted} accepted, ${rejected} rejected`);io.say(reviewQueueLine(ctx, summary.reviewQueue, span));for (const proposal of summary.submitInvariantProposals) io.say(submitInvariantLine(proposal));+ if (!summary.relay.linked && !originRepository(ctx.info.root, { optional: true })) {+ io.say('optional: add a GitHub origin and run pullboard relay on to link this board');+ }if (Object.keys(ctx.config.products).length) {const all = withBoard(ctx, (board) => store.listItems(board, { all: true }));productSummaries(ctx.config, loadSpec(ctx.info.root, ctx.config), all).forEach((product) => io.say(productLine(product)));diff --git a/src/init.js b/src/init.jsindex 0a5e4a4b..628da881 100644--- a/src/init.js+++ b/src/init.js@@ -42,7 +42,10 @@ import {settingCommand,} from './gate-config.js';export { detectGate } from './gate-config.js';-import { gitPath } from './git.js';+import {+ gitPath,+ tryGit,+} from './git.js';import { machineHome } from './machine-home.js';import { Refused } from './refused.js';import { reviewerStartup } from './next-steps.js';@@ -565,11 +568,13 @@ export function initRepo({ info, openBoardHere, register, closeBoard, model, perconst doctrine = existsSync(join(root, CONFIG_FILE)) ? loadConfig(root).practice : doctrineFile(root);const gate = detectGate(root);const configured = configuredGate(root);+ const config = JSON.parse(configTemplate(gate, detectFixers(root)));+ if (!tryGit(root, ['remote']).stdout) config.landing = { publish: 'separate' };const written = [];/** Record only paths setup actually writes; unrelated files never enter its staging command. */const onWrite = (path) => { if (!written.includes(path)) written.push(path); onWritten?.(path); };const notes = [- writeNew(join(root, CONFIG_FILE), configTemplate(gate, detectFixers(root)), CONFIG_FILE, onWrite),+ writeNew(join(root, CONFIG_FILE), `${JSON.stringify(config, null, 2)}\n`, CONFIG_FILE, onWrite),writeNew(join(root, 'SPEC.md'), specTemplate(basename(root), gate), 'SPEC.md', onWrite),writeNew(join(root, doctrine), practiceTemplate(), doctrine, onWrite),ignoreAgentWorktrees(root, onWrite),diff --git a/src/relay-setup.js b/src/relay-setup.jsindex 0227e089..168fdbeb 100644--- a/src/relay-setup.js+++ b/src/relay-setup.js@@ -91,6 +91,8 @@ export async function autoLinkProject(root, io) {if (!machine.autoLink) return;const project = repoInfo(root).root;if (machine.excluded.includes(project) || relayStatus(project).linked) return;+ const repository = originRepository(project, { optional: true });+ if (!repository) return;const name = listApiProjects().find(entry => entry.root === project)?.name ?? project;let pending = machine.approvals.find(entry => entry.root === project);// Only the command that publishes the request prints the wait; later commands poll quietly.@@ -104,7 +106,7 @@ export async function autoLinkProject(root, io) {.find(entry => entry.state?.token?.startsWith('pm_') && entry.state.account === machine.owner?.account && entry.state.url === machine.owner?.url);if (!candidate) throw new Refused('RELAY_SESSION', 'Run pullboard relay on --all to link this project and pair the phone.');source = candidate.state;- const proposal = await phoneProposal(source, 'link', originRepository(project),+ const proposal = await phoneProposal(source, 'link', repository,{ board: projectBoard(project), command: 'Link ' + name + '? (pullboard init)', link: true, root: project });const value = { root: project, publisherRoot: candidate.root, context: proposal.context, sealed: proposal.sealed, replyKey: proposal.reply.storedKey, published: false };pending = updateRelayMachine(state => {diff --git a/src/relay.js b/src/relay.jsindex c90dbd13..dbe60576 100644--- a/src/relay.js+++ b/src/relay.js@@ -163,10 +163,10 @@ export function relayOrigin(address) {}return url.origin;}--/** Resolve the GitHub owner/repository named by the actual origin remote, never a guessed repo. */-export function originRepository(root) {+/** Resolve the actual GitHub origin; optional discovery leaves ineligible local projects alone. */+export function originRepository(root, { optional = false } = {}) {const remote = tryGit(root, ['remote', 'get-url', 'origin']);+ if (remote.status !== 0 && optional) return null;if (remote.status !== 0) throw new Refused('RELAY_ORIGIN', 'add a GitHub origin remote before running pullboard relay on');let repository;const ssh = /^git@github\.com:([^\s?#]+)$/.exec(remote.stdout);@@ -180,11 +180,11 @@ export function originRepository(root) {}repository = repository?.replace(/\.git$/, '');if (!repository || !/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(repository) || repository.split('/').some((part) => ['.', '..'].includes(part))) {+ if (optional) return null;throw new Refused('RELAY_ORIGIN', 'origin must name a GitHub owner/repository using HTTPS or git SSH; fix origin and run pullboard relay on');}return repository;}-/** Find the shared local link metadata without opening a board or connecting for an unlinked repo. */function linkFile(root) { return join(repoInfo(root).commonDir, 'pullboard', 'relay.json'); }diff --git a/test/land-no-remote-fixture.js b/test/land-no-remote-fixture.jsnew file mode 100644index 00000000..e694e82c--- /dev/null+++ b/test/land-no-remote-fixture.js@@ -0,0 +1,74 @@+/** Real local-only initialization, relay opt-in and landing proof [I1,B3,R3,H5]. */+import assert from 'node:assert/strict';+import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';+import { join } from 'node:path';+import { runFixtureChild } from './fixture-child.js';++/** Preserve every independent observable failure so the prefeature control proves both paths. */+export function assertNoRemoteLanding(sandbox, commitFile) {+ const box = sandbox();+ const repo = join(box.dir, 'local-repo');+ mkdirSync(repo);+ box.git(repo, 'init', '-q', '-b', 'main');+ const initialized = box.run(repo, 'init');+ assert.equal(initialized.code, 0, initialized.err);+ const configFile = join(repo, 'pullboard.json');+ const original = JSON.parse(readFileSync(configFile, 'utf8'));+ const failures = [];+ /** Collect assertions only; setup or execution exceptions remain fatal. */+ const observe = (check) => { try { check(); } catch (error) { if (error.code !== 'ERR_ASSERTION') throw error; failures.push(error.message); } };+ observe(() => assert.equal(original.landing?.publish, 'separate', 'init chooses local-first landing without any remote'));+ writeFileSync(configFile, JSON.stringify({ ...original, gate: 'true', verify: 'any', lanes: { web: { owns: ['web/'], specs: ['G1'] } } }, null, 2));+ writeFileSync(join(repo, 'SPEC.md'), '# Local fixture\n\n## Goals\n- G1 [approved, must] The local result exists. | gate: true\n');+ box.git(repo, 'add', '-A');+ box.git(repo, 'commit', '-q', '-m', 'chore: configure local landing');+ const added = box.run(repo, 'add', 'web', 'Local result', '--specs', 'G1', '--criterion', 'The result exists.', '--check', 'test -f web/result.txt', '--wait', '--json');+ assert.equal(added.code, 0, added.err);+ const item = JSON.parse(added.out).item.item_id;+ const made = box.run(repo, 'worktree', 'web', '--model', 'local-builder', '--json');+ assert.equal(made.code, 0, made.err);+ const builder = JSON.parse(made.out).path;+ assert.equal(box.run(builder, 'claim', String(item)).code, 0);+ const committed = commitFile(box, builder, 'web/result.txt', 'local result\n', 'feat(web): local result [G1]');+ assert.equal(committed.status, 0, committed.stderr);+ const submitted = box.run(builder, 'submit', String(item), '--json');+ assert.equal(submitted.code, 0, submitted.err);+ const head = JSON.parse(submitted.out).commit;+ box.git(repo, 'switch', '-q', '--detach', head);+ try { assert.equal(box.run(repo, 'verify', String(item), 'accept', '--as', 'coordinator', '--note', 'The actual local result exists.').code, 0); }+ finally { box.git(repo, 'switch', '-q', 'main'); }++ const machine = new URL('../src/relay-machine.js', import.meta.url).href;+ const enabled = runFixtureChild(process.execPath, ['--input-type=module', '-e', `import { updateRelayMachine } from ${JSON.stringify(machine)}; updateRelayMachine(state => { state.autoLink = true; });`], { cwd: repo, env: box.env, encoding: 'utf8' });+ assert.equal(enabled.status, 0, enabled.stderr);+ const status = box.run(repo, 'status');+ observe(() => assert.equal(status.code, 0, status.err));+ observe(() => assert.doesNotMatch(status.err + status.out, /not linked:|\[RELAY_(?:ORIGIN|SESSION)\]/u, 'an inherited link-all never turns local status into a relay refusal'));+ observe(() => assert.match(status.out, /optional:.*relay on/u, 'status offers linking as an optional next step'));+ const explicit = box.run(repo, 'relay', 'on', '--json');+ observe(() => assert.equal(explicit.code, 1, 'an explicit link still requires a GitHub origin'));+ observe(() => assert.match(explicit.out + explicit.err, /RELAY_ORIGIN/u));+ const landed = box.run(repo, 'land', '--json');+ observe(() => assert.equal(landed.code, 0, landed.err));+ if (landed.code === 0) {+ const receipt = JSON.parse(landed.out);+ observe(() => assert.deepEqual(receipt.landed, [item]));+ observe(() => assert.equal(receipt.batch.state, 'landed'));+ observe(() => assert.equal(box.git(repo, 'rev-parse', 'main'), receipt.batch.tip));+ const recorded = JSON.parse(box.run(repo, 'show', String(item), '--json').out);+ observe(() => assert.equal(recorded.item_merged_commit, receipt.batch.tip, 'normal land records the merge; no manual merged command'));+ observe(() => assert.equal(readFileSync(join(repo, 'web/result.txt'), 'utf8'), 'local result\n'));+ }+ assert.equal(box.git(repo, 'remote'), '', 'the whole workflow retains no remote');+ for (const origin of ['https://github.com/example/local-proof.git', join(box.dir, 'private-origin.git')]) {+ const remoteRepo = join(box.dir, origin.startsWith('https:') ? 'github-repo' : 'bare-repo');+ mkdirSync(remoteRepo);+ box.git(remoteRepo, 'init', '-q', '-b', 'main');+ box.git(remoteRepo, 'remote', 'add', 'origin', origin);+ assert.equal(box.run(remoteRepo, 'init').code, 0);+ const withRemote = JSON.parse(readFileSync(join(remoteRepo, 'pullboard.json'), 'utf8'));+ observe(() => assert.equal(withRemote.landing, undefined, 'a configured remote keeps the existing push-and-land default'));+ observe(() => assert.equal(box.git(remoteRepo, 'remote', 'get-url', 'origin'), origin));+ }+ assert.deepEqual(failures, [], failures.join('\n'));+}diff --git a/test/land.test.js b/test/land.test.jsindex 3689fd6e..15b28044 100644--- a/test/land.test.js+++ b/test/land.test.js@@ -9,6 +9,7 @@ import { exportBoard, importBoard } from '../src/exchange.js';import { landingFailures, landingSubject } from '../src/land.js';import { createE2eHelpers } from './e2e-helpers.js';import { startFixtureChild, runFixtureChild } from './fixture-child.js';+import { assertNoRemoteLanding } from './land-no-remote-fixture.js';const e2e = createE2eHelpers();after(e2e.cleanup);@@ -16,6 +17,10 @@ const { sandbox, project, commitFile, waitFor, BIN } = e2e;const FILES = [1, 2, 3, 4].map((n) => `web/land-${n}.test.js`);const MARKER_NOT_YET = Symbol('marker not yet written');+test('a repo with no remote lands into the local trunk and status reads as normal [I1,B3,R3,H5]', () => {+ assertNoRemoteLanding(sandbox, commitFile);+});+/** Read a complete marker, treating a missing or mid-write file as unpublished. */function readMarker(file) {try { return JSON.parse(readFileSync(file, 'utf8')); }