#!/bin/bash # Test Option 3: Manual Installation # This script tests the step-by-step manual installation set -e # Source common functions SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "$SCRIPT_DIR/common.sh" log_section "Testing Option 3: Manual Installation" TEST_NAME="manual-install" # Backup existing Claude directory if it exists BACKUP_DIR="" if [ -d "$HOME/.claude" ]; then BACKUP_DIR="$HOME/.claude.backup.$(date +%Y%m%d-%H%M%S)" log_info "Backing up existing .claude directory to $BACKUP_DIR" mv "$HOME/.claude" "$BACKUP_DIR" fi log_section "Step 1: Prerequisites Check" # Verify prerequisites verify_prerequisites log_section "Step 2: Configure Claude Code" # Create settings.json mkdir -p ~/.claude cat > ~/.claude/settings.json << 'EOF' { "env": { "ANTHROPIC_AUTH_TOKEN": "test-token-for-installation-test", "ANTHROPIC_BASE_URL": "https://api.anthropic.com" } } EOF test_pass "settings.json created" log_section "Step 3: Install Agents (38 agents)" # Clone agents repository log_info "Cloning contains-studio/agents repository..." if git clone --depth 1 https://github.com/contains-studio/agents.git /tmp/contains-studio-agents >> "$LOG_FILE" 2>&1; then test_pass "Agents repository cloned" else test_fail "Failed to clone agents repository" fi # Copy agents log_info "Copying agents to ~/.claude/agents..." mkdir -p ~/.claude/agents if cp -r /tmp/contains-studio-agents/* ~/.claude/agents/ >> "$LOG_FILE" 2>&1; then test_pass "Agents copied successfully" else test_fail "Failed to copy agents" fi # Verify agent count AGENT_COUNT=$(find ~/.claude/agents -name "*.md" -type f 2>/dev/null | wc -l) log_info "Found $AGENT_COUNT agent files" log_section "Step 4: Install MCP Tools" # Install @z_ai/mcp-server log_info "Installing @z_ai/mcp-server..." if npm install -g @z_ai/mcp-server >> "$LOG_FILE" 2>&1; then test_pass "@z_ai/mcp-server installed" else test_warn "@z_ai/mcp-server installation failed (may be already installed)" fi # Install @z_ai/coding-helper log_info "Installing @z_ai/coding-helper..." if npm install -g @z_ai/coding-helper >> "$LOG_FILE" 2>&1; then test_pass "@z_ai/coding-helper installed" else test_warn "@z_ai/coding-helper installation failed (may be already installed)" fi # Install llm-tldr log_info "Installing llm-tldr..." if npm install -g llm-tldr >> "$LOG_FILE" 2>&1; then test_pass "llm-tldr installed" else test_warn "llm-tldr installation failed (may be already installed)" fi log_section "Step 5: Install UI/UX Pro Max Skill" log_info "Cloning ui-ux-pro-max-skill repository..." if git clone --depth 1 https://github.com/nextlevelbuilder/ui-ux-pro-max-skill.git /tmp/ui-ux-skill >> "$LOG_FILE" 2>&1; then test_pass "UI/UX Pro Max repository cloned" else test_fail "Failed to clone UI/UX Pro Max repository" fi log_info "Copying UI/UX Pro Max skill..." mkdir -p ~/.claude/skills if cp -r /tmp/ui-ux-skill/* ~/.claude/skills/ >> "$LOG_FILE" 2>&1; then test_pass "UI/UX Pro Max skill installed" else test_fail "Failed to copy UI/UX Pro Max skill" fi log_section "Step 6: Configure MCP Tools" # Create settings.local.json with MCP configuration cat > ~/.claude/settings.local.json << 'EOF' { "mcpServers": { "zai-vision": { "command": "npx", "args": ["@z_ai/mcp-server"] }, "zai-web": { "command": "npx", "args": ["@z_ai/coding-helper"] } } } EOF test_pass "settings.local.json created with MCP configuration" log_section "Step 7: Verify Installation" # Verify installation run_full_verification # Save results save_results "$TEST_NAME" # Cleanup temporary files rm -rf /tmp/contains-studio-agents rm -rf /tmp/ui-ux-skill # Restore backup if test failed if [ $TESTS_FAILED -gt 0 ] && [ -n "$BACKUP_DIR" ]; then log_warning "Test failed, restoring backup" rm -rf "$HOME/.claude" mv "$BACKUP_DIR" "$HOME/.claude" fi log_section "Manual Installation Test Complete" echo ""