#!/bin/bash
# ClaudeAll - Quick Update Script
# Sync latest config from GitHub

set -e

REPO_DIR="$HOME/.claude-all-config"

if [ ! -d "$REPO_DIR" ]; then
    echo "❌ ClaudeAll not installed. Run install.sh first."
    exit 1
fi

echo "🔄 Updating ClaudeAll..."
cd "$REPO_DIR"
git pull origin main

echo "📋 Syncing to Claude..."

# Sync agents
cp -r agents/* "$HOME/.claude/agents/" 2>/dev/null || true

# Sync skills
cp -r skills/* "$HOME/.claude/skills/" 2>/dev/null || true

# Sync commands
cp -r commands/* "$HOME/.claude/commands/" 2>/dev/null || true

# Sync hooks
cp -r hooks/* "$HOME/.claude/hooks/" 2>/dev/null || true
chmod +x "$HOME/.claude/hooks/"*.sh 2>/dev/null || true

# Sync MCP config
cp mcp.json "$HOME/.mcp.json" 2>/dev/null || true

echo "✅ Updated! Restart Claude to apply changes."
