Aider-AI / aider

aider is AI pair programming in your terminal
https://aider.chat/
Apache License 2.0
22.74k stars 2.12k forks source link

--message parameter not working as expected #2018

Closed tomasmcm closed 2 weeks ago

tomasmcm commented 1 month ago

Issue

If I pass a prompt via --message using --sonnet --yes-always --architect it makes a plan, says it needs me to share the files but never triggers the method to ask for permission to get the file. However, if I don't pass the prompt via --message (keep all other parameter) and then paste the same prompt in the chat, it makes the plan, get's the files and makes the changes.

Shouldn't it be the same when we pass a prompt via --message or to the chat? I need to pass via --message because I'm trying to automate an AI agent.

Version and model info

Aider v0.59.1 Main model: claude-3-5-sonnet-20240620 with architect edit format, infinite output Editor model: claude-3-5-sonnet-20240620 with editor-diff edit format Weak model: claude-3-haiku-20240307 Git repo: .git with 147 files Repo-map: using 4096 tokens, auto refresh

fry69 commented 1 month ago

Thank you for filing this issue.

Can you please post the full command line you use to invoke aider with --message?

My hunch is that this might be a quoting problem.

tomasmcm commented 1 month ago

This is the prompt I'm using: aider --sonnet --no-auto-commits --yes-always --architect --no-auto-lint --map-tokens 4096 --message "You missed a couple of files. Make sure you rename all user visible instances of 'threads' to 'smiths':\n\n- /src/app/loading.tsx\n- /src/app/(pages)/[profile]/(username)/page.tsx\n- /src/app/seed/page.tsx\n- /src/components/auth/account-setup-form.tsx\n- /src/components/cards/user-profile-card.tsx\n- /src/components/layouts/site-footer.tsx\n- /src/components/user/user-details.tsx\n- /src/server/api/routers/auth.ts" and it fails to make edits

If instead I start aider with: aider --sonnet --no-auto-commits --yes-always --architect --no-auto-lint --map-tokens 4096 and then paste

You missed a couple of files. Make sure you rename all user visible instances of 'threads' to 'smiths':
- /src/app/loading.tsx
- /src/app/(pages)/[profile]/(username)/page.tsx
- /src/app/seed/page.tsx
- /src/components/auth/account-setup-form.tsx
- /src/components/cards/user-profile-card.tsx
- /src/components/layouts/site-footer.tsx
- /src/components/user/user-details.tsx
- /src/server/api/routers/auth.ts

it works

fry69 commented 1 month ago

You included all the file names inside the quoting for the message, they need to be outside this quote block so aider knows it should add them to the context and work on them.

tomasmcm commented 1 month ago

that's not the issue I'm talking about, if I use the exact same message in chat mode it is able to ask for those files and because I have --yes-always it get's access and makes the changes. The problem is that for some reason when using --message it never asks for access to the files. Shouldn't it be the same to use that parameter or paste in chat?

tomasmcm commented 1 month ago

I think it's the list, if I change the --message to You missed a couple of files. Make sure you rename all user visible instances of 'threads' to 'smiths': src/app/loading.tsx, src/app/(pages)/[profile]/(username)/page.tsx, src/app/seed/page.tsx, src/components/auth/account-setup-form.tsx, src/components/cards/user-profile-card.tsx, src/components/layouts/site-footer.tsx, src/components/user/user-details.tsx, src/server/api/routers/auth.ts it works 🤷

fry69 commented 1 month ago

This is not how it should work, but if it works, good for you.

The more canonical way to script aider goes like this -> https://aider.chat/docs/scripting.html#command-line

tomasmcm commented 1 month ago

I know this does not add the files like with /add that's not the point. I'm building an automation and I want it to follow instructions. Some of those instructions might have some files that it needs to look at. The point of this issue is that the behaviour of including a prompt via --message is not the same as pasting it into the chat. I don't know if it's the - or the \n but I expected the behaviour to be the same. Note that in the chat I'm also not using /add I'm just putting that whole text as a chat message

paul-gauthier commented 3 weeks ago

I'm labeling this issue as stale because it has been open for 2 weeks with no activity. If there are no additional comments, it will be closed in 7 days.

paul-gauthier commented 2 weeks ago

I'm closing this issue because it has been stalled for 3 weeks with no activity. Feel free to add a comment here and we can re-open it. Or feel free to file a new issue at any time.