fix: handle CRLF line endings and Windows path separators in skill/plugin loading#1232
Merged
Conversation
…ugin loading - Fix YAML frontmatter regex in skillParser, skillManager, subagentParser to accept \r\n (CRLF) line endings. On Windows, git checkout with core.autocrlf=true converts LF→CRLF, causing all SKILL.md frontmatter parsing to fail silently — plugin skills were skipped and never registered as slash commands. - Fix skillParser skill type detection to recognize Windows backslash paths (\.wave\skills) in addition to forward slash paths. - Fix fileWatcher path comparison to normalize backslashes before matching, so file watch events are correctly dispatched on Windows. - Fix commandPathResolver to split on both / and \ when generating command IDs from file paths.
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
On Windows, plugin skills (from the marketplace) silently fail to appear in the slash command list after installation. The user has to restart, and even then some plugins never show up.
Root Cause
The YAML frontmatter regex in
skillParser.ts(/^---\n/)) only matches LF line endings. On Windows,git checkoutwithcore.autocrlf=true(the default) converts LF → CRLF in working tree files. When a plugin'sSKILL.mdhas CRLF endings, frontmatter parsing fails → skill is marked invalid → silently skipped → never registered as a slash command.Whether a plugin is affected depends on whether its repo has
.gitattributesforcing LF — explaining why only some plugins are impacted.Fixes
CRLF frontmatter parsing (primary fix)
skillParser.ts:38— Frontmatter regex:/^---\n/→/^---\r?\n/skillManager.ts:445— Content extraction regex: same CRLF fixsubagentParser.ts:33— Frontmatter regex:\s*→[ \t]*+\r?\n(also fixes \s matching \r greedily)Windows path separator fixes (secondary)
skillParser.ts:56— Skill type detection now also checks\.wave\skillsfor Windows pathsfileWatcher.ts:286— Normalize both paths to/before comparison (chokidar uses/butpath.join()produces\on Windows)commandPathResolver.ts:29— Split on/[\\/]/instead of"/"for cross-platform path handlingTesting