Skip to content

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.

feat(view): the sidebar shows each product's progress [N28]

Corey Olsone51dad0ee029
diff --git a/src/cockpit.js b/src/cockpit.js
index ec1d6aa4..e8505da3 100644
--- a/src/cockpit.js
+++ b/src/cockpit.js
@@ -63,6 +63,16 @@ button, input, select, textarea { font: inherit; color: inherit; }
.start { margin: 12px 4px 0; padding: 10px 4px 0; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-muted); }
.start summary { cursor: pointer; }
.start form { margin-top: 10px; }
+.products { padding-top: 6px; }
+.prod { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; padding: 6px 8px 8px; font-size: 13px; }
+.prod p { margin: 0; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
+.prod p b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.prod p span { color: var(--ink-faint); font: 11.5px var(--mono); white-space: nowrap; }
+.prod .bar { height: 6px; border-radius: 99px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
+.prod .bar i { display: block; height: 100%; background: var(--accent); }
+.prod small { display: flex; flex-wrap: wrap; gap: 2px 10px; color: var(--ink-muted); font-size: 12px; }
+.prod small span { display: inline-flex; align-items: center; gap: 5px; }
+.prod small .dot { display: inline-block; width: 7px; height: 7px; }
.body { min-width: 0; }
.top { position: sticky; top: 0; z-index: 10; min-height: var(--top); display: flex; align-items: stretch; gap: 12px; padding: 0 18px; background: var(--surface); border-bottom: 1px solid var(--line); }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; }
@@ -70,7 +80,7 @@ button, input, select, textarea { font: inherit; color: inherit; }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.tab b { font: 600 11px var(--mono); color: var(--ink-faint); margin-left: 4px; }
.live { margin-left: auto; align-self: center; font-size: 12px; color: var(--ink-faint); white-space: nowrap; }
-.switching main { opacity: .45; transition: opacity .12s; }
+.switching main, .switching .products { opacity: .45; transition: opacity .12s; }
main { padding: 16px 18px 28px; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 42%, 600px); gap: 16px; align-items: start; }
@@ -199,6 +209,7 @@ input, select { border: 1px solid var(--line-strong); background: var(--surface)
<div class="side-body" id="side-body">
<div class="label">Projects</div>
<nav id="proj-list" aria-label="Projects on this machine"></nav>
+ <section class="products" id="products" aria-label="Products" hidden><div class="label">Products</div><div id="prod-list"></div></section>
<details class="start"><summary>Start a board</summary><form id="init-form" class="panel-form"><label>Folder of a git repo<input id="init-path" required placeholder="/path/to/repo"></label><button class="go" type="submit">Init</button></form></details>
</div>
</aside>
@@ -335,6 +346,13 @@ function render() {
const p = data.project;
renderSide();
if (!p) return;
+ // Each product's progress (N28): the rows an accepted item cites, and its items by state.
+ $('products').hidden = !p.products.length;
+ $('prod-list').innerHTML = p.products.map((x) => {
+ const states = [['open', '', x.items.open], ['building', 'building', x.items.claimed], ['to verify', 'verify', x.items.submitted], ['verified', 'verified', x.items.verified]].filter(([, , n]) => n);
+ return '<div class="prod" title="' + x.rows + ' rows in force, ' + x.approved + ' approved, ' + x.proven + ' cited by accepted items"><p><b>' + esc(x.name) + '</b><span>' + x.proven + '/' + x.rows + ' rows met</span></p><div class="bar"><i style="width:' + (x.rows ? Math.round((100 * x.proven) / x.rows) : 0) + '%"></i></div>'
+ + (states.length ? '<small>' + states.map(([label, dot, n]) => '<span><i class="dot ' + dot + '"></i>' + n + ' ' + label + '</span>').join('') + '</small>' : '') + '</div>';
+ }).join('');
const items = p.items.filter((i) => i.status !== 'withdrawn');
const by = (s) => items.filter((i) => stateOf(i) === s);
const active = items.filter((i) => stateOf(i) !== 'verified');
diff --git a/src/serve.js b/src/serve.js
index 84992746..ec9f7078 100644
--- a/src/serve.js
+++ b/src/serve.js
@@ -17,6 +17,7 @@ import * as store from './board.js';
import { cockpitPage } from './cockpit.js';
import { COORDINATOR, loadConfig } from './config.js';
import { repoInfo } from './git.js';
+import { productSummaries } from './products.js';
import { listProjects } from './projects.js';
import { loadSpec } from './spec.js';
@@ -119,6 +120,8 @@ export function projectState(root) {
holds: store.laneHolds(board),
spec: rows(config.spec),
practice: rows(config.practice),
+ // Each product's progress, counted as pullboard status counts it (N28).
+ products: productSummaries(config, loadSpec(info.root, config), all),
};
});
}
diff --git a/test/cockpit.test.js b/test/cockpit.test.js
index afd2b621..02bb7f2c 100644
--- a/test/cockpit.test.js
+++ b/test/cockpit.test.js
@@ -58,14 +58,14 @@ function machine() {
/**
* A project registered on the machine: a repo set up by `pullboard init`, one web lane, and a
- * worktree joined to it as web-1.
+ * worktree joined to it as web-1. `extra` adds to its pullboard.json, such as products.
*/
-function project(box, name, spec = SPEC) {
+function project(box, name, spec = SPEC, extra = {}) {
const repo = join(box.dir, name);
mkdirSync(repo);
box.git(repo, 'init', '-q', '-b', 'main');
box.run(repo, 'init');
- const config = { gate: 'true', spec: 'SPEC.md', verify: 'any', lease: '2h', lanes: { web: { owns: ['web/'], specs: ['G'] } }, shared: [] };
+ const config = { gate: 'true', spec: 'SPEC.md', verify: 'any', lease: '2h', lanes: { web: { owns: ['web/'], specs: ['G'] } }, shared: [], ...extra };
writeFileSync(join(repo, 'pullboard.json'), JSON.stringify(config, null, 2));
writeFileSync(join(repo, 'SPEC.md'), spec);
box.git(repo, 'add', '-A');
@@ -312,6 +312,52 @@ test('the sidebar lists every project and what needs the person [N26]', async ()
}
});
+/**
+ * The products the sidebar shows: name, rows met, how full the bar is, and the item counts with the
+ * state each dot is coloured for.
+ */
+function productEntries(html) {
+ return html.split('<div class="prod"').slice(1).map((entry) => ({
+ name: /<b>([^<]*)<\/b>/.exec(entry)?.[1],
+ met: /<span>([^<]*) rows met<\/span>/.exec(entry)?.[1],
+ bar: Number(/<i style="width:(\d+)%">/.exec(entry)?.[1]),
+ items: [...entry.matchAll(/<span><i class="dot ([a-z]*)"><\/i>(\d+) ([a-z ]+)<\/span>/g)].map((match) => `${match[2]} ${match[3]} (${match[1] || 'grey'})`),
+ }));
+}
+
+test("the sidebar shows each product's progress [N28]", async () => {
+ const box = machine();
+ const alpha = project(box, 'alpha', `${SPEC}- G3 [draft, must] The page has a footer. | gate: web test\n`, { products: { 'Pages <b>': ['G1', 'G3'], Goodbyes: ['G2'] } });
+ box.run(alpha.repo, 'add', 'web', 'Greeting', '--specs', 'G1', '--criterion', 'greets');
+ box.run(alpha.repo, 'add', 'web', 'Footer', '--specs', 'G3', '--criterion', 'has a footer');
+ box.run(alpha.repo, 'add', 'web', 'Farewell', '--specs', 'G2', '--criterion', 'says goodbye');
+ box.run(alpha.repo, 'add', 'web', 'Header', '--specs', 'G1', '--criterion', 'has a header');
+ build(box, alpha, 1, 'greeting.html');
+ accept(box, alpha, 1);
+ build(box, alpha, 2, 'footer.html');
+ box.run(alpha.web, 'claim', '3');
+ const beta = project(box, 'beta');
+ const view = await startView(box);
+ try {
+ const page = await openPage(view);
+ assert.equal(page.element('products').hidden, false);
+ assert.deepEqual(productEntries(page.show('prod-list')), [
+ { name: 'Pages &lt;b&gt;', met: '1/2', bar: 50, items: ['1 open (grey)', '1 to verify (verify)', '1 verified (verified)'] },
+ { name: 'Goodbyes', met: '0/1', bar: 0, items: ['1 building (building)'] },
+ ]);
+ // The same numbers pullboard status prints.
+ assert.deepEqual(box.run(alpha.repo, 'status').split('\n').filter((line) => line.startsWith('product ')), [
+ 'product Pages <b>: 2 rows, 1 approved, 1 cited by accepted items; items 1 open, 0 building, 1 awaiting verification, 1 verified',
+ 'product Goodbyes: 1 rows, 1 approved, 0 cited by accepted items; items 0 open, 1 building, 0 awaiting verification, 0 verified',
+ ]);
+ assert.match(page.show('prod-list'), /title="2 rows in force, 1 approved, 1 cited by accepted items"/);
+
+ await page.click({ root: beta.repo, classes: 'proj side' });
+ assert.equal(page.element('products').hidden, true, 'a project that names no products shows none');
+ } finally {
+ await view.stop();
+ }
+});
/**
* The agents the panel shows: id, the path on hover, its last move, what it holds and whether it
* reads idle, and its entry's text with the tags taken out.