#!/bin/bash

# Install Aider CLI on Debian/Ubuntu.
set -euo pipefail

# Allow running directly as root (no sudo needed) or as a regular user.
if [[ "${EUID}" -eq 0 ]]; then sudo() { while [[ "$1" == -* ]]; do shift; done; "$@"; }; export -f sudo; fi

sudo apt-get update
sudo apt-get install -y --no-install-recommends python3 python3-venv python3-pip pipx git curl ca-certificates

pipx ensurepath
pipx install aider-chat || pipx upgrade aider-chat

python3 --version
pipx --version
aider --version || true
