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): add roadmap tab [N26,N38]

Corey Olsonf296963860f0
diff --git a/src/cockpit.js b/src/cockpit.js
index 1aa48261..8d65f65c 100644
--- a/src/cockpit.js
+++ b/src/cockpit.js
@@ -69,6 +69,7 @@ export function cockpitPage(key = '', { snapshot = false, apiBase = '', apiHeade
<button class="tab" data-tab="spec" type="button">Spec<b id="count-spec"></b></button>
<button class="tab" data-tab="doctrine" type="button">Doctrine<b id="count-doctrine"></b></button>
<button class="tab" data-tab="activity" type="button">Activity</button>
+ <button class="tab" data-tab="roadmap" type="button">Roadmap</button>
</nav>
<span class="live" id="live"></span>
</header>
@@ -132,6 +133,7 @@ export function cockpitPage(key = '', { snapshot = false, apiBase = '', apiHeade
<button class="ghost flow-show" id="flow-show" type="button" hidden>Show the lifecycle</button>
<div class="card-panel feed" id="activity"></div>
</section>
+ <section data-pane="roadmap" class="roadmap" id="roadmap" aria-label="Roadmap"></section>
</main>
</div>
</div>
@@ -141,7 +143,7 @@ const snapshot = ${JSON.stringify(snapshot)};
const connection = ${connection};
const snapshotReplay = { final: null, events: [], index: 0, playing: false, timer: null };
const keep = (name, value) => { name = snapshot ? 'snapshot.' + name : name; try { if (value === undefined) return localStorage.getItem(name); localStorage.setItem(name, value); } catch { return null; } return value; };
-const view = { root: keep('pb.project'), tab: keep('pb.tab') || 'items', seen: {}, code: {}, item: null, adding: false, state: 'active', rows: { spec: 'decide', doctrine: 'all' }, row: { spec: null, doctrine: null } };
+const view = { root: keep('pb.project'), tab: location.pathname === '/roadmap' ? 'roadmap' : (keep('pb.tab') || 'items'), seen: {}, code: {}, item: null, adding: false, state: 'active', rows: { spec: 'decide', doctrine: 'all' }, row: { spec: null, doctrine: null } };
if (snapshot) view.state = 'all';
let data = null;
let seen = '';
@@ -772,6 +774,16 @@ function render() {
$('count-doctrine').textContent = p.practice.filter((r) => ['pending', 'draft'].includes(r.status)).length || '';
const titles = new Map(p.items.map((i) => [String(i.id), i.title]));
+ $('roadmap').innerHTML = p.milestones.length ? p.milestones.map((milestone) => {
+ const percent = milestone.total ? Math.round(100 * milestone.done / milestone.total) : 0;
+ const statuses = { verified: 'Done', submitted: 'In review', claimed: 'Building', open: 'Queued' };
+ const statusTones = { verified: 'ok', submitted: 'busy', claimed: 'warn' };
+ return '<article class="card-panel milestone"><header><h2>' + esc(milestone.name) + '</h2><span class="milestone-count">' + milestone.done + '/' + milestone.total + ' done</span></header>'
+ + '<svg class="milestone-progress" viewBox="0 0 100 1" preserveAspectRatio="none" role="progressbar" aria-label="' + esc(milestone.name) + ' progress" aria-valuemin="0" aria-valuemax="' + milestone.total + '" aria-valuenow="' + milestone.done + '"><rect width="' + percent + '" height="1"/></svg>'
+ + '<ul>' + milestone.items.map((item) => '<li><button class="milestone-item" data-go="item:' + esc(item.id) + '" type="button"><code>#' + esc(item.id) + '</code><span>' + esc(item.title) + '</span><span class="chip ' + (statusTones[item.status] || '') + '" data-status="' + esc(item.status) + '">' + esc(statuses[item.status] || item.status) + '</span></button></li>').join('') + '</ul>'
+ + (milestone.note ? '<p class="milestone-note">' + esc(milestone.note) + '</p>' : '') + '</article>';
+ }).join('') : '<div class="card-panel empty">No milestones yet.</div>';
+
// What needs the person, first, and only the person's calls (B26): the decisions passed up to them,
// questions in the spec, held lanes, then draft rows. Work waiting for a verdict or sent back shows
// on the board with who holds it; it is the agents' to move.
@@ -925,6 +937,13 @@ function showTab() {
countUnseen();
}
+/** Keep the roadmap's standalone address in sync with the selected tab. */
+function tabAddress(tab) {
+ if (typeof history === 'undefined' || typeof location === 'undefined') return;
+ const path = tab === 'roadmap' ? '/roadmap' : '/';
+ if (location.pathname !== path) history.pushState(null, '', path + location.search);
+}
+
/**
* Count on the Shouts tab the shouts that came after the newest one the person has seen in this
* project. Seeing means having the Shouts tab open with the board drawn; a project shown for the
@@ -972,6 +991,7 @@ function go(target) {
else if (kind === 'tab') view.tab = id;
else if (kind === 'decide') { view.tab = 'shouts'; answer(Number(id)); }
keep('pb.tab', view.tab);
+ tabAddress(view.tab);
if (kind === 'item') pick(Number(id));
else render();
}
@@ -1121,7 +1141,7 @@ document.addEventListener('click', (event) => {
if (t.id === 'proj-switch') { fold(!$('side').classList.contains('open')); return; }
if (t.id === 'console') { t.hidden = true; return; }
if (t.dataset.root) switchTo(t.dataset.root);
- else if (t.dataset.tab) { view.tab = t.dataset.tab; keep('pb.tab', view.tab); showTab(); }
+ else if (t.dataset.tab) { view.tab = t.dataset.tab; keep('pb.tab', view.tab); tabAddress(view.tab); showTab(); }
else if (t.dataset.go) go(t.dataset.go);
else if (t.dataset.item) pick(Number(t.dataset.item));
else if (t.dataset.state) { view.state = t.dataset.state; render(); }
diff --git a/src/serve.js b/src/serve.js
index afc4ec8c..ece4f499 100644
--- a/src/serve.js
+++ b/src/serve.js
@@ -315,7 +315,7 @@ export async function serveView({ port = 0, secret = randomBytes(18).toString('b
const isOwnHost = req.headers.host === `${LOOPBACK}:${bound}` || req.headers.host === `localhost:${bound}`;
if (!isOwnHost || given.length !== key.length || !timingSafeEqual(given, key)) return json(res, 403, { error: 'this view needs its own address and secret: open the link pullboard view printed' });
try {
- if (req.method === 'GET' && url.pathname === '/') return reply(res, 200, 'text/html; charset=utf-8', cockpitPage(secret));
+ if (req.method === 'GET' && (url.pathname === '/' || url.pathname === '/roadmap')) return reply(res, 200, 'text/html; charset=utf-8', cockpitPage(secret));
if (req.method === 'GET' && url.pathname === '/view.css') return reply(res, 200, 'text/css; charset=utf-8', VIEW_CSS);
return json(res, 404, { error: 'no such page' });
} catch (error) {
diff --git a/src/view.css b/src/view.css
index 74364087..9d562e59 100644
--- a/src/view.css
+++ b/src/view.css
@@ -87,6 +87,19 @@ main { padding: 16px 18px 28px; }
.boardless .first { display: block; }
.loading .top, .loading [data-pane], .boardless .top, .boardless [data-pane] { display: none; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 42%, 600px); gap: 16px; align-items: start; }
+.roadmap { display: grid; gap: 12px; max-width: 900px; }
+.milestone { padding: 14px 16px; min-width: 0; }
+.milestone header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
+.milestone h2 { margin: 0; font-size: 17px; overflow-wrap: anywhere; }
+.milestone-count { color: var(--ink-muted); font: 12px var(--mono); white-space: nowrap; }
+.milestone-progress { display: block; width: 100%; height: 7px; margin: 10px 0; overflow: hidden; border-radius: 99px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
+.milestone-progress rect { fill: var(--accent); }
+.milestone ul { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
+.milestone-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; width: 100%; min-width: 0; padding: 7px 4px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; cursor: pointer; }
+.milestone-item:hover { background: var(--surface-2); }
+.milestone-item code { color: var(--accent-strong); font: 12px var(--mono); }
+.milestone-item > span:nth-child(2) { min-width: 0; overflow-wrap: anywhere; }
+.milestone-note { margin: 10px 0 0; padding: 8px 10px; border-left: 3px solid var(--accent); border-radius: 0 7px 7px 0; background: var(--accent-soft); color: var(--ink-muted); overflow-wrap: anywhere; }
.two.narrow { grid-template-columns: minmax(0, 1fr) var(--agents-w); }
@media (max-width: 900px) {
.shell { display: block; }
diff --git a/test/cockpit.test.js b/test/cockpit.test.js
index c63c2918..b318aab3 100644
--- a/test/cockpit.test.js
+++ b/test/cockpit.test.js
@@ -3120,3 +3120,62 @@ test('wait references stay on one line and link to every prerequisite at phone a
await view.stop();
}
});
+
+test('roadmap has a direct responsive address and live milestone progress [N26,N38]', { timeout: 90_000 }, async (t) => {
+ const executable = chromeExecutable();
+ if (!executable) return t.skip('Install Chrome or set PULLBOARD_CHROME for roadmap browser checks.');
+ const box = machine();
+ const alpha = project(box, 'roadmap-demo');
+ box.run(alpha.repo, 'add', 'web', 'Verified milestone item', '--specs', 'G1', '--criterion', 'verified item is linked');
+ box.run(alpha.repo, 'add', 'web', 'Live milestone item', '--specs', 'G1', '--criterion', 'live item changes status');
+ build(box, alpha, 1, 'verified.txt');
+ box.git(alpha.repo, 'switch', '--detach', alpha.branch);
+ box.run(alpha.repo, 'verify', '1', 'accept', '--as', 'coordinator', '--note', 'Verified the submitted item in the isolated test fixture.');
+ box.git(alpha.repo, 'switch', 'main');
+ box.run(alpha.repo, 'milestone', 'add', 'First milestone', '--note', 'A highlighted note for the person.', '--items', '1');
+ box.run(alpha.repo, 'milestone', 'add', 'Second milestone', '--note', 'Keep this order.', '--items', '2');
+ const view = await startView(box);
+ const profile = mkdtempSync(join(tmpdir(), 'pullboard-roadmap-chrome-'));
+ const direct = new URL('/roadmap' + view.link.search, view.link).href;
+ let chrome;
+ try {
+ const response = await fetch(direct);
+ assert.equal(response.status, 200, 'the direct /roadmap address serves the authenticated view');
+ chrome = await openSnapshotChrome(executable, direct, profile);
+ await chrome.waitFor("typeof data === 'object' && !!data?.project?.milestones?.length");
+ for (const width of [375, 1280]) {
+ await chrome.send('Emulation.setDeviceMetricsOverride', { width, height: 900, deviceScaleFactor: 1, mobile: false });
+ await chrome.waitFor(`innerWidth === ${width} && document.querySelector('[data-pane="roadmap"]:not([hidden])')`);
+ const snapshot = JSON.parse(await chrome.evaluate(`JSON.stringify({
+ width: innerWidth, client: document.documentElement.clientWidth, scroll: document.documentElement.scrollWidth,
+ path: location.pathname, cards: [...document.querySelectorAll('.milestone')].map(card => ({
+ name: card.querySelector('h2').textContent,
+ note: card.querySelector('.milestone-note')?.textContent,
+ value: Number(card.querySelector('[role=progressbar]').getAttribute('aria-valuenow')),
+ total: Number(card.querySelector('[role=progressbar]').getAttribute('aria-valuemax')),
+ bar: Number(card.querySelector('.milestone-progress rect').getAttribute('width')),
+ items: [...card.querySelectorAll('[data-status]')].map(chip => ({ id: chip.closest('[data-go]').dataset.go, status: chip.dataset.status, label: chip.textContent.trim() }))
+ }))
+ })`));
+ assert.equal(snapshot.path, '/roadmap', `${width}px direct address loads the Roadmap tab`);
+ assert.ok(snapshot.scroll <= snapshot.client, `${width}px roadmap has no horizontal overflow: ${JSON.stringify(snapshot)}`);
+ assert.deepEqual(snapshot.cards.map((card) => card.name), ['First milestone', 'Second milestone'], 'cards retain API milestone order');
+ assert.equal(snapshot.cards[0].note, 'A highlighted note for the person.');
+ assert.deepEqual(snapshot.cards.map((card) => [card.value, card.total, card.bar]), [[1, 1, 100], [0, 1, 0]], 'visible progress and accessible counts match the API completion counts');
+ assert.deepEqual(snapshot.cards.flatMap((card) => card.items.map((item) => [item.id, item.status])), [['item:1', 'verified'], ['item:2', 'open']], 'each chip matches live API item state');
+ }
+ await chrome.evaluate("document.querySelector('[data-go=\"item:1\"]').click()");
+ await chrome.waitFor("document.querySelector('[data-pane=items]:not([hidden])') && document.querySelector('#detail').textContent.includes('Verified milestone item')");
+ assert.equal(await chrome.evaluate('location.pathname'), '/', 'opening an item leaves the Roadmap address for the Items tab');
+ await chrome.evaluate("document.querySelector('[data-tab=roadmap]').click()");
+ await chrome.waitFor("location.pathname === '/roadmap'");
+ box.run(alpha.web, 'claim', '2');
+ await chrome.waitFor("data.project.items.find(item => item.id === 2)?.status === 'claimed' && document.querySelector('[data-go=\"item:2\"] [data-status]')?.dataset.status === 'claimed'", 15_000);
+ assert.equal(await chrome.evaluate("document.querySelector('[data-go=\"item:2\"] [data-status]').textContent.trim()"), 'Building', 'the chip updates after a real item move');
+ assert.deepEqual(chrome.exceptions, [], 'Chrome reports no uncaught page exceptions');
+ } finally {
+ if (chrome) await closeSnapshotChrome(chrome);
+ await view.stop();
+ rmSync(profile, { recursive: true, force: true });
+ }
+});