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(brief): retain paths after unclosed notes [B14]

Corey Olsonaabd8291cf44
diff --git a/src/brief.js b/src/brief.js
index e5379c30..b07f24cb 100644
--- a/src/brief.js
+++ b/src/brief.js
@@ -6,23 +6,32 @@
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.
+/** Remove closed parenthetical notes while leaving an unmatched note visible to path checks.
*
* @param {string} text
* @returns {string}
*/
function withoutParentheticalNotes(text) {
let depth = 0;
+ let noteStart = -1;
let output = '';
- for (const character of text) {
+ for (let index = 0; index < text.length; index += 1) {
+ const character = text[index];
if (character === '(') {
- if (depth === 0) output += ' ';
+ if (depth === 0) {
+ noteStart = index;
+ output += ' ';
+ }
depth += 1;
} else if (character === ')' && depth > 0) {
depth -= 1;
- if (depth === 0) output += ' ';
+ if (depth === 0) {
+ noteStart = -1;
+ output += ' ';
+ }
} else if (depth === 0) output += character;
}
+ if (depth > 0) output += text.slice(noteStart);
return output;
}
diff --git a/test/board.test.js b/test/board.test.js
index 6a744c79..256976a0 100644
--- a/test/board.test.js
+++ b/test/board.test.js
@@ -103,6 +103,7 @@ test('[B14] notes in parentheses are not paths, and a foreign path still refuses
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']);
+ const unclosed = 'Files:\n- src/a.js (old note api/x.js';
let stdout = '';
let stderr = '';
@@ -116,6 +117,18 @@ test('[B14] notes in parentheses are not paths, and a foreign path still refuses
assert.equal(code, 1, stdout);
assert.match(stderr, /BRIEF_LANE.*api\/server\.js \(api's\)/);
assert.doesNotMatch(stderr, /make\.|folders\)/);
+
+ let unclosedStderr = '';
+ const unclosedCode = await main([
+ 'add', 'web', 'Page', '--route', 'light', '--criterion', 'the page renders', '--check', 'true', '--brief', `${unclosed}\nChange: update the page\nTest: check the page`,
+ ], {
+ cwd: repo,
+ stdout: { isTTY: false, write: () => {} },
+ stderr: { write: (text) => { unclosedStderr += text; } },
+ });
+ assert.equal(unclosedCode, 1);
+ assert.match(unclosedStderr, /BRIEF_LANE.*api\/x\.js/u);
+ assert.deepEqual(briefFiles(unclosed), ['src/a.js', 'api/x.js']);
});
test('agents are numbered per lane; one coordinator; a worktree joins once', () => {