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(view): the view's actions no longer start a board [N27]
Corey Olsonca8bfe72d18b
diff --git a/src/cockpit.js b/src/cockpit.jsindex 43cba263..a04c89e5 100644--- a/src/cockpit.js+++ b/src/cockpit.js@@ -792,7 +792,7 @@ function search() {* writes nothing there and sets no close, and a close fires only while its action is still the* latest, so a success can never hide a refusal that came after it.*/-async function act(command, args, root = view.root) {+async function act(command, args) {const out = $('console');const run = (view.acting = (view.acting || 0) + 1);const latest = () => run === view.acting;@@ -801,7 +801,7 @@ async function act(command, args, root = view.root) {out.className = 'console';out.textContent = 'running…';try {- const result = await api('/api/act', { root, command, args });+ const result = await api('/api/act', { root: view.root, command, args });if (latest()) {out.className = 'console ' + (result.code === 0 ? 'ok' : 'no');out.textContent = '$ ' + result.command + '\\n' + (result.out + result.err).trim();diff --git a/src/serve.js b/src/serve.jsindex 672d17c5..837fa9a2 100644--- a/src/serve.js+++ b/src/serve.js@@ -9,7 +9,6 @@*/import { spawn } from 'node:child_process';import { randomBytes, timingSafeEqual } from 'node:crypto';-import { existsSync, statSync } from 'node:fs';import { createServer } from 'node:http';import { join } from 'node:path';import { fileURLToPath } from 'node:url';@@ -147,7 +146,6 @@ export function actionArgs(command, args = {}) {if (command === 'shout') return ['shout', text(args.to), text(args.text)];if (command === 'hold') return ['hold', text(args.lane), '--reason', text(args.reason)];if (command === 'release') return ['hold', text(args.lane), '--off'];- if (command === 'init') return ['init'];return null;}@@ -223,11 +221,9 @@ export function serveView({ port = 0, secret = randomBytes(18).toString('base64uconst { root, command, args } = JSON.parse(raw || '{}');const argv = actionArgs(command, args);if (!argv) return json(res, 400, { error: `no action "${command}"` });- const cwd = command === 'init' ? String(args?.path ?? '').trim() : root;- if (command === 'init' ? !(cwd && existsSync(cwd) && statSync(cwd).isDirectory()) : !listProjects().some((project) => project.root === root)) {- return json(res, 400, { error: command === 'init' ? `no folder ${cwd}` : 'not a project on this machine' });- }- return json(res, 200, { command: `pullboard ${argv.join(' ')}`, ...(await runCli(cwd, argv)) });+ // An action runs only inside a project this machine already knows; agents start boards.+ if (!listProjects().some((project) => project.root === root)) return json(res, 400, { error: 'not a project on this machine' });+ return json(res, 200, { command: `pullboard ${argv.join(' ')}`, ...(await runCli(root, argv)) });}return json(res, 404, { error: 'no such page' });} catch (error) {diff --git a/test/cockpit.test.js b/test/cockpit.test.jsindex d029f070..70513ec6 100644--- a/test/cockpit.test.js+++ b/test/cockpit.test.js@@ -6,7 +6,7 @@*/import assert from 'node:assert/strict';import { execFileSync, spawn, spawnSync } from 'node:child_process';-import { chmodSync, mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from 'node:fs';+import { chmodSync, mkdirSync, mkdtempSync, readdirSync, realpathSync, rmSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';import { join, resolve } from 'node:path';import { after, test } from 'node:test';@@ -1195,6 +1195,33 @@ test('a machine with no board says how to start one [N26]', async () => {await view.stop();}});+test('the view runs no init [N27]', async () => {+ const box = machine();+ const alpha = project(box, 'alpha');+ const other = join(box.dir, 'other');+ mkdirSync(other);+ box.git(other, 'init', '-q', '-b', 'main');+ const view = await startView(box);+ try {+ const act = async (body) => {+ const res = await fetch(`${view.base}/api/act`, { method: 'POST', headers: { 'content-type': 'application/json', 'x-pullboard-key': view.key }, body: JSON.stringify(body) });+ return { status: res.status, ...(await res.json()) };+ };+ assert.deepEqual(await act({ command: 'init', args: { path: other } }), { status: 400, error: 'no action "init"' }, 'agents start boards, not the view');+ assert.deepEqual(await act({ root: alpha.repo, command: 'init', args: { path: other } }), { status: 400, error: 'no action "init"' }, 'not even from inside a project');+ assert.deepEqual(readdirSync(other), ['.git'], 'and nothing is set up at the path');+ for (const command of ['add', 'shout', 'hold', 'release']) {+ const args = { lane: 'web', title: 'x', to: 'all', text: 'x', reason: 'x' };+ assert.deepEqual(await act({ root: other, command, args }), { status: 400, error: 'not a project on this machine' }, `${command} runs only inside a known project`);+ }+ const state = await (await fetch(`${view.base}/api/state`, { headers: { 'x-pullboard-key': view.key } })).json();+ assert.deepEqual(state.projects.map((entry) => entry.name), ['alpha'], 'the machine has no new board');+ const shout = await act({ root: alpha.repo, command: 'shout', args: { to: 'all', text: 'still here' } });+ assert.deepEqual([shout.status, shout.code, shout.command], [200, 0, 'pullboard shout all still here'], 'the actions it keeps still run');+ } finally {+ await view.stop();+ }+});test('times say which day they were [N26]', async () => {const box = machine();const alpha = project(box, 'alpha');