Skip to content

feat(validate): fail build on unsubstituted {{placeholders}} in rendered Markdown#2

Open
mvanhorn wants to merge 1 commit into
replayio:mainfrom
mvanhorn:feat/ahp-placeholder-lint-validator
Open

feat(validate): fail build on unsubstituted {{placeholders}} in rendered Markdown#2
mvanhorn wants to merge 1 commit into
replayio:mainfrom
mvanhorn:feat/ahp-placeholder-lint-validator

Conversation

@mvanhorn

Copy link
Copy Markdown

Summary

  • Extend lib/validate.ts to walk dist/**/*.md and fail the build if any unsubstituted {{[A-Za-z0-9_]+}} placeholders remain in rendered Markdown.
  • Mirrors the existing jsonFiles() helper style; no new dependencies, no changes to lib/build-helpers.ts or any lib/strategies/*.ts.
  • Catches the failure mode where a new placeholder is added to src/content/*.md but not registered in RenderOptions + render(), which otherwise ships literal {{NEW_PLACEHOLDER}} text in agent-visible skill bodies.

Validation

npm run check passes on current main (current rendered output is clean).

Demo of the check catching a regression ({{FAKE_PLACEHOLDER}} appended to src/content/skill.md):

$ npm run build && npm run validate
> tsx lib/validate.ts

Error: Rendered Markdown contains unsubstituted placeholders. Add the missing placeholders to render() in lib/build-helpers.ts (or remove them from src/content/*.md):
  dist/claude-code/replayio/skills/replayio/SKILL.md: {{FAKE_PLACEHOLDER}}
  dist/codex/replayio/skills/replayio/SKILL.md: {{FAKE_PLACEHOLDER}}
  dist/cursor/replayio/skills/replayio/SKILL.md: {{FAKE_PLACEHOLDER}}

AI was used for assistance.

…red Markdown

The build pipeline in lib/build-helpers.ts:render() substitutes six
placeholders per target ({{PWCLI_EXPORT}}, {{TITLE_SUFFIX}},
{{ANALYSIS_SURFACE}}, {{ANALYSIS_TOOLS}}, {{AUTH_NOTE}},
{{AGENT_BROWSER_WARNING}}). If a contributor adds a new placeholder to
src/content/*.md without registering it in RenderOptions and render(),
the dist bundle ships with literal {{NEW_PLACEHOLDER}} text in skill
bodies that real agents see at runtime.

Extend lib/validate.ts to walk dist/**/*.md, scan for
{{[A-Za-z0-9_]+}} patterns, and throw a single summary error listing
each offending file with its unsubstituted tokens. Mirrors the existing
jsonFiles() helper style; no new dependencies.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant