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
Merge commit '53d5b5b'
Corey Olsonb43144b8711e
diff --cc src/cockpit.jsindex ec1d6aa4,317d6856..c380a36d--- a/src/cockpit.js+++ b/src/cockpit.js@@@ -364,18 -347,17 +364,19 @@@ function render()$('add-lane').innerHTML = [...working, 'coordinator'].map((l) => '<option>' + esc(l) + '</option>').join('');$('hold-lane').innerHTML = working.map((l) => '<option>' + esc(l) + '</option>').join('');}- const counts = { active: active.length, open: by('open').length, building: by('building').length, verify: by('verify').length, back: by('back').length, verified: by('verified').length, all: items.length };- const names = { active: 'Active', open: 'Open', building: 'Building', verify: 'To verify', back: 'Sent back', verified: 'Verified', all: 'All' };- $('state-chips').innerHTML = Object.keys(names).map((s) => '<button data-state="' + s + '" class="' + (view.state === s ? 'on' : '') + '" type="button">' + names[s] + '<b>' + counts[s] + '</b></button>').join('');const q = $('q').value.trim().toLowerCase();const lane = $('lane-filter').value;- const shown = items- .filter((i) => view.state === 'all' || (view.state === 'active' ? stateOf(i) !== 'verified' : stateOf(i) === view.state))+ // Each chip counts what it would show under the lane and the search. A search looks through every+ // state, withdrawn items included; browsing leaves those out.+ const matching = (q ? p.items : items).filter((i) => !lane || i.lane === lane)- .filter((i) => !q || ('#' + i.id + ' ' + i.title + ' ' + i.specs.join(' ') + ' ' + (i.criterion || '')).toLowerCase().includes(q))- .sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));+ .filter((i) => !q || ('#' + i.id + ' ' + i.title + ' ' + i.specs.join(' ') + ' ' + (i.criterion || '')).toLowerCase().includes(q));+ const inState = (s) => (i) => s === 'all' || (s === 'active' ? !['verified', 'withdrawn'].includes(stateOf(i)) : stateOf(i) === s);+ const names = { active: 'Active', open: 'Open', building: 'Building', verify: 'To verify', back: 'Sent back', verified: 'Verified', all: 'All' };+ $('state-chips').innerHTML = Object.keys(names).map((s) => '<button data-state="' + s + '" class="' + (view.state === s ? 'on' : '') + '" type="button">' + names[s] + '<b>' + matching.filter(inState(s)).length + '</b></button>').join('');+ const shown = matching.filter(inState(view.state)).sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));+ // With nothing picked, the detail shows the first row, and keeps it when a refresh reorders the list.+ if (!view.adding && !p.items.some((i) => i.id === view.item)) view.item = shown.length ? shown[0].id : null;$('chain').innerHTML = shown.length ? shown.map((i) => {const s = stateOf(i);const who = s === 'building' ? i.owner : [i.builtBy, i.verifiedBy].filter(Boolean).join(' → ');@@@ -406,17 -384,17 +407,25 @@@+ '<div class="links"><button data-shout="' + esc(item.lane) + '" data-about="' + item.id + '" type="button">Shout the ' + esc(item.lane) + ' lane about #' + item.id + '</button><button data-new type="button">New item</button></div></div>';}- $('feed').innerHTML = p.shouts.length ? p.shouts.map((x) => '<div><time>' + clock(x.shout_at) + '</time><div><b>' + esc(x.shout_from) + ' → ' + esc(x.shout_to) + '</b> ' + esc(x.shout_text) + '</div></div>').join('') : '<div class="empty">No shouts yet.</div>';+ // Every #id in a shout that names an item opens it, whatever stands next to it. The ids are found in+ // the raw text and each piece is escaped on its own, so an apostrophe's ' is never read as one;+ // a number that names no item stays text.+ const titles = new Map(p.items.map((i) => [String(i.id), i.title]));+ const linked = (text) => String(text ?? '').split(/(#\\d+)/).map((part) => {+ const id = /^#\\d+$/.test(part) ? String(Number(part.slice(1))) : '';+ return titles.has(id) ? '<button class="ref" data-go="item:' + id + '" title="' + esc(titles.get(id)) + '" type="button">' + esc(part) + '</button>' : esc(part);+ }).join('');+ $('feed').innerHTML = p.shouts.length ? p.shouts.map((x) => '<div><time>' + clock(x.shout_at) + '</time><div><b>' + esc(x.shout_from) + ' → ' + esc(x.shout_to) + '</b> ' + linked(x.shout_text) + '</div></div>').join('') : '<div class="empty">No shouts yet.</div>';$('shout-targets').innerHTML = ['all', ...lanes, ...p.agents.map((a) => a.agent_id)].map((t) => '<option value="' + esc(t) + '">').join('');- $('agents').innerHTML = p.agents.length ? p.agents.map((a) => '<div class="agent"><b>' + esc(a.agent_id) + '</b><span class="muted">' + esc(a.agent_lane) + ' lane · ' + esc(a.agent_route) + '</span><small>' + esc(a.agent_path) + '</small></div>').join('') : '<div class="empty">No agents yet.</div>';+ // Each agent with what it holds: its claim, then its work sent back, then its work waiting for a+ // verdict. The worktree path is there on hover; what the person reads is who is doing what.+ const order = ['building', 'back', 'verify'];+ const holding = (a) => items.filter((i) => i.status === 'claimed' ? i.owner === a.agent_id : i.builtBy === a.agent_id && order.includes(stateOf(i))).sort((x, y) => order.indexOf(stateOf(x)) - order.indexOf(stateOf(y)));+ $('agents').innerHTML = p.agents.length ? p.agents.map((a) => {+ const mine = holding(a);+ return '<div class="agent"><div><b title="' + esc(a.agent_path) + '">' + esc(a.agent_id) + '</b><span class="muted">' + esc(a.agent_lane) + ' · ' + esc(a.agent_route) + '</span>' + (a.lastMoveAt ? '<time title="last moved ' + when(a.lastMoveAt) + '">' + ago(a.lastMoveAt) + '</time>' : '') + '</div>'+ + (mine.length ? mine.map((i) => '<button data-go="item:' + i.id + '" type="button"><span>#' + i.id + ' ' + esc(i.title) + '</span>' + chip(stateOf(i)) + '</button>').join('') : '<small>idle</small>') + '</div>';+ }).join('') : '<div class="empty">No agents yet.</div>';const held = new Map(p.holds.map((h) => [h.hold_lane, h]));$('lanes').innerHTML = working.map((l) => '<div class="lane"><span><b>' + esc(l) + '</b> ' + (held.has(l) ? '<span class="chip no">held</span> <span class="muted">' + esc(held.get(l).hold_reason) + '</span>' : '<span class="chip ok">open</span>') + '</span>' + (held.has(l) ? '<button class="ghost" data-release="' + esc(l) + '" type="button">Release</button>' : '') + '</div>').join('');@@@ -513,10 -513,8 +546,10 @@@ document.addEventListener('click', (eveelse if (t.dataset.shout) { $('shout-to').value = t.dataset.shout; $('shout-text').value = '#' + t.dataset.about + ': '; view.tab = 'shouts'; showTab(); $('shout-text').focus(); }else if (t.dataset.new !== undefined) { view.adding = true; render(); $('add-title').focus(); }});-$('new-item').addEventListener('click', () => { view.adding = true; view.item = null; render(); $('add-title').focus(); });+// The form covers the picked item rather than dropping it, so Cancel brings it back.+$('new-item').addEventListener('click', () => { view.adding = true; render(); $('add-title').focus(); });+$('add-cancel').addEventListener('click', () => { view.adding = false; render(); });- $('q').addEventListener('input', () => render());+ $('q').addEventListener('input', search);$('lane-filter').addEventListener('change', () => render());$('add-form').addEventListener('submit', async (event) => {event.preventDefault();diff --cc test/cockpit.test.jsindex afd2b621,b71e4358..8b8e5b7e--- a/test/cockpit.test.js+++ b/test/cockpit.test.js@@@ -463,65 -409,71 +464,134 @@@ test('a sent-back item shows why first}});+ test('shout ids, search and narrow windows reach the item [N26]', async () => {+ const box = machine();+ const p = project(box, 'desk');+ box.run(p.repo, 'add', 'web', 'Greeting', '--specs', 'G1', '--criterion', 'greets');+ box.run(p.repo, 'add', 'web', 'Farewell banner', '--specs', 'G2', '--criterion', 'says goodbye');+ build(box, p, 2, 'farewell.html');+ accept(box, p, 2);+ // Item 39 exists, so an escaped apostrophe (') read as an id would turn into a link.+ for (let id = 3; id <= 39; id += 1) box.run(p.repo, 'add', 'web', `Filler ${id}`, '--specs', 'G1', '--criterion', 'fills');+ box.run(p.repo, 'add', 'web', 'Retired widget', '--specs', 'G1', '--criterion', 'retires');+ box.run(p.repo, 'withdraw', '40', 'nobody needs the widget');+ box.run(p.web, 'shout', 'coordinator', "#1 is next; #2 shipped (#99 is not an item) and it's done");+ box.run(p.web, 'shout', 'coordinator', "#7, see#7 and #7#8: it's 5 o'clock");+ const view = await startView(box);+ try {+ const page = await openPage(view);+ assert.equal(page.run('view.state'), 'active');+ assert.doesNotMatch(page.show('chain'), /Farewell banner/, 'Active hides the verified item');+ await page.type('q', 'farewell');+ assert.match(page.show('chain'), /Farewell banner/, 'a search finds the verified item');+ assert.match(page.show('state-chips'), /data-state="all" class="on"/, 'and says it looks in every state');+ assert.match(page.show('state-chips'), /Verified<b>1<\/b>/);+ assert.match(page.show('state-chips'), /Active<b>0<\/b>/, 'the chips count the matches');+ await page.type('q', '');+ assert.equal(page.run('view.state'), 'active', 'clearing the search brings the chip back');+ assert.doesNotMatch(page.show('chain'), /Farewell banner/);++ // Type, click Active with the query still there, then edit the query to the verified title.+ await page.type('q', 'filler');+ assert.equal(page.run('view.state'), 'all');+ await page.click({ state: 'active' });+ assert.equal(page.run('view.state'), 'active', 'a chip clicked mid-search narrows the list');+ await page.type('q', 'farewell banner');+ assert.equal(page.run('view.state'), 'all', 'typing again searches every state');+ assert.match(page.show('chain'), /Farewell banner/, 'and finds the verified item');+ await page.type('q', '');+ assert.equal(page.run('view.state'), 'active', 'emptying the box brings back the chip from before the search');+ assert.doesNotMatch(page.show('chain'), /Retired widget/, 'browsing leaves withdrawn items out');+ await page.type('q', 'retired widget');+ const found = itemRow(page.show('chain'), 40);+ assert.match(found, /Retired widget/, 'a search finds the withdrawn item too');+ assert.match(found, /<span class="chip ">withdrawn<\/span>/);+ assert.match(page.show('state-chips'), /All<b>1<\/b>/);+ assert.match(page.show('state-chips'), /Active<b>0<\/b>/, 'a withdrawn item is not active');+ await page.type('q', '');++ const feed = page.show('feed');+ assert.ok(feed.includes('<button class="ref" data-go="item:1" title="Greeting" type="button">#1</button> is next;'), feed);+ assert.ok(feed.includes('<button class="ref" data-go="item:2" title="Farewell banner" type="button">#2</button> shipped'));+ assert.ok(feed.includes('(#99 is not an item) and it's done'), 'no link for a missing item, and the apostrophe stays intact');+ const ref = (id, title) => `<button class="ref" data-go="item:${id}" title="${title}" type="button">#${id}</button>`;+ assert.ok(feed.includes(`${ref(7, 'Filler 7')}, see${ref(7, 'Filler 7')} and ${ref(7, 'Filler 7')}${ref(8, 'Filler 8')}: it's 5 o'clock`), 'every #id links, whatever stands next to it');+ assert.equal(feed.match(/class="ref"/g).length, 6);+ await page.click({ go: 'item:2', classes: 'ref' });+ assert.equal(page.run('view.tab'), 'items', 'the link opens the Items tab');+ assert.match(page.show('detail'), /<h2><span>#2<\/span>Farewell banner<\/h2>/, 'on that item');+ assert.equal(page.element('detail').scrolled, 0, 'side by side, the detail is already in view');++ const narrow = await openPage(view, { width: 600 });+ await narrow.click({ item: '1', classes: 'row' });+ assert.match(narrow.show('detail'), /Greeting/);+ assert.equal(narrow.element('detail').scrolled, 1, 'under 900px, picking an item brings its detail into view');+ await narrow.click({ go: 'item:2', classes: 'ref' });+ assert.equal(narrow.element('detail').scrolled, 2, 'and so does a link to one');+ } finally {+ await view.stop();+ }+ });+++test('the detail opens on the top item, not a blank form [N26]', async () => {+ const box = machine();+ const alpha = project(box, 'alpha');+ box.run(alpha.repo, 'add', 'web', 'Greeting', '--specs', 'G1', '--criterion', 'greets');+ box.run(alpha.repo, 'add', 'web', 'Farewell', '--specs', 'G2', '--criterion', 'says goodbye');+ // Beta's first row is #3, while its #1 and #2 share ids with alpha's first row and pick.+ const beta = project(box, 'beta');+ for (const title of ['Beta one', 'Beta two', 'Beta three']) box.run(beta.repo, 'add', 'web', title, '--specs', 'G1', '--criterion', 'renders');+ const empty = project(box, 'empty');+ const done = project(box, 'done');+ box.run(done.repo, 'add', 'web', 'Shipped page', '--specs', 'G1', '--criterion', 'renders');+ build(box, done, 1, 'shipped.html');+ accept(box, done, 1);+ const gone = project(box, 'gone');+ box.run(gone.repo, 'add', 'web', 'Dropped page', '--specs', 'G1', '--criterion', 'renders');+ box.run(gone.repo, 'withdraw', '1', 'nobody needs it');+ const view = await startView(box);+ try {+ const page = await openPage(view);+ const shown = () => /<h2><span>#(\d+)<\/span>([^<]*)</.exec(page.show('detail'))?.slice(1).join(' ');+ const rows = () => [...page.show('chain').matchAll(/<li class="row( on)?" data-item="(\d+)"/g)].map((match) => match[2] + (match[1] ? '*' : ''));+ const form = () => [page.element('add-form').hidden, page.element('detail').hidden];++ assert.equal(shown(), '2 Farewell', 'the first row, the item updated last');+ assert.deepEqual(rows(), ['2*', '1'], 'its row is marked');+ assert.deepEqual(form(), [true, false], 'no blank form');++ box.run(alpha.web, 'claim', '1');+ page.element('shout-to').value = 'web';+ page.element('shout-text').value = 'Greeting is claimed';+ await page.fire('shout-form', 'submit');+ assert.deepEqual(rows(), ['1', '2*'], 'the refresh put the claimed item first');+ assert.equal(shown(), '2 Farewell', 'and the pick held');++ await page.fire('new-item', 'click');+ assert.deepEqual(form(), [false, true], 'New item opens the form');+ assert.equal(page.element('add-cancel').hidden, false);+ await page.fire('add-cancel', 'click');+ assert.deepEqual(form(), [true, false], 'Cancel closes it');+ assert.equal(shown(), '2 Farewell', 'and brings back the item it covered');++ await page.click({ root: beta.repo, classes: 'proj side' });+ assert.equal(shown(), '3 Beta three', "the new project's first row, not an id from alpha");+ assert.deepEqual(rows(), ['3*', '2', '1']);++ await page.click({ root: empty.repo, classes: 'proj side' });+ assert.deepEqual(form(), [false, true], 'a project with no items opens on the form');+ assert.equal(page.element('add-cancel').hidden, true, 'with nothing to go back to');++ await page.click({ root: done.repo, classes: 'proj side' });+ assert.deepEqual(rows(), [], 'Active shows nothing: the only item is verified');+ assert.deepEqual(form(), [true, false]);+ assert.match(page.show('detail'), /Pick an item to see its criterion, verdicts and history\./);++ await page.click({ root: gone.repo, classes: 'proj side' });+ assert.deepEqual(rows(), [], 'no chip lists the only item: it is withdrawn');+ assert.deepEqual(form(), [true, false], 'but an item exists, so no form');+ assert.match(page.show('detail'), /Pick an item to see its criterion, verdicts and history\./);+ } finally {+ await view.stop();+ }+});