Repository navigation
feat(explorer): add a searchUpTo option for bounded upward search - #6
Merged
Merged
Conversation
A directory searches the start directory and each parent up to and including it, by calling a none-strategy explorer once per directory. cosmiconfig's global strategy cannot express this: it always ends by checking the OS config directory, whatever stopDir is. 'project' maps to the project strategy. Combining searchUpTo with cosmiconfig.searchStrategy or cosmiconfig.stopDir throws, naming both options.
…To relies on Runs against cosmiconfig 9 and 10: none checks one directory, project stops at a package file, stopDir is inclusive and only valid with global, and global still checks the OS config directory after stopDir.
Mearman
marked this pull request as ready for review
October 1, 2026 07:27
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
🎉 This PR is included in version 1.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Adds a
searchUpTooption tocreateExplorer: a directory searches the start directory and each parent up to and including it, and'project'stops at the first directory with a package file. Passing it together withcosmiconfig.searchStrategyorcosmiconfig.stopDirthrows and names both.The issue left open what
globalwithstopDirdoes about the OS config directory. I checked the installed cosmiconfig 9.0.2 and 10.0.1 source and probed both with HOME pointed at a scratch directory: it always yields the OS config directory last, whateverstopDiris, and also when the start is outsidestopDir. There is no option to turn that off, so a directory bound can't map toglobaland still keep the user's global config out. It is instead a walk over the parents with thenonestrategy, which checks one directory per call;projectnever leaves the project, so it maps straight across. The README documents this, and the interop tests pin the cosmiconfig behaviour in both majors so a change upstream shows up as a failure.The bound is lexical and does not follow symlinks.
Closes #3