Zsh script development using /run
Issue
The aider is excellent at task which involves software like pytest to have human in the loop. But when I use it to develop some zsh functions which I have lot of them to do some nifty operations like a lot in backend development. I do the /run but it expects my already loaded ~/.zshrc to be loaded again. Do I understand this correctly ?
One thing is for testing this additional function which I am going to add to my zsh, Assume I have make target which simply reloads the ~/.zshrc from its component scripts. I need to load the entire ~/.zshrc in the test. Instead can you provde access to my current shell which is zsh with ohmyz theme. And allow me to add a new zsh function in a scratch file which I can source assuming the dependecies of this function is already loaded.
I believe the aider shell is not having access to my loaded functions in ~/.zshrc.
Is there any setting to enable this?
change_directory function is available in the current shell. It was a dependency to another test I was doing. Just to show that I am getting a function not found on an existing function which existed in zsh basically the loaded ~/.zshrc.
Is there any plans to use the same shell that can resolve these functions in local aider shell.
Version and model info
Aider: 0.31.1 OS: Mac Model: Ollama
If I understand what you are saying, change_to_directory is a function defined in your .zshrc which does not appear to load from the shell that aider uses for /run.
Perhaps you can just source your .zshrc file manually?
> /run source ~/.zshrc && change_to_directory ai-tools
It may also be nice to have a feature where the inner shell uses the exact same environment as the outer shell -- but that might be like trying to fit the ocean in a teacup.
You can also do a sort of inversion of control by piping command output to aider as a message argument:
aider --yes main.py --message "$(python main.py examples/narrative.docx 2>&1)"
The 2>&1 at the end will capture both standard and error outputs. The only thing missing here is the context of what command was run, which you could also append by both echoing and executing the command:
command="python main.py examples/narrative.docx"; aider --yes main.py --message "$(echo -e "$command\n$($command 2>&1)")"
Running commands this way lets you leverage your outer shell for the command and only give aider the output.
The main issue here is that this gives no context to the aider session, so if there is no immediate or obvious error, then aider will complain that you have not given it clear task instructions. So you probably want to also add some text saying how to react to the output, at the start of the message.
It seems you've run the script and provided the output. However, I'm not sure what changes you would like to make to the main.py file. Could you please specify the changes you want to implement in the
code?
You might want to try:
/run zsh -i -c 'change-to-directory ai-tools'