Closes #239 /claim #239 ## Description video :- https://www.loom.com/share/d1d1d54d48bc45c4a48271ca9a387a88?sid=933e250d-78f8-4a7f-9745-0e908c0ee4d9 <!-- Briefly describe what this PR does and why --> ## Type of Change - [x] New module - [ ] Bug fix - [ ] Feature/enhancement - [ ] Documentation - [ ] Other ## Module Information <!-- Delete this section if not applicable --> **Path:** `registry/coder/modules/aider` **New version:** `v1.0.0` **Breaking change:** [ ] Yes [x] No ## Testing & Validation - [ ] Tests pass (`bun test`) - [ ] Code formatted (`bun run fmt`) - [ ] Changes tested locally ## Related Issues <!-- Link related issues or write "None" if not applicable --> --------- Co-authored-by: DevCats <christofer@coder.com>
50 lines
1.3 KiB
Bash
50 lines
1.3 KiB
Bash
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
# Function to check if a command exists
|
|
command_exists() {
|
|
command -v "$1" > /dev/null 2>&1
|
|
}
|
|
|
|
# Inputs
|
|
ARG_WORKDIR=${ARG_WORKDIR:-/home/coder}
|
|
ARG_INSTALL_AIDER=${ARG_INSTALL_AIDER:-true}
|
|
ARG_AIDER_CONFIG=${ARG_AIDER_CONFIG:-}
|
|
|
|
echo "--------------------------------"
|
|
echo "Install flag: $ARG_INSTALL_AIDER"
|
|
echo "Workspace: $ARG_WORKDIR"
|
|
echo "--------------------------------"
|
|
|
|
function install_aider() {
|
|
echo "pipx installing..."
|
|
sudo apt-get install -y pipx
|
|
echo "pipx installed!"
|
|
pipx ensurepath
|
|
mkdir -p "$ARG_WORKDIR/.local/bin"
|
|
export PATH="$HOME/.local/bin:$ARG_WORKDIR/.local/bin:$PATH"
|
|
|
|
if ! command_exists aider; then
|
|
echo "Installing Aider via pipx..."
|
|
pipx install --force aider-install
|
|
aider-install
|
|
fi
|
|
echo "Aider installed: $(aider --version || echo 'Aider installation check failed')"
|
|
}
|
|
|
|
function configure_aider_settings() {
|
|
if [ -n "${ARG_AIDER_CONFIG}" ]; then
|
|
echo "Configuring Aider environment variables and model"
|
|
|
|
mkdir -p "$HOME/.config/aider"
|
|
|
|
echo "$ARG_AIDER_CONFIG" > "$HOME/.config/aider/.aider.conf.yml"
|
|
echo "Aider config created at $HOME/.config/aider/.aider.conf.yml"
|
|
else
|
|
printf "No Aider environment variables or model configured\n"
|
|
fi
|
|
}
|
|
|
|
install_aider
|
|
configure_aider_settings
|