Fix validate.ts path splitting on Windows - #932
Merged
Conversation
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.
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.
Summary
src/validate.tssplit the incoming file path withpath.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.subPathended up empty,slug/versioncame backundefined, the report printed✓ undefined/undefined/undefined, and the run then crashed inpath.join(TypeError [ERR_INVALID_ARG_TYPE])./[\\/]/instead handles both separator styles, then rejoins with the nativepath.sepbefore handing off topathGetSlug/pathGetVersion.Reported by @gPTPPs in #844.
Test plan
npx prettier --check src/validate.tsnpx eslint src/validate.tsnpx tsc --noEmitnpx vitest run(7 passed)path.sepforced to\\): old code produced an emptysubPath, new code correctly resolves itnpx tsx src/validate.ts src/plugins/crowbait/gnomedistort-2/1.0.0/index.yamlstill resolves and validates correctly on this platform (no regression)🤖 Generated with Claude Code