Simplify getAllFilesInPath with single glob call#1107
Simplify getAllFilesInPath with single glob call#1107mishushakov wants to merge 7 commits intomainfrom
Conversation
…tterns Instead of looping through matched directories and making nested glob calls for each one, use glob's ability to accept an array of patterns. Pass both the original pattern and its recursive variant (pattern/**/*) in one call, eliminating the need for sequential async/sync operations. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 861a67412b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
The nodir option in glob can interfere with symlink type detection for broken symlinks. Instead, filter directories manually in the loop like the Python implementation does. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
The glob library has a bug where array patterns cause broken symlinks to have isSymbolicLink() return false, while single patterns work correctly. Reverting to the original nested-call approach to maintain correct symlink detection. The Python SDK simplification is retained since wcmatch may handle this differently. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The simplified version changed behavior when includeDirectories=False: - Old: Only top-level matched directories excluded, nested subdirs included - New: All directories excluded Reverting to preserve the original behavior and avoid breaking callers. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This comment was marked as outdated.
This comment was marked as outdated.
…tterns Instead of looping through matched directories and making nested glob calls for each one, use glob's ability to accept an array of patterns. Pass both the original pattern and its recursive variant (pattern/**/*) in one call. Note: This changes the behavior of includeDirectories - it now excludes ALL directories when false, not just top-level matched directories. This is the desired behavior for file copying operations. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
Simplified
getAllFilesInPathin both JS and Python SDKs by using a single glob call with multiple patterns instead of nested sequential calls. This eliminates the need to loop through matched directories and make additional glob calls for each one.Changes
glob(src)+ loop +glob(dir/**/*)toglob([src, src/**/*])🤖 Generated with Claude Code
Note
Low Risk
Small refactor to file globbing logic; risk is limited to edge-case differences in which paths are returned for certain patterns/directories.
Overview
Simplifies Python SDK template file discovery by replacing per-directory recursive globbing with a single
glob.glob([src, src/**/*])call, normalizing paths for cross-platform matching, and deduplicating results.Adds a changeset to publish patch releases for
@e2b/python-sdkande2breflecting this internal behavior/performance change; directory inclusion is now handled via a simple filter wheninclude_directoriesis false.Written by Cursor Bugbot for commit 2bdbb41. This will update automatically on new commits. Configure here.