fix: YAML-quote frontmatter description values#96
Open
fix: YAML-quote frontmatter description values#96
Conversation
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.
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.
Summary
descriptionwas built via string concatenation, which produces invalid YAML when the value contains colon-space sequences (e.g."Use key: value for precision")Skill.tswithyamlStringify()from theyamlpackage (already a dependency) — handles all YAML quoting edge cases correctlyCli.tsindex.json generation withyamlParse()for correct roundtrippingBefore (broken)
YAML parsers interpret
key: valueas a nested mapping → parse error.After (correct)
The
yamllibrary quotes only when necessary and handles all edge cases (escaped quotes, special characters, etc.).Test plan
yamllibrary output matches original for safe values)YAML-quotes description containing colon-space