From d7a1db7c99ceabb1a259a046d6d3396b0d7287b0 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Mar 2026 05:06:30 +0000 Subject: [PATCH] Add Aider as local Claude Code-equivalent coding assistant - Add aider Docker service (paulgauthier/aider) with GUI on port 8080 pointing at local ollama code model (auto-detected by VRAM tier) - Add aider.sh CLI wrapper: cd into any git repo and run files through aider terminal mode against the same local model - Add port 8080 to UFW firewall rules - Surface Aider UI URL in start.sh output and final install summary https://claude.ai/code/session_012gDnantBmFTWZGCiKyjazx --- local-ai-setup.sh | 63 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 2 deletions(-) diff --git a/local-ai-setup.sh b/local-ai-setup.sh index 1bed487..04d8cf8 100755 --- a/local-ai-setup.sh +++ b/local-ai-setup.sh @@ -513,7 +513,7 @@ cat > "$BASE/docker-compose.yml" << COMPOSE # Pull latest images: docker compose pull && docker compose up -d # Show status: docker compose ps # -# Services: ollama open-webui chromadb rag-server mcp-server +# Services: ollama open-webui chromadb rag-server mcp-server aider # kiwix gitea invokeai portainer # ─────────────────────────────────────────────────────────────────────────────── @@ -619,6 +619,27 @@ services: python mcp_server.py" depends_on: [rag-server, kiwix] + aider: + image: paulgauthier/aider:latest + container_name: aider + restart: unless-stopped + ports: ["0.0.0.0:8080:8501"] + volumes: + - $BASE/workspace:/workspace + - $BASE/repos:/repos + working_dir: /workspace + environment: + - OLLAMA_API_BASE=http://ollama:11434 + - GIT_AUTHOR_NAME=aider + - GIT_AUTHOR_EMAIL=aider@local + - GIT_COMMITTER_NAME=aider + - GIT_COMMITTER_EMAIL=aider@local + command: > + --gui --no-auto-commits --no-check-update + --model ollama/$CODE_MODEL + depends_on: + ollama: {condition: service_healthy} + kiwix: image: ghcr.io/kiwix/kiwix-serve:latest container_name: kiwix @@ -688,7 +709,7 @@ if command -v ufw &>/dev/null && [[ ! -f "$BASE/.ufw-done" ]] || $FORCE; then read -rp " LAN subnet [192.168.1.0/24]: " LAN; LAN="${LAN:-192.168.1.0/24}" [[ "$LAN" =~ /[0-9]+$ ]] || LAN="${LAN}/24" for pc in "3000:Open WebUI" "11434:Ollama" "8001:RAG" "8002:MCP" \ - "8000:ChromaDB" "8181:Kiwix" \ + "8000:ChromaDB" "8080:Aider" "8181:Kiwix" \ "3001:Gitea" "2222:Gitea SSH" "9090:InvokeAI" \ "9000:Portainer" "9443:Portainer S"; do sudo ufw allow from "$LAN" to any port "${pc%%:*}" proto tcp comment "${pc##*:}" >/dev/null @@ -706,6 +727,7 @@ docker compose pull --quiet 2>/dev/null docker compose up -d echo "" echo " Open WebUI → http://$LOCAL_IP:3000" +echo " Aider UI → http://$LOCAL_IP:8080 (Claude Code-like editor)" echo " InvokeAI → http://$LOCAL_IP:9090" echo " Kiwix → http://$LOCAL_IP:8181 (run kiwix_download.sh first)" echo " Gitea → http://$LOCAL_IP:3001" @@ -759,6 +781,39 @@ PULLSH chmod +x "$BASE/pull-models.sh" ok "start.sh stop.sh status.sh pull-models.sh" +cat > "$BASE/aider.sh" << AIDSH +#!/bin/bash +# Aider CLI — Claude Code-like terminal experience against any local git repo. +# Usage: +# ./aider.sh # interactive, files from stdin +# ./aider.sh src/main.py # open specific files +# ./aider.sh --model ollama/qwen2.5-coder:7b src/foo.py # override model +# +# Tip: clone Gitea repos into $BASE/repos/, then: +# cd $BASE/repos/my-project && $BASE/aider.sh + +MODEL="\${AIDER_MODEL:-ollama/$CODE_MODEL}" +REPO_ROOT="\$(git rev-parse --show-toplevel 2>/dev/null || pwd)" + +docker run --rm -it \\ + --network local-ai_default \\ + -v "\$REPO_ROOT:\$REPO_ROOT" \\ + -v "$BASE/repos:/repos" \\ + -w "\$REPO_ROOT" \\ + -e OLLAMA_API_BASE=http://ollama:11434 \\ + -e GIT_AUTHOR_NAME=aider \\ + -e GIT_AUTHOR_EMAIL=aider@local \\ + -e GIT_COMMITTER_NAME=aider \\ + -e GIT_COMMITTER_EMAIL=aider@local \\ + paulgauthier/aider:latest \\ + --no-auto-commits \\ + --no-check-update \\ + --model "\$MODEL" \\ + "\$@" +AIDSH +chmod +x "$BASE/aider.sh" +ok "aider.sh" + # ============================================================================= section "Systemd" # ============================================================================= @@ -805,6 +860,7 @@ echo -e "${GREEN}${BOLD} Done! GPU: ${VRAM_GB}GB → $TIER${NC}" echo -e "${GREEN}${BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" echo "" echo -e " ${CYAN}Open WebUI${NC} → http://$LOCAL_IP:3000" +echo -e " ${CYAN}Aider UI${NC} → http://$LOCAL_IP:8080 (browser coding assistant)" echo -e " ${CYAN}InvokeAI${NC} → http://$LOCAL_IP:9090" echo -e " ${CYAN}Kiwix${NC} → http://$LOCAL_IP:8181" echo -e " ${CYAN}Gitea${NC} → http://$LOCAL_IP:3001" @@ -820,6 +876,9 @@ echo -e " ${YELLOW}PDFs:${NC} $BASE/papers/" echo -e " ${YELLOW}Workspace:${NC} $BASE/workspace/" echo -e " ${YELLOW}ZIMs:${NC} ./kiwix_download.sh" echo "" +echo -e " ${YELLOW}Aider CLI:${NC} cd your-repo && $BASE/aider.sh " +echo " (or open browser UI above — both use your local code model)" +echo "" echo -e " ${YELLOW}Save Claude usage:${NC} use local 14B for boilerplate, docs," echo " simple fixes. Use Claude Sonnet 4.6 for hard bugs," echo " multi-file refactoring, architecture decisions."