Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I initially just wanted to improve the .gitignore handling which currently doesn't work really well because it's implemented by parsing the gitignore and creating grep patterns from it. This misses a few gitignore patterns and also ignores global git ignores. I found that implementing this manually actually added a lot of complexity.
This is where I ended up replacing find with fd which is .gitignore aware and has it's own .fdignore file. It also excludes hidden directories by default. And in my testing is much faster. In my personal use, I ended up finding it much faster than the previous implementation. I don't think that's really important since at the size where it would matter, the size of the files would blow the context limit of any models out there, but it's still neat.
In the end this pushes most of the complexity of file searching, exclusion, etc to fd.
I also replaced the file count with a counter instead of running grep on the final output.
This does make this script much less portable with a more esoteric dependency, but one I think most people have(?). I am not entirely sure whether you would want to merge this many changes that might have some behaviour changes that might affect you.
I leave it up to you. If you don't merge it, I could live with my changes and rename my repo if you would prefer. Thanks for the initial implementation, appreciated it for quick and dirty contexts to llms.