Repository navigation
Conversation
parseFrontmatter accepted a CRLF opening fence but searched for an LF closing fence, so every Windows-authored rule or skill came through with no name or description and the raw frontmatter as its content. The object branch for `author:` was unreachable because the array branch matched the same `key:` line first, so author.name/url/avatar were never read. Normalise CRLF, accept a closing fence on the last line, and decide list vs mapping from the first indented line.
This branch has not been deployed
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.
Problem
Two defects in
parseFrontmatter(apps/cursor/src/lib/github-plugin/parse.ts), the parser behind every rule, skill, command and agent imported from GitHub:---\r\n, but the closing fence is searched as"\n---\n", which never occurs in a CRLF file ("\r\n---\r\n"). The function returns{ data: {}, body: content }, so a Windows-authored component gets its filename asname, the first 200 characters of the raw file (starting with---\r\nname: ...) asdescription, and the frontmatter inside its storedcontent.author:blocks are never read. Thekey:line is matched by the array branch before the object branch (same regex, earlier in the loop), sodata.authoris always[]and the indentedname:/url:/avatar:lines are dropped. Theauthor_name/author_url/author_avatarmetadata the rule importer reads fromdata.authorhas therefore never been populated.Repro on
main(function extracted and run withnode):Fix
\r\nto\nonce; everything after that works on LF.key:opens a block; the first indented line decides whether it is a list (- item) or a mapping (sub: value). Scalars, quoted values and blank lines inside a block behave as before.Same output for LF files with scalar and list keys, so existing imports are unchanged;
contentfor CRLF files is now the LF-normalised body.Verification
Extracted function,
nodewith type stripping, cases: LF, CRLF, BOM + LF, fence on the last line, no frontmatter, empty block followed by a scalar, unterminated fence. CRLF now equals LF;authoris{ name, url };tagsis["a","b"]; unterminated fence still returns the whole text as body.tsc --stricton the extracted function is clean andbiome formatis applied. No open PR changesparseFrontmatter;git merge-treeagainst #466, #467, #472, #476, #477 and #427 (the open PRs on this file) reports no conflicts.