Files
Aetheel/install.sh
2026-02-14 00:02:22 -05:00

245 lines
8.4 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env sh
# =============================================================================
# Aetheel — One-Click Installer
# =============================================================================
# Usage:
# curl -fsSL http://10.0.0.59:3051/tanmay/Aetheel/raw/branch/main/install.sh | sh
#
# What this script does:
# 1. Checks prerequisites (git, python/uv)
# 2. Clones the repo
# 3. Sets up Python environment & installs dependencies
# 4. Creates .env from template
# 5. Walks you through token configuration
# 6. Optionally starts the bot
# =============================================================================
set -e
# ---------------------------------------------------------------------------
# Colors & Helpers
# ---------------------------------------------------------------------------
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
BOLD='\033[1m'
NC='\033[0m' # No Color
info() { printf "${BLUE}${NC} %s\n" "$1"; }
success() { printf "${GREEN}${NC} %s\n" "$1"; }
warn() { printf "${YELLOW}${NC} %s\n" "$1"; }
error() { printf "${RED}${NC} %s\n" "$1"; }
step() { printf "\n${BOLD}${CYAN}▸ %s${NC}\n" "$1"; }
# ---------------------------------------------------------------------------
# Banner
# ---------------------------------------------------------------------------
printf "\n"
printf "${BOLD}${CYAN}"
printf " ╔══════════════════════════════════════════╗\n"
printf " ║ ║\n"
printf " ║ ⚔️ Aetheel Installer ║\n"
printf " ║ Personal AI for Slack ║\n"
printf " ║ ║\n"
printf " ╚══════════════════════════════════════════╝\n"
printf "${NC}\n"
# ---------------------------------------------------------------------------
# 1. Check Prerequisites
# ---------------------------------------------------------------------------
step "Checking prerequisites"
# Git
if command -v git >/dev/null 2>&1; then
success "git $(git --version | awk '{print $3}')"
else
error "git is not installed"
printf " Install: https://git-scm.com/downloads\n"
exit 1
fi
# Python / uv
HAS_UV=false
HAS_PYTHON=false
if command -v uv >/dev/null 2>&1; then
success "uv $(uv --version 2>/dev/null | head -1)"
HAS_UV=true
elif command -v python3 >/dev/null 2>&1; then
PY_VER=$(python3 --version 2>&1 | awk '{print $2}')
success "python3 ${PY_VER}"
HAS_PYTHON=true
elif command -v python >/dev/null 2>&1; then
PY_VER=$(python --version 2>&1 | awk '{print $2}')
success "python ${PY_VER}"
HAS_PYTHON=true
else
error "Neither uv nor python3 found"
printf " Install uv (recommended): ${BOLD}curl -LsSf https://astral.sh/uv/install.sh | sh${NC}\n"
printf " Or install Python 3.14+: https://python.org/downloads\n"
exit 1
fi
# AI Runtime (optional check)
if command -v opencode >/dev/null 2>&1; then
success "opencode CLI found"
elif command -v claude >/dev/null 2>&1; then
success "claude CLI found"
else
warn "No AI runtime found (opencode or claude)"
printf " You'll need one of:\n"
printf " • OpenCode: curl -fsSL https://opencode.ai/install | bash\n"
printf " • Claude Code: npm install -g @anthropic-ai/claude-code\n"
fi
# ---------------------------------------------------------------------------
# 2. Choose Install Directory
# ---------------------------------------------------------------------------
step "Setting up Aetheel"
INSTALL_DIR="${AETHEEL_DIR:-$HOME/aetheel}"
if [ -d "$INSTALL_DIR" ]; then
warn "Directory already exists: $INSTALL_DIR"
printf " Pulling latest changes...\n"
cd "$INSTALL_DIR"
git pull --ff-only 2>/dev/null || warn "Could not pull (you may have local changes)"
else
info "Cloning into $INSTALL_DIR"
git clone http://10.0.0.59:3051/tanmay/Aetheel.git "$INSTALL_DIR"
cd "$INSTALL_DIR"
success "Repository cloned"
fi
# ---------------------------------------------------------------------------
# 3. Install Dependencies
# ---------------------------------------------------------------------------
step "Installing dependencies"
if [ "$HAS_UV" = true ]; then
info "Using uv for dependency management"
uv sync 2>&1 | tail -5
success "Dependencies installed via uv"
else
info "Using pip for dependency management"
python3 -m venv .venv 2>/dev/null || python -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt 2>&1 | tail -3
success "Dependencies installed via pip"
fi
# ---------------------------------------------------------------------------
# 4. Configure .env
# ---------------------------------------------------------------------------
step "Configuration"
if [ -f .env ]; then
warn ".env already exists — skipping token setup"
info "Edit $INSTALL_DIR/.env to update your tokens"
else
cp .env.example .env
success "Created .env from template"
printf "\n"
printf " ${BOLD}You need two Slack tokens to proceed:${NC}\n"
printf " 1. Bot Token (xoxb-...) — OAuth & Permissions page\n"
printf " 2. App Token (xapp-...) — Basic Information → App-Level Tokens\n"
printf "\n"
printf " See: ${CYAN}docs/slack-setup.md${NC} for full instructions\n"
printf "\n"
# Interactive token entry
printf " ${BOLD}Enter your Slack Bot Token${NC} (xoxb-...) or press Enter to skip: "
read -r BOT_TOKEN
if [ -n "$BOT_TOKEN" ]; then
if command -v sed >/dev/null 2>&1; then
sed -i.bak "s|SLACK_BOT_TOKEN=.*|SLACK_BOT_TOKEN=${BOT_TOKEN}|" .env
rm -f .env.bak
success "Bot token saved"
fi
else
warn "Skipped — edit .env manually before starting"
fi
printf " ${BOLD}Enter your Slack App Token${NC} (xapp-...) or press Enter to skip: "
read -r APP_TOKEN
if [ -n "$APP_TOKEN" ]; then
if command -v sed >/dev/null 2>&1; then
sed -i.bak "s|SLACK_APP_TOKEN=.*|SLACK_APP_TOKEN=${APP_TOKEN}|" .env
rm -f .env.bak
success "App token saved"
fi
else
warn "Skipped — edit .env manually before starting"
fi
fi
# ---------------------------------------------------------------------------
# 5. Create Data Directories
# ---------------------------------------------------------------------------
step "Setting up data directories"
mkdir -p "$HOME/.aetheel/workspace/daily"
success "Created ~/.aetheel/workspace/"
info "Identity files (SOUL.md, USER.md, MEMORY.md) will be auto-generated on first run"
# ---------------------------------------------------------------------------
# 6. Done!
# ---------------------------------------------------------------------------
printf "\n"
printf "${BOLD}${GREEN}"
printf " ╔══════════════════════════════════════════╗\n"
printf " ║ ║\n"
printf " ║ ✅ Aetheel is ready! ║\n"
printf " ║ ║\n"
printf " ╚══════════════════════════════════════════╝\n"
printf "${NC}\n"
printf " ${BOLD}To start Aetheel:${NC}\n"
printf "\n"
printf " cd %s\n" "$INSTALL_DIR"
if [ "$HAS_UV" = true ]; then
printf " uv run python main.py\n"
else
printf " source .venv/bin/activate\n"
printf " python main.py\n"
fi
printf "\n"
printf " ${BOLD}Other commands:${NC}\n"
printf " --claude Use Claude Code instead of OpenCode\n"
printf " --test Echo mode (no AI, for testing Slack)\n"
printf " --help Show all options\n"
printf "\n"
printf " ${BOLD}Files:${NC}\n"
printf " Config: %s/.env\n" "$INSTALL_DIR"
printf " Memory: ~/.aetheel/workspace/\n"
printf " Docs: %s/docs/\n" "$INSTALL_DIR"
printf "\n"
# Offer to start
printf " ${BOLD}Start Aetheel now?${NC} [y/N] "
read -r START_NOW
if [ "$START_NOW" = "y" ] || [ "$START_NOW" = "Y" ]; then
printf "\n"
info "Starting Aetheel..."
if [ "$HAS_UV" = true ]; then
exec uv run python main.py
else
exec python main.py
fi
fi
printf "\n"