Conversation
…ings With no `.gitattributes`, Git's `core.autocrlf=true` Windows default checks every text file out with CRLF. On that tree `SKILL.md` starts `---\r\n`, the frontmatter pattern matched `---\n` only, and every skill failed to parse -- `Skill has no frontmatter`, on files that are perfectly well formed. `prettier --check` reports the same tree for the same reason, its `endOfLine` default being `lf`. Linux CI never sees either. `.gitattributes` declares `* text=auto eol=lf`, so a fresh clone produces a working tree the suite and the formatter pass on with no per-machine Git configuration. Binary extensions are declared rather than detected: a heuristic that guesses wrong there corrupts the file instead of merely reformatting it. The parser accepts `\r?\n` at both delimiters as well. `.gitattributes` only fixes trees that are cloned or renormalised after it lands, and an existing Windows checkout keeps the endings it already has -- and refusing a well-formed skill over its line endings is a defect on its own terms. The delimiters stay anchored: the frontmatter block must still start the file and sit on its own lines, so a horizontal rule in the body is not mistaken for it. Refs every-app#331
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.
Refs #331.
Two things, because the issue has two halves
The tree. There is no
.gitattributes, so Git'score.autocrlf=trueWindows default checks every text file out with CRLF. On that treeSKILL.mdstarts---\r\nand every skill fails to parse;prettier --checkreports the same tree, itsendOfLinedefault beinglf. Linux CI never sees either, and each Windows contributor hits it independently.* text=auto eol=lffixes the checkout, which is the direction the issue suggests.The parser.
.gitattributesonly helps trees cloned or renormalised after it lands — an existing Windows checkout keeps the endings it already has. And separately from Windows: refusing a well-formed skill because of its line endings is a defect on its own terms, soparseSkillnow accepts\r?\nat both delimiters.Either half alone leaves a real case broken, which is why both are here.
On the binary declarations
text=autokeeps Git's own binary detection, andeol=lfthen applies to what it decides is text. I declared the binary extensions explicitly anyway (48 such files in the tree) because a detection heuristic that guesses wrong there corrupts the file, where the same mistake on a text file merely reformats it. Verified withgit check-attr:No
.bat/.cmd/.ps1in the tree, so nothing needs to keep CRLF.The anchors stay
The widened pattern is
/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/— still anchored at the start of the file, still requiring the delimiters on their own lines.\r?\nwidens which line endings are accepted, not which files are. There is a cell for that: a markdown horizontal rule in the body must not be mistaken for frontmatter.parseSkillis now exported so the tests can reach it;buildSamSkillSourcebundles the repo's own skills throughimport.meta.globat build time, so there is no way to hand it a CRLF file from outside.Tests
Four new cells in
samSkills.test.ts, checked against mutants:parses a skill checked out with CRLF endingsdoes not mistake a horizontal rule in the body for frontmatterparses a skill checked out with CRLF endingsstill parses LF endingsandstill refuses a file with no frontmatter, CRLF or notare the accept controls.I could not run this on Windows — no Windows machine here — so the CRLF cases are driven by building the string with
\r\nrather than by a real checkout. The.gitattributeshalf is verified withgit check-attrrather than by re-cloning.