From fcd0e4a382dfb58f012fdc276daec051fcd67f72 Mon Sep 17 00:00:00 2001 From: uroma Date: Fri, 16 Jan 2026 15:11:50 +0000 Subject: [PATCH] feat: Update extra-tools installer with all features from main installer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added all missing features to extra-tools/install-claude-customizations.sh: New Features: - ✅ Skills installation (from skills/ directory) - ✅ Skills directory creation in ~/.claude/skills/ - ✅ Python script executable permissions for skills - ✅ GitHub agent fetching (fetch_latest_agents function) - ✅ Agent installation from local agents/ directory - ✅ Sync script installation (sync-agents.sh) - ✅ Better directory structure with skills support - ✅ Agent and skill counters - ✅ Enhanced verification with skill counting Changes: - Added SKILLS_DIR configuration variable - Added install_skills() function - Added fetch_latest_agents() function - Updated setup_directories() to include skills/ - Updated install_agents() to copy from local agents/ dir - Enhanced verification to count and report skills - Added --skip-git-fetch option for faster installs Summary: → The extra-tools installer now has feature parity with interactive-install-claude.sh → No functionality missing - both installers are now equivalent → Skills are properly installed with Python scripts made executable → Agents can be fetched from GitHub or installed from local directory Co-Authored-By: Claude Sonnet 4.5 --- extra-tools/install-claude-customizations.sh | 222 ++++++++++++++----- 1 file changed, 167 insertions(+), 55 deletions(-) diff --git a/extra-tools/install-claude-customizations.sh b/extra-tools/install-claude-customizations.sh index 4d36901..b8af9b6 100755 --- a/extra-tools/install-claude-customizations.sh +++ b/extra-tools/install-claude-customizations.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash ################################################################################ # Claude Code Customizations Installer -# This script automates the setup of custom agents, MCP tools, and plugins +# This script automates the setup of custom agents, MCP tools, skills, and plugins # for Claude Code on a new machine. ################################################################################ @@ -12,13 +12,20 @@ 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 # Configuration CLAUDE_DIR="$HOME/.claude" AGENTS_DIR="$CLAUDE_DIR/agents" +SKILLS_DIR="$CLAUDE_DIR/skills" PLUGINS_DIR="$CLAUDE_DIR/plugins" BACKUP_DIR="$HOME/.claude-backup-$(date +%Y%m%d_%H%M%S)" +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" + +# Counters +AGENTS_INSTALLED=0 +SKILLS_INSTALLED=0 ################################################################################ # Helper Functions @@ -85,14 +92,62 @@ check_prerequisites() { setup_directories() { log_info "Setting up directory structure..." + # Create main directories including skills + mkdir -p "$CLAUDE_DIR"/{skills,agents,plugins/cache,plugins/marketplaces,hooks,debug,file-history,paste-cache,projects,session-env,shell-snapshots,todos} + + # Create agent category directories mkdir -p "$AGENTS_DIR"/{engineering,marketing,product,studio-operations,project-management,testing,design,bonus} - mkdir -p "$PLUGINS_DIR"/{cache,marketplaces} - mkdir -p "$CLAUDE_DIR"/{hooks,debug,file-history,paste-cache,projects,session-env,shell-snapshots,todos} - log_success "Directory structure created" } +################################################################################ +# Fetch Latest Agents from GitHub (Optional) +################################################################################ + +fetch_latest_agents() { + log_info "Checking for agent updates from GitHub..." + + local GITHUB_REPO="https://github.com/contains-studio/agents" + local TEMP_AGENT_DIR="/tmp/claude-agents-latest-$RANDOM" + local UPDATE_FOUND=false + + # Create temp directory + mkdir -p "$TEMP_AGENT_DIR" + + # Try to clone using git + if command -v git &> /dev/null; then + if git clone --depth 1 --quiet "$GITHUB_REPO" "$TEMP_AGENT_DIR" 2>/dev/null; then + UPDATE_FOUND=true + log_success "Fetched latest agents from GitHub" + + # Copy updated agents to source directory + for category in engineering marketing product studio-operations project-management testing design bonus; do + if [ -d "$TEMP_AGENT_DIR/$category" ]; then + mkdir -p "$SCRIPT_DIR/agents/$category" + cp -f "$TEMP_AGENT_DIR/$category"/*.md "$SCRIPT_DIR/agents/$category/" 2>/dev/null || true + fi + done + + # Update README if present + if [ -f "$TEMP_AGENT_DIR/README.md" ]; then + cp -f "$TEMP_AGENT_DIR/README.md" "$SCRIPT_DIR/agents/README.md" 2>/dev/null || true + fi + + log_info "Local agents updated from GitHub" + else + log_warning "Failed to fetch from GitHub (using local agents)" + fi + else + log_warning "Git not found (using local agents)" + fi + + # Cleanup + rm -rf "$TEMP_AGENT_DIR" + + return 0 +} + ################################################################################ # Settings Configuration ################################################################################ @@ -181,21 +236,81 @@ install_mcp_services() { } ################################################################################ -# Agent Definitions +# Agent Installation ################################################################################ install_agents() { log_info "Installing custom agents..." - # Note: In a production setup, these would be downloaded from a repository - # For now, we'll create placeholder agent definitions - # The actual agent content should be copied from the source machine + local source_agents="$SCRIPT_DIR/agents" - log_info "Agent directory structure created at $AGENTS_DIR" - log_warning "NOTE: You need to copy the actual agent .md files from the source machine" - log_info "Run: scp -r user@source:~/.claude/agents/* $AGENTS_DIR/" + if [ ! -d "$source_agents" ]; then + log_warning "Agent source directory not found at $source_agents" + log_warning "Agents will not be installed" + return + fi - log_success "Agent structure ready" + # Copy agents from each category + for category in engineering marketing product studio-operations project-management testing design bonus; do + if [ -d "$source_agents/$category" ]; then + mkdir -p "$AGENTS_DIR/$category" + agent_count=$(cp -f "$source_agents/$category"/*.md "$AGENTS_DIR/$category/" 2>/dev/null | wc -l) + if [ -d "$AGENTS_DIR/$category" ]; then + count=$(ls -1 "$AGENTS_DIR/$category"/*.md 2>/dev/null | wc -l) + AGENTS_INSTALLED=$((AGENTS_INSTALLED + count)) + fi + fi + done + + log_info "Agents installed: $AGENTS_INSTALLED" + + # Install sync-agents.sh script if available + if [ -f "$SCRIPT_DIR/extra-tools/sync-agents.sh" ]; then + log_info "Installing sync-agents.sh script..." + cp "$SCRIPT_DIR/extra-tools/sync-agents.sh" "$CLAUDE_DIR/sync-agents.sh" + chmod +x "$CLAUDE_DIR/sync-agents.sh" + log_success "sync-agents.sh installed (run: ~/.claude/sync-agents.sh)" + fi + + log_success "Agent installation completed" +} + +################################################################################ +# Skills Installation (NEW - Added from main installer) +################################################################################ + +install_skills() { + log_info "Installing skills..." + + local source_skills="$SCRIPT_DIR/skills" + + if [ ! -d "$source_skills" ]; then + log_warning "Skills source directory not found at $source_skills" + log_warning "Skills will not be installed" + return + fi + + # Create skills directory + mkdir -p "$SKILLS_DIR" + + # Copy all skill directories + for skill_dir in "$source_skills"/*; do + if [ -d "$skill_dir" ]; then + skill_name=$(basename "$skill_dir") + log_info " → Installing skill: $skill_name" + cp -r "$skill_dir" "$SKILLS_DIR/" + + # Make Python scripts executable + if [ -d "$SKILLS_DIR/$skill_name/scripts" ]; then + chmod +x "$SKILLS_DIR/$skill_name/scripts"/*.py 2>/dev/null || true + fi + + SKILLS_INSTALLED=$((SKILLS_INSTALLED + 1)) + fi + done + + log_success "✓ Skills installed: $SKILLS_INSTALLED skill(s)" + log_success "✓ Skills location: $SKILLS_DIR/" } ################################################################################ @@ -261,35 +376,6 @@ EOF log_success "Plugins configured" } -################################################################################ -# Download Agents from Repository -################################################################################ - -download_agent_definitions() { - log_info "Preparing to download agent definitions..." - - # Create a temporary script to download agents - # In production, this would download from a git repository or CDN - - cat > /tmp/download_agents.sh << 'DOWNLOAD_SCRIPT' -#!/bin/bash -# This script would download agent definitions from a central repository -# For now, it creates a template structure - -AGENT_CATEGORIES=("engineering" "marketing" "product" "studio-operations" "project-management" "testing" "design" "bonus") - -for category in "${AGENT_CATEGORIES[@]}"; do - echo "Category: $category" - # Agents would be downloaded here -done -DOWNLOAD_SCRIPT - - chmod +x /tmp/download_agents.sh - - log_info "Agent download script created at /tmp/download_agents.sh" - log_warning "You need to provide the actual agent definitions" -} - ################################################################################ # Verification ################################################################################ @@ -302,6 +388,7 @@ verify_installation() { # Check directories [ -d "$CLAUDE_DIR" ] || { log_error "Claude directory missing"; errors=$((errors+1)); } [ -d "$AGENTS_DIR" ] || { log_error "Agents directory missing"; errors=$((errors+1)); } + [ -d "$SKILLS_DIR" ] || { log_warning "Skills directory missing (optional)"; } [ -d "$PLUGINS_DIR" ] || { log_error "Plugins directory missing"; errors=$((errors+1)); } # Check files @@ -317,6 +404,20 @@ verify_installation() { errors=$((errors+1)) fi + # Count agents and skills + if [ -d "$AGENTS_DIR" ]; then + agent_count=$(find "$AGENTS_DIR" -name "*.md" | wc -l) + log_success "Agents installed: $agent_count" + fi + + if [ -d "$SKILLS_DIR" ]; then + skill_count=$(find "$SKILLS_DIR" -maxdepth 1 -type d | wc -l) + skill_count=$((skill_count - 1)) # Subtract 1 for the skills directory itself + if [ $skill_count -gt 0 ]; then + log_success "Skills installed: $skill_count skill(s)" + fi + fi + if [ $errors -eq 0 ]; then log_success "Installation verification passed" return 0 @@ -331,25 +432,25 @@ verify_installation() { ################################################################################ main() { - echo -e "${BLUE}╔════════════════════════════════════════════════════════════╗${NC}" - echo -e "${BLUE}║ Claude Code Customizations - Automated Installer ║${NC}" - echo -e "${BLUE}╚════════════════════════════════════════════════════════════╝${NC}" + echo -e "${CYAN}╔════════════════════════════════════════════════════════════╗${NC}" + echo -e "${CYAN}║ Claude Code Customizations - Automated Installer ║${NC}" + echo -e "${CYAN}╚════════════════════════════════════════════════════════════╝${NC}" echo "" # Parse command line arguments - SKIP_AGENTS_COPY=false + SKIP_GIT_FETCH=false while [[ $# -gt 0 ]]; do case $1 in - --skip-agents) - SKIP_AGENTS_COPY=true + --skip-git-fetch) + SKIP_GIT_FETCH=true shift ;; --help) echo "Usage: $0 [OPTIONS]" echo "" echo "Options:" - echo " --skip-agents Skip copying agent files (if already present)" - echo " --help Show this help message" + echo " --skip-git-fetch Skip fetching latest agents from GitHub" + echo " --help Show this help message" echo "" exit 0 ;; @@ -365,8 +466,15 @@ main() { check_prerequisites setup_directories setup_settings + + # Fetch latest agents from GitHub (optional) + if [ "$SKIP_GIT_FETCH" = false ]; then + fetch_latest_agents + fi + install_mcp_services install_agents + install_skills # NEW: Skills installation install_plugins # Verify installation @@ -376,16 +484,20 @@ main() { log_success "Installation completed successfully!" log_success "═══════════════════════════════════════════════════════════" echo "" + log_info "Summary:" + log_info " → Agents installed: $AGENTS_INSTALLED" + log_info " → Skills installed: $SKILLS_INSTALLED" + echo "" log_info "Next steps:" - echo " 1. Copy agent definitions from source machine:" - echo " scp -r user@source:~/.claude/agents/* $AGENTS_DIR/" - echo "" - echo " 2. Restart Claude Code to load all customizations" - echo "" - echo " 3. Verify MCP tools are working by starting a new session" + echo " 1. Restart Claude Code to load all customizations" + echo " 2. Verify agents are available in Claude Code" + echo " 3. Verify skills are available (check: ~/.claude/skills/)" + echo " 4. Test MCP tools by starting a new session" echo "" echo "Backup location: $BACKUP_DIR" echo "" + echo "Sync agents later: ~/.claude/sync-agents.sh" + echo "" else log_error "Installation failed. Please check the errors above." exit 1