Skip to content

Fix validate.ts path splitting on Windows - #932

Merged
kmturley merged 1 commit into
mainfrom
fix/validate-path-separator
Aug 18, 2026
Merged

Fix validate.ts path splitting on Windows#932
kmturley merged 1 commit into
mainfrom
fix/validate-path-separator

Conversation

@kmturley

Copy link
Copy Markdown
Member

Summary

  • src/validate.ts split the incoming file path with path.sep, so on Windows (path.sep === '\\') a path written with forward slashes — including the exact form used in AGENTS.md's own example command — never split.
  • subPath ended up empty, slug/version came back undefined, the report printed ✓ undefined/undefined/undefined, and the run then crashed in path.join (TypeError [ERR_INVALID_ARG_TYPE]).
  • Splitting on /[\\/]/ instead handles both separator styles, then rejoins with the native path.sep before handing off to pathGetSlug/pathGetVersion.

Reported by @gPTPPs in #844.

Test plan

  • npx prettier --check src/validate.ts
  • npx eslint src/validate.ts
  • npx tsc --noEmit
  • npx vitest run (7 passed)
  • Simulated the Windows scenario directly (forward-slash path + path.sep forced to \\): old code produced an empty subPath, new code correctly resolves it
  • npx tsx src/validate.ts src/plugins/crowbait/gnomedistort-2/1.0.0/index.yaml still resolves and validates correctly on this platform (no regression)

🤖 Generated with Claude Code

filePath.split(path.sep) only split on backslashes on Windows, so the
documented forward-slash example command (AGENTS.md) produced an empty
subPath, an undefined/undefined/undefined report line, and a crash in
path.join. Splitting on [\\/] handles both separator styles.
@kmturley
kmturley merged commit 8269977 into main Aug 18, 2026
6 checks passed
@kmturley
kmturley deleted the fix/validate-path-separator branch August 18, 2026 00: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