baa-conductor

git clone 

commit
4f0ce32
parent
0ca1920
author
im_wower
date
2026-03-29 03:02:44 +0800 CST
fix: accept baa fences with attributes
3 files changed,  +44, -5
M apps/conductor-daemon/src/index.test.js
+29, -0
 1@@ -630,6 +630,35 @@ test("BAA instruction extraction ignores unterminated baa blocks and keeps close
 2   assert.equal(parseBaaInstructionBlock(blocks[0]).tool, "describe");
 3 });
 4 
 5+test("BAA instruction extraction accepts fence attributes and rejects non-baa languages", () => {
 6+  const message = [
 7+    "```baa",
 8+    "@conductor::describe",
 9+    "```",
10+    "",
11+    '```baa id="p4k2vt"',
12+    "@conductor::status",
13+    "```",
14+    "",
15+    "```javascript",
16+    "@conductor::exec::printf 'ignore-js'",
17+    "```",
18+    "",
19+    "```baa-ext",
20+    "@conductor::exec::printf 'ignore-baa-ext'",
21+    "```"
22+  ].join("\n");
23+
24+  const blocks = extractBaaInstructionBlocks(message);
25+
26+  assert.equal(blocks.length, 2);
27+  assert.deepEqual(
28+    blocks.map((block) => block.content),
29+    ["@conductor::describe", "@conductor::status"]
30+  );
31+  assert.equal(blocks[1].rawBlock, '```baa id="p4k2vt"\n@conductor::status\n```');
32+});
33+
34 test("InMemoryBaaInstructionDeduper evicts the oldest keys when maxSize is exceeded", () => {
35   const deduper = new InMemoryBaaInstructionDeduper({
36     maxSize: 2
M apps/conductor-daemon/src/instructions/extract.ts
+1, -1
1@@ -33,7 +33,7 @@ export function extractBaaInstructionBlocks(text: string): BaaExtractedBlock[] {
2 
3       pending = {
4         contentLines: [],
5-        isBaa: (match[1] ?? "").trim() === "baa",
6+        isBaa: /^baa(?:\s|$)/u.test((match[1] ?? "").trim()),
7         openingLine: line
8       };
9       continue;
M tasks/T-BUG-030.md
+14, -4
 1@@ -2,7 +2,7 @@
 2 
 3 ## 状态
 4 
 5-- 当前状态:`待开始`
 6+- 当前状态:`已完成`
 7 - 规模预估:`S`
 8 - 依赖任务:无
 9 - 建议执行者:`均可`(一行改动)
10@@ -101,21 +101,31 @@ isBaa: /^baa(?:\s|$)/u.test((match[1] ?? "").trim()),
11 
12 ### 开始执行
13 
14-- 执行者:
15-- 开始时间:
16+- 执行者:`Codex (GPT-5)`
17+- 开始时间:`2026-03-29 03:00:48 +0800`
18 - 状态变更:`待开始` → `进行中`
19 
20 ### 完成摘要
21 
22-- 完成时间:
23+- 完成时间:`2026-03-29 03:02:12 +0800`
24 - 状态变更:`进行中` → `已完成`
25 - 修改了哪些文件:
26+  - `apps/conductor-daemon/src/instructions/extract.ts`
27+  - `apps/conductor-daemon/src/index.test.js`
28+  - `tasks/T-BUG-030.md`
29 - 核心实现思路:
30+  - 将 `baa` fence 判定从精确等于改为 `^baa(?:\\s|$)`,允许 `baa` 后带空格属性,同时拒绝 `baa-ext` 这类紧跟非空白字符的标记。
31+  - 在现有提取测试中补充带属性 fence、普通 `javascript` fence、`baa-ext` fence 的覆盖,确认只提取合法 `baa` 代码块。
32 - 跑了哪些测试:
33+  - `cd /Users/george/code/baa-conductor-baa-fence-attribute && pnpm build`
34+  - `cd /Users/george/code/baa-conductor-baa-fence-attribute && pnpm test`
35 
36 ### 执行过程中遇到的问题
37 
38 > 记录执行过程中遇到的阻塞、环境问题、临时绕过方案等。合并时由合并者判断是否需要修复或建新任务。
39 
40+- worktree 初始缺少依赖,首次 `pnpm build` 因找不到 `tsc` 失败;已在 worktree 执行 `pnpm install --frozen-lockfile` 后完成构建与测试。
41+
42 ### 剩余风险
43 
44+- 当前修复覆盖了 `` ```baa`` 和 `` ```baa <attributes>`` 两种格式;如果后续要支持更多 fence 变体(如波浪线 fence),需要单独扩展提取规则。