[BUG] Glob tool fails to match files when pattern contains explicit dot-directory prefix
What's Wrong?
The Glob tool silently returns no results when the pattern starts with an explicit dot-directory like .claude/**/*, even though the directory exists and contains files.
This appears to be caused by Bun.Glob not receiving dot: true in its scan options, so the filesystem scanner skips dot-prefixed directories at the traversal layer — before pattern matching even occurs — regardless of whether the pattern explicitly names the directory.
| Pattern | path param | Result | Expected |
|---|---|---|---|
| .claude/**/* | repo root | No files found | Should find all files |
| .claude/* | repo root | No files found | Should find settings.json |
| .claude/settings.json | repo root | No files found | Should find the exact file |
| **/* | .claude/ directory | Works | ✓ |
| **/settings.json | repo root | Works (finds it inside .claude) | ✓ |
What Should Happen?
Patterns that explicitly name a dot-directory (e.g. .claude/**/*) should match files inside that directory. Other glob libraries (fast-glob, picomatch) handle this correctly — "an explicit dot in a portion of the pattern always matches dot files."
Steps to Reproduce
- Have any repo with a
.claude/directory containing files (e.g.settings.json,hooks/ruff-format.sh) - Use the Glob tool with pattern
.claude/**/*and path set to the repo root - Observe: "No files found"
- Use the Glob tool with pattern
**/*and path set to the.claude/directory itself - Observe: files are found correctly
Root Cause
Bun.Glob.scan() / scanSync() defaults dot to false, which causes the scanner to skip entries starting with . during filesystem traversal — regardless of whether the pattern explicitly names them.
The distinction is between the match layer (does * match dotfiles?) and the traversal layer (does the scanner enter dot-directories?). Bun.Glob applies dot: false at the traversal layer without checking if the pattern explicitly names the directory.
Suggested fix: Pass { dot: true } to Bun.Glob.scan() / scanSync().
Is this a regression?
I don't know
Claude Code Version
2.1.74 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
Workaround: Set the path parameter to the dot-directory itself and glob from within:
Glob(pattern="**/*", path="/path/to/.claude") // works
Related issues:
- #17302 — closed as "not planned" (inactivity)
- #25143 — closed as duplicate of #17302
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗