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 tab title says what needs you [N26]

Corey Olsonc9e20f24c8db
diff --git a/src/cockpit.js b/src/cockpit.js
index dd986ab9..17d81378 100644
--- a/src/cockpit.js
+++ b/src/cockpit.js
@@ -495,6 +495,9 @@ function renderSide() {
$('proj-elsewhere').hidden = !elsewhere;
const p = data.project;
$('proj-name').textContent = p ? (data.projects.find((x) => x.root === view.root) || { name: p.root.split('/').pop() }).name : 'No project';
+ // The browser tab says it too, for when the view sits behind other tabs.
+ const needs = data.projects.reduce((n, x) => n + needCount(x), 0);
+ document.title = p ? (needs ? '(' + needs + ') ' : '') + $('proj-name').textContent + ' · Pullboard' : 'Pullboard';
}
/** Draw the board shown: the sidebar, then every tab's panes from the project's board. */
diff --git a/test/cockpit.test.js b/test/cockpit.test.js
index b1502df3..5398e235 100644
--- a/test/cockpit.test.js
+++ b/test/cockpit.test.js
@@ -446,6 +446,40 @@ test('the agents panel says what each agent holds [N26]', async () => {
}
});
+test('the tab title says what needs you [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');
+ build(box, alpha, 1, 'greeting.html');
+ sendBack(box, alpha, 1, 'no greeting');
+ build(box, alpha, 2, 'farewell.html');
+ const beta = project(box, 'beta');
+ box.run(beta.repo, 'hold', 'web', '--reason', 'G2 is changing');
+ const calm = project(box, 'calm');
+ const view = await startView(box);
+ const nobody = await startView(machine());
+ try {
+ const page = await openPage(view);
+ const title = () => page.run('document.title');
+ assert.equal(title(), '(3) alpha · Pullboard', 'one sent back and one to verify here, one lane held in beta');
+ page.run(`switchTo(${JSON.stringify(calm.repo)})`);
+ assert.equal(title(), '(3) calm · Pullboard', 'a switch names the project at once; the count still covers them all');
+ await page.run('refresh()');
+ assert.equal(title(), '(3) calm · Pullboard');
+
+ box.run(alpha.repo, 'withdraw', '1', 'the greeting moved to the next release');
+ accept(box, alpha, 2);
+ box.run(beta.repo, 'hold', 'web', '--off');
+ await page.run('refresh()');
+ assert.equal(title(), 'calm · Pullboard', 'nothing needs the person, so no count');
+
+ assert.equal((await openPage(nobody)).run('document.title'), 'Pullboard', 'with no project to show');
+ } finally {
+ await view.stop();
+ await nobody.stop();
+ }
+});
/**
* The lifecycle drawing: each box's state, count and title; each arrow's title, the pair of states
* its title starts with, and the label drawn with it, if any.