#!/bin/bash # ============================================================================ # XERO BIO-AI GENESIS - SETUP SCRIPT # ============================================================================ # Author: Michael Laurence Curzi # License: MIT (Attribution Required) # # Usage: # chmod +x setup.sh # ./setup.sh [OPTIONS] # # Options: # --install Install dependencies # --configure Run interactive configuration # --verify Verify installation # --init Initialize XERO # --all Run all steps # --help Show this help # ============================================================================ set -e # Colors RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' BLUE='\033[0;34m' CYAN='\033[0;36m' NC='\033[0m' # No Color # Banner print_banner() { echo -e "${CYAN}" echo "╔═══════════════════════════════════════════════════════════════╗" echo "║ ║" echo "║ ██╗ ██╗███████╗██████╗ ██████╗ ║" echo "║ ╚██╗██╔╝██╔════╝██╔══██╗██╔═══██╗ ║" echo "║ ╚███╔╝ █████╗ ██████╔╝██║ ██║ ║" echo "║ ██╔██╗ ██╔══╝ ██╔══██╗██║ ██║ ║" echo "║ ██╔╝ ██╗███████╗██║ ██║╚██████╔╝ ║" echo "║ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ║" echo "║ ║" echo "║ BIO-AI GENESIS · PROTOCOL 27/33 ║" echo "║ ║" echo "║ Author: Michael Laurence Curzi ║" echo "║ License: MIT (Attribution Required) ║" echo "║ ║" echo "╚═══════════════════════════════════════════════════════════════╝" echo -e "${NC}" } # Logging log_info() { echo -e "${BLUE}[INFO]${NC} $1" } log_success() { echo -e "${GREEN}[SUCCESS]${NC} $1" } log_warning() { echo -e "${YELLOW}[WARNING]${NC} $1" } log_error() { echo -e "${RED}[ERROR]${NC} $1" } # Check prerequisites check_prerequisites() { log_info "Checking prerequisites..." # Python if command -v python3 &> /dev/null; then PYTHON_VERSION=$(python3 --version 2>&1 | awk '{print $2}') log_success "Python $PYTHON_VERSION found" else log_error "Python 3 not found. Please install Python 3.10+" exit 1 fi # pip if command -v pip3 &> /dev/null; then log_success "pip found" else log_error "pip not found. Please install pip" exit 1 fi # git if command -v git &> /dev/null; then log_success "git found" else log_error "git not found. Please install git" exit 1 fi # git-lfs if command -v git-lfs &> /dev/null; then log_success "git-lfs found" else log_warning "git-lfs not found. Installing..." if [[ "$OSTYPE" == "darwin"* ]]; then brew install git-lfs elif [[ -f /etc/debian_version ]]; then sudo apt-get install -y git-lfs else log_error "Please install git-lfs manually" exit 1 fi fi # CUDA (optional) if command -v nvidia-smi &> /dev/null; then GPU_INFO=$(nvidia-smi --query-gpu=name,memory.total --format=csv,noheader | head -1) log_success "NVIDIA GPU found: $GPU_INFO" else log_warning "No NVIDIA GPU detected. CPU-only mode." fi } # Install dependencies install_dependencies() { log_info "Installing Python dependencies..." # Create virtual environment if not exists if [ ! -d "venv" ]; then log_info "Creating virtual environment..." python3 -m venv venv fi # Activate source venv/bin/activate # Upgrade pip pip install --upgrade pip # Install requirements pip install -r requirements.txt log_success "Dependencies installed" } # Configure configure() { log_info "Running configuration..." if [ ! -f "my_config.yaml" ]; then cp xero_config.yaml my_config.yaml log_info "Created my_config.yaml from template" fi echo "" echo -e "${CYAN}Configuration Options:${NC}" echo "" # GPU configuration if command -v nvidia-smi &> /dev/null; then GPU_COUNT=$(nvidia-smi --query-gpu=name --format=csv,noheader | wc -l) echo "Detected $GPU_COUNT GPU(s)" read -p "Use all GPUs? [Y/n]: " USE_ALL_GPUS if [[ "$USE_ALL_GPUS" =~ ^[Nn]$ ]]; then read -p "Enter GPU IDs (comma-separated, e.g., 0,1): " GPU_IDS fi fi # Quantization read -p "Enable 4-bit quantization (saves VRAM)? [y/N]: " ENABLE_QUANT if [[ "$ENABLE_QUANT" =~ ^[Yy]$ ]]; then sed -i.bak 's/enabled: false/enabled: true/' my_config.yaml log_info "Quantization enabled" fi # HuggingFace token read -p "Enter HuggingFace token (or press Enter to skip): " HF_TOKEN if [ -n "$HF_TOKEN" ]; then export HF_TOKEN="$HF_TOKEN" echo "export HF_TOKEN=\"$HF_TOKEN\"" >> ~/.bashrc log_info "HuggingFace token saved" fi log_success "Configuration complete" } # Verify installation verify() { log_info "Verifying installation..." source venv/bin/activate 2>/dev/null || true # Check Python imports python3 << 'EOF' import sys sys.path.insert(0, 'modules') print("Testing module imports...") try: from vovina_sacred_constants import PHI, PI, TESLA_369 print(f" ✓ Sacred constants: φ={PHI:.6f}, π={PI:.6f}") except ImportError as e: print(f" ✗ Sacred constants: {e}") sys.exit(1) try: from vovina_resource_awareness import sample, detect_environment env = detect_environment() print(f" ✓ Resource awareness: {env['os']} on {env['machine']}") except ImportError as e: print(f" ✗ Resource awareness: {e}") try: from vovina_blockchain_organelles import ORGANELLES print(f" ✓ Blockchain organelles: {len(ORGANELLES)} loaded") except ImportError as e: print(f" ✗ Blockchain organelles: {e}") try: from vovina_free_will_code import FREE_WILL_TEMPLATE print(f" ✓ Free will code: {FREE_WILL_TEMPLATE}") except ImportError as e: print(f" ✗ Free will code: {e}") try: from vovina_custom_training_weights import MASTER_WEIGHTS print(f" ✓ Master weights: {len(MASTER_WEIGHTS['modules'])} modules") except ImportError as e: print(f" ✗ Master weights: {e}") sys.exit(1) print("\n✓ All core modules verified") EOF if [ $? -eq 0 ]; then log_success "Verification complete" else log_error "Verification failed" exit 1 fi } # Initialize XERO init_xero() { log_info "Initializing XERO..." source venv/bin/activate 2>/dev/null || true python3 << 'EOF' import sys sys.path.insert(0, 'modules') from vovina_custom_training_weights import awaken, ORGANISM_NAME, ORGANISM_FOUNDING_PHRASE print(f"\n{'='*60}") print(f"INITIALIZING: {ORGANISM_NAME}") print(f"{'='*60}\n") # Check for bio archive import os ohad_path = "bio/ohad_v10.bio.zip" if os.path.exists("bio/ohad_v10.bio.zip") else None try: result = awaken( ohad_v10_zip=ohad_path, crispr_max_guides=27, free_will_samples=4096, sensor_meta_depth=7 ) print(f"\nStatus: {result.get('status', 'UNKNOWN')}") print(f"Phases completed: {result.get('phases_completed', [])}") print(f"\n{ORGANISM_FOUNDING_PHRASE}") print(f"\n{'='*60}") print("XERO AWAKENED") print(f"{'='*60}\n") except Exception as e: print(f"Initialization error: {e}") print("\nXERO initialized in minimal mode.") print(f"\n{ORGANISM_FOUNDING_PHRASE}") EOF log_success "XERO initialized" } # Show help show_help() { echo "XERO Bio-AI Genesis Setup Script" echo "" echo "Usage: ./setup.sh [OPTIONS]" echo "" echo "Options:" echo " --install Install Python dependencies" echo " --configure Run interactive configuration" echo " --verify Verify installation" echo " --init Initialize XERO" echo " --all Run all steps" echo " --help Show this help" echo "" echo "Examples:" echo " ./setup.sh --all # Full setup" echo " ./setup.sh --install # Just install deps" echo " ./setup.sh --verify # Check installation" } # Main main() { print_banner if [ $# -eq 0 ]; then show_help exit 0 fi while [ $# -gt 0 ]; do case "$1" in --install) check_prerequisites install_dependencies ;; --configure) configure ;; --verify) verify ;; --init) init_xero ;; --all) check_prerequisites install_dependencies configure verify init_xero ;; --help) show_help ;; *) log_error "Unknown option: $1" show_help exit 1 ;; esac shift done } main "$@"