fix(prd): stop a --> in the idea closing the seed comment early#41
Merged
ralyodio merged 1 commit intoJul 26, 2026
Merged
Conversation
`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 (`-->`), which is invisible
inside the comment. Ideas without `-->` render byte-identically.
Two regression tests added; both fail on unpatched src. Full suite 149/149.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
renderPrdembeds 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)writes into
prd/0001-ship-a-parser-for-arrows-in-specs.md: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 (-->→-->) and only inside the seed marker, where it is never displayed. Ideas that contain no-->render byte-identically, so existing PRDs andprd/README.mdare unaffected. Nothing reads the marker back, so no parsing changes.Tests
Two regression tests in
test/prd.test.mjs— one atrenderPrdlevel, one end-to-end throughcreatePrd— 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 passnode --test: 149 pass / 0 fail (was 147)