Skip to content

Add exclude glob patterns and subtree pruning to find #121

Description

@abhinavgautam01

Description

WorkspaceFilesystem.find accepts one inclusion glob plus limit and offset. The walker tests the inclusion glob before yielding an entry, but it descends into every directory regardless of whether that subtree is useful. Searches in workspaces containing directories such as node_modules, .git, or generated build output must scan those trees even when callers do not want any results from them.

Add exclusion patterns to FindOptions:

interface FindOptions {
  limit?: number;
  offset?: number;
  exclude?: string[];
}

Patterns should be matched against paths relative to the requested search directory, like the existing inclusion glob. Exclusion should take precedence over inclusion. When an excluded entry is a directory, the walker should skip both the directory result and its entire subtree before issuing more child queries.

Expected outcome

  • Support multiple exclusion glob patterns.
  • Match exclusions relative to the search root.
  • Prevent excluded files and directories from appearing in results.
  • Prune excluded directory subtrees during traversal rather than filtering them afterward.
  • Preserve deterministic traversal and apply limit and offset to the remaining matches.
  • Pass the option through WorkspaceFilesystem, WorkspaceFilesystemStub and the public find tool.
  • Add tests proving both matching behavior and subtree pruning.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions