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
fix(view): command chips know every command help --all prints [N26]
Corey Olson6fd1d75e40b5
diff --git a/src/cockpit.js b/src/cockpit.jsindex af5cdda2..65ff417d 100644--- a/src/cockpit.js+++ b/src/cockpit.js@@ -1,10 +1,11 @@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+ * The command phrases the CLI declares, as help --all prints them (HELP.all) and as each command's usage+ * lines do, 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"]);+export const PULLBOARD_COMMANDS = Object.freeze(["spec signers add","hook commit-msg","hook pre-commit","hook pre-merge-commit","hook pre-push","milestone add","milestone edit","milestone items","milestone move","milestone remove","prompt decompose","prompt plan","prompt review","prompt signoff","prompt verify","relay join","relay off","relay on","relay pair","relay revoke","relay tokens","spec apply","spec approve","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-]))*';diff --git a/test/cockpit.test.js b/test/cockpit.test.jsindex 3d089088..9c914f26 100644--- a/test/cockpit.test.js+++ b/test/cockpit.test.js@@ -811,18 +811,29 @@ test('the tabs fit one row on a phone [N26]', async () => {}});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.+ // The page's command list is the CLI's: every "pullboard ..." that help --all prints (HELP.all) or a usage line+ // declares, choices in [a|b] or a|b, and commands after " | ", 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;+ const read = (text) => {+ for (const found of text.matchAll(/(?:^|[\s(`'"])pullboard ((?:\S+ ?)+?)(?= {2}|$|[;,.)](?:\s|$))/gm)) {+ const tokens = found[1].trim().split(' ');+ const phrase = [];+ for (let n = 0; n < tokens.length; n++) {+ const token = tokens[n];+ if (/^[a-z][a-zA-Z-]*$/.test(token)) { phrase.push(token); continue; }+ const choices = /^\[?([a-z][a-zA-Z-]*(?:\|[a-z][a-zA-Z-]*)+)\]?$/.exec(token);+ if (choices) for (const choice of choices[1].split('|')) declared.add([...phrase, choice].join(' '));+ else if (token === '|' && phrase.length === 1) {+ for (let k = n + 1; k < tokens.length; k += 2) { if (!/^[a-z][a-zA-Z-]*$/.test(tokens[k])) break; declared.add(tokens[k]); if (tokens[k + 1] !== '|') break; }+ }+ break;+ }+ if (phrase.length) declared.add(phrase.join(' '));}- if (phrase.length) declared.add(phrase.join(' '));- }+ };+ read(HELP.all);+ for (const row of Object.values(HELP.commands)) for (const usage of row.usages) read(usage);+ for (const sub of ['milestone add', 'relay tokens', 'spec approve', 'prompt review']) assert.ok(declared.has(sub), `help --all declares ${sub}`);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');@@ -835,6 +846,7 @@ test('a pullboard command in prose chips only the command [N26]', async () => {'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.",+ 'Then pullboard milestone add Launch for the person, and pullboard prompt review prints a guide.',].join(' '));const view = await startView(box);try {@@ -842,10 +854,10 @@ test('a pullboard command in prose chips only the command [N26]', async () => {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('"', '"'));- 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'],+ 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', 'pullboard milestone add', 'pullboard prompt review'],`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`);+ for (const word of ['prints', 'serves', 'then', 'goes', 'now', 'after', 'own', 'for', 'a']) assert.ok(!chips.some((chip) => chip.split(' ').includes(word)), `"${word}" stays prose`);} finally {await view.stop();}