Skip to content
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

proposal: replace find with fd #5

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

proposal: replace find with fd #5

wants to merge 6 commits into from

Conversation

jonfk
Copy link
Contributor

@jonfk jonfk commented Mar 6, 2025

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.

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.

1 participant