@foldrun/core 24.4.0 → 24.4.1

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.
@@ -558,11 +558,18 @@ export function setFrontmatterScalar(raw, key, value) {
558
558
  return ["---", line, "---", ...lines].join(eol);
559
559
  const k = keyLine(lines, b.close, key);
560
560
  if (k) {
561
- const { value: v, comment } = splitComment(k.rest);
561
+ const { comment } = splitComment(k.rest);
562
+ // Every line indented deeper than the key is its value's — a block
563
+ // scalar, a plain scalar folded onto the next lines, blank lines inside
564
+ // either. Trailing blank lines are left where they are (Codex: a value
565
+ // after a blank line survived and joined the new one).
562
566
  let end = k.index + 1;
563
- if (/^\s*[|>][-+]?\d*\s*$/.test(v) || !v.trim()) {
564
- while (end < b.close && (lines[end].match(/^\s*/)?.[0].length ?? 0) > k.indent.length && /\S/.test(lines[end]))
565
- end++;
567
+ for (let i = k.index + 1; i < b.close; i++) {
568
+ if (!/\S/.test(lines[i]))
569
+ continue;
570
+ if ((lines[i].match(/^\s*/)?.[0].length ?? 0) <= k.indent.length)
571
+ break;
572
+ end = i + 1;
566
573
  }
567
574
  lines.splice(k.index, end - k.index, `${k.indent}${line}${comment}`);
568
575
  return lines.join(eol);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foldrun/core",
3
- "version": "24.4.0",
3
+ "version": "24.4.1",
4
4
  "description": "Agents are just folders. The format, the runner, the checks.",
5
5
  "license": "FSL-1.1-ALv2",
6
6
  "type": "module",
@@ -587,10 +587,16 @@ export function setFrontmatterScalar(raw: string, key: string, value: string): s
587
587
  if (!b) return ["---", line, "---", ...lines].join(eol);
588
588
  const k = keyLine(lines, b.close, key);
589
589
  if (k) {
590
- const { value: v, comment } = splitComment(k.rest);
590
+ const { comment } = splitComment(k.rest);
591
+ // Every line indented deeper than the key is its value's — a block
592
+ // scalar, a plain scalar folded onto the next lines, blank lines inside
593
+ // either. Trailing blank lines are left where they are (Codex: a value
594
+ // after a blank line survived and joined the new one).
591
595
  let end = k.index + 1;
592
- if (/^\s*[|>][-+]?\d*\s*$/.test(v) || !v.trim()) {
593
- while (end < b.close && (lines[end].match(/^\s*/)?.[0].length ?? 0) > k.indent.length && /\S/.test(lines[end])) end++;
596
+ for (let i = k.index + 1; i < b.close; i++) {
597
+ if (!/\S/.test(lines[i])) continue;
598
+ if ((lines[i].match(/^\s*/)?.[0].length ?? 0) <= k.indent.length) break;
599
+ end = i + 1;
594
600
  }
595
601
  lines.splice(k.index, end - k.index, `${k.indent}${line}${comment}`);
596
602
  return lines.join(eol);