Skip to content

fix: handle CRLF line endings and Windows path separators in skill/plugin loading#1232

Merged
lewis617 merged 1 commit into
mainfrom
worktree-cool-slow-bear
Jun 16, 2026
Merged

fix: handle CRLF line endings and Windows path separators in skill/plugin loading#1232
lewis617 merged 1 commit into
mainfrom
worktree-cool-slow-bear

Conversation

@lewis617

Copy link
Copy Markdown
Collaborator

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 checkout with core.autocrlf=true (the default) converts LF → CRLF in working tree files. When a plugin's SKILL.md has 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 .gitattributes forcing 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 fix
  • subagentParser.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\skills for Windows paths
  • fileWatcher.ts:286 — Normalize both paths to / before comparison (chokidar uses / but path.join() produces \ on Windows)
  • commandPathResolver.ts:29 — Split on /[\\/]/ instead of "/" for cross-platform path handling

Testing

  • All 3080 existing tests pass
  • Verified CRLF regex fix with manual test: LF regex + CRLF content → NO MATCH; CRLF-tolerant regex → MATCH

…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.
@lewis617 lewis617 merged commit 22535a1 into main Jun 16, 2026
1 check passed
@lewis617 lewis617 deleted the worktree-cool-slow-bear branch June 16, 2026 03:35
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.

1 participant