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): polish phone results and feed [H5,N26]

Corey Olson6d6d28c37fc3
diff --git a/src/cockpit.js b/src/cockpit.js
index c11fdc2c..4aedcea5 100644
--- a/src/cockpit.js
+++ b/src/cockpit.js
@@ -985,31 +985,41 @@ function moveMessage(move, result) {
return move.args.off ? 'released the ' + move.args.lane + ' lane' : 'holding the ' + move.args.lane + ' lane: ' + move.args.reason;
}
-/** Run a public API move and let only the latest action own the console and its close timer. */
-async function act(command, args) {
+/** Run a public API move beside its action and let only the latest one own the console and timer. */
+async function act(command, args, anchor) {
const out = $('console');
if (snapshot) { out.hidden = false; out.className = 'console no'; out.textContent = 'This is a read-only snapshot.'; return false; }
+ if (anchor) {
+ const target = anchor.matches('form')
+ ? anchor.querySelector('.actions') || anchor.querySelector('[type="submit"]') || anchor
+ : anchor.closest('#lanes') || anchor;
+ target.insertAdjacentElement(anchor.matches('form') ? 'beforebegin' : 'afterend', out);
+ }
const run = (view.acting = (view.acting || 0) + 1);
const latest = () => run === view.acting;
clearTimeout(view.closing);
out.hidden = false;
out.className = 'console';
out.textContent = 'running…';
+ out.scrollIntoView({ block: 'nearest' });
try {
const move = pageMove(command, args);
const result = await api(boardPath(view.root) + '/moves', move.body);
if (latest()) {
out.className = 'console ok';
out.textContent = '$ pullboard ' + move.label + '\\n' + moveMessage(move.body, result.result);
+ out.scrollIntoView({ block: 'nearest' });
// What went through says so and then steps aside; a refusal stays until the person closes it.
view.closing = setTimeout(() => { if (latest()) out.hidden = true; }, 6000);
}
await refresh();
+ if (latest()) out.scrollIntoView({ block: 'nearest' });
return true;
} catch (error) {
if (latest()) {
out.className = 'console no';
out.textContent = String(error.message || error);
+ out.scrollIntoView({ block: 'nearest' });
}
return false;
}
@@ -1059,7 +1069,7 @@ document.addEventListener('click', (event) => {
else if (t.dataset.rows) { const [kind, f] = t.dataset.rows.split(':'); view.rows[kind] = f; render(); }
else if (t.dataset.row) { const [kind, id] = t.dataset.row.split(':'); view.row[kind] = id; render(); }
else if (t.dataset.code) code(t.dataset.code, t.dataset.before || '');
- else if (t.dataset.release) act('release', { lane: t.dataset.release });
+ else if (t.dataset.release) act('release', { lane: t.dataset.release }, t);
else if (t.dataset.shout) { answer(null); $('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(); }
});
@@ -1080,7 +1090,7 @@ $('theme').addEventListener('click', () => {
$('q').addEventListener('input', search);
$('add-form').addEventListener('submit', async (event) => {
event.preventDefault();
- if (await act('add', { lane: $('add-lane').value, title: $('add-title').value, criterion: $('add-criterion').value, specs: $('add-specs').value, brief: $('add-brief').value })) {
+ if (await act('add', { lane: $('add-lane').value, title: $('add-title').value, criterion: $('add-criterion').value, specs: $('add-specs').value, brief: $('add-brief').value }, event.currentTarget)) {
$('add-title').value = '';
$('add-criterion').value = '';
$('add-specs').value = '';
@@ -1092,13 +1102,13 @@ $('shout-form').addEventListener('submit', async (event) => {
const text = $('shout-text').value;
const ask = view.answering;
if (ask && ask.root !== view.root) return answer(null);
- if (!(await (ask ? act('answer', { id: ask.id, text }) : act('shout', { to: $('shout-to').value, text })))) return;
+ if (!(await (ask ? act('answer', { id: ask.id, text }, event.currentTarget) : act('shout', { to: $('shout-to').value, text }, event.currentTarget)))) return;
$('shout-text').value = '';
answer(null);
});
$('hold-form').addEventListener('submit', async (event) => {
event.preventDefault();
- if (await act('hold', { lane: $('hold-lane').value, reason: $('hold-reason').value })) $('hold-reason').value = '';
+ if (await act('hold', { lane: $('hold-lane').value, reason: $('hold-reason').value }, event.currentTarget)) $('hold-reason').value = '';
});
showTab();
if (snapshot) {
diff --git a/src/view.css b/src/view.css
index 0238d83c..3e3aeb2a 100644
--- a/src/view.css
+++ b/src/view.css
@@ -148,7 +148,7 @@ input:disabled { background: var(--surface-2); color: var(--ink-muted); }
.ev code { font: 12px var(--mono); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 2px; }
-.chips button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 9px; cursor: pointer; font-size: 13px; }
+.chips button { flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 9px; cursor: pointer; font-size: 13px; }
.chips button.on { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.chips button b { font: 600 11px var(--mono); color: var(--ink-faint); margin-left: 4px; }
.seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--surface-2); box-shadow: 0 0 0 1px var(--line); }
@@ -223,7 +223,7 @@ input:disabled { background: var(--surface-2); color: var(--ink-muted); }
.inline label { flex: 1 1 150px; min-width: 0; }
.inline label.wide { flex: 4 1 260px; }
.feed { padding: 6px 10px 10px; display: grid; }
-.feed > div { display: grid; grid-template-columns: 4.6em minmax(0, 1fr); gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
+.feed > div { display: grid; grid-template-columns: 4.6em minmax(0, 1fr); gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); overflow-wrap: break-word; }
.feed > .empty { display: block; }
.feed > div:first-child, .feed > .day + div { border-top: 0; }
.feed .day { margin: 0; padding: 12px 0 4px; font: 600 11px/1 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-faint); }
@@ -235,7 +235,7 @@ input:disabled { background: var(--surface-2); color: var(--ink-muted); }
.code .more, .code.no { padding: 2px 10px; white-space: normal; color: var(--ink-muted); }
.code.no { color: var(--reject); }
.feed .act { display: flex; gap: 0 5px; align-items: baseline; min-width: 0; }
-.feed .act .what { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-muted); }
+.feed .act .what { flex: 1 1 auto; min-width: 0; overflow-wrap: break-word; color: var(--ink-muted); }
.agent { display: grid; gap: 2px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; }
.agent:first-child { border-top: 0; }
.agent small { color: var(--ink-faint); font: 11.5px var(--mono); overflow-wrap: anywhere; }
@@ -275,7 +275,7 @@ input:disabled { background: var(--surface-2); color: var(--ink-muted); }
.flow .tag { font: 12px var(--sans); fill: var(--ink-muted); }
.flow .tag.idle { fill: var(--ink-faint); } .flow .tag.back { fill: var(--reject); }
.flow g:hover > .box, .flow g:hover > .edge { stroke-width: 2.2; }
-.console { position: fixed; right: 16px; bottom: 16px; width: min(560px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 12px; font: 12px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 38vh; overflow: auto; z-index: 20; cursor: pointer; }
+.console { position: static; width: min(560px, calc(100% - 32px)); margin: 8px auto; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 12px; font: 12px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 38vh; overflow: auto; cursor: pointer; }
.console.ok { border-color: var(--accent); } .console.no { border-color: var(--reject); }
.snapshot-controls:not([hidden]) { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; padding: 12px 16px; }
.snapshot-controls > span { font-weight: 600; }
diff --git a/test/cockpit.test.js b/test/cockpit.test.js
index 299100a2..09994501 100644
--- a/test/cockpit.test.js
+++ b/test/cockpit.test.js
@@ -2100,7 +2100,7 @@ test('activity names the item each event moved [N26]', async () => {
for (const row of about) assert.match(row, /type="button">#1<\/button> <span class="what">Greeting &lt;b&gt;bold&lt;\/b&gt;<\/span><\/div>/, 'the escaped title follows the link');
const joins = rows.filter((row) => /<\/b> join<\/div>/.test(row));
assert.ok(joins.length > 0 && joins.every((row) => !row.includes('class="what"')), 'an event about no item names none');
- assert.match(await styleOf(view), /\.feed \.act \.what \{ min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;/, 'a long title keeps to one line');
+ assert.match(await styleOf(view), /\.feed \.act \.what \{ flex: 1 1 auto; min-width: 0; overflow-wrap: break-word;/, 'activity titles wrap at words and permit an overflowing token to break');
} finally {
await view.stop();
}
@@ -2539,7 +2539,7 @@ test('served connection reaches an authenticated API on another origin and path
}
});
-test('real Chrome keeps the demo board usable at phone and desktop widths [N26,N27]', { timeout: 120_000 }, async (t) => {
+test('real Chrome keeps the demo board usable at phone and desktop widths [H5,N26,N27]', { timeout: 120_000 }, async (t) => {
const executable = chromeExecutable();
if (!executable) return t.skip('Install Chrome or set PULLBOARD_CHROME for viewport checks.');
@@ -2547,6 +2547,8 @@ test('real Chrome keeps the demo board usable at phone and desktop widths [N26,N
const demo = project(box, 'phone-demo');
const other = project(box, 'other-demo');
box.run(demo.repo, 'add', 'web', 'Starter item', '--specs', 'G1', '--criterion', 'visible in the detail pane');
+ const wrapTitle = 'word boundary test ' + 'abcdef0123456789'.repeat(12);
+ box.run(demo.repo, 'add', 'web', wrapTitle, '--specs', 'G1', '--criterion', 'the activity title wraps without splitting words');
box.run(demo.repo, 'shout', 'person', 'Should the phone demo ship?', '--decision');
const view = await startView(box);
const profile = mkdtempSync(join(tmpdir(), 'pullboard-phone-'));
@@ -2591,10 +2593,14 @@ test('real Chrome keeps the demo board usable at phone and desktop widths [N26,N
const snapshot = async () => JSON.parse(await chrome.evaluate(`JSON.stringify((() => {
const visible=e=>{const s=getComputedStyle(e),r=e.getBoundingClientRect();return !e.disabled&&s.display!=='none'&&s.visibility!=='hidden'&&Number(s.opacity)!==0&&r.width>0&&r.height>0&&!e.closest('[hidden]')};
const selector='button,a[href],input:not([type=hidden]),select,textarea,[role=button],[data-root],[data-tab],[data-go],[data-item],[data-state],[data-rows],[data-row],[data-release],[data-shout],[data-new],[data-code]';
- const controls=[...new Set(document.querySelectorAll(selector))].filter(visible).map(e=>{const r=e.getBoundingClientRect();return {tag:e.tagName,id:e.id||'',text:(e.innerText||e.getAttribute('aria-label')||'').trim().slice(0,60),width:r.width,height:r.height}});
+ const controls=[...new Set(document.querySelectorAll(selector))].filter(visible).map(e=>{const r=e.getBoundingClientRect();return {tag:e.tagName,id:e.id||'',text:(e.innerText||e.getAttribute('aria-label')||'').trim().slice(0,60),x:r.x,y:r.y,right:r.right,bottom:r.bottom,width:r.width,height:r.height}});
+ const notice=document.querySelector('#console');
+ const noticeBox=visible(notice)?notice.getBoundingClientRect():null;
+ const toast=noticeBox?{x:noticeBox.x,y:noticeBox.y,right:noticeBox.right,bottom:noticeBox.bottom,visible:noticeBox.y>=0&&noticeBox.bottom<=innerHeight,
+ overlaps:controls.filter(c=>c.x<noticeBox.right&&c.right>noticeBox.x&&c.y<noticeBox.bottom&&c.bottom>noticeBox.y).map(c=>c.id||c.text)}:null;
return {width:innerWidth,documentWidth:document.documentElement.scrollWidth,bodyWidth:document.body.scrollWidth,
projectList:visible(document.querySelector('#proj-list')),needs:visible(document.querySelector('#needs')),
- detail:visible(document.querySelector('#detail')),controls};
+ detail:visible(document.querySelector('#detail')),controls,toast};
})())`));
/** Assert the current pane fits and all its controls remain touchable. */
const checkLayout = async (width, place) => {
@@ -2603,6 +2609,8 @@ test('real Chrome keeps the demo board usable at phone and desktop widths [N26,N
`${width} ${place}: no horizontal overflow: ${JSON.stringify(layout)}`);
const short = layout.controls.filter((control) => control.height < 44);
assert.deepEqual(short, [], `${width} ${place}: visible enabled actions are at least 44px high: ${JSON.stringify(short)}`);
+ if (layout.toast) assert.deepEqual(layout.toast.overlaps, [], `${width} ${place}: the result toast clears every visible control: ${JSON.stringify(layout.toast)}`);
+ if (place === 'successful add toast') assert.equal(layout.toast?.visible, true, `${width}: the successful action toast remains in the viewport: ${JSON.stringify(layout.toast)}`);
};
await chrome.send('Emulation.setDeviceMetricsOverride', { width: 375, height: 900, deviceScaleFactor: 1, mobile: false });
@@ -2631,6 +2639,27 @@ test('real Chrome keeps the demo board usable at phone and desktop widths [N26,N
for (const tab of ['shouts', 'spec', 'doctrine', 'activity']) {
await click(`[data-tab="${tab}"]`);
await checkLayout(width, `${tab} tab`);
+ if (tab === 'spec') {
+ const chips = JSON.parse(await chrome.evaluate(`JSON.stringify([...document.querySelectorAll('#spec-chips button')].map(button => {
+ const clone=button.cloneNode(true); clone.style.cssText += ';position:fixed;visibility:hidden;width:max-content;flex:none'; button.parentElement.append(clone);
+ const naturalWidth=clone.getBoundingClientRect().width, actualWidth=button.getBoundingClientRect().width; clone.remove();
+ return {text:button.textContent.trim(),actualWidth,naturalWidth};
+ }))`));
+ assert.ok(chips.length >= 2, `${width}: spec filters render as chips`);
+ for (const chip of chips) assert.ok(Math.abs(chip.actualWidth - chip.naturalWidth) < 2, `${width}: ${chip.text} keeps its natural width: ${JSON.stringify(chip)}`);
+ }
+ if (tab === 'activity') {
+ const wrap = JSON.parse(await chrome.evaluate(`JSON.stringify((() => {
+ const element=[...document.querySelectorAll('#activity .what')].find(node=>node.textContent===${JSON.stringify(wrapTitle)});
+ if(!element) return null;
+ const text=element.firstChild, ranges=(word)=>{const start=text.textContent.indexOf(word),range=document.createRange();range.setStart(text,start);range.setEnd(text,start+word.length);return [...range.getClientRects()].map(rect=>({x:rect.x,y:rect.y,width:rect.width}));};
+ const lines=(rects)=>new Set(rects.map(rect=>Math.round(rect.y))).size;
+ return {width:element.clientWidth,height:element.getBoundingClientRect().height,wordLines:lines(ranges('boundary')),tokenLines:lines(ranges('abcdef0123456789'.repeat(12)))};
+ })())`));
+ assert.ok(wrap, `${width}: the activity feed shows the long item title`);
+ assert.equal(wrap.wordLines, 1, `${width}: a normal word stays together at a line boundary: ${JSON.stringify(wrap)}`);
+ assert.ok(wrap.tokenLines > 1, `${width}: only the overflowing unbroken token splits: ${JSON.stringify(wrap)}`);
+ }
}
await click('[data-tab="items"]');
@@ -2639,8 +2668,9 @@ test('real Chrome keeps the demo board usable at phone and desktop widths [N26,N
await fill('#add-lane', 'web');
await fill('#add-title', `Phone item ${width}`);
await fill('#add-specs', 'G1');
- await submit('#add-form');
+ await click('#add-form button[type="submit"]');
await chrome.waitFor(`document.querySelector('#chain').innerText.includes('Phone item ${width}')`);
+ await checkLayout(width, 'successful add toast');
await click('[data-tab="shouts"]');
await checkLayout(width, 'shout and hold forms');