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(core): parse brief file notes safely [B14]
Corey Olsone7bf95a8f0d7
diff --git a/src/brief.js b/src/brief.jsindex 0294449a..e5379c30 100644--- a/src/brief.js+++ b/src/brief.js@@ -6,6 +6,26 @@const LABEL_RE = /^(files|change|test|out of scope)\s*:\s*(.*)$/i;+/** Remove balanced parenthetical notes so their words cannot be mistaken for file paths.+ *+ * @param {string} text+ * @returns {string}+ */+function withoutParentheticalNotes(text) {+ let depth = 0;+ let output = '';+ for (const character of text) {+ if (character === '(') {+ if (depth === 0) output += ' ';+ depth += 1;+ } else if (character === ')' && depth > 0) {+ depth -= 1;+ if (depth === 0) output += ' ';+ } else if (depth === 0) output += character;+ }+ return output;+}+/*** The brief split into its labelled sections, each a list of non-empty lines without bullets.*@@ -37,7 +57,9 @@ export function briefSections(brief) {*/export function briefFiles(brief) {return (briefSections(brief).files ?? [])- .flatMap((entry) => entry.split(/[,\s]+/))+ .flatMap((entry) => withoutParentheticalNotes(entry).split(/[,\s]+/)).map((token) => token.replace(/^[(`'"]+|[)\]'".,;:!?]+$/g, ''))- .filter((token) => !/^[a-z]+:\/\//i.test(token) && (token.includes('/') || /\.[a-z0-9]+(?:\.[a-z0-9]+)*$/i.test(token)));+ .filter((token) => !/^[\d.]+$/.test(token)+ && !/^[a-z]+:\/\//i.test(token)+ && (token.includes('/') || /\.[a-z0-9]+(?:\.[a-z0-9]+)*$/i.test(token)));}diff --git a/test/board.test.js b/test/board.test.jsindex 582d933f..6a744c79 100644--- a/test/board.test.js+++ b/test/board.test.js@@ -84,7 +84,7 @@ beforeEach(() => {store.register(board, { lane: 'api', path: '/repo-api-1' });});-test('[B14] brief paths ignore sentence punctuation but still refuse a foreign path', async (t) => {+test('[B14] notes in parentheses are not paths, and a foreign path still refuses', async (t) => {const directory = mkdtempSync(join(tmpdir(), 'pullboard-brief-files-'));t.after(() => rmSync(directory, { recursive: true, force: true }));const repo = join(directory, 'repo');@@ -101,6 +101,8 @@ test('[B14] brief paths ignore sentence punctuation but still refuse a foreign p}));const brief = 'Files:\n- src/x.js, README.md, docs/, make. folders). api/server.js.\nChange: add a page\nTest: check the page';assert.deepEqual(briefFiles(brief), ['src/x.js', 'README.md', 'docs/', 'api/server.js']);+ const noted = 'Files:\n- src/a.js (only where a checked claim changed in 0.8.1 (see api/v1.js)) .8.1 1..2 0.8.1\n- src/b.js (main.moved and skills/ stay as they are)';+ assert.deepEqual(briefFiles(noted), ['src/a.js', 'src/b.js']);let stdout = '';let stderr = '';