Fix: Convert all shell scripts from CRLF to LF

Fixed Windows line endings (CRLF) in all shell scripts to Unix format (LF):
- supercharge.sh (main installation script)
- agents/*.sh (all agent management scripts)
- hooks/*.sh (all hook scripts)
- skills/ui-ux-pro-max/scripts/wordpress_safe_update.sh

All scripts now pass bash syntax validation.
This commit is contained in:
uroma
2026-01-22 15:41:59 +00:00
Unverified
parent c98b3a1565
commit 4efc4f4762
7 changed files with 2846 additions and 2846 deletions

View File

@@ -1,329 +1,329 @@
#!/usr/bin/env bash
################################################################################
# Claude Code Customizations - Master Control Script
# Provides an interactive menu for all setup operations
################################################################################
# Colors
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'
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Script paths
INSTALL_SCRIPT="$SCRIPT_DIR/install-claude-customizations.sh"
EXPORT_SCRIPT="$SCRIPT_DIR/export-claude-customizations.sh"
PACKAGE_SCRIPT="$SCRIPT_DIR/create-complete-package.sh"
VERIFY_SCRIPT="$SCRIPT_DIR/verify-claude-setup.sh"
# Helper functions
print_header() {
clear
echo -e "${CYAN}╔══════════════════════════════════════════════════════════════════╗${NC}"
echo -e "${CYAN}${NC} ${BOLD}Claude Code Customizations - Setup Manager${NC} ${CYAN}${NC}"
echo -e "${CYAN}╚══════════════════════════════════════════════════════════════════╝${NC}"
echo ""
}
print_menu() {
print_header
echo -e "${BOLD}Main Menu:${NC}"
echo ""
echo -e " ${GREEN}1${NC}) 📦 Create Complete Package (recommended for distribution)"
echo -e " ${GREEN}2${NC}) 📥 Install Customizations (on new machine)"
echo -e " ${GREEN}3${NC}) 📤 Export Customizations (backup/transfer)"
echo -e " ${GREEN}4${NC}) ✅ Verify Installation"
echo -e " ${GREEN}5${NC}) 📋 Show Package Contents"
echo -e " ${GREEN}6${NC}) 📖 View Documentation"
echo -e " ${GREEN}7${NC}) 🧹 Clean Backup Files"
echo ""
echo -e " ${YELLOW}0${NC}) 🚪 Exit"
echo ""
echo -ne "${CYAN}Select an option: ${NC}"
}
check_script() {
local script="$1"
local name="$2"
if [ ! -f "$script" ]; then
echo -e "${RED}✗ Error: $name not found at $script${NC}"
return 1
fi
if [ ! -x "$script" ]; then
echo -e "${YELLOW}⚠ Making $name executable...${NC}"
chmod +x "$script"
fi
return 0
}
create_package() {
print_header
echo -e "${BOLD}Create Complete Package${NC}"
echo "═══════════════════════════════════════════════════════════"
echo ""
echo "This will create a complete package with all agents, plugins,"
echo "and configurations ready for distribution."
echo ""
read -p "Continue? (y/N): " confirm
if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
return
fi
if check_script "$PACKAGE_SCRIPT" "Package Script"; then
echo ""
bash "$PACKAGE_SCRIPT"
fi
echo ""
read -p "Press Enter to continue..."
}
install_customizations() {
print_header
echo -e "${BOLD}Install Customizations${NC}"
echo "═══════════════════════════════════════════════════════════"
echo ""
echo "This will install Claude Code customizations on this machine."
echo ""
echo "Note: If you're creating a complete package, use option 1 instead."
echo ""
if check_script "$INSTALL_SCRIPT" "Install Script"; then
echo ""
bash "$INSTALL_SCRIPT"
fi
echo ""
read -p "Press Enter to continue..."
}
export_customizations() {
print_header
echo -e "${BOLD}Export Customizations${NC}"
echo "═══════════════════════════════════════════════════════════"
echo ""
echo "This will export your current customizations to a package"
echo "for backup or transfer to another machine."
echo ""
read -p "Continue? (y/N): " confirm
if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
return
fi
if check_script "$EXPORT_SCRIPT" "Export Script"; then
echo ""
bash "$EXPORT_SCRIPT"
fi
echo ""
read -p "Press Enter to continue..."
}
verify_installation() {
print_header
if check_script "$VERIFY_SCRIPT" "Verify Script"; then
bash "$VERIFY_SCRIPT"
fi
echo ""
read -p "Press Enter to continue..."
}
show_contents() {
print_header
echo -e "${BOLD}Package Contents${NC}"
echo "═══════════════════════════════════════════════════════════"
echo ""
CLAUDE_DIR="$HOME/.claude"
if [ ! -d "$CLAUDE_DIR" ]; then
echo -e "${RED}No Claude Code directory found at $CLAUDE_DIR${NC}"
echo ""
read -p "Press Enter to continue..."
return
fi
echo -e "${CYAN}Agent Categories:${NC}"
for category in engineering marketing product studio-operations project-management testing design bonus; do
if [ -d "$CLAUDE_DIR/agents/$category" ]; then
count=$(ls -1 "$CLAUDE_DIR/agents/$category"/*.md 2>/dev/null | wc -l)
if [ $count -gt 0 ]; then
printf " %-25s %2d agents\n" "$category" "$count"
fi
fi
done
echo ""
echo -e "${CYAN}Configuration Files:${NC}"
echo " settings.json"
echo " settings.local.json"
echo " plugins/installed_plugins.json"
echo ""
echo -e "${CYAN}MCP Tools:${NC}"
echo " • zai-mcp-server (vision analysis)"
echo " • web-search-prime"
echo " • web-reader"
echo " • zread (GitHub)"
echo ""
echo -e "${CYAN}Skills:${NC}"
echo " • glm-plan-bug:case-feedback"
echo " • glm-plan-usage:usage-query"
echo ""
read -p "Press Enter to continue..."
}
view_documentation() {
print_header
echo -e "${BOLD}Documentation${NC}"
echo "═══════════════════════════════════════════════════════════"
echo ""
DOCS=(
"SCRIPTS-GUIDE.md:Script usage guide"
"CLAUDE-CUSTOMIZATIONS-README.md:Complete feature documentation"
)
echo "Available documentation:"
echo ""
for doc in "${DOCS[@]}"; do
file="${doc%%:*}"
desc="${doc##*:}"
if [ -f "$SCRIPT_DIR/$file" ]; then
echo -e " ${GREEN}${NC} $file"
echo " $desc"
else
echo -e " ${RED}${NC} $file (not found)"
fi
done
echo ""
echo "Would you like to view a document?"
echo " 1) SCRIPTS-GUIDE.md"
echo " 2) CLAUDE-CUSTOMIZATIONS-README.md"
echo " 0) Back"
echo ""
read -p "Select: " doc_choice
case $doc_choice in
1)
if [ -f "$SCRIPT_DIR/SCRIPTS-GUIDE.md" ]; then
less "$SCRIPT_DIR/SCRIPTS-GUIDE.md"
fi
;;
2)
if [ -f "$SCRIPT_DIR/CLAUDE-CUSTOMIZATIONS-README.md" ]; then
less "$SCRIPT_DIR/CLAUDE-CUSTOMIZATIONS-README.md"
fi
;;
esac
}
clean_backups() {
print_header
echo -e "${BOLD}Clean Backup Files${NC}"
echo "═══════════════════════════════════════════════════════════"
echo ""
# Find backup directories
BACKUPS=$(find "$HOME" -maxdepth 1 -name ".claude-backup-*" -type d 2>/dev/null)
PACKAGES=$(find "$HOME" -maxdepth 1 -name "claude-customizations-*.tar.gz" -type f 2>/dev/null)
EXPORT_DIRS=$(find "$HOME" -maxdepth 1 -name "claude-*-export" -type d 2>/dev/null)
BACKUP_COUNT=$(echo "$BACKUPS" | grep -c "^" || echo 0)
PACKAGE_COUNT=$(echo "$PACKAGES" | grep -c "^" || echo 0)
EXPORT_COUNT=$(echo "$EXPORT_DIRS" | grep -c "^" || echo 0)
echo "Found:"
echo "$BACKUP_COUNT backup directories"
echo "$PACKAGE_COUNT package archives"
echo "$EXPORT_COUNT export directories"
echo ""
if [ $((BACKUP_COUNT + PACKAGE_COUNT + EXPORT_COUNT)) -eq 0 ]; then
echo -e "${GREEN}No backup files to clean${NC}"
echo ""
read -p "Press Enter to continue..."
return
fi
read -p "Clean all backup files? (y/N): " confirm
if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
return
fi
echo ""
echo "Cleaning..."
if [ -n "$BACKUPS" ]; then
echo "$BACKUPS" | while read -r backup; do
echo " Removing: $backup"
rm -rf "$backup"
done
fi
if [ -n "$PACKAGES" ]; then
echo "$PACKAGES" | while read -r package; do
echo " Removing: $package"
rm -f "$package"
done
fi
if [ -n "$EXPORT_DIRS" ]; then
echo "$EXPORT_DIRS" | while read -r export_dir; do
echo " Removing: $export_dir"
rm -rf "$export_dir"
done
fi
echo ""
echo -e "${GREEN}✓ Cleanup complete${NC}"
echo ""
read -p "Press Enter to continue..."
}
# Main loop
main() {
while true; do
print_menu
read -r choice
echo ""
case $choice in
1) create_package ;;
2) install_customizations ;;
3) export_customizations ;;
4) verify_installation ;;
5) show_contents ;;
6) view_documentation ;;
7) clean_backups ;;
0)
echo "Goodbye!"
exit 0
;;
*)
echo -e "${RED}Invalid option. Please try again.${NC}"
sleep 1
;;
esac
done
}
# Run main function
main
#!/usr/bin/env bash
################################################################################
# Claude Code Customizations - Master Control Script
# Provides an interactive menu for all setup operations
################################################################################
# Colors
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'
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Script paths
INSTALL_SCRIPT="$SCRIPT_DIR/install-claude-customizations.sh"
EXPORT_SCRIPT="$SCRIPT_DIR/export-claude-customizations.sh"
PACKAGE_SCRIPT="$SCRIPT_DIR/create-complete-package.sh"
VERIFY_SCRIPT="$SCRIPT_DIR/verify-claude-setup.sh"
# Helper functions
print_header() {
clear
echo -e "${CYAN}╔══════════════════════════════════════════════════════════════════╗${NC}"
echo -e "${CYAN}${NC} ${BOLD}Claude Code Customizations - Setup Manager${NC} ${CYAN}${NC}"
echo -e "${CYAN}╚══════════════════════════════════════════════════════════════════╝${NC}"
echo ""
}
print_menu() {
print_header
echo -e "${BOLD}Main Menu:${NC}"
echo ""
echo -e " ${GREEN}1${NC}) 📦 Create Complete Package (recommended for distribution)"
echo -e " ${GREEN}2${NC}) 📥 Install Customizations (on new machine)"
echo -e " ${GREEN}3${NC}) 📤 Export Customizations (backup/transfer)"
echo -e " ${GREEN}4${NC}) ✅ Verify Installation"
echo -e " ${GREEN}5${NC}) 📋 Show Package Contents"
echo -e " ${GREEN}6${NC}) 📖 View Documentation"
echo -e " ${GREEN}7${NC}) 🧹 Clean Backup Files"
echo ""
echo -e " ${YELLOW}0${NC}) 🚪 Exit"
echo ""
echo -ne "${CYAN}Select an option: ${NC}"
}
check_script() {
local script="$1"
local name="$2"
if [ ! -f "$script" ]; then
echo -e "${RED}✗ Error: $name not found at $script${NC}"
return 1
fi
if [ ! -x "$script" ]; then
echo -e "${YELLOW}⚠ Making $name executable...${NC}"
chmod +x "$script"
fi
return 0
}
create_package() {
print_header
echo -e "${BOLD}Create Complete Package${NC}"
echo "═══════════════════════════════════════════════════════════"
echo ""
echo "This will create a complete package with all agents, plugins,"
echo "and configurations ready for distribution."
echo ""
read -p "Continue? (y/N): " confirm
if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
return
fi
if check_script "$PACKAGE_SCRIPT" "Package Script"; then
echo ""
bash "$PACKAGE_SCRIPT"
fi
echo ""
read -p "Press Enter to continue..."
}
install_customizations() {
print_header
echo -e "${BOLD}Install Customizations${NC}"
echo "═══════════════════════════════════════════════════════════"
echo ""
echo "This will install Claude Code customizations on this machine."
echo ""
echo "Note: If you're creating a complete package, use option 1 instead."
echo ""
if check_script "$INSTALL_SCRIPT" "Install Script"; then
echo ""
bash "$INSTALL_SCRIPT"
fi
echo ""
read -p "Press Enter to continue..."
}
export_customizations() {
print_header
echo -e "${BOLD}Export Customizations${NC}"
echo "═══════════════════════════════════════════════════════════"
echo ""
echo "This will export your current customizations to a package"
echo "for backup or transfer to another machine."
echo ""
read -p "Continue? (y/N): " confirm
if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
return
fi
if check_script "$EXPORT_SCRIPT" "Export Script"; then
echo ""
bash "$EXPORT_SCRIPT"
fi
echo ""
read -p "Press Enter to continue..."
}
verify_installation() {
print_header
if check_script "$VERIFY_SCRIPT" "Verify Script"; then
bash "$VERIFY_SCRIPT"
fi
echo ""
read -p "Press Enter to continue..."
}
show_contents() {
print_header
echo -e "${BOLD}Package Contents${NC}"
echo "═══════════════════════════════════════════════════════════"
echo ""
CLAUDE_DIR="$HOME/.claude"
if [ ! -d "$CLAUDE_DIR" ]; then
echo -e "${RED}No Claude Code directory found at $CLAUDE_DIR${NC}"
echo ""
read -p "Press Enter to continue..."
return
fi
echo -e "${CYAN}Agent Categories:${NC}"
for category in engineering marketing product studio-operations project-management testing design bonus; do
if [ -d "$CLAUDE_DIR/agents/$category" ]; then
count=$(ls -1 "$CLAUDE_DIR/agents/$category"/*.md 2>/dev/null | wc -l)
if [ $count -gt 0 ]; then
printf " %-25s %2d agents\n" "$category" "$count"
fi
fi
done
echo ""
echo -e "${CYAN}Configuration Files:${NC}"
echo " settings.json"
echo " settings.local.json"
echo " plugins/installed_plugins.json"
echo ""
echo -e "${CYAN}MCP Tools:${NC}"
echo " • zai-mcp-server (vision analysis)"
echo " • web-search-prime"
echo " • web-reader"
echo " • zread (GitHub)"
echo ""
echo -e "${CYAN}Skills:${NC}"
echo " • glm-plan-bug:case-feedback"
echo " • glm-plan-usage:usage-query"
echo ""
read -p "Press Enter to continue..."
}
view_documentation() {
print_header
echo -e "${BOLD}Documentation${NC}"
echo "═══════════════════════════════════════════════════════════"
echo ""
DOCS=(
"SCRIPTS-GUIDE.md:Script usage guide"
"CLAUDE-CUSTOMIZATIONS-README.md:Complete feature documentation"
)
echo "Available documentation:"
echo ""
for doc in "${DOCS[@]}"; do
file="${doc%%:*}"
desc="${doc##*:}"
if [ -f "$SCRIPT_DIR/$file" ]; then
echo -e " ${GREEN}${NC} $file"
echo " $desc"
else
echo -e " ${RED}${NC} $file (not found)"
fi
done
echo ""
echo "Would you like to view a document?"
echo " 1) SCRIPTS-GUIDE.md"
echo " 2) CLAUDE-CUSTOMIZATIONS-README.md"
echo " 0) Back"
echo ""
read -p "Select: " doc_choice
case $doc_choice in
1)
if [ -f "$SCRIPT_DIR/SCRIPTS-GUIDE.md" ]; then
less "$SCRIPT_DIR/SCRIPTS-GUIDE.md"
fi
;;
2)
if [ -f "$SCRIPT_DIR/CLAUDE-CUSTOMIZATIONS-README.md" ]; then
less "$SCRIPT_DIR/CLAUDE-CUSTOMIZATIONS-README.md"
fi
;;
esac
}
clean_backups() {
print_header
echo -e "${BOLD}Clean Backup Files${NC}"
echo "═══════════════════════════════════════════════════════════"
echo ""
# Find backup directories
BACKUPS=$(find "$HOME" -maxdepth 1 -name ".claude-backup-*" -type d 2>/dev/null)
PACKAGES=$(find "$HOME" -maxdepth 1 -name "claude-customizations-*.tar.gz" -type f 2>/dev/null)
EXPORT_DIRS=$(find "$HOME" -maxdepth 1 -name "claude-*-export" -type d 2>/dev/null)
BACKUP_COUNT=$(echo "$BACKUPS" | grep -c "^" || echo 0)
PACKAGE_COUNT=$(echo "$PACKAGES" | grep -c "^" || echo 0)
EXPORT_COUNT=$(echo "$EXPORT_DIRS" | grep -c "^" || echo 0)
echo "Found:"
echo "$BACKUP_COUNT backup directories"
echo "$PACKAGE_COUNT package archives"
echo "$EXPORT_COUNT export directories"
echo ""
if [ $((BACKUP_COUNT + PACKAGE_COUNT + EXPORT_COUNT)) -eq 0 ]; then
echo -e "${GREEN}No backup files to clean${NC}"
echo ""
read -p "Press Enter to continue..."
return
fi
read -p "Clean all backup files? (y/N): " confirm
if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
return
fi
echo ""
echo "Cleaning..."
if [ -n "$BACKUPS" ]; then
echo "$BACKUPS" | while read -r backup; do
echo " Removing: $backup"
rm -rf "$backup"
done
fi
if [ -n "$PACKAGES" ]; then
echo "$PACKAGES" | while read -r package; do
echo " Removing: $package"
rm -f "$package"
done
fi
if [ -n "$EXPORT_DIRS" ]; then
echo "$EXPORT_DIRS" | while read -r export_dir; do
echo " Removing: $export_dir"
rm -rf "$export_dir"
done
fi
echo ""
echo -e "${GREEN}✓ Cleanup complete${NC}"
echo ""
read -p "Press Enter to continue..."
}
# Main loop
main() {
while true; do
print_menu
read -r choice
echo ""
case $choice in
1) create_package ;;
2) install_customizations ;;
3) export_customizations ;;
4) verify_installation ;;
5) show_contents ;;
6) view_documentation ;;
7) clean_backups ;;
0)
echo "Goodbye!"
exit 0
;;
*)
echo -e "${RED}Invalid option. Please try again.${NC}"
sleep 1
;;
esac
done
}
# Run main function
main

View File

@@ -1,212 +1,212 @@
#!/usr/bin/env bash
################################################################################
# Claude Code Customizations Exporter
# This script packages all customizations for transfer to another machine
################################################################################
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
# Configuration
CLAUDE_DIR="$HOME/.claude"
EXPORT_DIR="$HOME/claude-customizations-export"
EXPORT_FILE="$HOME/claude-customizations-$(date +%Y%m%d_%H%M%S).tar.gz"
log_info() {
echo -e "${BLUE}[INFO]${NC} $1"
}
log_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
log_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
# Create export directory
log_info "Creating export directory..."
rm -rf "$EXPORT_DIR"
mkdir -p "$EXPORT_DIR"
# Export agents
log_info "Exporting custom agents..."
mkdir -p "$EXPORT_DIR/agents"
cp -r "$CLAUDE_DIR/agents/"* "$EXPORT_DIR/agents/" 2>/dev/null || true
# Export plugins configuration
log_info "Exporting plugins configuration..."
mkdir -p "$EXPORT_DIR/plugins"
cp -r "$CLAUDE_DIR/plugins/cache/"* "$EXPORT_DIR/plugins/" 2>/dev/null || true
cp "$CLAUDE_DIR/plugins/installed_plugins.json" "$EXPORT_DIR/plugins/" 2>/dev/null || true
cp "$CLAUDE_DIR/plugins/known_marketplaces.json" "$EXPORT_DIR/plugins/" 2>/dev/null || true
# Export settings (without sensitive data)
log_info "Exporting settings..."
mkdir -p "$EXPORT_DIR/config"
# Export settings.local.json (permissions)
cp "$CLAUDE_DIR/settings.local.json" "$EXPORT_DIR/config/" 2>/dev/null || true
# Create settings template (without actual API token)
cat > "$EXPORT_DIR/config/settings-template.json" << EOF
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "YOUR_API_TOKEN_HERE",
"ANTHROPIC_BASE_URL": "https://api.anthropic.com",
"API_TIMEOUT_MS": "3000000",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
},
"enabledPlugins": {
"glm-plan-bug@zai-coding-plugins": true,
"glm-plan-usage@zai-coding-plugins": true
}
}
EOF
# Export hooks if present
log_info "Exporting hooks..."
if [ -d "$CLAUDE_DIR/hooks" ] && [ "$(ls -A $CLAUDE_DIR/hooks)" ]; then
mkdir -p "$EXPORT_DIR/hooks"
cp -r "$CLAUDE_DIR/hooks/"* "$EXPORT_DIR/hooks/"
fi
# Create README
log_info "Creating documentation..."
cat > "$EXPORT_DIR/README.md" << 'EOF'
# Claude Code Customizations Package
This package contains all customizations for Claude Code including custom agents, MCP tools configuration, and plugins.
## Contents
- `agents/` - Custom agent definitions organized by category
- `plugins/` - Plugin configurations
- `config/` - Settings files
- `hooks/` - Custom hooks (if any)
## Installation
### Quick Install
Run the automated installer:
```bash
bash install-claude-customizations.sh
```
### Manual Install
1. **Copy agents:**
```bash
cp -r agents/* ~/.claude/agents/
```
2. **Copy plugins:**
```bash
cp -r plugins/* ~/.claude/plugins/
```
3. **Configure settings:**
```bash
cp config/settings.local.json ~/.claude/
# Edit ~/.claude/settings.json and add your API token
```
4. **Install MCP tools:**
```bash
npm install -g @z_ai/mcp-server @z_ai/coding-helper
```
5. **Restart Claude Code**
## Agent Categories
- **Engineering** - AI engineer, backend architect, frontend developer, DevOps, mobile app builder
- **Marketing** - TikTok strategist, growth hacker, content creator
- **Product** - Sprint prioritizer, feedback synthesizer, trend researcher
- **Studio Operations** - Studio producer, project shipper, analytics, finance
- **Project Management** - Experiment tracker, studio coach
- **Testing** - Test writer/fixer, API tester, performance benchmarker
- **Design** - UI designer, UX researcher, brand guardian, whimsy injector
- **Bonus** - Joker, studio coach
## MCP Tools Included
- **zai-mcp-server** - Vision analysis (images, videos, UI screenshots, error diagnosis)
- **web-search-prime** - Enhanced web search with domain filtering
- **web-reader** - Fetch URLs and convert to markdown
- **zread** - GitHub repository reader
## Skills
- `glm-plan-bug:case-feedback` - Submit bug/issue feedback
- `glm-plan-usage:usage-query` - Query account usage statistics
## Customization
Edit agent `.md` files in `~/.claude/agents/` to customize agent behavior.
## Support
For issues or questions, refer to the original source machine or Claude Code documentation.
EOF
# Create manifest
log_info "Creating package manifest..."
cat > "$EXPORT_DIR/MANIFEST.json" << EOF
{
"package": "claude-code-customizations",
"version": "1.0.0",
"exported_at": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)",
"contents": {
"agents": "$(ls -1 "$EXPORT_DIR/agents" | wc -l) categories",
"plugins": "$(ls -1 "$EXPORT_DIR/plugins" 2>/dev/null | wc -l) items",
"config_files": "$(ls -1 "$EXPORT_DIR/config" | wc -l) files"
},
"mcp_tools": [
"zai-mcp-server (vision)",
"web-search-prime",
"web-reader",
"zread"
],
"skills": [
"glm-plan-bug:case-feedback",
"glm-plan-usage:usage-query"
]
}
EOF
# Create tarball
log_info "Creating compressed archive..."
tar -czf "$EXPORT_FILE" -C "$HOME" "$(basename "$EXPORT_DIR")"
# Get file size
FILE_SIZE=$(du -h "$EXPORT_FILE" | cut -f1)
log_success "═══════════════════════════════════════════════════════════"
log_success "Export completed successfully!"
log_success "═══════════════════════════════════════════════════════════"
echo ""
log_info "Export location: $EXPORT_FILE"
log_info "Package size: $FILE_SIZE"
log_info "Unpacked directory: $EXPORT_DIR"
echo ""
log_info "To transfer to another machine:"
echo " 1. Copy the archive: scp $EXPORT_FILE user@target:~/"
echo " 2. Extract: tar -xzf $(basename "$EXPORT_FILE")"
echo " 3. Run: cd $(basename "$EXPORT_DIR") && bash install-claude-customizations.sh"
echo ""
# Ask if user wants to keep unpacked directory
read -p "Keep unpacked export directory? (y/N): " keep_unpacked
if [[ ! "$keep_unpacked" =~ ^[Yy]$ ]]; then
rm -rf "$EXPORT_DIR"
log_info "Unpacked directory removed"
fi
#!/usr/bin/env bash
################################################################################
# Claude Code Customizations Exporter
# This script packages all customizations for transfer to another machine
################################################################################
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
# Configuration
CLAUDE_DIR="$HOME/.claude"
EXPORT_DIR="$HOME/claude-customizations-export"
EXPORT_FILE="$HOME/claude-customizations-$(date +%Y%m%d_%H%M%S).tar.gz"
log_info() {
echo -e "${BLUE}[INFO]${NC} $1"
}
log_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
log_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
# Create export directory
log_info "Creating export directory..."
rm -rf "$EXPORT_DIR"
mkdir -p "$EXPORT_DIR"
# Export agents
log_info "Exporting custom agents..."
mkdir -p "$EXPORT_DIR/agents"
cp -r "$CLAUDE_DIR/agents/"* "$EXPORT_DIR/agents/" 2>/dev/null || true
# Export plugins configuration
log_info "Exporting plugins configuration..."
mkdir -p "$EXPORT_DIR/plugins"
cp -r "$CLAUDE_DIR/plugins/cache/"* "$EXPORT_DIR/plugins/" 2>/dev/null || true
cp "$CLAUDE_DIR/plugins/installed_plugins.json" "$EXPORT_DIR/plugins/" 2>/dev/null || true
cp "$CLAUDE_DIR/plugins/known_marketplaces.json" "$EXPORT_DIR/plugins/" 2>/dev/null || true
# Export settings (without sensitive data)
log_info "Exporting settings..."
mkdir -p "$EXPORT_DIR/config"
# Export settings.local.json (permissions)
cp "$CLAUDE_DIR/settings.local.json" "$EXPORT_DIR/config/" 2>/dev/null || true
# Create settings template (without actual API token)
cat > "$EXPORT_DIR/config/settings-template.json" << EOF
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "YOUR_API_TOKEN_HERE",
"ANTHROPIC_BASE_URL": "https://api.anthropic.com",
"API_TIMEOUT_MS": "3000000",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
},
"enabledPlugins": {
"glm-plan-bug@zai-coding-plugins": true,
"glm-plan-usage@zai-coding-plugins": true
}
}
EOF
# Export hooks if present
log_info "Exporting hooks..."
if [ -d "$CLAUDE_DIR/hooks" ] && [ "$(ls -A $CLAUDE_DIR/hooks)" ]; then
mkdir -p "$EXPORT_DIR/hooks"
cp -r "$CLAUDE_DIR/hooks/"* "$EXPORT_DIR/hooks/"
fi
# Create README
log_info "Creating documentation..."
cat > "$EXPORT_DIR/README.md" << 'EOF'
# Claude Code Customizations Package
This package contains all customizations for Claude Code including custom agents, MCP tools configuration, and plugins.
## Contents
- `agents/` - Custom agent definitions organized by category
- `plugins/` - Plugin configurations
- `config/` - Settings files
- `hooks/` - Custom hooks (if any)
## Installation
### Quick Install
Run the automated installer:
```bash
bash install-claude-customizations.sh
```
### Manual Install
1. **Copy agents:**
```bash
cp -r agents/* ~/.claude/agents/
```
2. **Copy plugins:**
```bash
cp -r plugins/* ~/.claude/plugins/
```
3. **Configure settings:**
```bash
cp config/settings.local.json ~/.claude/
# Edit ~/.claude/settings.json and add your API token
```
4. **Install MCP tools:**
```bash
npm install -g @z_ai/mcp-server @z_ai/coding-helper
```
5. **Restart Claude Code**
## Agent Categories
- **Engineering** - AI engineer, backend architect, frontend developer, DevOps, mobile app builder
- **Marketing** - TikTok strategist, growth hacker, content creator
- **Product** - Sprint prioritizer, feedback synthesizer, trend researcher
- **Studio Operations** - Studio producer, project shipper, analytics, finance
- **Project Management** - Experiment tracker, studio coach
- **Testing** - Test writer/fixer, API tester, performance benchmarker
- **Design** - UI designer, UX researcher, brand guardian, whimsy injector
- **Bonus** - Joker, studio coach
## MCP Tools Included
- **zai-mcp-server** - Vision analysis (images, videos, UI screenshots, error diagnosis)
- **web-search-prime** - Enhanced web search with domain filtering
- **web-reader** - Fetch URLs and convert to markdown
- **zread** - GitHub repository reader
## Skills
- `glm-plan-bug:case-feedback` - Submit bug/issue feedback
- `glm-plan-usage:usage-query` - Query account usage statistics
## Customization
Edit agent `.md` files in `~/.claude/agents/` to customize agent behavior.
## Support
For issues or questions, refer to the original source machine or Claude Code documentation.
EOF
# Create manifest
log_info "Creating package manifest..."
cat > "$EXPORT_DIR/MANIFEST.json" << EOF
{
"package": "claude-code-customizations",
"version": "1.0.0",
"exported_at": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)",
"contents": {
"agents": "$(ls -1 "$EXPORT_DIR/agents" | wc -l) categories",
"plugins": "$(ls -1 "$EXPORT_DIR/plugins" 2>/dev/null | wc -l) items",
"config_files": "$(ls -1 "$EXPORT_DIR/config" | wc -l) files"
},
"mcp_tools": [
"zai-mcp-server (vision)",
"web-search-prime",
"web-reader",
"zread"
],
"skills": [
"glm-plan-bug:case-feedback",
"glm-plan-usage:usage-query"
]
}
EOF
# Create tarball
log_info "Creating compressed archive..."
tar -czf "$EXPORT_FILE" -C "$HOME" "$(basename "$EXPORT_DIR")"
# Get file size
FILE_SIZE=$(du -h "$EXPORT_FILE" | cut -f1)
log_success "═══════════════════════════════════════════════════════════"
log_success "Export completed successfully!"
log_success "═══════════════════════════════════════════════════════════"
echo ""
log_info "Export location: $EXPORT_FILE"
log_info "Package size: $FILE_SIZE"
log_info "Unpacked directory: $EXPORT_DIR"
echo ""
log_info "To transfer to another machine:"
echo " 1. Copy the archive: scp $EXPORT_FILE user@target:~/"
echo " 2. Extract: tar -xzf $(basename "$EXPORT_FILE")"
echo " 3. Run: cd $(basename "$EXPORT_DIR") && bash install-claude-customizations.sh"
echo ""
# Ask if user wants to keep unpacked directory
read -p "Keep unpacked export directory? (y/N): " keep_unpacked
if [[ ! "$keep_unpacked" =~ ^[Yy]$ ]]; then
rm -rf "$EXPORT_DIR"
log_info "Unpacked directory removed"
fi

View File

@@ -1,396 +1,396 @@
#!/usr/bin/env bash
################################################################################
# Claude Code Customizations Installer
# This script automates the setup of custom agents, MCP tools, and plugins
# for Claude Code on a new machine.
################################################################################
set -e # Exit on error
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Configuration
CLAUDE_DIR="$HOME/.claude"
AGENTS_DIR="$CLAUDE_DIR/agents"
PLUGINS_DIR="$CLAUDE_DIR/plugins"
BACKUP_DIR="$HOME/.claude-backup-$(date +%Y%m%d_%H%M%S)"
################################################################################
# Helper Functions
################################################################################
log_info() {
echo -e "${BLUE}[INFO]${NC} $1"
}
log_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
log_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
log_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
check_command() {
if ! command -v $1 &> /dev/null; then
log_error "$1 is not installed. Please install it first."
exit 1
fi
}
backup_file() {
local file="$1"
if [ -f "$file" ]; then
mkdir -p "$BACKUP_DIR"
cp "$file" "$BACKUP_DIR/"
log_info "Backed up $file to $BACKUP_DIR"
fi
}
################################################################################
# Prerequisites Check
################################################################################
check_prerequisites() {
log_info "Checking prerequisites..."
check_command "node"
check_command "npm"
check_command "python3"
check_command "curl"
# Check Node.js version (need 14+)
NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1)
if [ "$NODE_VERSION" -lt 14 ]; then
log_error "Node.js version 14 or higher required. Current: $(node -v)"
exit 1
fi
log_success "Prerequisites check passed"
}
################################################################################
# Directory Structure Setup
################################################################################
setup_directories() {
log_info "Setting up directory structure..."
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"
}
################################################################################
# Settings Configuration
################################################################################
setup_settings() {
log_info "Configuring Claude Code settings..."
local settings_file="$CLAUDE_DIR/settings.json"
backup_file "$settings_file"
# Prompt for API credentials
read -p "Enter your ANTHROPIC_AUTH_TOKEN (or press Enter to skip): " API_TOKEN
read -p "Enter your ANTHROPIC_BASE_URL (default: https://api.anthropic.com): " API_BASE
API_BASE=${API_BASE:-https://api.anthropic.com}
# Create settings.json
cat > "$settings_file" << EOF
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "${API_TOKEN}",
"ANTHROPIC_BASE_URL": "${API_BASE}",
"API_TIMEOUT_MS": "3000000",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
},
"enabledPlugins": {
"glm-plan-bug@zai-coding-plugins": true,
"glm-plan-usage@zai-coding-plugins": true
}
}
EOF
# Create local settings for permissions
local local_settings="$CLAUDE_DIR/settings.local.json"
backup_file "$local_settings"
cat > "$local_settings" << EOF
{
"permissions": {
"allow": [
"Bash(npm install:*)",
"Bash(npm run content:*)",
"Bash(npm run build:*)",
"Bash(grep:*)",
"Bash(find:*)",
"Bash(for:*)",
"Bash(do sed:*)",
"Bash(done)",
"Bash(python3:*)",
"Bash(while read f)",
"Bash(do echo \\"\\$f%-* \\$f\\")",
"Bash(ls:*)",
"Bash(node:*)",
"Bash(pm2 delete:*)",
"Bash(pm2 start npm:*)",
"Bash(pm2 save:*)"
]
}
}
EOF
log_success "Settings configured"
}
################################################################################
# MCP Services Installation
################################################################################
install_mcp_services() {
log_info "Installing MCP services..."
# Install @z_ai/mcp-server globally for vision tools
log_info "Installing @z_ai/mcp-server (vision analysis tools)..."
npm install -g @z_ai/mcp-server 2>/dev/null || {
log_warning "Global install failed, trying with npx..."
# It's okay if this fails, the tools will use npx
}
# Install @z_ai/coding-helper for MCP management
log_info "Installing @z_ai/coding-helper..."
npm install -g @z_ai/coding-helper 2>/dev/null || {
log_warning "Global install failed, will use npx"
}
log_success "MCP services installation completed"
}
################################################################################
# Agent Definitions
################################################################################
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
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/"
log_success "Agent structure ready"
}
################################################################################
# Plugins Installation
################################################################################
install_plugins() {
log_info "Installing Claude Code plugins..."
# Initialize plugin registry
local installed_plugins="$PLUGINS_DIR/installed_plugins.json"
local known_marketplaces="$PLUGINS_DIR/known_marketplaces.json"
backup_file "$installed_plugins"
backup_file "$known_marketplaces"
cat > "$known_marketplaces" << EOF
{
"marketplaces": {
"https://github.com/anthropics/claude-plugins": {
"displayName": "Official Claude Plugins",
"contact": "support@anthropic.com"
}
}
}
EOF
# Install GLM plugins via npx
log_info "Installing GLM Coding Plan plugins..."
# Create plugin cache structure
mkdir -p "$PLUGINS_DIR/cache/zai-coding-plugins"/{glm-plan-bug,glm-plan-usage}
# Note: Actual plugin installation happens via the @z_ai/coding-helper
# which should already be installed
cat > "$installed_plugins" << EOF
{
"version": 2,
"plugins": {
"glm-plan-bug@zai-coding-plugins": [
{
"scope": "user",
"installPath": "$PLUGINS_DIR/cache/zai-coding-plugins/glm-plan-bug/0.0.1",
"version": "0.0.1",
"installedAt": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)",
"lastUpdated": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)"
}
],
"glm-plan-usage@zai-coding-plugins": [
{
"scope": "user",
"installPath": "$PLUGINS_DIR/cache/zai-coding-plugins/glm-plan-usage/0.0.1",
"version": "0.0.1",
"installedAt": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)",
"lastUpdated": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)"
}
]
}
}
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
################################################################################
verify_installation() {
log_info "Verifying installation..."
local errors=0
# 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 "$PLUGINS_DIR" ] || { log_error "Plugins directory missing"; errors=$((errors+1)); }
# Check files
[ -f "$CLAUDE_DIR/settings.json" ] || { log_error "settings.json missing"; errors=$((errors+1)); }
[ -f "$CLAUDE_DIR/settings.local.json" ] || { log_error "settings.local.json missing"; errors=$((errors+1)); }
[ -f "$PLUGINS_DIR/installed_plugins.json" ] || { log_error "installed_plugins.json missing"; errors=$((errors+1)); }
# Check MCP availability
if command -v npx &> /dev/null; then
log_success "npx available for MCP tools"
else
log_error "npx not available"
errors=$((errors+1))
fi
if [ $errors -eq 0 ]; then
log_success "Installation verification passed"
return 0
else
log_error "Installation verification failed with $errors errors"
return 1
fi
}
################################################################################
# Main Installation Flow
################################################################################
main() {
echo -e "${BLUE}╔════════════════════════════════════════════════════════════╗${NC}"
echo -e "${BLUE}║ Claude Code Customizations - Automated Installer ║${NC}"
echo -e "${BLUE}╚════════════════════════════════════════════════════════════╝${NC}"
echo ""
# Parse command line arguments
SKIP_AGENTS_COPY=false
while [[ $# -gt 0 ]]; do
case $1 in
--skip-agents)
SKIP_AGENTS_COPY=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 ""
exit 0
;;
*)
log_error "Unknown option: $1"
echo "Use --help for usage information"
exit 1
;;
esac
done
# Run installation steps
check_prerequisites
setup_directories
setup_settings
install_mcp_services
install_agents
install_plugins
# Verify installation
if verify_installation; then
echo ""
log_success "═══════════════════════════════════════════════════════════"
log_success "Installation completed successfully!"
log_success "═══════════════════════════════════════════════════════════"
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 ""
echo "Backup location: $BACKUP_DIR"
echo ""
else
log_error "Installation failed. Please check the errors above."
exit 1
fi
}
# Run main function
main "$@"
#!/usr/bin/env bash
################################################################################
# Claude Code Customizations Installer
# This script automates the setup of custom agents, MCP tools, and plugins
# for Claude Code on a new machine.
################################################################################
set -e # Exit on error
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Configuration
CLAUDE_DIR="$HOME/.claude"
AGENTS_DIR="$CLAUDE_DIR/agents"
PLUGINS_DIR="$CLAUDE_DIR/plugins"
BACKUP_DIR="$HOME/.claude-backup-$(date +%Y%m%d_%H%M%S)"
################################################################################
# Helper Functions
################################################################################
log_info() {
echo -e "${BLUE}[INFO]${NC} $1"
}
log_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
log_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
log_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
check_command() {
if ! command -v $1 &> /dev/null; then
log_error "$1 is not installed. Please install it first."
exit 1
fi
}
backup_file() {
local file="$1"
if [ -f "$file" ]; then
mkdir -p "$BACKUP_DIR"
cp "$file" "$BACKUP_DIR/"
log_info "Backed up $file to $BACKUP_DIR"
fi
}
################################################################################
# Prerequisites Check
################################################################################
check_prerequisites() {
log_info "Checking prerequisites..."
check_command "node"
check_command "npm"
check_command "python3"
check_command "curl"
# Check Node.js version (need 14+)
NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1)
if [ "$NODE_VERSION" -lt 14 ]; then
log_error "Node.js version 14 or higher required. Current: $(node -v)"
exit 1
fi
log_success "Prerequisites check passed"
}
################################################################################
# Directory Structure Setup
################################################################################
setup_directories() {
log_info "Setting up directory structure..."
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"
}
################################################################################
# Settings Configuration
################################################################################
setup_settings() {
log_info "Configuring Claude Code settings..."
local settings_file="$CLAUDE_DIR/settings.json"
backup_file "$settings_file"
# Prompt for API credentials
read -p "Enter your ANTHROPIC_AUTH_TOKEN (or press Enter to skip): " API_TOKEN
read -p "Enter your ANTHROPIC_BASE_URL (default: https://api.anthropic.com): " API_BASE
API_BASE=${API_BASE:-https://api.anthropic.com}
# Create settings.json
cat > "$settings_file" << EOF
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "${API_TOKEN}",
"ANTHROPIC_BASE_URL": "${API_BASE}",
"API_TIMEOUT_MS": "3000000",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
},
"enabledPlugins": {
"glm-plan-bug@zai-coding-plugins": true,
"glm-plan-usage@zai-coding-plugins": true
}
}
EOF
# Create local settings for permissions
local local_settings="$CLAUDE_DIR/settings.local.json"
backup_file "$local_settings"
cat > "$local_settings" << EOF
{
"permissions": {
"allow": [
"Bash(npm install:*)",
"Bash(npm run content:*)",
"Bash(npm run build:*)",
"Bash(grep:*)",
"Bash(find:*)",
"Bash(for:*)",
"Bash(do sed:*)",
"Bash(done)",
"Bash(python3:*)",
"Bash(while read f)",
"Bash(do echo \\"\\$f%-* \\$f\\")",
"Bash(ls:*)",
"Bash(node:*)",
"Bash(pm2 delete:*)",
"Bash(pm2 start npm:*)",
"Bash(pm2 save:*)"
]
}
}
EOF
log_success "Settings configured"
}
################################################################################
# MCP Services Installation
################################################################################
install_mcp_services() {
log_info "Installing MCP services..."
# Install @z_ai/mcp-server globally for vision tools
log_info "Installing @z_ai/mcp-server (vision analysis tools)..."
npm install -g @z_ai/mcp-server 2>/dev/null || {
log_warning "Global install failed, trying with npx..."
# It's okay if this fails, the tools will use npx
}
# Install @z_ai/coding-helper for MCP management
log_info "Installing @z_ai/coding-helper..."
npm install -g @z_ai/coding-helper 2>/dev/null || {
log_warning "Global install failed, will use npx"
}
log_success "MCP services installation completed"
}
################################################################################
# Agent Definitions
################################################################################
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
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/"
log_success "Agent structure ready"
}
################################################################################
# Plugins Installation
################################################################################
install_plugins() {
log_info "Installing Claude Code plugins..."
# Initialize plugin registry
local installed_plugins="$PLUGINS_DIR/installed_plugins.json"
local known_marketplaces="$PLUGINS_DIR/known_marketplaces.json"
backup_file "$installed_plugins"
backup_file "$known_marketplaces"
cat > "$known_marketplaces" << EOF
{
"marketplaces": {
"https://github.com/anthropics/claude-plugins": {
"displayName": "Official Claude Plugins",
"contact": "support@anthropic.com"
}
}
}
EOF
# Install GLM plugins via npx
log_info "Installing GLM Coding Plan plugins..."
# Create plugin cache structure
mkdir -p "$PLUGINS_DIR/cache/zai-coding-plugins"/{glm-plan-bug,glm-plan-usage}
# Note: Actual plugin installation happens via the @z_ai/coding-helper
# which should already be installed
cat > "$installed_plugins" << EOF
{
"version": 2,
"plugins": {
"glm-plan-bug@zai-coding-plugins": [
{
"scope": "user",
"installPath": "$PLUGINS_DIR/cache/zai-coding-plugins/glm-plan-bug/0.0.1",
"version": "0.0.1",
"installedAt": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)",
"lastUpdated": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)"
}
],
"glm-plan-usage@zai-coding-plugins": [
{
"scope": "user",
"installPath": "$PLUGINS_DIR/cache/zai-coding-plugins/glm-plan-usage/0.0.1",
"version": "0.0.1",
"installedAt": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)",
"lastUpdated": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)"
}
]
}
}
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
################################################################################
verify_installation() {
log_info "Verifying installation..."
local errors=0
# 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 "$PLUGINS_DIR" ] || { log_error "Plugins directory missing"; errors=$((errors+1)); }
# Check files
[ -f "$CLAUDE_DIR/settings.json" ] || { log_error "settings.json missing"; errors=$((errors+1)); }
[ -f "$CLAUDE_DIR/settings.local.json" ] || { log_error "settings.local.json missing"; errors=$((errors+1)); }
[ -f "$PLUGINS_DIR/installed_plugins.json" ] || { log_error "installed_plugins.json missing"; errors=$((errors+1)); }
# Check MCP availability
if command -v npx &> /dev/null; then
log_success "npx available for MCP tools"
else
log_error "npx not available"
errors=$((errors+1))
fi
if [ $errors -eq 0 ]; then
log_success "Installation verification passed"
return 0
else
log_error "Installation verification failed with $errors errors"
return 1
fi
}
################################################################################
# Main Installation Flow
################################################################################
main() {
echo -e "${BLUE}╔════════════════════════════════════════════════════════════╗${NC}"
echo -e "${BLUE}║ Claude Code Customizations - Automated Installer ║${NC}"
echo -e "${BLUE}╚════════════════════════════════════════════════════════════╝${NC}"
echo ""
# Parse command line arguments
SKIP_AGENTS_COPY=false
while [[ $# -gt 0 ]]; do
case $1 in
--skip-agents)
SKIP_AGENTS_COPY=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 ""
exit 0
;;
*)
log_error "Unknown option: $1"
echo "Use --help for usage information"
exit 1
;;
esac
done
# Run installation steps
check_prerequisites
setup_directories
setup_settings
install_mcp_services
install_agents
install_plugins
# Verify installation
if verify_installation; then
echo ""
log_success "═══════════════════════════════════════════════════════════"
log_success "Installation completed successfully!"
log_success "═══════════════════════════════════════════════════════════"
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 ""
echo "Backup location: $BACKUP_DIR"
echo ""
else
log_error "Installation failed. Please check the errors above."
exit 1
fi
}
# Run main function
main "$@"

File diff suppressed because it is too large Load Diff

View File

@@ -1,217 +1,217 @@
#!/usr/bin/env bash
################################################################################
# Claude Code Setup Verification Script
# Checks if all customizations are properly installed
################################################################################
set -e
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
CLAUDE_DIR="$HOME/.claude"
AGENTS_DIR="$CLAUDE_DIR/agents"
PLUGINS_DIR="$CLAUDE_DIR/plugins"
PASSED=0
FAILED=0
WARNINGS=0
check_pass() {
echo -e "${GREEN}${NC} $1"
PASSED=$((PASSED+1))
}
check_fail() {
echo -e "${RED}${NC} $1"
FAILED=$((FAILED+1))
}
check_warn() {
echo -e "${YELLOW}${NC} $1"
WARNINGS=$((WARNINGS+1))
}
check_info() {
echo -e "${BLUE}${NC} $1"
}
echo -e "${BLUE}╔════════════════════════════════════════════════════════════╗${NC}"
echo -e "${BLUE}║ Claude Code Customizations - Verification ║${NC}"
echo -e "${BLUE}╚════════════════════════════════════════════════════════════╝${NC}"
echo ""
# 1. Check directory structure
echo "═══════════════════════════════════════════════════════════"
echo "Directory Structure"
echo "═══════════════════════════════════════════════════════════"
[ -d "$CLAUDE_DIR" ] && check_pass "Claude directory exists" || check_fail "Claude directory missing"
[ -d "$AGENTS_DIR" ] && check_pass "Agents directory exists" || check_fail "Agents directory missing"
[ -d "$PLUGINS_DIR" ] && check_pass "Plugins directory exists" || check_fail "Plugins directory missing"
echo ""
echo "═══════════════════════════════════════════════════════════"
echo "Agent Categories"
echo "═══════════════════════════════════════════════════════════"
CATEGORIES=("engineering" "marketing" "product" "studio-operations" "project-management" "testing" "design" "bonus")
AGENT_COUNT=0
for category in "${CATEGORIES[@]}"; do
if [ -d "$AGENTS_DIR/$category" ]; then
count=$(ls -1 "$AGENTS_DIR/$category"/*.md 2>/dev/null | wc -l)
if [ $count -gt 0 ]; then
echo -e "${GREEN}${NC} $category: $count agents"
AGENT_COUNT=$((AGENT_COUNT + count))
else
check_warn "$category: directory exists but no agents"
fi
else
check_fail "$category: directory missing"
fi
done
echo ""
check_info "Total agents: $AGENT_COUNT"
# 2. Check configuration files
echo ""
echo "═══════════════════════════════════════════════════════════"
echo "Configuration Files"
echo "═══════════════════════════════════════════════════════════"
[ -f "$CLAUDE_DIR/settings.json" ] && check_pass "settings.json exists" || check_fail "settings.json missing"
[ -f "$CLAUDE_DIR/settings.local.json" ] && check_pass "settings.local.json exists" || check_fail "settings.local.json missing"
[ -f "$PLUGINS_DIR/installed_plugins.json" ] && check_pass "installed_plugins.json exists" || check_fail "installed_plugins.json missing"
[ -f "$PLUGINS_DIR/known_marketplaces.json" ] && check_pass "known_marketplaces.json exists" || check_fail "known_marketplaces.json missing"
# 3. Check MCP tools
echo ""
echo "═══════════════════════════════════════════════════════════"
echo "MCP Tools"
echo "═══════════════════════════════════════════════════════════"
if command -v npx &> /dev/null; then
check_pass "npx available"
# Check if @z_ai/mcp-server can be accessed
if npx -y @z_ai/mcp-server --help &> /dev/null; then
check_pass "@z_ai/mcp-server accessible"
else
check_warn "@z_ai/mcp-server not directly accessible (may download on first use)"
fi
# Check if @z_ai/coding-helper can be accessed
if npx -y @z_ai/coding-helper --help &> /dev/null; then
check_pass "@z_ai/coding-helper accessible"
else
check_warn "@z_ai/coding-helper not directly accessible (may download on first use)"
fi
else
check_fail "npx not available - MCP tools may not work"
fi
# 4. Check plugins
echo ""
echo "═══════════════════════════════════════════════════════════"
echo "Plugins"
echo "═══════════════════════════════════════════════════════════"
if [ -f "$PLUGINS_DIR/installed_plugins.json" ]; then
# Check if GLM plugins are registered
if grep -q "glm-plan-bug" "$PLUGINS_DIR/installed_plugins.json" 2>/dev/null; then
check_pass "glm-plan-bug plugin registered"
else
check_warn "glm-plan-bug plugin not registered"
fi
if grep -q "glm-plan-usage" "$PLUGINS_DIR/installed_plugins.json" 2>/dev/null; then
check_pass "glm-plan-usage plugin registered"
else
check_warn "glm-plan-usage plugin not registered"
fi
fi
# 5. Sample agent check
echo ""
echo "═══════════════════════════════════════════════════════════"
echo "Agent Content Verification"
echo "═══════════════════════════════════════════════════════════"
CRITICAL_AGENTS=(
"engineering/test-writer-fixer.md"
"engineering/frontend-developer.md"
"marketing/tiktok-strategist.md"
"product/sprint-prioritizer.md"
"studio-operations/studio-producer.md"
"project-management/project-shipper.md"
"design/whimsy-injector.md"
)
for agent in "${CRITICAL_AGENTS[@]}"; do
if [ -f "$AGENTS_DIR/$agent" ]; then
# Check file has content
if [ -s "$AGENTS_DIR/$agent" ]; then
check_pass "$agent exists and has content"
else
check_warn "$agent exists but is empty"
fi
else
check_warn "$agent missing"
fi
done
# 6. Settings validation
echo ""
echo "═══════════════════════════════════════════════════════════"
echo "Settings Validation"
echo "═══════════════════════════════════════════════════════════"
if [ -f "$CLAUDE_DIR/settings.json" ]; then
# Check if JSON is valid
if python3 -m json.tool "$CLAUDE_DIR/settings.json" &> /dev/null; then
check_pass "settings.json is valid JSON"
# Check for API token placeholder
if grep -q "YOUR_API_TOKEN_HERE\|YOUR_TOKEN_HERE" "$CLAUDE_DIR/settings.json" 2>/dev/null; then
check_warn "API token not configured (still placeholder)"
else
if grep -q "ANTHROPIC_AUTH_TOKEN" "$CLAUDE_DIR/settings.json" 2>/dev/null; then
check_pass "ANTHROPIC_AUTH_TOKEN is set"
fi
fi
else
check_fail "settings.json is not valid JSON"
fi
fi
# 7. Summary
echo ""
echo "═══════════════════════════════════════════════════════════"
echo "Summary"
echo "═══════════════════════════════════════════════════════════"
if [ $FAILED -eq 0 ]; then
echo -e "${GREEN}✓ All critical checks passed!${NC}"
echo ""
echo "Passed: $PASSED"
echo "Warnings: $WARNINGS"
echo "Failed: $FAILED"
echo ""
echo -e "${GREEN}Your Claude Code setup is ready to use!${NC}"
exit 0
else
echo -e "${RED}✗ Some checks failed${NC}"
echo ""
echo "Passed: $PASSED"
echo "Warnings: $WARNINGS"
echo "Failed: $FAILED"
echo ""
echo "Please fix the failed checks above."
exit 1
fi
#!/usr/bin/env bash
################################################################################
# Claude Code Setup Verification Script
# Checks if all customizations are properly installed
################################################################################
set -e
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
CLAUDE_DIR="$HOME/.claude"
AGENTS_DIR="$CLAUDE_DIR/agents"
PLUGINS_DIR="$CLAUDE_DIR/plugins"
PASSED=0
FAILED=0
WARNINGS=0
check_pass() {
echo -e "${GREEN}${NC} $1"
PASSED=$((PASSED+1))
}
check_fail() {
echo -e "${RED}${NC} $1"
FAILED=$((FAILED+1))
}
check_warn() {
echo -e "${YELLOW}${NC} $1"
WARNINGS=$((WARNINGS+1))
}
check_info() {
echo -e "${BLUE}${NC} $1"
}
echo -e "${BLUE}╔════════════════════════════════════════════════════════════╗${NC}"
echo -e "${BLUE}║ Claude Code Customizations - Verification ║${NC}"
echo -e "${BLUE}╚════════════════════════════════════════════════════════════╝${NC}"
echo ""
# 1. Check directory structure
echo "═══════════════════════════════════════════════════════════"
echo "Directory Structure"
echo "═══════════════════════════════════════════════════════════"
[ -d "$CLAUDE_DIR" ] && check_pass "Claude directory exists" || check_fail "Claude directory missing"
[ -d "$AGENTS_DIR" ] && check_pass "Agents directory exists" || check_fail "Agents directory missing"
[ -d "$PLUGINS_DIR" ] && check_pass "Plugins directory exists" || check_fail "Plugins directory missing"
echo ""
echo "═══════════════════════════════════════════════════════════"
echo "Agent Categories"
echo "═══════════════════════════════════════════════════════════"
CATEGORIES=("engineering" "marketing" "product" "studio-operations" "project-management" "testing" "design" "bonus")
AGENT_COUNT=0
for category in "${CATEGORIES[@]}"; do
if [ -d "$AGENTS_DIR/$category" ]; then
count=$(ls -1 "$AGENTS_DIR/$category"/*.md 2>/dev/null | wc -l)
if [ $count -gt 0 ]; then
echo -e "${GREEN}${NC} $category: $count agents"
AGENT_COUNT=$((AGENT_COUNT + count))
else
check_warn "$category: directory exists but no agents"
fi
else
check_fail "$category: directory missing"
fi
done
echo ""
check_info "Total agents: $AGENT_COUNT"
# 2. Check configuration files
echo ""
echo "═══════════════════════════════════════════════════════════"
echo "Configuration Files"
echo "═══════════════════════════════════════════════════════════"
[ -f "$CLAUDE_DIR/settings.json" ] && check_pass "settings.json exists" || check_fail "settings.json missing"
[ -f "$CLAUDE_DIR/settings.local.json" ] && check_pass "settings.local.json exists" || check_fail "settings.local.json missing"
[ -f "$PLUGINS_DIR/installed_plugins.json" ] && check_pass "installed_plugins.json exists" || check_fail "installed_plugins.json missing"
[ -f "$PLUGINS_DIR/known_marketplaces.json" ] && check_pass "known_marketplaces.json exists" || check_fail "known_marketplaces.json missing"
# 3. Check MCP tools
echo ""
echo "═══════════════════════════════════════════════════════════"
echo "MCP Tools"
echo "═══════════════════════════════════════════════════════════"
if command -v npx &> /dev/null; then
check_pass "npx available"
# Check if @z_ai/mcp-server can be accessed
if npx -y @z_ai/mcp-server --help &> /dev/null; then
check_pass "@z_ai/mcp-server accessible"
else
check_warn "@z_ai/mcp-server not directly accessible (may download on first use)"
fi
# Check if @z_ai/coding-helper can be accessed
if npx -y @z_ai/coding-helper --help &> /dev/null; then
check_pass "@z_ai/coding-helper accessible"
else
check_warn "@z_ai/coding-helper not directly accessible (may download on first use)"
fi
else
check_fail "npx not available - MCP tools may not work"
fi
# 4. Check plugins
echo ""
echo "═══════════════════════════════════════════════════════════"
echo "Plugins"
echo "═══════════════════════════════════════════════════════════"
if [ -f "$PLUGINS_DIR/installed_plugins.json" ]; then
# Check if GLM plugins are registered
if grep -q "glm-plan-bug" "$PLUGINS_DIR/installed_plugins.json" 2>/dev/null; then
check_pass "glm-plan-bug plugin registered"
else
check_warn "glm-plan-bug plugin not registered"
fi
if grep -q "glm-plan-usage" "$PLUGINS_DIR/installed_plugins.json" 2>/dev/null; then
check_pass "glm-plan-usage plugin registered"
else
check_warn "glm-plan-usage plugin not registered"
fi
fi
# 5. Sample agent check
echo ""
echo "═══════════════════════════════════════════════════════════"
echo "Agent Content Verification"
echo "═══════════════════════════════════════════════════════════"
CRITICAL_AGENTS=(
"engineering/test-writer-fixer.md"
"engineering/frontend-developer.md"
"marketing/tiktok-strategist.md"
"product/sprint-prioritizer.md"
"studio-operations/studio-producer.md"
"project-management/project-shipper.md"
"design/whimsy-injector.md"
)
for agent in "${CRITICAL_AGENTS[@]}"; do
if [ -f "$AGENTS_DIR/$agent" ]; then
# Check file has content
if [ -s "$AGENTS_DIR/$agent" ]; then
check_pass "$agent exists and has content"
else
check_warn "$agent exists but is empty"
fi
else
check_warn "$agent missing"
fi
done
# 6. Settings validation
echo ""
echo "═══════════════════════════════════════════════════════════"
echo "Settings Validation"
echo "═══════════════════════════════════════════════════════════"
if [ -f "$CLAUDE_DIR/settings.json" ]; then
# Check if JSON is valid
if python3 -m json.tool "$CLAUDE_DIR/settings.json" &> /dev/null; then
check_pass "settings.json is valid JSON"
# Check for API token placeholder
if grep -q "YOUR_API_TOKEN_HERE\|YOUR_TOKEN_HERE" "$CLAUDE_DIR/settings.json" 2>/dev/null; then
check_warn "API token not configured (still placeholder)"
else
if grep -q "ANTHROPIC_AUTH_TOKEN" "$CLAUDE_DIR/settings.json" 2>/dev/null; then
check_pass "ANTHROPIC_AUTH_TOKEN is set"
fi
fi
else
check_fail "settings.json is not valid JSON"
fi
fi
# 7. Summary
echo ""
echo "═══════════════════════════════════════════════════════════"
echo "Summary"
echo "═══════════════════════════════════════════════════════════"
if [ $FAILED -eq 0 ]; then
echo -e "${GREEN}✓ All critical checks passed!${NC}"
echo ""
echo "Passed: $PASSED"
echo "Warnings: $WARNINGS"
echo "Failed: $FAILED"
echo ""
echo -e "${GREEN}Your Claude Code setup is ready to use!${NC}"
exit 0
else
echo -e "${RED}✗ Some checks failed${NC}"
echo ""
echo "Passed: $PASSED"
echo "Warnings: $WARNINGS"
echo "Failed: $FAILED"
echo ""
echo "Please fix the failed checks above."
exit 1
fi

View File

@@ -1,82 +1,82 @@
#!/bin/bash
# WordPress Safe Content Update Script
# Prevents encoding issues when updating WordPress post content
# Usage: ./wordpress_safe_update.sh <post_id> <html_file_path>
set -euo pipefail
# Configuration
DB_NAME="wordpress"
DB_USER="root"
TABLE_PREFIX="wp_"
# Check arguments
if [ $# -ne 2 ]; then
echo "Usage: $0 <post_id> <html_file_path>"
echo "Example: $0 112 /tmp/article_content.html"
exit 1
fi
POST_ID="$1"
HTML_FILE="$2"
# Verify file exists
if [ ! -f "$HTML_FILE" ]; then
echo "Error: File not found: $HTML_FILE"
exit 1
fi
# Verify file is readable
if [ ! -r "$HTML_FILE" ]; then
echo "Error: File is not readable: $HTML_FILE"
exit 1
fi
# Check file encoding
FILE_ENCODING=$(file -b --mime-encoding "$HTML_FILE")
if [[ ! "$FILE_ENCODING" =~ utf-8 ]]; then
echo "Warning: File encoding is $FILE_ENCODING, expected utf-8"
echo "Converting to UTF-8..."
iconv -f UTF-8 -t UTF-8 "$HTML_FILE" > "${HTML_FILE}.utf8"
mv "${HTML_FILE}.utf8" "$HTML_FILE"
fi
# Verify no literal escape sequences
if grep -q '\\n' "$HTML_FILE"; then
echo "Error: File contains literal \\n escape sequences"
echo "Please fix the file before updating WordPress"
exit 1
fi
# Backup current content
echo "Backing up current content..."
sudo mysql "${DB_NAME}" --skip-column-names --raw \
-e "SELECT post_content FROM ${TABLE_PREFIX}posts WHERE ID = ${POST_ID};" \
> "/tmp/wp_post_${POST_ID}_backup_$(date +%Y%m%d_%H%M%S).html"
# Update post content
echo "Updating post ID ${POST_ID}..."
sudo mysql "${DB_NAME}" \
-e "UPDATE ${TABLE_PREFIX}posts SET post_content = LOAD_FILE('${HTML_FILE}') WHERE ID = ${POST_ID};"
# Verify update
RESULT=$(sudo mysql "${DB_NAME}" --skip-column-names --raw \
-e "SELECT post_content FROM ${TABLE_PREFIX}posts WHERE ID = ${POST_ID};" \
| head -20)
if echo "$RESULT" | grep -q '<!DOCTYPE\|<section\|<div'; then
echo "✓ Update successful!"
echo "✓ Post ID ${POST_ID} has been updated"
echo "✓ Content verified"
else
echo "✗ Update may have failed - please verify manually"
exit 1
fi
echo ""
echo "Verification preview:"
echo "$RESULT"
echo ""
echo "To view full content:"
echo "sudo mysql ${DB_NAME} --skip-column-names --raw -e \"SELECT post_content FROM ${TABLE_PREFIX}posts WHERE ID = ${POST_ID};\""
#!/bin/bash
# WordPress Safe Content Update Script
# Prevents encoding issues when updating WordPress post content
# Usage: ./wordpress_safe_update.sh <post_id> <html_file_path>
set -euo pipefail
# Configuration
DB_NAME="wordpress"
DB_USER="root"
TABLE_PREFIX="wp_"
# Check arguments
if [ $# -ne 2 ]; then
echo "Usage: $0 <post_id> <html_file_path>"
echo "Example: $0 112 /tmp/article_content.html"
exit 1
fi
POST_ID="$1"
HTML_FILE="$2"
# Verify file exists
if [ ! -f "$HTML_FILE" ]; then
echo "Error: File not found: $HTML_FILE"
exit 1
fi
# Verify file is readable
if [ ! -r "$HTML_FILE" ]; then
echo "Error: File is not readable: $HTML_FILE"
exit 1
fi
# Check file encoding
FILE_ENCODING=$(file -b --mime-encoding "$HTML_FILE")
if [[ ! "$FILE_ENCODING" =~ utf-8 ]]; then
echo "Warning: File encoding is $FILE_ENCODING, expected utf-8"
echo "Converting to UTF-8..."
iconv -f UTF-8 -t UTF-8 "$HTML_FILE" > "${HTML_FILE}.utf8"
mv "${HTML_FILE}.utf8" "$HTML_FILE"
fi
# Verify no literal escape sequences
if grep -q '\\n' "$HTML_FILE"; then
echo "Error: File contains literal \\n escape sequences"
echo "Please fix the file before updating WordPress"
exit 1
fi
# Backup current content
echo "Backing up current content..."
sudo mysql "${DB_NAME}" --skip-column-names --raw \
-e "SELECT post_content FROM ${TABLE_PREFIX}posts WHERE ID = ${POST_ID};" \
> "/tmp/wp_post_${POST_ID}_backup_$(date +%Y%m%d_%H%M%S).html"
# Update post content
echo "Updating post ID ${POST_ID}..."
sudo mysql "${DB_NAME}" \
-e "UPDATE ${TABLE_PREFIX}posts SET post_content = LOAD_FILE('${HTML_FILE}') WHERE ID = ${POST_ID};"
# Verify update
RESULT=$(sudo mysql "${DB_NAME}" --skip-column-names --raw \
-e "SELECT post_content FROM ${TABLE_PREFIX}posts WHERE ID = ${POST_ID};" \
| head -20)
if echo "$RESULT" | grep -q '<!DOCTYPE\|<section\|<div'; then
echo "✓ Update successful!"
echo "✓ Post ID ${POST_ID} has been updated"
echo "✓ Content verified"
else
echo "✗ Update may have failed - please verify manually"
exit 1
fi
echo ""
echo "Verification preview:"
echo "$RESULT"
echo ""
echo "To view full content:"
echo "sudo mysql ${DB_NAME} --skip-column-names --raw -e \"SELECT post_content FROM ${TABLE_PREFIX}posts WHERE ID = ${POST_ID};\""

View File

@@ -1,440 +1,440 @@
#!/bin/bash
################################################################################
# SuperCharge Claude Code - Ultimate Installation Script
################################################################################
# This script transforms any Claude Code installation into a supercharged
# version with all customizations, skills, agents, plugins, and integrations.
#
# Features:
# - 30+ Custom Skills (cognitive, development, UI/UX, brainstorming)
# - RalphLoop autonomous agent integration
# - Multi-AI consultation (Qwen integration)
# - Agent management system with sync capabilities
# - Custom hooks for session management
# - MCP servers integration
# - 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 ║
║ ║
╚═══════════════════════════════════════════════════════════════╝
EOF
echo -e "${NC}"
}
check_claude_code() {
log_step "Checking for Claude Code installation..."
if ! command -v claude &> /dev/null; then
log_error "Claude Code CLI not found!"
echo "Please install Claude Code first: https://claude.com/claude-code"
exit 1
fi
log_success "Claude Code found: $(claude --version 2>/dev/null || echo 'installed')"
}
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
log_success "Node.js found: $(node --version)"
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 if not present
if ! command -v ralph &> /dev/null; then
log_info "Installing Ralph Orchestrator..."
if command -v pip3 &> /dev/null; then
pip3 install ralph-orchestrator 2>/dev/null || log_warn "Failed to install Ralph Orchestrator"
else
log_warn "pip3 not found. Skipping Ralph Orchestrator installation."
fi
else
log_success "Ralph Orchestrator found"
fi
}
install_skills() {
log_step "Installing custom skills..."
mkdir -p "$CLAUDE_DIR/skills"
# Copy all 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" | wc -l)
log_success "Installed $skill_count 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"
# Make scripts executable
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
# Make hook scripts executable
find "$CLAUDE_DIR/hooks" -name "*.sh" -exec chmod +x {} \;
log_success "Custom hooks installed"
else
log_warn "Hooks directory not found"
fi
# Install hooks.json if it doesn't exist
if [ -f "$SCRIPT_DIR/templates/hooks.json" ] && [ ! -f "$CLAUDE_DIR/hooks.json" ]; then
cp "$SCRIPT_DIR/templates/hooks.json" "$CLAUDE_DIR/hooks.json"
log_success "Hooks configuration 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 custom commands"
else
log_warn "Commands directory not found"
fi
}
install_plugins() {
log_step "Installing plugin references..."
mkdir -p "$CLAUDE_DIR/plugins"
if [ -d "$SCRIPT_DIR/plugins" ]; then
cp -r "$SCRIPT_DIR/plugins/"* "$CLAUDE_DIR/plugins/" 2>/dev/null || true
local plugin_count=$(find "$SCRIPT_DIR/plugins" -type d -mindepth 1 | wc -l)
log_success "Installed $plugin_count plugin references"
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"
# Add to PATH if not already there
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
# Make scripts executable
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
# Install config.json if not exists
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
# Merge settings.json
if [ -f "$SCRIPT_DIR/templates/settings.json" ]; then
if [ -f "$CLAUDE_DIR/settings.json" ]; then
# Merge existing settings with template
local temp_file=$(mktemp)
python3 -c "
import json
import sys
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 = {}
# Merge: template values take precedence for keys that exist in template
for key in template:
if key != 'permissions': # Don't override 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
# Install settings.local.json if not exists
if [ -f "$SCRIPT_DIR/templates/settings.local.json" ] && [ ! -f "$CLAUDE_DIR/settings.local.json" ]; then
cp "$SCRIPT_DIR/templates/settings.local.json" "$CLAUDE_DIR/settings.local.json"
log_success "settings.local.json installed"
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! ║${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} 30+ Custom Skills (cognitive, development, UI/UX)"
echo -e " ${GREEN}${NC} RalphLoop Autonomous Agent Integration"
echo -e " ${GREEN}${NC} Multi-AI Consultation (Qwen)"
echo -e " ${GREEN}${NC} Agent Management System"
echo -e " ${GREEN}${NC} Custom Hooks & Commands"
echo -e " ${GREEN}${NC} Plugin Marketplace Setup"
echo ""
echo -e "${CYAN}New Commands Available:${NC}"
echo -e " ${YELLOW}/ralph${NC} - Autonomous \"Tackle Until Solved\" agent"
echo -e " ${YELLOW}/brainstorm${NC} - Multi-AI brainstorming session"
echo -e " ${YELLOW}/write-plan${NC} - Create implementation plans"
echo -e " ${YELLOW}/execute-plan${NC} - Execute written plans"
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: ${YELLOW}/ralph \"Design a microservices architecture\"${NC}"
echo ""
echo -e "${CYAN}Configuration:${NC}"
echo -e " Config dir: ${YELLOW}$CLAUDE_DIR${NC}"
echo -e " Backup: ${YELLOW}$BACKUP_DIR${NC}"
echo ""
echo -e "${CYAN}Optional Configuration:${NC}"
echo -e " ${YELLOW}export RALPH_AGENT=claude${NC} # Set Ralph agent"
echo -e " ${YELLOW}export RALPH_MAX_ITERATIONS=100${NC} # Set max iterations"
echo -e " ${YELLOW}export QWEN_CONSULT_MODE=always${NC} # Qwen consultation mode"
echo ""
echo -e "${GREEN}${BOLD}Enjoy your supercharged Claude Code experience!${NC}"
echo ""
}
################################################################################
# Main Installation
################################################################################
main() {
print_banner
# Parse arguments
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
# Run installation steps
check_claude_code
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
}
# Run main function
main "$@"
#!/bin/bash
################################################################################
# SuperCharge Claude Code - Ultimate Installation Script
################################################################################
# This script transforms any Claude Code installation into a supercharged
# version with all customizations, skills, agents, plugins, and integrations.
#
# Features:
# - 30+ Custom Skills (cognitive, development, UI/UX, brainstorming)
# - RalphLoop autonomous agent integration
# - Multi-AI consultation (Qwen integration)
# - Agent management system with sync capabilities
# - Custom hooks for session management
# - MCP servers integration
# - 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 ║
║ ║
╚═══════════════════════════════════════════════════════════════╝
EOF
echo -e "${NC}"
}
check_claude_code() {
log_step "Checking for Claude Code installation..."
if ! command -v claude &> /dev/null; then
log_error "Claude Code CLI not found!"
echo "Please install Claude Code first: https://claude.com/claude-code"
exit 1
fi
log_success "Claude Code found: $(claude --version 2>/dev/null || echo 'installed')"
}
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
log_success "Node.js found: $(node --version)"
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 if not present
if ! command -v ralph &> /dev/null; then
log_info "Installing Ralph Orchestrator..."
if command -v pip3 &> /dev/null; then
pip3 install ralph-orchestrator 2>/dev/null || log_warn "Failed to install Ralph Orchestrator"
else
log_warn "pip3 not found. Skipping Ralph Orchestrator installation."
fi
else
log_success "Ralph Orchestrator found"
fi
}
install_skills() {
log_step "Installing custom skills..."
mkdir -p "$CLAUDE_DIR/skills"
# Copy all 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" | wc -l)
log_success "Installed $skill_count 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"
# Make scripts executable
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
# Make hook scripts executable
find "$CLAUDE_DIR/hooks" -name "*.sh" -exec chmod +x {} \;
log_success "Custom hooks installed"
else
log_warn "Hooks directory not found"
fi
# Install hooks.json if it doesn't exist
if [ -f "$SCRIPT_DIR/templates/hooks.json" ] && [ ! -f "$CLAUDE_DIR/hooks.json" ]; then
cp "$SCRIPT_DIR/templates/hooks.json" "$CLAUDE_DIR/hooks.json"
log_success "Hooks configuration 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 custom commands"
else
log_warn "Commands directory not found"
fi
}
install_plugins() {
log_step "Installing plugin references..."
mkdir -p "$CLAUDE_DIR/plugins"
if [ -d "$SCRIPT_DIR/plugins" ]; then
cp -r "$SCRIPT_DIR/plugins/"* "$CLAUDE_DIR/plugins/" 2>/dev/null || true
local plugin_count=$(find "$SCRIPT_DIR/plugins" -type d -mindepth 1 | wc -l)
log_success "Installed $plugin_count plugin references"
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"
# Add to PATH if not already there
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
# Make scripts executable
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
# Install config.json if not exists
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
# Merge settings.json
if [ -f "$SCRIPT_DIR/templates/settings.json" ]; then
if [ -f "$CLAUDE_DIR/settings.json" ]; then
# Merge existing settings with template
local temp_file=$(mktemp)
python3 -c "
import json
import sys
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 = {}
# Merge: template values take precedence for keys that exist in template
for key in template:
if key != 'permissions': # Don't override 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
# Install settings.local.json if not exists
if [ -f "$SCRIPT_DIR/templates/settings.local.json" ] && [ ! -f "$CLAUDE_DIR/settings.local.json" ]; then
cp "$SCRIPT_DIR/templates/settings.local.json" "$CLAUDE_DIR/settings.local.json"
log_success "settings.local.json installed"
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! ║${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} 30+ Custom Skills (cognitive, development, UI/UX)"
echo -e " ${GREEN}${NC} RalphLoop Autonomous Agent Integration"
echo -e " ${GREEN}${NC} Multi-AI Consultation (Qwen)"
echo -e " ${GREEN}${NC} Agent Management System"
echo -e " ${GREEN}${NC} Custom Hooks & Commands"
echo -e " ${GREEN}${NC} Plugin Marketplace Setup"
echo ""
echo -e "${CYAN}New Commands Available:${NC}"
echo -e " ${YELLOW}/ralph${NC} - Autonomous \"Tackle Until Solved\" agent"
echo -e " ${YELLOW}/brainstorm${NC} - Multi-AI brainstorming session"
echo -e " ${YELLOW}/write-plan${NC} - Create implementation plans"
echo -e " ${YELLOW}/execute-plan${NC} - Execute written plans"
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: ${YELLOW}/ralph \"Design a microservices architecture\"${NC}"
echo ""
echo -e "${CYAN}Configuration:${NC}"
echo -e " Config dir: ${YELLOW}$CLAUDE_DIR${NC}"
echo -e " Backup: ${YELLOW}$BACKUP_DIR${NC}"
echo ""
echo -e "${CYAN}Optional Configuration:${NC}"
echo -e " ${YELLOW}export RALPH_AGENT=claude${NC} # Set Ralph agent"
echo -e " ${YELLOW}export RALPH_MAX_ITERATIONS=100${NC} # Set max iterations"
echo -e " ${YELLOW}export QWEN_CONSULT_MODE=always${NC} # Qwen consultation mode"
echo ""
echo -e "${GREEN}${BOLD}Enjoy your supercharged Claude Code experience!${NC}"
echo ""
}
################################################################################
# Main Installation
################################################################################
main() {
print_banner
# Parse arguments
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
# Run installation steps
check_claude_code
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
}
# Run main function
main "$@"