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(cli): write static view exports [A10,A3,A1]
Corey Olson8df501c51e42
diff --git a/docs/api.md b/docs/api.mdindex de3cf9fe..6b99d102 100644--- a/docs/api.md+++ b/docs/api.md@@ -54,6 +54,7 @@ A successful command returns the fields listed below. `version` is always the nu| `tour` | `version:number`, `messages:array` || `lifecycle` | `version:number`, `markdown:string` || `view` | `version:number`, `url:string`, `port:number` |+| `view export` | `version:number`, `path:string` || `serve` | `version:number`, `url:string`, `port:number` || `forget` | `version:number`, `root:string` || `prompt` | `version:number`, `role:string`, `text:string` |diff --git a/src/cli.js b/src/cli.jsindex ec80595a..153af66c 100644--- a/src/cli.js+++ b/src/cli.js@@ -47,7 +47,7 @@ import { commandOutput } from './json.js';import { forgetProject, registerProject } from './projects.js';import { listResources } from './resources.js';import { citedTestFiles, rowEvidence, rowStage } from './evidence.js';-import { serveView } from './serve.js';+import { exportView, serveView } from './serve.js';import { serveApi } from './api.js';import { doctorProblems } from './doctor.js';import { exportBoard, importBoard } from './exchange.js';@@ -71,6 +71,7 @@ Set uppullboard settings [gateSlots <n>] view or set this machine's gate slots (default 2)pullboard view [--port N] [--no-open] every project on this machine in your browser: items, shouts, doctrine,agents and activity, live; add items, shout and hold lanes from it+ pullboard view --export <dir> a read-only snapshot with event replay, for any static hostpullboard serve [--port N] local API v1: boards, state, moves, requests and live events,behind the session secret in its printed addresspullboard resume where you are: your claim, branch, uncommitted work, what came back,@@ -157,6 +158,7 @@ const OPTIONS = {reason: { type: 'string' },off: { type: 'boolean' },port: { type: 'string' },+ export: { type: 'string' },'no-open': { type: 'boolean' },note: { type: 'string' },'note-file': { type: 'string' },@@ -675,13 +677,20 @@ function resumeHere(io) {/*** \`pullboard view\` (N26): serve the micro site for every project on this machine until stopped,- * registering the repo it starts in, and open it in the browser unless asked not to.+ * registering the repo it starts in, and open it in the browser unless asked not to. With --export,+ * write the current board's read-only static snapshot instead, and return its folder.** @param {any} io* @param {any} values* @returns {Promise<number>}*/async function viewHere(io, values) {+ if (values.export !== undefined) {+ const exported = await exportView(io.cwd, resolve(io.cwd, values.export));+ io.result?.(exported);+ io.say(`wrote snapshot ${exported.path}`);+ return 0;+ }try {const info = repoInfo(io.cwd);if (info.isMain && existsSync(join(info.root, CONFIG_FILE))) registerProject(info.root, new Date(), loadConfig(info.root));diff --git a/src/json.js b/src/json.jsindex cbc82d1d..40cd2190 100644--- a/src/json.js+++ b/src/json.js@@ -50,6 +50,7 @@ export const JSON_SHAPES = {tour: shape({ messages: 'array' }),lifecycle: shape({ markdown: 'string' }),view: shape({ url: 'string', port: 'number' }),+ 'view export': shape({ path: 'string' }),serve: shape({ url: 'string', port: 'number' }),forget: shape({ root: 'string' }),prompt: shape({ role: 'string', text: 'string' }),diff --git a/test/api.test.js b/test/api.test.jsindex 2d960055..03d5a1c5 100644--- a/test/api.test.js+++ b/test/api.test.js@@ -462,6 +462,31 @@ test('[A1] long-running servers flush one JSON document before shutdown', asyncassert.deepEqual(parseOneDocument(stdout), document, `${command} does not flush a second document on shutdown`);}});+test('[A1,A10] view exports a static folder through its JSON variant', () => {+ const box = project();+ const item = json(box, box.repo, 'add', ['app', 'Snapshot item', '--specs', 'G1']).item;+ const output = join(box.dir, 'snapshot folder');+ const result = json(box, box.repo, 'view', ['--export', output], 'export');+ assert.equal(result.path, output);+ assert.equal(result.url, undefined);+ assert.equal(result.port, undefined);+ assert.ok(existsSync(join(output, 'index.html')));+ assert.ok(existsSync(join(output, 'view.css')));+ const listing = JSON.parse(readFileSync(join(output, 'api/v1/boards.json'), 'utf8'));+ assert.equal(listing.version, 1);+ assert.equal(listing.boards.length, 1);+ const id = listing.boards[0].id;+ const state = JSON.parse(readFileSync(join(output, 'api/v1/boards', id, 'state.json'), 'utf8'));+ const events = JSON.parse(readFileSync(join(output, 'api/v1/boards', id, 'events.json'), 'utf8'));+ assert.equal(state.version, 1);+ assert.equal(state.state.board, id);+ assert.equal(state.state.root, box.repo);+ assert.equal(state.state.items[0].id, item.item_id);+ assert.equal(events.version, 1);+ assert.ok(events.events.some((event) => event.event_kind === 'add' && event.item_id === item.item_id));+ assert.deepEqual(events.events.map((event) => event.event_id), events.events.map((event) => event.event_id).sort((a, b) => a - b));+});+test('[A1] every catalog command and subcommand has a real CLI exercise', () => {const source = project();const target = project();