#!/bin/bash

# Install Aider CLI on Debian/Ubuntu.
set -e

# 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 update && sudo apt upgrade -y
sudo apt install -y 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
