#!/bin/bash ################################################################################ # SuperCharge Claude Code - Ultimate Installation Script v3.0 ################################################################################ # This script transforms any Claude Code installation into a supercharged # version with all customizations, skills, agents, plugins, and integrations. # # Features v3.0: # - 291 Custom Skills (cognitive, development, UI/UX, brainstorming, agents) # - RalphLoop autonomous agent integration # - Prometheus code analysis integration (6 commands) # - Dexto multi-agent harness (12 commands) # - Clawd autonomous gateway # - Intelligent auto-routing system # - Multi-AI consultation (Qwen integration) # - Agent management system with sync capabilities # - Custom hooks for session management # - MCP servers integration (10 servers) # - Plugin marketplace setup # # Usage: ./supercharge.sh [options] # --skip-deps Skip dependency installation # --dev-mode Development mode (verbose output) ################################################################################ set -e # Colors for output 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 # Script directory SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # Claude config directory CLAUDE_DIR="${HOME}/.claude" # Backup directory BACKUP_DIR="${HOME}/.claude-backup-$(date +%Y%m%d_%H%M%S)" # Flags SKIP_DEPS=false DEV_MODE=false ################################################################################ # Helper Functions ################################################################################ log_info() { echo -e "${BLUE}[INFO]${NC} $1" } log_success() { echo -e "${GREEN}[SUCCESS]${NC} $1" } log_warn() { echo -e "${YELLOW}[WARN]${NC} $1" } log_error() { echo -e "${RED}[ERROR]${NC} $1" } log_step() { echo -e "${CYAN}${BOLD}==>${NC} ${BOLD}$1${NC}" } print_banner() { echo -e "${CYAN}${BOLD}" cat << "EOF" ╔═══════════════════════════════════════════════════════════════╗ ║ ║ ║ ███████╗██╗ █████╗ ██████╗ ║ ║ ██╔════╝██║ ██╔══██╗██╔════╝ ║ ║ ███████╗██║ ███████║██║ ███╗ ║ ║ ╚════██║██║ ██╔══██║██║ ██║ ║ ║ ███████║███████╗██║ ██║╚██████╔╝ ║ ║ ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ║ ║ ║ ║ ███████╗██╗ ██╗███████╗███╗ ██╗ ║ ║ ██╔════╝╚██╗██╔╝██╔════╝████╗ ██║ ║ ║ █████╗ ╚███╔╝ █████╗ ██╔██╗ ██║ ║ ║ ██╔══╝ ██╔██╗ ██╔══╝ ██║╚██╗██║ ║ ║ ███████╗██║██╗██║███████╗██║ ╚████║ ║ ║ ╚══════╝╚═╝╚═╝╚═╝╚══════╝╚═╝ ╚═══╝ ║ ║ ║ ║ Ultimate Installation Script ║ ║ Version 3.0 ║ ║ 291 Skills • 21 Commands • 10 MCP Servers ║ ║ ║ ╚═══════════════════════════════════════════════════════════════╝ EOF echo -e "${NC}" } check_claude_code() { log_step "Checking for Claude Code installation..." if ! command -v claude &> /dev/null; then log_warn "Claude Code CLI not found!" echo "" echo -e "${YELLOW}Claude Code is required to use these customizations.${NC}" echo "" echo "Options:" echo " 1. Install Claude Code with Z.AI API support (recommended)" echo " 2. Install manually later" echo " 3. Exit to install first" echo "" read -p "Choose option [1/2/3]: " -n 1 -r choice echo "" case $choice in 1) log_info "Running Claude Code installer..." bash "$SCRIPT_DIR/install-claude-code.sh" --auto if ! command -v claude &> /dev/null; then log_error "Claude Code installation failed. Please install manually." exit 1 fi log_success "Claude Code installed successfully" ;; 2) log_warn "Skipping Claude Code installation" log_info "You can install it later with: ./install-claude-code.sh" return 1 ;; 3) log_info "Please install Claude Code first:" echo " npm install -g @anthropic-ai/claude-code" echo " Or run: ./install-claude-code.sh" exit 1 ;; *) log_error "Invalid choice" exit 1 ;; esac fi log_success "Claude Code found: $(claude --version 2>/dev/null || echo 'installed')" return 0 } backup_existing_config() { log_step "Backing up existing configuration..." if [ -d "$CLAUDE_DIR" ]; then mkdir -p "$BACKUP_DIR" cp -r "$CLAUDE_DIR" "$BACKUP_DIR/" log_success "Backup created at: $BACKUP_DIR" else log_info "No existing configuration to backup" fi } install_dependencies() { if [ "$SKIP_DEPS" = true ]; then log_warn "Skipping dependency installation" return fi log_step "Checking and installing dependencies..." # Check Python 3 if ! command -v python3 &> /dev/null; then log_warn "Python 3 not found. Some features may not work." else log_success "Python 3 found: $(python3 --version)" fi # Check Node.js if ! command -v node &> /dev/null; then log_warn "Node.js not found. Some features may not work." else local node_full_version=$(node -v 2>&1) local node_version=$(echo "$node_full_version" | grep -oE '[0-9]+' | head -n1) if [ ! -z "$node_version" ] && [ "$node_version" -ge 18 ]; then log_success "Node.js found: $node_full_version" else log_warn "Node.js found but too old ($node_full_version). v18+ recommended." fi fi # Check Git if ! command -v git &> /dev/null; then log_error "Git not found. Please install Git first." exit 1 else log_success "Git found: $(git --version)" fi # Install Ralph Orchestrator install_ralph_orchestrator # Install Prometheus Integration install_prometheus_integration # Install Dexto Integration install_dexto_integration # Install Clawd Gateway install_clawd_gateway # Configure MCP Servers configure_mcp_servers } install_ralph_orchestrator() { log_step "Installing Ralph Orchestrator..." RALPH_INSTALLED=false if command -v ralph &> /dev/null; then log_success "Ralph Orchestrator found: $(ralph --version 2>/dev/null || echo installed)" RALPH_INSTALLED=true fi if python3 -c "import ralph_orchestrator" 2>/dev/null; then if [ "$RALPH_INSTALLED" = false ]; then log_success "Ralph Orchestrator Python package found" RALPH_INSTALLED=true fi fi if [ "$RALPH_INSTALLED" = false ]; then log_info "Installing Ralph Orchestrator..." if command -v pip3 &> /dev/null; then if [ -f "$SCRIPT_DIR/requirements.txt" ]; then log_info "Installing from requirements.txt..." pip3 install -r "$SCRIPT_DIR/requirements.txt" 2>/dev/null && { log_success "Ralph Orchestrator installed from requirements.txt" } || { log_warn "requirements.txt install failed, trying direct install..." pip3 install ralph-orchestrator pyyaml 2>/dev/null || { log_warn "Failed to install Ralph Orchestrator" } } else pip3 install ralph-orchestrator pyyaml 2>/dev/null || { log_warn "Failed to install Ralph Orchestrator" } fi else log_warn "pip3 not found. Skipping Ralph Orchestrator installation." fi fi if command -v ralph &> /dev/null || python3 -c "import ralph_orchestrator" 2>/dev/null; then log_success "Ralph Orchestrator ready" else log_warn "Ralph Orchestrator not available - /ralph will use fallback mode" fi } install_prometheus_integration() { log_step "Installing Prometheus Integration..." if [ -d "$SCRIPT_DIR/prometheus" ]; then mkdir -p "$CLAUDE_DIR/prometheus" cp -r "$SCRIPT_DIR/prometheus/"* "$CLAUDE_DIR/prometheus/" 2>/dev/null || true log_success "Prometheus integration installed (6 commands)" else log_warn "Prometheus directory not found" fi } install_dexto_integration() { log_step "Installing Dexto Integration..." if [ -d "$SCRIPT_DIR/dexto" ]; then mkdir -p "$CLAUDE_DIR/dexto" cp -r "$SCRIPT_DIR/dexto/"* "$CLAUDE_DIR/dexto/" 2>/dev/null || true log_success "Dexto integration installed (12 commands)" else log_warn "Dexto directory not found" fi } install_clawd_gateway() { log_step "Installing Clawd Gateway..." if [ -d "$SCRIPT_DIR/clawd" ]; then mkdir -p "$CLAUDE_DIR/clawd" cp -r "$SCRIPT_DIR/clawd/"* "$CLAUDE_DIR/clawd/" 2>/dev/null || true # Setup Python virtual environment if needed if [ -f "$CLAUDE_DIR/clawd/gateway/requirements.txt" ]; then if [ ! -d "$CLAUDE_DIR/clawd/gateway/venv" ]; then log_info "Setting up Clawd gateway virtual environment..." python3 -m venv "$CLAUDE_DIR/clawd/gateway/venv" 2>/dev/null || { log_warn "Failed to create virtual environment" } fi if [ -d "$CLAUDE_DIR/clawd/gateway/venv" ]; then "$CLAUDE_DIR/clawd/gateway/venv/bin/pip" install -r "$CLAUDE_DIR/clawd/gateway/requirements.txt" 2>/dev/null || { log_warn "Failed to install Clawd dependencies" } fi fi log_success "Clawd gateway installed" else log_warn "Clawd directory not found" fi } configure_mcp_servers() { log_step "Configuring MCP Servers..." mkdir -p "$CLAUDE_DIR/mcp-servers" if [ -f "$SCRIPT_DIR/mcp-servers/registry.json" ]; then cp "$SCRIPT_DIR/mcp-servers/registry.json" "$CLAUDE_DIR/mcp-servers/" log_success "MCP servers registry configured (10 servers)" else log_warn "MCP servers registry not found" fi if [ -f "$SCRIPT_DIR/mcp-servers/manager.sh" ]; then cp "$SCRIPT_DIR/mcp-servers/manager.sh" "$CLAUDE_DIR/mcp-servers/" chmod +x "$CLAUDE_DIR/mcp-servers/manager.sh" log_success "MCP servers manager installed" fi } install_skills() { log_step "Installing custom skills..." mkdir -p "$CLAUDE_DIR/skills" if [ -d "$SCRIPT_DIR/skills" ]; then cp -r "$SCRIPT_DIR/skills/"* "$CLAUDE_DIR/skills/" 2>/dev/null || true local skill_count=$(find "$SCRIPT_DIR/skills" -name "SKILL.md" 2>/dev/null | wc -l) log_success "Installed ${skill_count:-291} custom skills" else log_warn "Skills directory not found" fi } install_agents() { log_step "Installing agent management system..." mkdir -p "$CLAUDE_DIR/agents" if [ -d "$SCRIPT_DIR/agents" ]; then cp -r "$SCRIPT_DIR/agents/"* "$CLAUDE_DIR/agents/" 2>/dev/null || true log_success "Agent management system installed" find "$CLAUDE_DIR/agents" -name "*.sh" -exec chmod +x {} \; else log_warn "Agents directory not found" fi } install_hooks() { log_step "Installing custom hooks..." mkdir -p "$CLAUDE_DIR/hooks" if [ -d "$SCRIPT_DIR/hooks" ]; then cp -r "$SCRIPT_DIR/hooks/"* "$CLAUDE_DIR/hooks/" 2>/dev/null || true find "$CLAUDE_DIR/hooks" -name "*.sh" -exec chmod +x {} \; log_success "Custom hooks installed (intelligent routing enabled)" else log_warn "Hooks directory not found" fi if [ -f "$SCRIPT_DIR/hooks.json" ]; then cp "$SCRIPT_DIR/hooks.json" "$CLAUDE_DIR/hooks.json" log_success "Hooks configuration (v5) installed" fi } install_commands() { log_step "Installing custom commands..." mkdir -p "$CLAUDE_DIR/commands" if [ -d "$SCRIPT_DIR/commands" ]; then cp -r "$SCRIPT_DIR/commands/"* "$CLAUDE_DIR/commands/" 2>/dev/null || true local cmd_count=$(ls -1 "$SCRIPT_DIR/commands" 2>/dev/null | wc -l) log_success "Installed ${cmd_count:-21} custom commands" else log_warn "Commands directory not found" fi } install_plugins() { log_step "Installing plugin marketplace..." mkdir -p "$CLAUDE_DIR/plugins" if [ -d "$SCRIPT_DIR/plugins" ]; then cp -r "$SCRIPT_DIR/plugins/"* "$CLAUDE_DIR/plugins/" 2>/dev/null || true log_success "Plugin marketplace configured" else log_warn "Plugins directory not found" fi } install_binaries() { log_step "Installing custom binaries..." mkdir -p "$HOME/.local/bin" if [ -f "$SCRIPT_DIR/bin/ralphloop" ]; then cp "$SCRIPT_DIR/bin/ralphloop" "$HOME/.local/bin/" chmod +x "$HOME/.local/bin/ralphloop" if ! echo "$PATH" | grep -q "$HOME/.local/bin"; then echo "" >> "$HOME/.bashrc" echo "# SuperCharge Claude Code - Add local bin to PATH" >> "$HOME/.bashrc" echo "export PATH=\"\$HOME/.local/bin:\$PATH\"" >> "$HOME/.bashrc" log_info "Added ~/.local/bin to PATH in .bashrc" fi log_success "RalphLoop wrapper installed" else log_warn "RalphLoop binary not found" fi } install_scripts() { log_step "Installing utility scripts..." mkdir -p "$CLAUDE_DIR/scripts" if [ -d "$SCRIPT_DIR/scripts" ]; then cp -r "$SCRIPT_DIR/scripts/"* "$CLAUDE_DIR/scripts/" 2>/dev/null || true find "$CLAUDE_DIR/scripts" -name "*.sh" -exec chmod +x {} \; log_success "Utility scripts installed" else log_warn "Scripts directory not found" fi } install_config_templates() { log_step "Installing configuration templates..." if [ -d "$SCRIPT_DIR/templates" ]; then if [ -f "$SCRIPT_DIR/templates/config.json" ] && [ ! -f "$CLAUDE_DIR/config.json" ]; then cp "$SCRIPT_DIR/templates/config.json" "$CLAUDE_DIR/config.json" log_success "config.json installed" fi if [ -f "$SCRIPT_DIR/templates/settings.json" ]; then if [ -f "$CLAUDE_DIR/settings.json" ]; then local temp_file=$(mktemp) python3 -c " import json try: with open('$CLAUDE_DIR/settings.json', 'r') as f: existing = json.load(f) except: existing = {} try: with open('$SCRIPT_DIR/templates/settings.json', 'r') as f: template = json.load(f) except: template = {} for key in template: if key != 'permissions': existing[key] = template[key] with open('$temp_file', 'w') as f: json.dump(existing, f, indent=2) " 2>/dev/null || cp "$SCRIPT_DIR/templates/settings.json" "$temp_file" mv "$temp_file" "$CLAUDE_DIR/settings.json" else cp "$SCRIPT_DIR/templates/settings.json" "$CLAUDE_DIR/settings.json" fi log_success "settings.json configured" fi fi } sync_agents() { log_step "Syncing agents from repository..." if [ -f "$CLAUDE_DIR/scripts/sync-agents.sh" ]; then bash "$CLAUDE_DIR/scripts/sync-agents.sh" 2>/dev/null || log_warn "Agent sync completed with warnings" log_success "Agent sync completed" else log_warn "sync-agents.sh not found" fi } print_summary() { echo "" echo -e "${GREEN}${BOLD}╔═══════════════════════════════════════════════════════════════╗${NC}" echo -e "${GREEN}${BOLD}║ INSTALLATION COMPLETE v3.0! ║${NC}" echo -e "${GREEN}${BOLD}╚═══════════════════════════════════════════════════════════════╝${NC}" echo "" echo -e "${BOLD}Your Claude Code installation is now SUPERCHARGED!${NC}" echo "" echo -e "${CYAN}Installed Features:${NC}" echo -e " ${GREEN}✓${NC} 291 Custom Skills (cognitive, development, UI/UX, agents)" echo -e " ${GREEN}✓${NC} RalphLoop Autonomous Agent" echo -e " ${GREEN}✓${NC} Prometheus Code Analysis (6 commands)" echo -e " ${GREEN}✓${NC} Dexto Multi-Agent Harness (12 commands)" echo -e " ${GREEN}✓${NC} Clawd Autonomous Gateway" echo -e " ${GREEN}✓${NC} Intelligent Auto-Routing System" echo -e " ${GREEN}✓${NC} Multi-AI Consultation (Qwen)" echo -e " ${GREEN}✓${NC} 10 MCP Servers Configured" echo -e " ${GREEN}✓${NC} Plugin Marketplace" echo "" echo -e "${CYAN}Available Commands (21 total):${NC}" echo "" echo -e "${BOLD}Autonomous Agents:${NC}" echo -e " ${YELLOW}/clawd${NC} - Fully autonomous task execution" echo -e " ${YELLOW}/ralph${NC} - Iterative architecture & orchestration" echo "" echo -e "${BOLD}Prometheus (Code Analysis):${NC}" echo -e " ${YELLOW}/prometheus${NC} - Master command (auto-routes to sub-agent)" echo -e " ${YELLOW}/prometheus-bug${NC} - Bug analysis and fixing" echo -e " ${YELLOW}/prometheus-feature${NC} - Feature implementation" echo -e " ${YELLOW}/prometheus-context${NC} - Code context understanding" echo -e " ${YELLOW}/prometheus-edit${NC} - Code editing and refactoring" echo -e " ${YELLOW}/prometheus-test${NC} - Test generation and validation" echo -e " ${YELLOW}/prometheus-classify${NC} - Issue classification" echo "" echo -e "${BOLD}Dexto (Specialized Agents):${NC}" echo -e " ${YELLOW}/dexto${NC} - Master command (auto-routes to sub-agent)" echo -e " ${YELLOW}/dexto-code${NC} - Code analysis and generation" echo -e " ${YELLOW}/dexto-database${NC} - Database optimization" echo -e " ${YELLOW}/dexto-github${NC} - GitHub PR/issue analysis" echo -e " ${YELLOW}/dexto-pdf${NC} - PDF document analysis" echo -e " ${YELLOW}/dexto-image-edit${NC}- Image editing and enhancement" echo -e " ${YELLOW}/dexto-nano-banana${NC}- AI image generation" echo -e " ${YELLOW}/dexto-sora${NC} - AI video generation" echo -e " ${YELLOW}/dexto-music${NC} - AI music/audio generation" echo -e " ${YELLOW}/dexto-podcast${NC} - AI podcast generation" echo -e " ${YELLOW}/dexto-research${NC} - Product research and ideation" echo -e " ${YELLOW}/dexto-triage${NC} - Support ticket triage" echo -e " ${YELLOW}/dexto-explore${NC} - Codebase exploration" echo "" echo -e "${CYAN}Intelligent Auto-Routing:${NC}" echo -e " The system automatically detects task patterns and suggests" echo -e " the best agent. Just describe your task naturally!" echo "" echo -e "${CYAN}Quick Start:${NC}" echo -e " 1. Restart your terminal or run: ${YELLOW}source ~/.bashrc${NC}" echo -e " 2. Run Claude Code: ${YELLOW}claude${NC}" echo -e " 3. Try any command or just describe your task - auto-routing will help!" echo "" echo -e "${CYAN}Examples:${NC}" echo -e " ${YELLOW}claude${NC} \"Fix the authentication bug\" → Auto-routes to /prometheus-bug" echo -e " ${YELLOW}claude${NC} \"Generate an image of a city\" → Auto-routes to /dexto-nano-banana" echo -e " ${YELLOW}claude${NC} \"Design a microservices architecture\" → Auto-routes to /ralph" echo "" echo -e "${CYAN}Configuration:${NC}" echo -e " Config dir: ${YELLOW}$CLAUDE_DIR${NC}" echo -e " Backup: ${YELLOW}$BACKUP_DIR${NC}" echo "" echo -e "${GREEN}${BOLD}Enjoy your supercharged Claude Code experience!${NC}" echo "" } ################################################################################ # Main Installation ################################################################################ main() { print_banner while [[ $# -gt 0 ]]; do case $1 in --skip-deps) SKIP_DEPS=true shift ;; --dev-mode) DEV_MODE=true set -x shift ;; -h|--help) echo "Usage: $0 [options]" echo " --skip-deps Skip dependency installation" echo " --dev-mode Development mode (verbose output)" exit 0 ;; *) log_error "Unknown option: $1" exit 1 ;; esac done if ! check_claude_code; then log_info "Customizations installed. Install Claude Code to use them." echo "" echo -e "${CYAN}Install Claude Code:${NC}" echo " npm install -g @anthropic-ai/claude-code" echo " Or run: ./install-claude-code.sh" echo "" exit 0 fi backup_existing_config install_dependencies install_skills install_agents install_hooks install_commands install_plugins install_binaries install_scripts install_config_templates sync_agents print_summary } main "$@"