Skip to content

Refactor where command - #322

Merged
andrew merged 2 commits into
mainfrom
cleanup/where-command
Aug 14, 2026
Merged

andrew merged 2 commits into
mainfrom
cleanup/where-command

Conversation

@andrew

@andrew andrew commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Breaks the where command into focused helpers for option parsing, traversal, filtering, and output.

Uses filepath.WalkDir to avoid per-file metadata lookups, removes the unnecessary error return from text output, and adds coverage for ignored paths, ecosystem filters, submodules, and missing roots. Adds a command benchmark for repositories with multiple manifests.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Refactors the where command implementation into smaller helpers to separate option parsing, filesystem traversal/filtering, and output formatting, while switching traversal to filepath.WalkDir and expanding coverage around gitignore/submodule/ecosystem filtering behaviors.

Changes:

  • Split runWhere into whereOptionsFromCommand, findWhereMatches, and outputWhereMatches, introducing a whereSearch visitor used with filepath.WalkDir.
  • Simplified text output by making outputWhereText non-error-returning and updating unit tests accordingly.
  • Added integration tests for nested .gitignore + ecosystem filtering, and added a benchmark for repos with many manifests.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
cmd/where.go Refactors option parsing, match search, and output; switches traversal to WalkDir with a visitor struct.
cmd/where_test.go Updates tests to match outputWhereText’s new signature; adds unit coverage for submodules and missing roots.
cmd/where_command_test.go Adds command-level tests for nested gitignore behavior and ecosystem filtering.
cmd/where_benchmark_test.go Adds a benchmark simulating many manifests/ignored paths to measure where performance.

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

Comment thread cmd/where.go Resolved
@andrew
andrew merged commit 890970c into main Aug 14, 2026
7 checks passed
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.

2 participants