Created
July 12, 2024 07:49
-
-
Save maledorak/cf1f90d37f585a6f36a9aab5093e6c60 to your computer and use it in GitHub Desktop.
aider.chat workflow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" | |
CMD=$1 | |
TASK=$2 | |
shift 2 | |
if [ -z "$CMD" ] || [ -z "$TASK" ]; then | |
echo "Usage: aider <cmd> <task>" | |
exit 1 | |
fi | |
if [ ! -d "$SCRIPT_DIR/tasks/$TASK" ]; then | |
echo "Task '$TASK' does not exist. Do you want to create it? [y/n]" | |
read answer | |
if [ "$answer" != "y" ]; then | |
exit 1 | |
fi | |
mkdir $SCRIPT_DIR/tasks/$TASK | |
fi | |
TASK_DIR=$SCRIPT_DIR/tasks/$TASK | |
TASK_AIDER_DIR=$SCRIPT_DIR/tasks/$TASK/.aider | |
cat $SCRIPT_DIR/templates/$CMD.md | sed "s/{{task}}/$TASK/g" | sed "s/{{date}}/$(date -I)/g" > $TASK_DIR/conventions.md | |
case $CMD in | |
plan) | |
echo "Planning '$TASK'" | |
aider \ | |
--vim \ | |
--no-auto-commit \ | |
--input-history-file $TASK_AIDER_DIR/.plan.input.history \ | |
--chat-history-file $TASK_AIDER_DIR/.plan.chat.history \ | |
--llm-history-file $TASK_AIDER_DIR/.plan.llm.history \ | |
$@ \ | |
$SCRIPT_DIR/tasks/$TASK/conventions.md \ | |
$SCRIPT_DIR/tasks/$TASK/plan.md \ | |
'pyproject.toml' | |
;; | |
implement) | |
echo "Implementing '$TASK'" | |
aider \ | |
--vim \ | |
--no-auto-commit \ | |
--input-history-file $TASK_AIDER_DIR/.implement.input.history \ | |
--chat-history-file $TASK_AIDER_DIR/.implement.chat.history \ | |
--llm-history-file $TASK_AIDER_DIR/.implement.llm.history \ | |
$@ \ | |
$SCRIPT_DIR/tasks/$TASK/conventions.md \ | |
$SCRIPT_DIR/tasks/$TASK/plan.md \ | |
'pyproject.toml' | |
;; | |
code) | |
echo "Coding '$TASK'" | |
aider \ | |
--vim \ | |
--no-auto-commit \ | |
--input-history-file $TASK_AIDER_DIR/.code.input.history \ | |
--chat-history-file $TASK_AIDER_DIR/.code.chat.history \ | |
--llm-history-file $TASK_AIDER_DIR/.code.llm.history \ | |
$@ \ | |
$SCRIPT_DIR/tasks/$TASK/conventions.md \ | |
'pyproject.toml' | |
;; | |
review) | |
echo "Reviewing '$TASK'" | |
aider \ | |
--vim \ | |
--no-auto-commit \ | |
--input-history-file $TASK_AIDER_DIR/.review.input.history \ | |
--chat-history-file $TASK_AIDER_DIR/.review.chat.history \ | |
--llm-history-file $TASK_AIDER_DIR/.review.llm.history \ | |
$@ \ | |
$SCRIPT_DIR/tasks/$TASK/conventions.md \ | |
'pyproject.toml' | |
;; | |
*) | |
echo "Unknown phase" | |
exit 1 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment