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 project corner reads the same in both modes [N26]
Corey Olson41aa2bc13d01
diff --git a/src/cockpit.js b/src/cockpit.jsindex dffd22a6..d56a8ab3 100644--- a/src/cockpit.js+++ b/src/cockpit.js@@ -192,9 +192,10 @@ const $ = (id) => document.getElementById(id);* The tokens hold both values, so only the scheme they answer to changes.*/function theme(pick) {- if (pick === 'light' || pick === 'dark') document.documentElement.dataset.theme = pick;- else delete document.documentElement.dataset.theme;- $('theme').title = 'Theme: ' + (document.documentElement.dataset.theme || 'system');+ const now = pick === 'light' || pick === 'dark' ? pick : matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';+ document.documentElement.dataset.theme = now;+ $('theme').title = now === 'dark' ? 'Dark theme: switch to light' : 'Light theme: switch to dark';+ $('theme').setAttribute('aria-label', $('theme').title);}theme(keep('pb.theme'));/** Collapse the sidebar into the tab bar on a wide screen, or bring it back, as the person last chose. */@@ -903,14 +904,16 @@ function renderSide() {const repoButton = (x) => {if (!x.ok) return '<p class="repo-error" role="status"><b>' + esc(x.name) + ':</b> ' + esc(x.error) + '</p>';const on = x.root === view.root;- return '<button class="proj repo' + (on ? ' on' : '') + '"' + (on ? ' aria-current="true"' : '') + ' data-root="' + esc(x.root) + '" title="' + esc(x.root) + '" type="button"><span class="pname">' + esc(x.name) + '</span>' + (needCount(x) ? '<b class="need" title="needs you">' + needCount(x) + '</b>' : '') + '<small>' + esc(doing(x)) + '</small></button>';+ const parts = doing(x).split(' · '), asks = [x.decisions, x.pending, x.drafts, x.holds].filter(Boolean).length;+ const line = (asks ? '<span class="asks">' + esc(parts.slice(0, asks).join(' · ')) + '</span>' + (parts.length > asks ? ' · ' : '') : '') + esc(parts.slice(asks).join(' · '));+ return '<button class="proj repo' + (on ? ' on' : '') + '"' + (on ? ' aria-current="true"' : '') + ' data-root="' + esc(x.root) + '" title="' + esc(x.root) + '" type="button"><span class="pname">' + esc(x.name) + '</span><small>' + line + '</small></button>';};const groupedRoots = new Set(data.groups.flatMap((group) => group.repos.map((repo) => repo.root)));const grouped = data.groups.map((group) => {const on = group.key === view.root;const needs = group.repos.reduce((total, repo) => total + needCount(repo), 0);const count = group.repos.length;- return '<section class="repo-group"><button class="proj project-pick' + (on ? ' on' : '') + '"' + (on ? ' aria-current="true"' : '') + ' data-root="' + esc(group.key) + '" type="button"><span class="pname">' + esc(group.name) + '</span>' + (needs ? '<b class="need" title="needs you">' + needs + '</b>' : '') + '<small>' + count + ' ' + (count === 1 ? 'repo' : 'repos') + '</small></button><div class="repos">' + group.repos.map(repoButton).join('') + '</div></section>';+ return '<section class="repo-group"><button class="proj project-pick' + (on ? ' on' : '') + '"' + (on ? ' aria-current="true"' : '') + ' data-root="' + esc(group.key) + '" type="button"><span class="pname">' + esc(group.name) + '</span><small>' + (needs ? '<span class="asks">' + needs + ' need you</span> · ' : '') + count + ' ' + (count === 1 ? 'repo' : 'repos') + '</small></button><div class="repos">' + group.repos.map(repoButton).join('') + '</div></section>';}).join('');const loose = data.projects.filter((repo) => !groupedRoots.has(repo.root)).map(repoButton).join('');$('proj-list').innerHTML = grouped || loose ? grouped + loose : '<div class="empty">None yet.</div>';@@ -2009,7 +2012,7 @@ $('side-toggle').addEventListener('click', () => {keep('pb.side', collapsed ? 'collapsed' : 'open');});$('theme').addEventListener('click', () => {- const next = { light: 'dark', dark: 'system' }[document.documentElement.dataset.theme] || 'light';+ const next = document.documentElement.dataset.theme === 'dark' ? 'light' : 'dark';keep('pb.theme', next);theme(next);});diff --git a/src/view.css b/src/view.cssindex 5b52379f..d26f9a29 100644--- a/src/view.css+++ b/src/view.css@@ -43,7 +43,7 @@ button, input, select, textarea { font: inherit; color: inherit; }* restores it; phones always show the switcher, so there the logo is only the logo. The theme button sits at the* right end of the tab bar on a wide screen, sidebar or not. */@media (width > 900px) {- .theme-btn { position: fixed; top: 6px; right: 10px; z-index: 12; }+ .theme-btn { position: fixed; top: calc(var(--top) / 2); right: 10px; z-index: 12; transform: translateY(-50%); }header.top { padding-right: 62px; }:root[data-side="collapsed"] .shell { grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto 1fr; }:root[data-side="collapsed"] .body { display: contents; }@@ -57,10 +57,12 @@ button, input, select, textarea { font: inherit; color: inherit; }:root[data-side="collapsed"] .side-body { display: none; }:root[data-side="collapsed"] .side.open .side-body { display: grid; position: absolute; top: calc(var(--top) + 4px); left: 8px; width: 300px; max-height: calc(100vh - var(--top) - 16px); overflow-y: auto; padding: 8px 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }}-.label { font: 600 11px/1 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-faint); padding: 8px 8px 6px; }+.label { font: 600 11px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); padding: 8px 8px 6px; }.proj { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 8px; align-items: center; width: 100%; text-align: left; border: 1px solid transparent; background: none; border-radius: 8px; padding: 7px 8px; cursor: pointer; }.proj:hover { background: var(--surface-2); }-.proj.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }+/* The project shown is a quiet tint, as a picked row is. */+.proj.on { background: color-mix(in srgb, var(--ink) 7%, transparent); }+.proj small .asks { color: var(--warn); }.proj .pname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.proj small { grid-column: 1 / -1; color: var(--ink-faint); font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; }.repo-group { display: grid; gap: 1px; }@@ -79,7 +81,6 @@ button, input, select, textarea { font: inherit; color: inherit; }.group-need > button { min-height: 44px; border: 0; padding: 0; background: none; cursor: pointer; text-align: right; }.group-need > button em { color: var(--ink-faint); font-size: 12px; font-style: normal; }.repo-label { color: var(--ink-muted); }-.need { min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font: 700 11.5px/1.5 var(--mono); text-align: center; }.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; }@@ -575,3 +576,16 @@ button, input, select, textarea, [data-item], [data-row] { min-height: 44px; }.heard-face.lead { border-radius: 5px; background: var(--ink); color: var(--surface); }.heard-face svg { width: 11px; height: 11px; }.roadmap-only { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px; color: var(--ink-muted); font-size: 13px; }++/* One corner in both modes: the logo, then the project name, in the same place and size. Docked, the project list sits+ * under it; collapsed, the same list drops down from it, and only then does the name carry its arrow. */+@media (width > 900px) {+ .side-top { gap: 6px; }+ .brand span { display: none; }+ .brand { justify-content: center; width: 44px; height: 44px; margin: 0 0 0 -10px; padding: 0; }+ :root[data-side="collapsed"] .brand { margin: 0; }+ .switch-btn, :root[data-side="collapsed"] .switch-btn { display: flex; max-width: 16rem; padding: 6px 8px; border-color: transparent; background: none; font-size: 15px; font-weight: 700; }+ :root[data-side="collapsed"] .switch-btn:hover { background: var(--surface-2); }+ :root:not([data-side="collapsed"]) .switch-btn { cursor: default; }+ :root:not([data-side="collapsed"]) .switch-btn small { display: none; }+}diff --git a/test/cockpit.test.js b/test/cockpit.test.jsindex cdd72c17..819e3f0d 100644--- a/test/cockpit.test.js+++ b/test/cockpit.test.js@@ -442,13 +442,18 @@ async function openPage(view, { width = 1280, later = 0, store = null, hold = fa* The project rows the sidebar shows: name, needs count, the line under it, and which is current.*/function projectRows(html) {- return html.split('<button').slice(1).map((row) => ({- root: /data-root="([^"]*)"/.exec(row)?.[1],- name: /class="pname">([^<]*)</.exec(row)?.[1],- needs: /class="need"[^>]*>([^<]*)</.exec(row)?.[1] ?? '',- line: /<small[^>]*>([^<]*)</.exec(row)?.[1],- current: /aria-current="true"/.test(row),- }));+ return html.split('<button').slice(1).map((row) => {+ const small = /<small[^>]*>([^]*?)<\/small>/.exec(row)?.[1] ?? '';+ const asks = /<span class="asks">([^<]*)<\/span>/.exec(small)?.[1] ?? '';+ return {+ root: /data-root="([^"]*)"/.exec(row)?.[1],+ name: /class="pname">([^<]*)</.exec(row)?.[1],+ // What needs the person leads the line in the warning colour; their count is the sum of its parts.+ needs: asks ? String(asks.split(' · ').reduce((n, part) => n + Number(/^\d+/.exec(part)?.[0] ?? 0), 0)) : '',+ line: small.replace(/<[^>]*>/g, ''),+ current: /aria-current="true"/.test(row),+ };+ });}test('the page uses only API v1 for state, code and every offered move [A3,N26,N27]', async () => {@@ -753,7 +758,7 @@ test('a project with one repo shows once in the project list [N33, N26]', asyncassert.doesNotMatch(side, /data-root="group:Solo"|data-root="group:acme\/site"/, 'a project with one repo has no group heading');assert.deepEqual([once('Solo board'), once('acme/site'), once('Solo')], [1, 1, 0], 'each one-repo project shows as its repo, once');assert.ok(side.includes(`data-root="${solo.repo}"`) && side.includes(`data-root="${mirrored.repo}"`), 'as a repo button of its own');- assert.equal((side.match(/title="needs you">1<\/b>/g) || []).length, 1, "the lone repo's decision is counted once, not again on a heading");+ assert.equal((side.match(/<span class="asks">1 decision<\/span>/g) || []).length, 1, "the lone repo's decision is counted once, not again on a heading");assert.match(side, /data-root="group:Atlas"/, 'two repos sharing a project still group');assert.deepEqual([once('Core API'), once('Web UI'), once('Atlas')], [1, 1, 1], 'under one heading');await page.click({ root: solo.repo });@@ -1017,19 +1022,19 @@ test('the view has a light and a dark theme to choose [N26]', async () => {assert.doesNotMatch(style, /prefers-color-scheme/, 'no second list for dark');assert.match(page.html, /<div class="side-top">\n(?: {4}<[^\n]*\n)*? {4}<button class="theme-btn" id="theme" type="button" title="Theme: system">[^\n]*<\/button>\n {2}<\/div>/, 'the button sits in the bar atop the sidebar, which is the top bar on a phone');- const theme = (on) => [on.run('document.documentElement.dataset.theme') ?? 'system', on.element('theme').title];- assert.deepEqual(theme(page), ['system', 'Theme: system'], 'it starts with the system\'s theme');+ const theme = (on) => [on.run('document.documentElement.dataset.theme') ?? 'none', on.element('theme').title];+ assert.deepEqual(theme(page), ['dark', 'Dark theme: switch to light'], 'with none picked it starts with the system\'s theme');const presses = [];for (let press = 0; press < 3; press += 1) {await page.fire('theme', 'click');presses.push(theme(page));}- assert.deepEqual(presses, [['light', 'Theme: light'], ['dark', 'Theme: dark'], ['system', 'Theme: system']], 'each press moves on one, and the title says which is on');+ assert.deepEqual(presses, [['light', 'Light theme: switch to dark'], ['dark', 'Dark theme: switch to light'], ['light', 'Light theme: switch to dark']], 'each press switches between light and dark, and the title says which is on');await page.fire('theme', 'click');await page.fire('theme', 'click');- assert.deepEqual(theme(await openPage(view, { store })), ['dark', 'Theme: dark'], 'a reload keeps the pick');- assert.deepEqual(theme(await openPage(view)), ['system', 'Theme: system'], 'a browser that keeps nothing follows the system');+ assert.deepEqual(theme(await openPage(view, { store })), ['light', 'Light theme: switch to dark'], 'a reload keeps the pick');+ assert.deepEqual(theme(await openPage(view)), ['dark', 'Dark theme: switch to light'], 'a browser that keeps nothing starts from the system');} finally {await view.stop();}@@ -6929,3 +6934,95 @@ test('the board reads at a glance from the status bar [N26]', { timeout: 180_000await view.stop();}});++test('the project corner and the theme read the same everywhere [N26]', { timeout: 120_000 }, async (t) => {+ const executable = chromeExecutable();+ if (!executable) return t.skip('Install Chrome or set PULLBOARD_CHROME for project corner checks.');+ const box = machine();+ const alpha = project(box, 'corner-alpha', `${SPEC}- G3 [pending] Should the greeting name the visitor? | gate: review\n- G4 [draft, must] The footer links home. | gate: web test\n`);+ project(box, 'corner-beta');+ box.run(alpha.repo, 'add', 'web', 'Greeting', '--specs', 'G1', '--criterion', 'greets');+ box.run(alpha.web, 'claim', '1');+ const view = await startView(box);+ const profile = mkdtempSync(join(tmpdir(), 'pullboard-corner-chrome-'));+ let chrome;+ /** The corner, the project list and the theme button as they read. */+ const read = async () => JSON.parse(await chrome.evaluate(`JSON.stringify((() => {+ const box = (e) => { if (!e) return null; const r = e.getBoundingClientRect(); return { left: r.left, top: r.top, right: r.right, bottom: r.bottom, width: r.width, height: r.height }; };+ const shown = (e) => !!e && getComputedStyle(e).display !== 'none' && e.getBoundingClientRect().width > 0;+ const rgb = (css) => (css.match(/[\\d.]+/g) || []).map(Number);+ const probe = document.createElement('i'); probe.style.color = 'var(--warn)'; document.body.append(probe); const warn = getComputedStyle(probe).color; probe.remove();+ const theme = document.querySelector('#theme'), bar = document.querySelector('.top');+ return {+ page: { width: document.documentElement.clientWidth, scroll: document.documentElement.scrollWidth },+ mode: document.documentElement.dataset.side || 'docked', logo: box(document.querySelector('#side-toggle svg')), name: box(document.querySelector('#proj-name')),+ wordmark: shown(document.querySelector('#side-toggle span')), arrow: shown(document.querySelector('#proj-switch small')),+ rows: [...document.querySelectorAll('#proj-list .proj.repo')].filter(shown).map((row) => {+ const s = getComputedStyle(row), asks = row.querySelector('small .asks');+ return { name: row.querySelector('.pname').textContent, line: row.querySelector('small').textContent, pill: !!row.querySelector('.need'), on: row.classList.contains('on'),+ asks: asks ? { text: asks.textContent, first: row.querySelector('small').firstElementChild === asks, warn: getComputedStyle(asks).color === warn } : null,+ tint: rgb(s.backgroundColor), edge: rgb(s.borderTopColor) };+ }),+ theme: { scheme: document.documentElement.dataset.theme || null, title: theme.title, box: box(theme), bar: box(bar) },+ };+ })())`));+ const click = (selector) => chrome.evaluate(`document.querySelector(${JSON.stringify(selector)}).click()`);+ try {+ chrome = await openSnapshotChrome(executable, view.link.href, profile);+ await chrome.waitFor("typeof data === 'object' && data?.projects?.length === 2 && !!document.querySelector('#proj-list .proj.repo')");+ for (const scheme of ['light', 'dark']) {+ for (const width of [1280, 375]) {+ await chrome.send('Emulation.setDeviceMetricsOverride', { width, height: 900, deviceScaleFactor: 1, mobile: false });+ await chrome.send('Emulation.setEmulatedMedia', { features: [{ name: 'prefers-color-scheme', value: scheme }] });+ await chrome.waitFor(`innerWidth === ${width} && matchMedia('(prefers-color-scheme: ${scheme})').matches`);+ const at = `${width}px ${scheme}`;+ const r = await read();+ assert.ok(r.page.scroll <= r.page.width, `${at}: no sideways scroll`);+ assert.equal(r.wordmark, false, `${at}: the corner is the logo mark, never a wordmark`);+ if (width === 375) continue;+ // In the project list: a project is its name and what it holds, what needs the person first in the warning+ // colour; no count pills; the project shown a quiet neutral tint, no coloured edge.+ const [shownRow, other] = [r.rows.find((row) => row.on), r.rows.find((row) => !row.on)];+ assert.ok(r.rows.length === 2 && r.rows.every((row) => !row.pill), `${at}: two projects, no count pills: ${JSON.stringify(r.rows)}`);+ assert.deepEqual([shownRow.name, shownRow.asks?.text, shownRow.asks?.first, shownRow.asks?.warn], ['corner-alpha', '1 question · 1 draft row', true, true], `${at}: what needs the person comes first, in the warning colour: ${JSON.stringify(shownRow)}`);+ assert.equal(other.asks, null, `${at}: a project needing nothing says only what it holds`);+ const [tr, tg, tb] = shownRow.tint, [er, eg, eb] = shownRow.edge;+ assert.ok(Math.max(tr, tg, tb) - Math.min(tr, tg, tb) <= 14 && Math.max(er, eg, eb) - Math.min(er, eg, eb) <= 14, `${at}: the project shown is a neutral tint with no coloured edge: ${JSON.stringify(shownRow)}`);+ }+ }++ // The corner is the same docked and collapsed: the logo, then the name, in the same place; collapsed, the name opens+ // the list, so only then does it carry its arrow.+ await chrome.send('Emulation.setDeviceMetricsOverride', { width: 1280, height: 900, deviceScaleFactor: 1, mobile: false });+ await chrome.send('Emulation.setEmulatedMedia', { features: [{ name: 'prefers-color-scheme', value: 'light' }] });+ await chrome.waitFor('innerWidth === 1280');+ const docked = await read();+ await click('#side-toggle');+ await chrome.waitFor('document.documentElement.dataset.side === "collapsed"');+ const collapsed = await read();+ for (const part of ['logo', 'name']) {+ assert.ok(Math.abs(docked[part].left - collapsed[part].left) <= 1 && Math.abs(docked[part].top - collapsed[part].top) <= 1 && Math.abs(docked[part].height - collapsed[part].height) <= 1,+ `the ${part} keeps its place and size: ${JSON.stringify([docked[part], collapsed[part]])}`);+ }+ assert.deepEqual([docked.mode, docked.arrow, collapsed.mode, collapsed.arrow], ['docked', false, 'collapsed', true], 'the arrow only where the name opens a list');++ // The theme is light or dark: it starts from the system's, each press switches, the title says which, a reload keeps+ // it; the button sits centred in the top bar.+ assert.deepEqual([collapsed.theme.scheme, collapsed.theme.title], ['light', 'Light theme: switch to dark'], 'none picked yet: the system\'s, light here');+ const middle = (b) => b.top + b.height / 2;+ assert.ok(Math.abs(middle(collapsed.theme.box) - middle(collapsed.theme.bar)) <= 2, `the button sits centred in the top bar: ${JSON.stringify(collapsed.theme)}`);+ await click('#theme');+ assert.deepEqual(Object.values((await read()).theme).slice(0, 2), ['dark', 'Dark theme: switch to light'], 'a press switches to dark');+ await click('#theme');+ assert.deepEqual([...Object.values((await read()).theme).slice(0, 2), await chrome.evaluate("localStorage.getItem('pb.theme')")], ['light', 'Light theme: switch to dark', 'light'], 'the next press is light again, never back to following the system');+ await click('#theme');+ await chrome.send('Page.reload');+ await chrome.waitFor("document.readyState === 'complete' && !!document.querySelector('#theme')");+ assert.deepEqual(Object.values((await read()).theme).slice(0, 2), ['dark', 'Dark theme: switch to light'], 'presses switch between the two, and a reload keeps the last');+ assert.deepEqual(chrome.exceptions, [], 'the page raises no uncaught exception');+ } finally {+ if (chrome) await closeSnapshotChrome(chrome);+ rmSync(profile, { recursive: true, force: true });+ await view.stop();+ }+});