-
Notifications
You must be signed in to change notification settings - Fork 0
feat(filefinder): add reusable utility for file discovery in project structure #255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…structure Introduced `FileFinder`, a reusable, extensible utility to locate files within a directory hierarchy. Implements upward root-marker detection and breadth-first downward search, with exclusions for ignored folders. Integrated the new tool into `RunCommand` to streamline file and project discovery logic. BREAKING CHANGE: Replaces custom directory traversal logic in `RunCommand` with `FileFinder`. Ensure project searches follow the updated hierarchy detection rules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces a centralized FileFinder utility to replace custom directory traversal logic in RunCommand. The new utility implements a two-phase search strategy: first searching upward from the starting directory (stopping at project root markers like .git or .sln), then performing a breadth-first downward search with depth limits and folder exclusions.
- Adds
FileFinderclass with configurable upward/downward file search - Refactors
RunCommandto useFileFinderinstead of manual directory traversal - Simplifies test suite to focus on key FileFinder behaviors
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 12 comments.
| File | Description |
|---|---|
| DecSm.Atom.Tool/FileFinder.cs | New utility class implementing upward and BFS downward file search with root marker detection and folder exclusions |
| DecSm.Atom.Tool/Commands/RunCommand.cs | Refactored to delegate file discovery to FileFinder, removing custom traversal logic |
| DecSm.Atom.Tool.Tests/RunCommandTests.cs | Reduced test suite from comprehensive scenario coverage to 3 focused tests on FileFinder behavior |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Excluded the 'build' folder from the default ignored directories list, as it might be a valid search target in some use cases. Also added a condition to return early if the starting path is already a file. This improves flexibility and optimizes file search logic.
Lowered the default `MaxDownstreamDepth` from 8 to 4 to limit unnecessary deep directory traversals during file searches. Balances performance and depth coverage for typical use cases.
Changed the `execute` call to always pass `true` for the `isInteractive` parameter when a file is found. This aligns execution behavior with expected operational use cases for `RunCommand`.
Introduced
FileFinder, a reusable, extensible utility to locate files within a directory hierarchy. Implements upward root-marker detection and breadth-first downward search, with exclusions for ignored folders. Integrated the new tool intoRunCommandto streamline file and project discovery logic.BREAKING CHANGE: Replaces custom directory traversal logic in
RunCommandwithFileFinder. Ensure project searches follow the updated hierarchy detection rules.