Skip to content

fix(core): exclude hidden files from glob results - #48894

Open
RRiiiccckkk wants to merge 1 commit into
anomalyco:devfrom
RRiiiccckkk:fix-glob-hidden-files
Open

fix(core): exclude hidden files from glob results#48894
RRiiiccckkk wants to merge 1 commit into
anomalyco:devfrom
RRiiiccckkk:fix-glob-hidden-files

Conversation

@RRiiiccckkk

@RRiiiccckkk RRiiiccckkk commented Sep 14, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #47421

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

While checking the glob tool with a temporary project, I found that **/*.ts returned a top-level .hidden.ts even when hidden files were disabled.

Ripgrep allows an explicit glob pattern to match dotfiles unless an exclusion is supplied. The glob adapter now adds --glob=!**/.* when hidden files are disabled. Callers that pass hidden: true keep the existing behavior.

The tool test covers a visible file and a dot-prefixed file and verifies that only the visible file is returned.

How did you verify your code works?

  • Ran bun test test/tool/glob.test.ts from packages/opencode (3 passed).
  • Ran Prettier checks on the changed files.
  • Ran Oxlint on the changed files (0 errors).

Screenshots / recordings

Not applicable; this change affects filesystem filtering and has no UI changes.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Copilot AI lite review requested due to automatic review settings September 14, 2026 01:36
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Sep 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The fix and regression test address the reported issue with no unresolved review comments.

Pull request overview

Fixes glob matching so hidden files are excluded by default while preserving opt-in hidden-file support.

Changes:

  • Adds a ripgrep exclusion for hidden paths.
  • Adds regression coverage for top-level dotfiles.
File summaries
File Summary
packages/opencode/test/tool/glob.test.ts Verifies visible files remain while hidden files are excluded.
packages/core/src/ripgrep.ts Filters hidden paths when hidden matching is disabled.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Sep 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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.

Glob returns hidden files with hidden disabled

2 participants