Files
PaperClipAI/packages/shared
scotttongandClaude Opus 4.8 635de31df4 fix(plan): heal collapsed single-line plan bodies
The Plan pane could render an entire plan document as one giant H1 with
`##` markers showing inline (e.g. "…plan pack)## The goal, restatedYou
picked…") when a producer wrote the plan document body with its
paragraph/heading newlines collapsed onto a single line.

Two layers:

- Producer (source): the plan-authoring guidance modeled the body as a
  single-line `"# Plan\n\n…"` template, inviting flattened bodies. Add
  explicit formatting rules (each heading on its own line, blank line
  between blocks, JSON-safe encoding) and a multi-section example.
  Reinforce the same rule in the onboarding publish contract.

- Write-path guard (defense-in-depth): multilineTextSchema now runs
  normalizeMidLineHeadings after escaped-break normalization. It inserts
  a paragraph break before a mid-line ATX heading marker (`#{1,6} `) so a
  malformed single-line body self-heals into headings/paragraphs. Scoped
  to skip fenced code blocks and to leave inline `#` tokens (C#, F#,
  #hashtags, #123) untouched.

Unit tests cover the guard (mid-line `##` break, C#/F#/hashtag/code-fence
exclusions, leading-heading no-op).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-06 02:24:44 -07:00
..
2026-03-12 13:09:22 -05:00