syntaur 0.65.0 → 0.66.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -731,7 +731,9 @@ function parseDecisionRecord(fileContent) {
731
731
  function parseComments(fileContent) {
732
732
  const [fm, body] = extractFrontmatter(fileContent);
733
733
  const entries = [];
734
- const sections = body.split(/^## /m).slice(1);
734
+ const sections = body.split(
735
+ /^## (?=[^\n]*\n\s*\*\*Recorded:\*\*[^\n]*\n\*\*Author:\*\*[^\n]*\n\*\*Type:\*\*\s*(?:question|note|feedback)\b)/m
736
+ ).slice(1);
735
737
  for (const section of sections) {
736
738
  const newlineIdx = section.indexOf("\n");
737
739
  if (newlineIdx === -1) continue;
@@ -2356,6 +2358,16 @@ function parseStatusConfig(content) {
2356
2358
  }
2357
2359
  return t;
2358
2360
  };
2361
+ const unquoteAql = (v) => {
2362
+ const t = v.trim();
2363
+ if (t.startsWith('"') && t.endsWith('"') && t.length >= 2) {
2364
+ return t.slice(1, -1).replace(/\\(["\\])/g, "$1");
2365
+ }
2366
+ if (t.startsWith("'") && t.endsWith("'") && t.length >= 2) {
2367
+ return t.slice(1, -1);
2368
+ }
2369
+ return t;
2370
+ };
2359
2371
  let currentSection = null;
2360
2372
  const lines = remaining.split("\n");
2361
2373
  function parseListEntry(lineIdx, baseIndent) {
@@ -2435,8 +2447,8 @@ function parseStatusConfig(content) {
2435
2447
  if (entry["phase"] && entry["when"] !== void 0) {
2436
2448
  phaseLadder.push({
2437
2449
  phase: unquote(entry["phase"]),
2438
- when: unquote(entry["when"]),
2439
- next: entry["next"] !== void 0 ? unquote(entry["next"]) : void 0
2450
+ when: unquoteAql(entry["when"]),
2451
+ next: entry["next"] !== void 0 ? unquoteAql(entry["next"]) : void 0
2440
2452
  });
2441
2453
  }
2442
2454
  lineIdx += consumed - 1;
@@ -2447,7 +2459,7 @@ function parseStatusConfig(content) {
2447
2459
  if (entry["else"] !== void 0) {
2448
2460
  disposition.push({ when: null, is: unquote(entry["else"]) });
2449
2461
  } else if (entry["when"] !== void 0 && entry["is"]) {
2450
- disposition.push({ when: unquote(entry["when"]), is: unquote(entry["is"]) });
2462
+ disposition.push({ when: unquoteAql(entry["when"]), is: unquote(entry["is"]) });
2451
2463
  }
2452
2464
  lineIdx += consumed - 1;
2453
2465
  continue;
@@ -2511,6 +2523,7 @@ function buildDefaultStatusConfig() {
2511
2523
  }
2512
2524
  function serializeStatusConfig(statuses) {
2513
2525
  const lines = [];
2526
+ const escapeAql = (s) => s.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
2514
2527
  lines.push("statuses:");
2515
2528
  lines.push(" definitions:");
2516
2529
  for (const s of statuses.statuses) {
@@ -2551,15 +2564,15 @@ function serializeStatusConfig(statuses) {
2551
2564
  lines.push(" phaseLadder:");
2552
2565
  for (const rung of d.phaseLadder) {
2553
2566
  lines.push(` - phase: ${rung.phase}`);
2554
- lines.push(` when: "${rung.when.replace(/"/g, '\\"')}"`);
2555
- if (rung.next) lines.push(` next: "${rung.next.replace(/"/g, '\\"')}"`);
2567
+ lines.push(` when: "${escapeAql(rung.when)}"`);
2568
+ if (rung.next !== void 0) lines.push(` next: "${escapeAql(rung.next)}"`);
2556
2569
  }
2557
2570
  lines.push(" disposition:");
2558
2571
  for (const rule of d.disposition) {
2559
2572
  if (rule.when === null) {
2560
2573
  lines.push(` - else: ${rule.is}`);
2561
2574
  } else {
2562
- lines.push(` - when: "${rule.when.replace(/"/g, '\\"')}"`);
2575
+ lines.push(` - when: "${escapeAql(rule.when)}"`);
2563
2576
  lines.push(` is: ${rule.is}`);
2564
2577
  }
2565
2578
  }