Skip to content

Simplify getAllFilesInPath with single glob call#1107

Draft
mishushakov wants to merge 7 commits intomainfrom
mishushakov/simplify-getallfiles
Draft

Simplify getAllFilesInPath with single glob call#1107
mishushakov wants to merge 7 commits intomainfrom
mishushakov/simplify-getallfiles

Conversation

@mishushakov
Copy link
Member

@mishushakov mishushakov commented Jan 30, 2026

Summary

Simplified getAllFilesInPath in 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

  • Changed from glob(src) + loop + glob(dir/**/*) to glob([src, src/**/*])
  • Reduces complexity and improves performance by avoiding multiple filesystem traversals
  • All 25 tests pass (12 JS + 13 Python)

🤖 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-sdk and e2b reflecting this internal behavior/performance change; directory inclusion is now handled via a simple filter when include_directories is false.

Written by Cursor Bugbot for commit 2bdbb41. This will update automatically on new commits. Configure here.

…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>
@changeset-bot
Copy link

changeset-bot bot commented Jan 30, 2026

⚠️ No Changeset found

Latest commit: d29fb7f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@mishushakov mishushakov marked this pull request as draft January 30, 2026 13:06
mishushakov and others added 2 commits January 30, 2026 14:08
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>
@mishushakov

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>
@mishushakov mishushakov reopened this Jan 30, 2026
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