Skip to content

fix: YAML-quote frontmatter description values#96

Merged
tmm merged 4 commits intowevm:mainfrom
douglance:fix/yaml-quote-description
Apr 24, 2026
Merged

fix: YAML-quote frontmatter description values#96
tmm merged 4 commits intowevm:mainfrom
douglance:fix/yaml-quote-description

Conversation

@douglance
Copy link
Copy Markdown
Contributor

@douglance douglance commented Mar 26, 2026

Summary

  • Frontmatter description was built via string concatenation, which produces invalid YAML when the value contains colon-space sequences (e.g. "Use key: value for precision")
  • Replaced manual string building in Skill.ts with yamlStringify() from the yaml package (already a dependency) — handles all YAML quoting edge cases correctly
  • Replaced naive regex extraction in Cli.ts index.json generation with yamlParse() for correct roundtripping
  • Added regression test for colon-space in descriptions

Before (broken)

description: Search items. Use key: value for precision. Run `app --help` for usage details.

YAML parsers interpret key: value as a nested mapping → parse error.

After (correct)

description: "Search items. Use key: value for precision. Run `app --help` for usage details."

The yaml library quotes only when necessary and handles all edge cases (escaped quotes, special characters, etc.).

Test plan

  • All 815 existing tests pass (no snapshot changes needed — yaml library output matches original for safe values)
  • Added new test: YAML-quotes description containing colon-space

Description values containing colons, backticks, and other YAML-special
characters (e.g. "Run `app ping --help` for usage details.") break
frontmatter parsing when left unquoted. This adds a `yamlQuote()` helper
that wraps the value in double quotes when it contains any character that
needs escaping, and strips quotes when reading the description back in
index.json generation.
The frontmatter description was built via string concatenation, which
produces invalid YAML when the value contains colon-space sequences
(e.g. "Use key: value"). Instead of hand-rolling quoting logic, use the
`yaml` package (already a dependency) to serialize frontmatter and parse
it back in index.json generation. This handles all YAML edge cases
correctly.
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 24, 2026

Open in StackBlitz

npm i https://pkg.pr.new/incur@96

commit: e37031b

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

❌ Patch coverage is 90.90909% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@0da3639). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/SyncSkills.ts 87.50% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main      #96   +/-   ##
=======================================
  Coverage        ?   92.93%           
=======================================
  Files           ?       24           
  Lines           ?     2932           
  Branches        ?     1185           
=======================================
  Hits            ?     2725           
  Misses          ?      172           
  Partials        ?       35           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tmm tmm merged commit 36daf86 into wevm:main Apr 24, 2026
8 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