fix(config): load directory tool sources on Windows (#150)#152
Open
ajshedivy wants to merge 1 commit into
Open
fix(config): load directory tool sources on Windows (#150)#152ajshedivy wants to merge 1 commit into
ajshedivy wants to merge 1 commit into
Conversation
…ndows
resolveDirectoryPaths built its glob pattern with path.join(), producing
backslash separators on Windows (e.g. c:\users\...\tools\**\*.{yaml,yml}).
glob v10 treats backslashes as escape characters rather than path
separators, so the pattern matched nothing and no tools loaded when
--tools pointed at a directory.
Pass the resolved directory via glob's cwd option (a filesystem path,
where separators are fine) and keep the pattern forward-slash only.
Apply the same fix to resolveGlobPaths, which had the identical
join()-into-pattern bug when baseDir was set.
Adds path-resolution tests covering directory and glob sources,
including nested files and non-YAML exclusion.
Fixes #150
Signed-off-by: Adam Shedivy <ajshedivyaj@gmail.com>
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
Fixes #150 — on Windows,
--tools <directory>discovered no tool YAML files, so no tools loaded.Root cause
ToolConfigBuilder.resolveDirectoryPathsbuilt its glob pattern withpath.join():glob(v10) requires forward-slash-only patterns. On Windows it treats backslashes as escape characters, not path separators, so the pattern matched nothing and no tools were registered.Fix
Pass the resolved directory through glob's
cwdoption (a filesystem path, where native separators are fine) and keep the pattern forward-slash only:The same
join()-into-pattern bug existed inresolveGlobPathswhenbaseDirwas set, so it gets the samecwd-based treatment. Behavior is unchanged on macOS/Linux and whenbaseDiris omitted (glob defaultscwdtoprocess.cwd()).Testing
toolConfigBuilder.pathResolution.test.tscovering directory + glob source resolution (nested files, non-YAML exclusion, missing-directory and no-match error paths).resolveDirectoryPaths/resolveGlobPathsboth discover all 9 YAML files across the repo's nestedtools/subdirectories.npm run typecheck,npm run lint, and the fullnpm testsuite (543 tests) pass.