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

Add files based on content #509

Open
jawadst opened this issue Mar 18, 2024 · 2 comments
Open

Add files based on content #509

jawadst opened this issue Mar 18, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@jawadst
Copy link

jawadst commented Mar 18, 2024

When refactoring a large codebase, it is hard to know exactly which files are needed and will be impacted by the refactoring. As a result, one generally has to spend time looking at the code and searching which files should be added to aider in a text editor before starting the refactoring.

For instance: if I want to ask aider to refactor the function exampleFunction (rename, change call parameters, etc.), I need to list all the files where that function appears and manually add them to aider.

One solution to make this workflow easier would be to allow the /add command (or a new command) to search for a specific string or pattern inside all the files in the current folder and all its sub-folders, and then automatically add the files where the string or patterns appear at least once.

Example: /add-pattern exampleFunction

@paul-gauthier paul-gauthier added the enhancement New feature or request label Mar 19, 2024
@innateessence
Copy link

innateessence commented Mar 19, 2024

I think even better would be a combo between /run and /add

Imagine you sloppily write a feature, and commit it to a branch.

Then, you want to clean it up the next work day, but it's now Monday, and you don't remember what files you changed.

You could do something like:
/run_and_add git diff-tree --no-commit-id --name-only -r HEAD (this just lists all files changed in the last commit)

To execute that bash, and interpret each line as a file argument to the /add command

Bash is VERY flexible, and fits your use-case as well. Your use-case can be solved with grep or ag or ls or many other tools easily if mixing bash code with the /add command is possible one way or another

@rawwerks
Copy link

related to this: one of my current workflows is to use cursor to write aider scripts: https://forum.cursor.sh/t/has-cursor-gotten-dumb/2884/14?u=raw.works

so cursor helps you with the part you are struggling with: "finding the right files to add to aider". then aider does what aider does for that script.

see also: https://aider.chat/docs/faq.html#can-i-script-aider

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants