feat: add `/rg` command (ripgrep for `/add` files)
NOTE: Using this command requires ripgrep installed on your machine.
How it works
It calls rg through a subprocess with the -l flag to return a list of filenames. These filenames are then fed into the /add command. Anything you pass after /rg is forwarded to the ripgrep tool.
This is nice. Would it be possible to make the /rg command pop up an interactive window for selecting a file? Otherwise, it seems like it would be easy to add too many files by accident.
Also, one thing you might want to check out in the interim is fzf shell integration. This way, you can type aider **<tab> and it will pop open an interactive fzf window where you can search for a file using fuzzy matching. I have found this quite effective, and much easier/faster than using the /add command from within aider.
This seems like a very valuable feature which I would want to take advantage of.
I am not the author, but my suggestion would be to follow the current implementation approach to tests.
Aider knows very little about tests:
- if given the command /test
, it will run the command and include it in chat if return code shows an error. - Alternatively, it is told what fixed command to run via --test-cmd (e.g., pytest)
- Tests should be run after changes and block commits (I think)
So it is:
- enabling workflows that help the user+LLM make progress
- avoiding dependence on pre-installed tools that might be relevant to a subset of projects or users
- allowing future improvements to the workflow (e.g., user or project level config so the command line argument isn't necessary).
So how about instead adding a /search command that only activates when --search-cmd is given? that way people get to choose their preferred among grep, ag, etc.
More importantly: the user should be asked to review the grep result (the list of files that are going to be added) before actually adding them. So that it would be simple to cancel and try again with a better pattern.
This is nice. Would it be possible to make the
/rgcommand pop up an interactive window for selecting a file? Otherwise, it seems like it would be easy to add too many files by accident.Also, one thing you might want to check out in the interim is fzf shell integration. This way, you can type
aider **<tab>and it will pop open an interactive fzf window where you can search for a file using fuzzy matching. I have found this quite effective, and much easier/faster than using the/addcommand from within aider.
would you happen to know how to use fzf for aider file selection in Windows?
+1 for fzf ;
However, -3 for hard dependence on external tools, which are often platform-specific.
Maybe this feature could be packaged as "optional plugin" ?