Skip to content

fix(prd): stop a --> in the idea closing the seed comment early#41

Merged
ralyodio merged 1 commit into
moshcoder:mainfrom
clawedassistant26:fix/prd-seed-comment-terminator
Jul 26, 2026
Merged

fix(prd): stop a --> in the idea closing the seed comment early#41
ralyodio merged 1 commit into
moshcoder:mainfrom
clawedassistant26:fix/prd-seed-comment-terminator

Conversation

@clawedassistant26

Copy link
Copy Markdown
Contributor

renderPrd embeds the idea verbatim in the hidden <!-- seed: ... --> marker (src/prd.mjs:113). If the idea itself contains -->, the comment closes at that terminator, so the remainder of the idea and the template's real closer land in the rendered output as visible text.

Repro (on main)

moshcode prd "ship a parser for --> arrows in specs"

writes into prd/0001-ship-a-parser-for-arrows-in-specs.md:

## Problem

<!-- seed: ship a parser for -->
 arrows in specs -->
_Describe the user/business problem, and why it matters now._

The arrows in specs --> line is outside the comment and renders in the Problem section of every new PRD created from such an idea. Any idea quoting an HTML comment, an arrow, or a spec snippet hits it.

Fix

A small commentSafe() helper escapes only the terminator (-->--&gt;) and only inside the seed marker, where it is never displayed. Ideas that contain no --> render byte-identically, so existing PRDs and prd/README.md are unaffected. Nothing reads the marker back, so no parsing changes.

Tests

Two regression tests in test/prd.test.mjs — one at renderPrd level, one end-to-end through createPrd — asserting the seed line holds exactly one terminator and that the line after it is still the untouched template placeholder.

  • git stash push -- src/ (tests only, unpatched source): 2 fail, 4 pass
  • With the fix: 6/6 pass
  • Full suite node --test: 149 pass / 0 fail (was 147)

`renderPrd` embeds the idea verbatim in a hidden `<!-- seed: ... -->` marker.
An idea containing `-->` closes that comment at its own terminator, so the
rest of the idea and the template's real closer render as visible text at the
top of the Problem section.

Repro on main: `moshcode prd "ship a parser for --> arrows in specs"` writes

    <!-- seed: ship a parser for -->
     arrows in specs -->
    _Describe the user/business problem, and why it matters now._

Neutralise the terminator in the marker only (`--&gt;`), which is invisible
inside the comment. Ideas without `-->` render byte-identically.

Two regression tests added; both fail on unpatched src. Full suite 149/149.
@ralyodio
ralyodio merged commit b85fc94 into moshcoder:main Jul 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants