sane-assistant / scripts /install.sh
agenthinkmesh's picture
Upload project files
c13f797 verified
Raw History Blame Contribute Delete
3.14 kB
#!/bin/bash
# ============================================================
# صانع (San'e) — One-Command Install Script
# ============================================================
# Installs San'e on macOS and Linux (Ubuntu)
# ============================================================
# Colors
BLUE='\033[0;34m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
# Helper functions
echo_info() {
echo -e "${BLUE}INFO: $1${NC}"
}
echo_success() {
echo -e "${GREEN}SUCCESS: $1${NC}"
}
echo_warn() {
echo -e "${YELLOW}WARN: $1${NC}"
}
echo_error() {
echo -e "${RED}ERROR: $1${NC}"
exit 1
}
# Check for required commands
check_command() {
if ! command -v $1 &> /dev/null; then
echo_error "$1 is not installed. Please install it first."
fi
}
main() {
echo_info "🦅 Starting San'e (صانع) installation..."
# 1. Check dependencies
echo_info "Checking dependencies (git, node, npm)..."
check_command "git"
check_command "node"
check_command "npm"
# Check Node version (must be >= 22)
NODE_VERSION=$(node -v | cut -d'v' -f2)
if [[ $(echo "$NODE_VERSION" | cut -d'.' -f1) -lt 22 ]]; then
echo_error "Node.js version 22 or higher is required. You have v${NODE_VERSION}."
fi
echo_success "Dependencies are satisfied."
# 2. Clone the repository
if [ -d "sane-assistant" ]; then
echo_warn "Directory 'sane-assistant' already exists. Skipping clone."
else
echo_info "Cloning the repository..."
git clone https://github.com/your-org/sane-assistant.git || echo_error "Failed to clone repository."
fi
cd sane-assistant || echo_error "Failed to enter directory 'sane-assistant'."
# 3. Install dependencies
echo_info "Installing dependencies using pnpm (will be installed globally if needed)..."
if ! command -v pnpm &> /dev/null; then
npm install -g pnpm || echo_error "Failed to install pnpm."
fi
pnpm install || echo_error "Failed to install dependencies."
echo_success "Dependencies installed."
# 4. Setup .env file
if [ -f ".env" ]; then
echo_warn ".env file already exists. Skipping creation."
else
echo_info "Creating .env file from .env.example..."
cp .env.example .env || echo_error "Failed to create .env file."
echo_warn "Please edit the .env file now to add your API keys."
echo_info "You need to set at least ANTHROPIC_API_KEY."
read -p "Press [Enter] to open .env in your default editor..."
${EDITOR:-nano} .env
fi
# 5. Run onboarding wizard
echo_info "Running the interactive onboarding wizard..."
pnpm sane onboard || echo_error "Onboarding wizard failed."
# 6. Final instructions
echo_success "🎉 San'e (صانع) installation is complete!"
echo_info "To start the assistant, run:"
echo -e "${YELLOW} cd sane-assistant${NC}"
echo -e "${YELLOW} pnpm start${NC}"
echo_info "You can then interact with it via Telegram, WhatsApp, or the command line."
echo_info "Dashboard: http://localhost:18789"
}
main