#!/bin/bash # Test Option 1: Master Prompt Installation # This script tests the MASTER-PROMPT installation method set -e # Source common functions SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "$SCRIPT_DIR/common.sh" log_section "Testing Option 1: Master Prompt Installation" TEST_NAME="master-prompt-install" REPO_DIR="$HOME/claude-code-glm-suite" MASTER_PROMPT="$REPO_DIR/MASTER-PROMPT.md" # Check if repo is available if [ ! -d "$REPO_DIR" ]; then log_error "Repository not found at $REPO_DIR" exit 1 fi # Check if MASTER-PROMPT exists if [ ! -f "$MASTER_PROMPT" ]; then log_error "MASTER-PROMPT.md not found" exit 1 fi log_info "MASTER-PROMPT.md found" # 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 # Extract and execute steps from MASTER-PROMPT log_section "Executing MASTER-PROMPT Installation Steps" # Create a script from MASTER-PROMPT instructions cat > /tmp/master-install-script.sh << 'MASTER_SCRIPT_EOF' #!/bin/bash set -e echo "Step 1: Installing Contains Studio Agents..." # Clone agents repository git clone --depth 1 https://github.com/contains-studio/agents.git /tmp/contains-studio-agents # Copy agents mkdir -p ~/.claude/agents cp -r /tmp/contains-studio-agents/agents/* ~/.claude/agents/ echo "Step 2: Installing MCP Tools..." # Install vision tools (via npx, not global install) npm install -g @z_ai/mcp-server 2>/dev/null || echo "MCP server already installed" # Install web tools npm install -g @z_ai/coding-helper 2>/dev/null || echo "Coding helper already installed" # Install TLDR npm install -g llm-tldr 2>/dev/null || echo "TLDR already installed" echo "Step 3: Installing UI/UX Pro Max Skill..." git clone --depth 1 https://github.com/nextlevelbuilder/ui-ux-pro-max-skill.git /tmp/ui-ux-skill mkdir -p ~/.claude/skills cp -r /tmp/ui-ux-skill/* ~/.claude/skills/ echo "Step 4: Installing Ralph CLI (Optional - skipping for test)" # Skipping Ralph CLI for this test to keep it simple echo "Step 5: Creating configuration..." mkdir -p ~/.claude # Create basic settings.json cat > ~/.claude/settings.json << 'EOF' { "env": { "ANTHROPIC_AUTH_TOKEN": "test-token-for-installation-test", "ANTHROPIC_BASE_URL": "https://api.anthropic.com" } } EOF echo "Step 6: Verification..." echo "Installation completed!" MASTER_SCRIPT_EOF chmod +x /tmp/master-install-script.sh # Run the installation script log_info "Executing installation steps..." if /tmp/master-install-script.sh >> "$LOG_FILE" 2>&1; then log_success "Installation steps completed" else log_error "Installation failed with exit code $?" fi # Verify installation log_section "Verifying Installation" run_full_verification # Save results save_results "$TEST_NAME" # Cleanup rm -f /tmp/master-install-script.sh 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 "Master Prompt Installation Test Complete" echo ""