#!/usr/bin/env bash set -euo pipefail # Lobster AI Installer (macOS / Linux) # Usage: curl -fsSL https://install.lobsterbio.com | bash # # Installs lobster-ai via uv tool install, configures API keys, # and selects agent packages. # # Environment variables (for non-interactive use): # LOBSTER_EXTRAS="anthropic,full" Provider + bundle extras # LOBSTER_SKIP_INIT=1 Skip lobster init after install # ── Colors ────────────────────────────────────────────────────────── RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[0;33m' CYAN='\033[0;36m' DIM='\033[2m' BOLD='\033[1m' RESET='\033[0m' info() { echo -e "${DIM}$1${RESET}"; } ok() { echo -e "${GREEN}✓${RESET} $1"; } warn() { echo -e "${YELLOW}⚠${RESET} $1"; } err() { echo -e "${RED}✗${RESET} $1"; exit 1; } # ── Banner ────────────────────────────────────────────────────────── echo "" echo -e "${BOLD}🦞 Lobster AI Installer${RESET}" echo -e "${DIM} Multi-agent bioinformatics in natural language${RESET}" echo "" # Track whether we need step 4 (fresh install / reinstall) NEED_INSTALL=1 # ── Detect OS ─────────────────────────────────────────────────────── OS="$(uname -s)" case "$OS" in Darwin) PLATFORM="macOS" ;; Linux) PLATFORM="Linux" ;; *) err "Unsupported platform: $OS. Use the Windows installer (PowerShell) instead." ;; esac info "Platform: $PLATFORM ($(uname -m))" # ── Step 1: Install uv ───────────────────────────────────────────── echo "" echo -e "${BOLD}[1/5] Checking uv...${RESET}" if command -v uv &>/dev/null; then UV_VERSION="$(uv --version 2>/dev/null || echo 'unknown')" ok "uv found ($UV_VERSION)" else info "Installing uv..." curl -LsSf https://astral.sh/uv/install.sh | sh # Source uv's shell integration if [ -f "$HOME/.local/bin/env" ]; then # shellcheck disable=SC1091 . "$HOME/.local/bin/env" elif [ -f "$HOME/.cargo/env" ]; then # shellcheck disable=SC1091 . "$HOME/.cargo/env" fi # Add to PATH for this session export PATH="$HOME/.local/bin:$PATH" if command -v uv &>/dev/null; then ok "uv installed" else err "Failed to install uv. Visit https://docs.astral.sh/uv/getting-started/installation/" fi fi # ── Step 2: Ensure Python 3.12+ ──────────────────────────────────── echo "" echo -e "${BOLD}[2/5] Checking Python...${RESET}" PYTHON_OK=0 if uv python list --only-installed 2>/dev/null | grep -qE "3\.(1[2-9]|[2-9][0-9])"; then PYTHON_OK=1 ok "Python 3.12+ available" fi if [ "$PYTHON_OK" -eq 0 ]; then info "Installing Python 3.12 via uv..." uv python install 3.12 || err "Failed to install Python 3.12" ok "Python 3.12 installed" fi # ── Step 3: Check existing install ────────────────────────────────── echo "" echo -e "${BOLD}[3/5] Checking existing installation...${RESET}" if command -v lobster &>/dev/null; then CURRENT_VERSION="$(lobster --version 2>/dev/null || echo 'unknown')" warn "Lobster AI already installed ($CURRENT_VERSION)" echo "" echo -e " ${CYAN}1${RESET} - Upgrade to latest version" echo -e " ${CYAN}2${RESET} - Reinstall (fresh)" echo -e " ${CYAN}3${RESET} - Skip installation, just reconfigure" echo "" read -rp " Choose [1]: " EXISTING_CHOICE EXISTING_CHOICE="${EXISTING_CHOICE:-1}" case "$EXISTING_CHOICE" in 1) info "Upgrading..." uv tool upgrade lobster-ai ok "Lobster AI upgraded" NEED_INSTALL=0 # Skip step 4 ;; 2) info "Reinstalling..." uv tool uninstall lobster-ai 2>/dev/null || true NEED_INSTALL=1 # Will be installed in step 4 ;; 3) ok "Skipping installation" if [ "${LOBSTER_SKIP_INIT:-}" != "1" ]; then echo "" lobster init --global --force fi echo "" ok "Done!" exit 0 ;; esac else info "No existing installation found" fi # ── Step 4: Select extras & install ──────────────────────────────── if [ "$NEED_INSTALL" -eq 1 ]; then echo "" echo -e "${BOLD}[4/5] Configuring installation...${RESET}" if [ -n "${LOBSTER_EXTRAS:-}" ]; then # Non-interactive: use env var EXTRAS="$LOBSTER_EXTRAS" info "Using LOBSTER_EXTRAS=$EXTRAS" else # Interactive: ask for provider echo "" echo -e " ${BOLD}LLM Provider:${RESET}" echo -e " ${CYAN}1${RESET} - Anthropic Claude (recommended)" echo -e " ${CYAN}2${RESET} - Google Gemini" echo -e " ${CYAN}3${RESET} - Ollama (local, free)" echo -e " ${CYAN}4${RESET} - AWS Bedrock" echo -e " ${CYAN}5${RESET} - Azure AI" echo "" read -rp " Choose provider [1]: " PROVIDER_CHOICE PROVIDER_CHOICE="${PROVIDER_CHOICE:-1}" case "$PROVIDER_CHOICE" in 1) PROVIDER_EXTRA="anthropic" ;; 2) PROVIDER_EXTRA="gemini" ;; 3) PROVIDER_EXTRA="" ;; 4) PROVIDER_EXTRA="bedrock" ;; 5) PROVIDER_EXTRA="azure" ;; *) PROVIDER_EXTRA="anthropic" ;; esac # Agent bundle echo "" echo -e " ${BOLD}Agent Bundle:${RESET}" echo -e " ${CYAN}1${RESET} - Full (all agents, recommended)" echo -e " ${CYAN}2${RESET} - Core only (install agents later)" echo "" read -rp " Choose bundle [1]: " BUNDLE_CHOICE BUNDLE_CHOICE="${BUNDLE_CHOICE:-1}" case "$BUNDLE_CHOICE" in 1) BUNDLE_EXTRA="full" ;; 2) BUNDLE_EXTRA="" ;; *) BUNDLE_EXTRA="full" ;; esac # Build extras string EXTRAS_PARTS=() [ -n "$PROVIDER_EXTRA" ] && EXTRAS_PARTS+=("$PROVIDER_EXTRA") [ -n "$BUNDLE_EXTRA" ] && EXTRAS_PARTS+=("$BUNDLE_EXTRA") if [ ${#EXTRAS_PARTS[@]} -gt 0 ]; then EXTRAS="$(IFS=,; echo "${EXTRAS_PARTS[*]}")" else EXTRAS="" fi fi # Build and run install command echo "" if [ -n "$EXTRAS" ]; then INSTALL_CMD="uv tool install 'lobster-ai[$EXTRAS]'" info "Running: $INSTALL_CMD" uv tool install "lobster-ai[$EXTRAS]" else INSTALL_CMD="uv tool install lobster-ai" info "Running: $INSTALL_CMD" uv tool install lobster-ai fi # Verify installation if command -v lobster &>/dev/null; then ok "Lobster AI installed" else # Try updating shell PATH uv tool update-shell 2>/dev/null || true export PATH="$HOME/.local/bin:$PATH" if command -v lobster &>/dev/null; then ok "Lobster AI installed (restart your shell for permanent PATH)" else warn "lobster command not found in PATH" info "Try: export PATH=\"\$HOME/.local/bin:\$PATH\"" info "Or restart your terminal." fi fi else echo "" echo -e "${BOLD}[4/5] Skipping (already upgraded)${RESET}" ok "Using upgraded installation" fi # ── Step 5: Configure ────────────────────────────────────────────── echo "" echo -e "${BOLD}[5/5] Configuring Lobster AI...${RESET}" if [ "${LOBSTER_SKIP_INIT:-}" = "1" ]; then info "Skipping init (LOBSTER_SKIP_INIT=1)" elif [ -f "$HOME/.config/lobster/providers.json" ]; then info "Global config already exists." info "To reconfigure: lobster init --global --force" else lobster init --global --skip-extras fi # ── Done ──────────────────────────────────────────────────────────── echo "" echo -e "${GREEN}${BOLD}🦞 Lobster AI is ready!${RESET}" echo "" info "Quick start:" echo -e " ${BOLD}lobster chat${RESET} Start interactive session" echo -e " ${BOLD}lobster query \"Analyze my data\"${RESET} Single query" echo "" info "Upgrade later: uv tool upgrade lobster-ai" info "Add agents: lobster init --force (generates the uv command)" info "Documentation: https://docs.omics-os.com" echo ""