Lessons Bsd Awk And Detection Fence Fix
# lessons.sh + archive-prompts.sh: BSD awk fix + Result-block-fence-aware detection
## Goal
E2E verification 抓到 2 個 bug,本輪修:
1. **Primary**:`scripts/lessons.sh` 的 `replace_entry()` 用 `awk -v new="$multiline"` 在 macOS BSD awk 上爆 "newline in string",extract 拼不起來
2. **Secondary**:`scripts/archive-prompts.sh` 的 detection awk 從 `^## Result$` 起讀但**沒處理 `## Result` 出現在 code fence 內**(archived inbox prompts 的 Result template 在 fence 裡)— 抓錯區塊內容導致本輪 E2E archive 的 FAIL 訊號沒被偵測
## Execution profile
- model: sonnet
- effort: low(單檔 ~30 行 fix x 2 + verify)
- 2 commits + archive = 3
## Background context
- E2E sub-test A FAIL:`replace_entry()` 拿 candidate 多行內容(含 frontmatter + body)餵 `awk -v new="$content"`,BSD awk 拒絕 newline 在 -v assign。GNU awk OK,BSD awk 不行 → macOS broken。
- Self-validation 沒觸發:detection awk 假設 `## Result` 都在 top-level,但 archived inbox 的 Result block template 是寫在 ``` fence 裡,state machine 錯誤計到 fence 內 PASS/FAIL placeholder,filter 掉一切。
## Step-by-step
### Step 1: Pre-flightwhen to use it
Community prompt sourced from the open-source GitHub repo woodylin0920-bit/Tandem (MIT). A "Lessons Bsd Awk And Detection Fence Fix" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.
tags
roleplaycommunitygeneral
source
woodylin0920-bit/Tandem · MIT