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.

fix(view): a pullboard command chips only the command [N26]

Corey Olson0f8659f0b83c
diff --git a/src/cockpit.js b/src/cockpit.js
index 4f89c0ec..46c8b777 100644
--- a/src/cockpit.js
+++ b/src/cockpit.js
@@ -1,5 +1,13 @@
import { effectiveGuards, IN_STATE, MACHINE } from './machine.js';
+/**
+ * The command phrases the CLI declares in HELP, longest first. Inline text chips "pullboard" only with one of
+ * these (test/cockpit.test.js keeps the list equal to HELP), so the words after a command stay prose.
+ */
+export const PULLBOARD_COMMANDS = Object.freeze(["spec signers add","hook commit-msg","hook pre-commit","hook pre-merge-commit","hook pre-push","relay join","relay off","relay on","relay pair","spec check","spec show","spec signoff","spec unmet","spec view","add","answer","check","claim","decisions","doctor","done","edit","escalate","export","fact","forget","gate","help","hold","hook","hooks","import","inbox","init","join","lanes","ledger","lifecycle","list","log","merged","milestone","next","pass","prompt","refreeze","relay","release","resources","resume","roadmap","run","serve","settings","shout","show","spec","stats","status","submit","sweep","takeover","tour","verify","version","view","whoami","withdraw","worktree"]);
+/** A command in prose: its phrase, then only flags, numbers, #ids, quoted text, CAPS names, paths and agent ids. */
+const COMMAND_SOURCE = 'pullboard (?:' + PULLBOARD_COMMANDS.join('|') + ')(?![\\w-])(?: (?:--?[\\w-]+|\\d+|#\\d+|"[^"\\n]*"|[A-Z][A-Z0-9_]*|[\\w-]*[\\/.:@][^\\s"]*|[a-z]+-\\d+)(?![\\w-]))*';
+
/**
* The item lifecycle as the page draws it (M1): each state with what it means and, for a final
* state, what every way in checks; each move with who makes it, its command or the clock's
@@ -836,7 +844,7 @@ function renderSide() {
* @param {boolean} allowLinks
* @returns {string}
*/
- function inline(text, titles, allowLinks = true) { return String(text ?? '').split(/(\`[^\`]*\`|[^\\s:@()[\\]{}"'\`]+:\\d+(?:-\\d+)?@[0-9a-f]{7,40}|pullboard(?:\\s+\\w+)+|--[\\w-]+|(?:\\/|\\.\\.?\\/|[\\w.-]+\\/)\\w[\\w./-]*\\.[A-Za-z0-9]+|\\b[0-9a-fA-F]{7,40}\\b|#\\d+)/g).map((part, n, parts) => {
+ function inline(text, titles, allowLinks = true) { return String(text ?? '').split(/(\`[^\`]*\`|[^\\s:@()[\\]{}"'\`]+:\\d+(?:-\\d+)?@[0-9a-f]{7,40}|${COMMAND_SOURCE}|--[\\w-]+|(?:\\/|\\.\\.?\\/|[\\w.-]+\\/)\\w[\\w./-]*\\.[A-Za-z0-9]+|\\b[0-9a-fA-F]{7,40}\\b|#\\d+)/g).map((part, n, parts) => {
if (part.startsWith('\`') && part.endsWith('\`')) return codeChip(part.slice(1, -1));
if (part.includes('@') && part.includes(':')) {
const textBefore = parts.slice(0, n).join('');
@@ -848,7 +856,7 @@ function renderSide() {
if (allowLinks && validRef) return codeRef(part, textBefore.slice(-2000));
return codeChip(part);
}
- if (/^(?:pullboard(?:\\s+\\w+)+|--[\\w-]+|(?:\\/|\\.\\.?\\/|[\\w.-]+\\/)\\w[\\w./-]*\\.[A-Za-z0-9]+|\\b[0-9a-fA-F]{7,40}\\b)$/.test(part)) return codeChip(part);
+ if (/^(?:${COMMAND_SOURCE}|--[\\w-]+|(?:\\/|\\.\\.?\\/|[\\w.-]+\\/)\\w[\\w./-]*\\.[A-Za-z0-9]+|\\b[0-9a-fA-F]{7,40}\\b)$/.test(part)) return codeChip(part);
return linked(part, titles, allowLinks);
}).join(''); }
/** Render inline text and fenced or shell command blocks with escaped contents.
diff --git a/test/cockpit.test.js b/test/cockpit.test.js
index 677865ff..9263d9b3 100644
--- a/test/cockpit.test.js
+++ b/test/cockpit.test.js
@@ -18,7 +18,8 @@ import { loadDoctrine } from '../src/doctrine.js';
import { addItem, closeBoard, openBoard } from '../src/board.js';
import { exportBoard, importBoard } from '../src/exchange.js';
import { MACHINE } from '../src/machine.js';
-import { cockpitPage } from '../src/cockpit.js';
+import { cockpitPage, PULLBOARD_COMMANDS } from '../src/cockpit.js';
+import { HELP } from '../src/cli.js';
import { portableSnapshot, projectState } from '../src/serve.js';
import { fetchFresh } from './http-fixture.js';
@@ -809,6 +810,47 @@ test('the tabs fit one row on a phone [N26]', async () => {
await view.stop();
}
});
+test('a pullboard command in prose chips only the command [N26]', async () => {
+ // The page's command list is the CLI's: every phrase HELP declares, from its usage lines, and nothing else.
+ const declared = new Set();
+ for (const row of Object.values(HELP.commands)) for (const usage of row.usages) {
+ const phrase = [];
+ for (const word of usage.split(/\s+/).slice(1)) {
+ if (/^[a-z][a-zA-Z-]*$/.test(word)) { phrase.push(word); continue; }
+ const choices = /^\[?([a-z][a-zA-Z-]*(?:\|[a-z][a-zA-Z-]*)+)\]?$/.exec(word);
+ if (choices) for (const choice of choices[1].split('|')) declared.add([...phrase, choice].join(' '));
+ break;
+ }
+ if (phrase.length) declared.add(phrase.join(' '));
+ }
+ assert.deepEqual([...PULLBOARD_COMMANDS].sort(), [...declared].sort(), 'the view chips exactly the commands the CLI declares');
+ assert.deepEqual(PULLBOARD_COMMANDS, [...PULLBOARD_COMMANDS].sort((a, b) => b.split(' ').length - a.split(' ').length), 'longest phrases first, so spec check wins over spec');
+
+ const box = machine();
+ const demo = project(box, 'commands');
+ box.run(demo.repo, 'shout', 'all', [
+ 'pullboard spec check prints a line for docs/api.md with 0 errors.',
+ 'pullboard view serves every board.',
+ 'Run pullboard next --verify 235 then review it.',
+ 'pullboard verify 235 reject goes on in words.',
+ 'Turn pullboard relay on now, and pullboard hold web --reason "a pause" after that.',
+ "pullboard's own page has no command.",
+ ].join(' '));
+ const view = await startView(box);
+ try {
+ const page = await openPage(view);
+ page.run("view.tab = 'shouts'; render();");
+ const feed = page.show('feed');
+ const chips = [...feed.matchAll(/<code class="inline(?: long)?">([^<]*)<\/code>/g)].map((match) => match[1].replaceAll('&quot;', '"'));
+ assert.deepEqual(chips.filter((chip) => chip.startsWith('pullboard')), ['pullboard spec check', 'pullboard view', 'pullboard next --verify 235', 'pullboard verify 235', 'pullboard relay on', 'pullboard hold'],
+ `each chip is the command and its arguments, never the words after it: ${JSON.stringify(chips)}`);
+ assert.ok(chips.includes('docs/api.md') && chips.includes('--reason'), 'a path and a flag in the prose after a command still chip on their own');
+ for (const word of ['prints', 'serves', 'then', 'goes', 'now', 'after', 'own']) assert.ok(!chips.some((chip) => chip.split(' ').includes(word)), `"${word}" stays prose`);
+ } finally {
+ await view.stop();
+ }
+});
+
test('the view has a light and a dark theme to choose [N26]', async () => {
const view = await startView(machine());
try {
@@ -4168,8 +4210,8 @@ test('real Chrome styles shout code and item text without growing linked lines [
assert.ok(rendered.shoutCodeMetrics.width > 0 && rendered.shoutCodeMetrics.width < rendered.shoutCodeMetrics.lineWidth / 2,
`1280px shout code is a compact chip: ${JSON.stringify(rendered.shoutCodeMetrics)}`);
assert.match(rendered.shoutHtml, /<code class="inline">code &lt;b&gt;safe&lt;\/b&gt;<\/code>/, 'backticks create escaped inline code');
- assert.match(rendered.shoutHtml, /<code class="inline">pullboard shout<\/code>/, 'pullboard commands are inline code');
- assert.match(rendered.shoutHtml, /<code class="inline">--decision<\/code>/, 'flags are inline code');
+ assert.match(rendered.shoutHtml, /<code class="inline(?: long)?">pullboard shout --decision<\/code>/, 'a pullboard command is inline code, with the flags that follow it');
+ assert.match(rendered.shoutHtml, /<code class="inline">--flag<\/code>/, 'a flag on its own is inline code');
assert.match(rendered.shoutHtml, /<code class="inline">src\/cockpit\.js<\/code>/, 'slash paths are inline code');
assert.match(rendered.shoutHtml, /<code class="inline long">0123456789abcdef0123456789abcdef01234567<\/code>/, 'hex SHAs are inline code, long enough to wrap');
assert.ok((rendered.shoutHtml.match(/<code class="code block">/g) ?? []).length >= 2, 'fences and dollar-prefixed lines are code blocks');
@@ -4183,7 +4225,7 @@ test('real Chrome styles shout code and item text without growing linked lines [
await chrome.waitFor(`document.querySelector('#feed button[data-code^="SPEC.md:1-2@"]').getAttribute('aria-expanded') === 'true'`);
await chrome.waitFor(`document.querySelector('#feed button[data-code^="SPEC.md:1-2@"] + .code')?.textContent.includes('Demo spec')`);
assert.match(await chrome.evaluate(`document.querySelector('#feed button[data-code^="SPEC.md:1-2@"] + .code')?.textContent || ''`), /Demo spec/, 'the original code preview still opens its referenced lines');
- assert.match(rendered.askHtml, /<code class="inline">pullboard shout<\/code>/, 'needs-you uses the same code renderer');
+ assert.match(rendered.askHtml, /<code class="inline(?: long)?">pullboard shout --decision<\/code>/, 'needs-you uses the same code renderer');
assert.equal(rendered.askNestedButtons, 0, 'formatted text in an ask cannot nest interactive controls');
assert.equal(rendered.needsNestedButtons, 0, 'needs-you keeps its button markup valid');
assert.equal(rendered.agentNestedButtons, 0, 'agent item buttons never nest reference controls');