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:
@@ -1,329 +1,329 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
################################################################################
|
################################################################################
|
||||||
# Claude Code Customizations - Master Control Script
|
# Claude Code Customizations - Master Control Script
|
||||||
# Provides an interactive menu for all setup operations
|
# Provides an interactive menu for all setup operations
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
# Colors
|
# Colors
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
GREEN='\033[0;32m'
|
GREEN='\033[0;32m'
|
||||||
YELLOW='\033[1;33m'
|
YELLOW='\033[1;33m'
|
||||||
BLUE='\033[0;34m'
|
BLUE='\033[0;34m'
|
||||||
CYAN='\033[0;36m'
|
CYAN='\033[0;36m'
|
||||||
BOLD='\033[1m'
|
BOLD='\033[1m'
|
||||||
NC='\033[0m'
|
NC='\033[0m'
|
||||||
|
|
||||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
# Script paths
|
# Script paths
|
||||||
INSTALL_SCRIPT="$SCRIPT_DIR/install-claude-customizations.sh"
|
INSTALL_SCRIPT="$SCRIPT_DIR/install-claude-customizations.sh"
|
||||||
EXPORT_SCRIPT="$SCRIPT_DIR/export-claude-customizations.sh"
|
EXPORT_SCRIPT="$SCRIPT_DIR/export-claude-customizations.sh"
|
||||||
PACKAGE_SCRIPT="$SCRIPT_DIR/create-complete-package.sh"
|
PACKAGE_SCRIPT="$SCRIPT_DIR/create-complete-package.sh"
|
||||||
VERIFY_SCRIPT="$SCRIPT_DIR/verify-claude-setup.sh"
|
VERIFY_SCRIPT="$SCRIPT_DIR/verify-claude-setup.sh"
|
||||||
|
|
||||||
# Helper functions
|
# Helper functions
|
||||||
print_header() {
|
print_header() {
|
||||||
clear
|
clear
|
||||||
echo -e "${CYAN}╔══════════════════════════════════════════════════════════════════╗${NC}"
|
echo -e "${CYAN}╔══════════════════════════════════════════════════════════════════╗${NC}"
|
||||||
echo -e "${CYAN}║${NC} ${BOLD}Claude Code Customizations - Setup Manager${NC} ${CYAN}║${NC}"
|
echo -e "${CYAN}║${NC} ${BOLD}Claude Code Customizations - Setup Manager${NC} ${CYAN}║${NC}"
|
||||||
echo -e "${CYAN}╚══════════════════════════════════════════════════════════════════╝${NC}"
|
echo -e "${CYAN}╚══════════════════════════════════════════════════════════════════╝${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
print_menu() {
|
print_menu() {
|
||||||
print_header
|
print_header
|
||||||
echo -e "${BOLD}Main Menu:${NC}"
|
echo -e "${BOLD}Main Menu:${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
echo -e " ${GREEN}1${NC}) 📦 Create Complete Package (recommended for distribution)"
|
echo -e " ${GREEN}1${NC}) 📦 Create Complete Package (recommended for distribution)"
|
||||||
echo -e " ${GREEN}2${NC}) 📥 Install Customizations (on new machine)"
|
echo -e " ${GREEN}2${NC}) 📥 Install Customizations (on new machine)"
|
||||||
echo -e " ${GREEN}3${NC}) 📤 Export Customizations (backup/transfer)"
|
echo -e " ${GREEN}3${NC}) 📤 Export Customizations (backup/transfer)"
|
||||||
echo -e " ${GREEN}4${NC}) ✅ Verify Installation"
|
echo -e " ${GREEN}4${NC}) ✅ Verify Installation"
|
||||||
echo -e " ${GREEN}5${NC}) 📋 Show Package Contents"
|
echo -e " ${GREEN}5${NC}) 📋 Show Package Contents"
|
||||||
echo -e " ${GREEN}6${NC}) 📖 View Documentation"
|
echo -e " ${GREEN}6${NC}) 📖 View Documentation"
|
||||||
echo -e " ${GREEN}7${NC}) 🧹 Clean Backup Files"
|
echo -e " ${GREEN}7${NC}) 🧹 Clean Backup Files"
|
||||||
echo ""
|
echo ""
|
||||||
echo -e " ${YELLOW}0${NC}) 🚪 Exit"
|
echo -e " ${YELLOW}0${NC}) 🚪 Exit"
|
||||||
echo ""
|
echo ""
|
||||||
echo -ne "${CYAN}Select an option: ${NC}"
|
echo -ne "${CYAN}Select an option: ${NC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
check_script() {
|
check_script() {
|
||||||
local script="$1"
|
local script="$1"
|
||||||
local name="$2"
|
local name="$2"
|
||||||
|
|
||||||
if [ ! -f "$script" ]; then
|
if [ ! -f "$script" ]; then
|
||||||
echo -e "${RED}✗ Error: $name not found at $script${NC}"
|
echo -e "${RED}✗ Error: $name not found at $script${NC}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -x "$script" ]; then
|
if [ ! -x "$script" ]; then
|
||||||
echo -e "${YELLOW}⚠ Making $name executable...${NC}"
|
echo -e "${YELLOW}⚠ Making $name executable...${NC}"
|
||||||
chmod +x "$script"
|
chmod +x "$script"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
create_package() {
|
create_package() {
|
||||||
print_header
|
print_header
|
||||||
echo -e "${BOLD}Create Complete Package${NC}"
|
echo -e "${BOLD}Create Complete Package${NC}"
|
||||||
echo "═══════════════════════════════════════════════════════════"
|
echo "═══════════════════════════════════════════════════════════"
|
||||||
echo ""
|
echo ""
|
||||||
echo "This will create a complete package with all agents, plugins,"
|
echo "This will create a complete package with all agents, plugins,"
|
||||||
echo "and configurations ready for distribution."
|
echo "and configurations ready for distribution."
|
||||||
echo ""
|
echo ""
|
||||||
read -p "Continue? (y/N): " confirm
|
read -p "Continue? (y/N): " confirm
|
||||||
|
|
||||||
if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
|
if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if check_script "$PACKAGE_SCRIPT" "Package Script"; then
|
if check_script "$PACKAGE_SCRIPT" "Package Script"; then
|
||||||
echo ""
|
echo ""
|
||||||
bash "$PACKAGE_SCRIPT"
|
bash "$PACKAGE_SCRIPT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
read -p "Press Enter to continue..."
|
read -p "Press Enter to continue..."
|
||||||
}
|
}
|
||||||
|
|
||||||
install_customizations() {
|
install_customizations() {
|
||||||
print_header
|
print_header
|
||||||
echo -e "${BOLD}Install Customizations${NC}"
|
echo -e "${BOLD}Install Customizations${NC}"
|
||||||
echo "═══════════════════════════════════════════════════════════"
|
echo "═══════════════════════════════════════════════════════════"
|
||||||
echo ""
|
echo ""
|
||||||
echo "This will install Claude Code customizations on this machine."
|
echo "This will install Claude Code customizations on this machine."
|
||||||
echo ""
|
echo ""
|
||||||
echo "Note: If you're creating a complete package, use option 1 instead."
|
echo "Note: If you're creating a complete package, use option 1 instead."
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
if check_script "$INSTALL_SCRIPT" "Install Script"; then
|
if check_script "$INSTALL_SCRIPT" "Install Script"; then
|
||||||
echo ""
|
echo ""
|
||||||
bash "$INSTALL_SCRIPT"
|
bash "$INSTALL_SCRIPT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
read -p "Press Enter to continue..."
|
read -p "Press Enter to continue..."
|
||||||
}
|
}
|
||||||
|
|
||||||
export_customizations() {
|
export_customizations() {
|
||||||
print_header
|
print_header
|
||||||
echo -e "${BOLD}Export Customizations${NC}"
|
echo -e "${BOLD}Export Customizations${NC}"
|
||||||
echo "═══════════════════════════════════════════════════════════"
|
echo "═══════════════════════════════════════════════════════════"
|
||||||
echo ""
|
echo ""
|
||||||
echo "This will export your current customizations to a package"
|
echo "This will export your current customizations to a package"
|
||||||
echo "for backup or transfer to another machine."
|
echo "for backup or transfer to another machine."
|
||||||
echo ""
|
echo ""
|
||||||
read -p "Continue? (y/N): " confirm
|
read -p "Continue? (y/N): " confirm
|
||||||
|
|
||||||
if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
|
if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if check_script "$EXPORT_SCRIPT" "Export Script"; then
|
if check_script "$EXPORT_SCRIPT" "Export Script"; then
|
||||||
echo ""
|
echo ""
|
||||||
bash "$EXPORT_SCRIPT"
|
bash "$EXPORT_SCRIPT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
read -p "Press Enter to continue..."
|
read -p "Press Enter to continue..."
|
||||||
}
|
}
|
||||||
|
|
||||||
verify_installation() {
|
verify_installation() {
|
||||||
print_header
|
print_header
|
||||||
|
|
||||||
if check_script "$VERIFY_SCRIPT" "Verify Script"; then
|
if check_script "$VERIFY_SCRIPT" "Verify Script"; then
|
||||||
bash "$VERIFY_SCRIPT"
|
bash "$VERIFY_SCRIPT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
read -p "Press Enter to continue..."
|
read -p "Press Enter to continue..."
|
||||||
}
|
}
|
||||||
|
|
||||||
show_contents() {
|
show_contents() {
|
||||||
print_header
|
print_header
|
||||||
echo -e "${BOLD}Package Contents${NC}"
|
echo -e "${BOLD}Package Contents${NC}"
|
||||||
echo "═══════════════════════════════════════════════════════════"
|
echo "═══════════════════════════════════════════════════════════"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
CLAUDE_DIR="$HOME/.claude"
|
CLAUDE_DIR="$HOME/.claude"
|
||||||
|
|
||||||
if [ ! -d "$CLAUDE_DIR" ]; then
|
if [ ! -d "$CLAUDE_DIR" ]; then
|
||||||
echo -e "${RED}No Claude Code directory found at $CLAUDE_DIR${NC}"
|
echo -e "${RED}No Claude Code directory found at $CLAUDE_DIR${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
read -p "Press Enter to continue..."
|
read -p "Press Enter to continue..."
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "${CYAN}Agent Categories:${NC}"
|
echo -e "${CYAN}Agent Categories:${NC}"
|
||||||
for category in engineering marketing product studio-operations project-management testing design bonus; do
|
for category in engineering marketing product studio-operations project-management testing design bonus; do
|
||||||
if [ -d "$CLAUDE_DIR/agents/$category" ]; then
|
if [ -d "$CLAUDE_DIR/agents/$category" ]; then
|
||||||
count=$(ls -1 "$CLAUDE_DIR/agents/$category"/*.md 2>/dev/null | wc -l)
|
count=$(ls -1 "$CLAUDE_DIR/agents/$category"/*.md 2>/dev/null | wc -l)
|
||||||
if [ $count -gt 0 ]; then
|
if [ $count -gt 0 ]; then
|
||||||
printf " %-25s %2d agents\n" "$category" "$count"
|
printf " %-25s %2d agents\n" "$category" "$count"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${CYAN}Configuration Files:${NC}"
|
echo -e "${CYAN}Configuration Files:${NC}"
|
||||||
echo " settings.json"
|
echo " settings.json"
|
||||||
echo " settings.local.json"
|
echo " settings.local.json"
|
||||||
echo " plugins/installed_plugins.json"
|
echo " plugins/installed_plugins.json"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${CYAN}MCP Tools:${NC}"
|
echo -e "${CYAN}MCP Tools:${NC}"
|
||||||
echo " • zai-mcp-server (vision analysis)"
|
echo " • zai-mcp-server (vision analysis)"
|
||||||
echo " • web-search-prime"
|
echo " • web-search-prime"
|
||||||
echo " • web-reader"
|
echo " • web-reader"
|
||||||
echo " • zread (GitHub)"
|
echo " • zread (GitHub)"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${CYAN}Skills:${NC}"
|
echo -e "${CYAN}Skills:${NC}"
|
||||||
echo " • glm-plan-bug:case-feedback"
|
echo " • glm-plan-bug:case-feedback"
|
||||||
echo " • glm-plan-usage:usage-query"
|
echo " • glm-plan-usage:usage-query"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
read -p "Press Enter to continue..."
|
read -p "Press Enter to continue..."
|
||||||
}
|
}
|
||||||
|
|
||||||
view_documentation() {
|
view_documentation() {
|
||||||
print_header
|
print_header
|
||||||
echo -e "${BOLD}Documentation${NC}"
|
echo -e "${BOLD}Documentation${NC}"
|
||||||
echo "═══════════════════════════════════════════════════════════"
|
echo "═══════════════════════════════════════════════════════════"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
DOCS=(
|
DOCS=(
|
||||||
"SCRIPTS-GUIDE.md:Script usage guide"
|
"SCRIPTS-GUIDE.md:Script usage guide"
|
||||||
"CLAUDE-CUSTOMIZATIONS-README.md:Complete feature documentation"
|
"CLAUDE-CUSTOMIZATIONS-README.md:Complete feature documentation"
|
||||||
)
|
)
|
||||||
|
|
||||||
echo "Available documentation:"
|
echo "Available documentation:"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
for doc in "${DOCS[@]}"; do
|
for doc in "${DOCS[@]}"; do
|
||||||
file="${doc%%:*}"
|
file="${doc%%:*}"
|
||||||
desc="${doc##*:}"
|
desc="${doc##*:}"
|
||||||
if [ -f "$SCRIPT_DIR/$file" ]; then
|
if [ -f "$SCRIPT_DIR/$file" ]; then
|
||||||
echo -e " ${GREEN}✓${NC} $file"
|
echo -e " ${GREEN}✓${NC} $file"
|
||||||
echo " $desc"
|
echo " $desc"
|
||||||
else
|
else
|
||||||
echo -e " ${RED}✗${NC} $file (not found)"
|
echo -e " ${RED}✗${NC} $file (not found)"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Would you like to view a document?"
|
echo "Would you like to view a document?"
|
||||||
echo " 1) SCRIPTS-GUIDE.md"
|
echo " 1) SCRIPTS-GUIDE.md"
|
||||||
echo " 2) CLAUDE-CUSTOMIZATIONS-README.md"
|
echo " 2) CLAUDE-CUSTOMIZATIONS-README.md"
|
||||||
echo " 0) Back"
|
echo " 0) Back"
|
||||||
echo ""
|
echo ""
|
||||||
read -p "Select: " doc_choice
|
read -p "Select: " doc_choice
|
||||||
|
|
||||||
case $doc_choice in
|
case $doc_choice in
|
||||||
1)
|
1)
|
||||||
if [ -f "$SCRIPT_DIR/SCRIPTS-GUIDE.md" ]; then
|
if [ -f "$SCRIPT_DIR/SCRIPTS-GUIDE.md" ]; then
|
||||||
less "$SCRIPT_DIR/SCRIPTS-GUIDE.md"
|
less "$SCRIPT_DIR/SCRIPTS-GUIDE.md"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
if [ -f "$SCRIPT_DIR/CLAUDE-CUSTOMIZATIONS-README.md" ]; then
|
if [ -f "$SCRIPT_DIR/CLAUDE-CUSTOMIZATIONS-README.md" ]; then
|
||||||
less "$SCRIPT_DIR/CLAUDE-CUSTOMIZATIONS-README.md"
|
less "$SCRIPT_DIR/CLAUDE-CUSTOMIZATIONS-README.md"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
clean_backups() {
|
clean_backups() {
|
||||||
print_header
|
print_header
|
||||||
echo -e "${BOLD}Clean Backup Files${NC}"
|
echo -e "${BOLD}Clean Backup Files${NC}"
|
||||||
echo "═══════════════════════════════════════════════════════════"
|
echo "═══════════════════════════════════════════════════════════"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Find backup directories
|
# Find backup directories
|
||||||
BACKUPS=$(find "$HOME" -maxdepth 1 -name ".claude-backup-*" -type d 2>/dev/null)
|
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)
|
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)
|
EXPORT_DIRS=$(find "$HOME" -maxdepth 1 -name "claude-*-export" -type d 2>/dev/null)
|
||||||
|
|
||||||
BACKUP_COUNT=$(echo "$BACKUPS" | grep -c "^" || echo 0)
|
BACKUP_COUNT=$(echo "$BACKUPS" | grep -c "^" || echo 0)
|
||||||
PACKAGE_COUNT=$(echo "$PACKAGES" | grep -c "^" || echo 0)
|
PACKAGE_COUNT=$(echo "$PACKAGES" | grep -c "^" || echo 0)
|
||||||
EXPORT_COUNT=$(echo "$EXPORT_DIRS" | grep -c "^" || echo 0)
|
EXPORT_COUNT=$(echo "$EXPORT_DIRS" | grep -c "^" || echo 0)
|
||||||
|
|
||||||
echo "Found:"
|
echo "Found:"
|
||||||
echo " • $BACKUP_COUNT backup directories"
|
echo " • $BACKUP_COUNT backup directories"
|
||||||
echo " • $PACKAGE_COUNT package archives"
|
echo " • $PACKAGE_COUNT package archives"
|
||||||
echo " • $EXPORT_COUNT export directories"
|
echo " • $EXPORT_COUNT export directories"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
if [ $((BACKUP_COUNT + PACKAGE_COUNT + EXPORT_COUNT)) -eq 0 ]; then
|
if [ $((BACKUP_COUNT + PACKAGE_COUNT + EXPORT_COUNT)) -eq 0 ]; then
|
||||||
echo -e "${GREEN}No backup files to clean${NC}"
|
echo -e "${GREEN}No backup files to clean${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
read -p "Press Enter to continue..."
|
read -p "Press Enter to continue..."
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
read -p "Clean all backup files? (y/N): " confirm
|
read -p "Clean all backup files? (y/N): " confirm
|
||||||
|
|
||||||
if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
|
if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Cleaning..."
|
echo "Cleaning..."
|
||||||
|
|
||||||
if [ -n "$BACKUPS" ]; then
|
if [ -n "$BACKUPS" ]; then
|
||||||
echo "$BACKUPS" | while read -r backup; do
|
echo "$BACKUPS" | while read -r backup; do
|
||||||
echo " Removing: $backup"
|
echo " Removing: $backup"
|
||||||
rm -rf "$backup"
|
rm -rf "$backup"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$PACKAGES" ]; then
|
if [ -n "$PACKAGES" ]; then
|
||||||
echo "$PACKAGES" | while read -r package; do
|
echo "$PACKAGES" | while read -r package; do
|
||||||
echo " Removing: $package"
|
echo " Removing: $package"
|
||||||
rm -f "$package"
|
rm -f "$package"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$EXPORT_DIRS" ]; then
|
if [ -n "$EXPORT_DIRS" ]; then
|
||||||
echo "$EXPORT_DIRS" | while read -r export_dir; do
|
echo "$EXPORT_DIRS" | while read -r export_dir; do
|
||||||
echo " Removing: $export_dir"
|
echo " Removing: $export_dir"
|
||||||
rm -rf "$export_dir"
|
rm -rf "$export_dir"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${GREEN}✓ Cleanup complete${NC}"
|
echo -e "${GREEN}✓ Cleanup complete${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
read -p "Press Enter to continue..."
|
read -p "Press Enter to continue..."
|
||||||
}
|
}
|
||||||
|
|
||||||
# Main loop
|
# Main loop
|
||||||
main() {
|
main() {
|
||||||
while true; do
|
while true; do
|
||||||
print_menu
|
print_menu
|
||||||
read -r choice
|
read -r choice
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
case $choice in
|
case $choice in
|
||||||
1) create_package ;;
|
1) create_package ;;
|
||||||
2) install_customizations ;;
|
2) install_customizations ;;
|
||||||
3) export_customizations ;;
|
3) export_customizations ;;
|
||||||
4) verify_installation ;;
|
4) verify_installation ;;
|
||||||
5) show_contents ;;
|
5) show_contents ;;
|
||||||
6) view_documentation ;;
|
6) view_documentation ;;
|
||||||
7) clean_backups ;;
|
7) clean_backups ;;
|
||||||
0)
|
0)
|
||||||
echo "Goodbye!"
|
echo "Goodbye!"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo -e "${RED}Invalid option. Please try again.${NC}"
|
echo -e "${RED}Invalid option. Please try again.${NC}"
|
||||||
sleep 1
|
sleep 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Run main function
|
# Run main function
|
||||||
main
|
main
|
||||||
|
|||||||
@@ -1,212 +1,212 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
################################################################################
|
################################################################################
|
||||||
# Claude Code Customizations Exporter
|
# Claude Code Customizations Exporter
|
||||||
# This script packages all customizations for transfer to another machine
|
# This script packages all customizations for transfer to another machine
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Colors for output
|
# Colors for output
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
GREEN='\033[0;32m'
|
GREEN='\033[0;32m'
|
||||||
YELLOW='\033[1;33m'
|
YELLOW='\033[1;33m'
|
||||||
BLUE='\033[0;34m'
|
BLUE='\033[0;34m'
|
||||||
NC='\033[0m'
|
NC='\033[0m'
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
CLAUDE_DIR="$HOME/.claude"
|
CLAUDE_DIR="$HOME/.claude"
|
||||||
EXPORT_DIR="$HOME/claude-customizations-export"
|
EXPORT_DIR="$HOME/claude-customizations-export"
|
||||||
EXPORT_FILE="$HOME/claude-customizations-$(date +%Y%m%d_%H%M%S).tar.gz"
|
EXPORT_FILE="$HOME/claude-customizations-$(date +%Y%m%d_%H%M%S).tar.gz"
|
||||||
|
|
||||||
log_info() {
|
log_info() {
|
||||||
echo -e "${BLUE}[INFO]${NC} $1"
|
echo -e "${BLUE}[INFO]${NC} $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
log_success() {
|
log_success() {
|
||||||
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
log_warning() {
|
log_warning() {
|
||||||
echo -e "${YELLOW}[WARNING]${NC} $1"
|
echo -e "${YELLOW}[WARNING]${NC} $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create export directory
|
# Create export directory
|
||||||
log_info "Creating export directory..."
|
log_info "Creating export directory..."
|
||||||
rm -rf "$EXPORT_DIR"
|
rm -rf "$EXPORT_DIR"
|
||||||
mkdir -p "$EXPORT_DIR"
|
mkdir -p "$EXPORT_DIR"
|
||||||
|
|
||||||
# Export agents
|
# Export agents
|
||||||
log_info "Exporting custom agents..."
|
log_info "Exporting custom agents..."
|
||||||
mkdir -p "$EXPORT_DIR/agents"
|
mkdir -p "$EXPORT_DIR/agents"
|
||||||
cp -r "$CLAUDE_DIR/agents/"* "$EXPORT_DIR/agents/" 2>/dev/null || true
|
cp -r "$CLAUDE_DIR/agents/"* "$EXPORT_DIR/agents/" 2>/dev/null || true
|
||||||
|
|
||||||
# Export plugins configuration
|
# Export plugins configuration
|
||||||
log_info "Exporting plugins configuration..."
|
log_info "Exporting plugins configuration..."
|
||||||
mkdir -p "$EXPORT_DIR/plugins"
|
mkdir -p "$EXPORT_DIR/plugins"
|
||||||
cp -r "$CLAUDE_DIR/plugins/cache/"* "$EXPORT_DIR/plugins/" 2>/dev/null || true
|
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/installed_plugins.json" "$EXPORT_DIR/plugins/" 2>/dev/null || true
|
||||||
cp "$CLAUDE_DIR/plugins/known_marketplaces.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)
|
# Export settings (without sensitive data)
|
||||||
log_info "Exporting settings..."
|
log_info "Exporting settings..."
|
||||||
mkdir -p "$EXPORT_DIR/config"
|
mkdir -p "$EXPORT_DIR/config"
|
||||||
|
|
||||||
# Export settings.local.json (permissions)
|
# Export settings.local.json (permissions)
|
||||||
cp "$CLAUDE_DIR/settings.local.json" "$EXPORT_DIR/config/" 2>/dev/null || true
|
cp "$CLAUDE_DIR/settings.local.json" "$EXPORT_DIR/config/" 2>/dev/null || true
|
||||||
|
|
||||||
# Create settings template (without actual API token)
|
# Create settings template (without actual API token)
|
||||||
cat > "$EXPORT_DIR/config/settings-template.json" << EOF
|
cat > "$EXPORT_DIR/config/settings-template.json" << EOF
|
||||||
{
|
{
|
||||||
"env": {
|
"env": {
|
||||||
"ANTHROPIC_AUTH_TOKEN": "YOUR_API_TOKEN_HERE",
|
"ANTHROPIC_AUTH_TOKEN": "YOUR_API_TOKEN_HERE",
|
||||||
"ANTHROPIC_BASE_URL": "https://api.anthropic.com",
|
"ANTHROPIC_BASE_URL": "https://api.anthropic.com",
|
||||||
"API_TIMEOUT_MS": "3000000",
|
"API_TIMEOUT_MS": "3000000",
|
||||||
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
|
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
|
||||||
},
|
},
|
||||||
"enabledPlugins": {
|
"enabledPlugins": {
|
||||||
"glm-plan-bug@zai-coding-plugins": true,
|
"glm-plan-bug@zai-coding-plugins": true,
|
||||||
"glm-plan-usage@zai-coding-plugins": true
|
"glm-plan-usage@zai-coding-plugins": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Export hooks if present
|
# Export hooks if present
|
||||||
log_info "Exporting hooks..."
|
log_info "Exporting hooks..."
|
||||||
if [ -d "$CLAUDE_DIR/hooks" ] && [ "$(ls -A $CLAUDE_DIR/hooks)" ]; then
|
if [ -d "$CLAUDE_DIR/hooks" ] && [ "$(ls -A $CLAUDE_DIR/hooks)" ]; then
|
||||||
mkdir -p "$EXPORT_DIR/hooks"
|
mkdir -p "$EXPORT_DIR/hooks"
|
||||||
cp -r "$CLAUDE_DIR/hooks/"* "$EXPORT_DIR/hooks/"
|
cp -r "$CLAUDE_DIR/hooks/"* "$EXPORT_DIR/hooks/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create README
|
# Create README
|
||||||
log_info "Creating documentation..."
|
log_info "Creating documentation..."
|
||||||
cat > "$EXPORT_DIR/README.md" << 'EOF'
|
cat > "$EXPORT_DIR/README.md" << 'EOF'
|
||||||
# Claude Code Customizations Package
|
# Claude Code Customizations Package
|
||||||
|
|
||||||
This package contains all customizations for Claude Code including custom agents, MCP tools configuration, and plugins.
|
This package contains all customizations for Claude Code including custom agents, MCP tools configuration, and plugins.
|
||||||
|
|
||||||
## Contents
|
## Contents
|
||||||
|
|
||||||
- `agents/` - Custom agent definitions organized by category
|
- `agents/` - Custom agent definitions organized by category
|
||||||
- `plugins/` - Plugin configurations
|
- `plugins/` - Plugin configurations
|
||||||
- `config/` - Settings files
|
- `config/` - Settings files
|
||||||
- `hooks/` - Custom hooks (if any)
|
- `hooks/` - Custom hooks (if any)
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
### Quick Install
|
### Quick Install
|
||||||
|
|
||||||
Run the automated installer:
|
Run the automated installer:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bash install-claude-customizations.sh
|
bash install-claude-customizations.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
### Manual Install
|
### Manual Install
|
||||||
|
|
||||||
1. **Copy agents:**
|
1. **Copy agents:**
|
||||||
```bash
|
```bash
|
||||||
cp -r agents/* ~/.claude/agents/
|
cp -r agents/* ~/.claude/agents/
|
||||||
```
|
```
|
||||||
|
|
||||||
2. **Copy plugins:**
|
2. **Copy plugins:**
|
||||||
```bash
|
```bash
|
||||||
cp -r plugins/* ~/.claude/plugins/
|
cp -r plugins/* ~/.claude/plugins/
|
||||||
```
|
```
|
||||||
|
|
||||||
3. **Configure settings:**
|
3. **Configure settings:**
|
||||||
```bash
|
```bash
|
||||||
cp config/settings.local.json ~/.claude/
|
cp config/settings.local.json ~/.claude/
|
||||||
# Edit ~/.claude/settings.json and add your API token
|
# Edit ~/.claude/settings.json and add your API token
|
||||||
```
|
```
|
||||||
|
|
||||||
4. **Install MCP tools:**
|
4. **Install MCP tools:**
|
||||||
```bash
|
```bash
|
||||||
npm install -g @z_ai/mcp-server @z_ai/coding-helper
|
npm install -g @z_ai/mcp-server @z_ai/coding-helper
|
||||||
```
|
```
|
||||||
|
|
||||||
5. **Restart Claude Code**
|
5. **Restart Claude Code**
|
||||||
|
|
||||||
## Agent Categories
|
## Agent Categories
|
||||||
|
|
||||||
- **Engineering** - AI engineer, backend architect, frontend developer, DevOps, mobile app builder
|
- **Engineering** - AI engineer, backend architect, frontend developer, DevOps, mobile app builder
|
||||||
- **Marketing** - TikTok strategist, growth hacker, content creator
|
- **Marketing** - TikTok strategist, growth hacker, content creator
|
||||||
- **Product** - Sprint prioritizer, feedback synthesizer, trend researcher
|
- **Product** - Sprint prioritizer, feedback synthesizer, trend researcher
|
||||||
- **Studio Operations** - Studio producer, project shipper, analytics, finance
|
- **Studio Operations** - Studio producer, project shipper, analytics, finance
|
||||||
- **Project Management** - Experiment tracker, studio coach
|
- **Project Management** - Experiment tracker, studio coach
|
||||||
- **Testing** - Test writer/fixer, API tester, performance benchmarker
|
- **Testing** - Test writer/fixer, API tester, performance benchmarker
|
||||||
- **Design** - UI designer, UX researcher, brand guardian, whimsy injector
|
- **Design** - UI designer, UX researcher, brand guardian, whimsy injector
|
||||||
- **Bonus** - Joker, studio coach
|
- **Bonus** - Joker, studio coach
|
||||||
|
|
||||||
## MCP Tools Included
|
## MCP Tools Included
|
||||||
|
|
||||||
- **zai-mcp-server** - Vision analysis (images, videos, UI screenshots, error diagnosis)
|
- **zai-mcp-server** - Vision analysis (images, videos, UI screenshots, error diagnosis)
|
||||||
- **web-search-prime** - Enhanced web search with domain filtering
|
- **web-search-prime** - Enhanced web search with domain filtering
|
||||||
- **web-reader** - Fetch URLs and convert to markdown
|
- **web-reader** - Fetch URLs and convert to markdown
|
||||||
- **zread** - GitHub repository reader
|
- **zread** - GitHub repository reader
|
||||||
|
|
||||||
## Skills
|
## Skills
|
||||||
|
|
||||||
- `glm-plan-bug:case-feedback` - Submit bug/issue feedback
|
- `glm-plan-bug:case-feedback` - Submit bug/issue feedback
|
||||||
- `glm-plan-usage:usage-query` - Query account usage statistics
|
- `glm-plan-usage:usage-query` - Query account usage statistics
|
||||||
|
|
||||||
## Customization
|
## Customization
|
||||||
|
|
||||||
Edit agent `.md` files in `~/.claude/agents/` to customize agent behavior.
|
Edit agent `.md` files in `~/.claude/agents/` to customize agent behavior.
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
For issues or questions, refer to the original source machine or Claude Code documentation.
|
For issues or questions, refer to the original source machine or Claude Code documentation.
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Create manifest
|
# Create manifest
|
||||||
log_info "Creating package manifest..."
|
log_info "Creating package manifest..."
|
||||||
cat > "$EXPORT_DIR/MANIFEST.json" << EOF
|
cat > "$EXPORT_DIR/MANIFEST.json" << EOF
|
||||||
{
|
{
|
||||||
"package": "claude-code-customizations",
|
"package": "claude-code-customizations",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"exported_at": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)",
|
"exported_at": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)",
|
||||||
"contents": {
|
"contents": {
|
||||||
"agents": "$(ls -1 "$EXPORT_DIR/agents" | wc -l) categories",
|
"agents": "$(ls -1 "$EXPORT_DIR/agents" | wc -l) categories",
|
||||||
"plugins": "$(ls -1 "$EXPORT_DIR/plugins" 2>/dev/null | wc -l) items",
|
"plugins": "$(ls -1 "$EXPORT_DIR/plugins" 2>/dev/null | wc -l) items",
|
||||||
"config_files": "$(ls -1 "$EXPORT_DIR/config" | wc -l) files"
|
"config_files": "$(ls -1 "$EXPORT_DIR/config" | wc -l) files"
|
||||||
},
|
},
|
||||||
"mcp_tools": [
|
"mcp_tools": [
|
||||||
"zai-mcp-server (vision)",
|
"zai-mcp-server (vision)",
|
||||||
"web-search-prime",
|
"web-search-prime",
|
||||||
"web-reader",
|
"web-reader",
|
||||||
"zread"
|
"zread"
|
||||||
],
|
],
|
||||||
"skills": [
|
"skills": [
|
||||||
"glm-plan-bug:case-feedback",
|
"glm-plan-bug:case-feedback",
|
||||||
"glm-plan-usage:usage-query"
|
"glm-plan-usage:usage-query"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Create tarball
|
# Create tarball
|
||||||
log_info "Creating compressed archive..."
|
log_info "Creating compressed archive..."
|
||||||
tar -czf "$EXPORT_FILE" -C "$HOME" "$(basename "$EXPORT_DIR")"
|
tar -czf "$EXPORT_FILE" -C "$HOME" "$(basename "$EXPORT_DIR")"
|
||||||
|
|
||||||
# Get file size
|
# Get file size
|
||||||
FILE_SIZE=$(du -h "$EXPORT_FILE" | cut -f1)
|
FILE_SIZE=$(du -h "$EXPORT_FILE" | cut -f1)
|
||||||
|
|
||||||
log_success "═══════════════════════════════════════════════════════════"
|
log_success "═══════════════════════════════════════════════════════════"
|
||||||
log_success "Export completed successfully!"
|
log_success "Export completed successfully!"
|
||||||
log_success "═══════════════════════════════════════════════════════════"
|
log_success "═══════════════════════════════════════════════════════════"
|
||||||
echo ""
|
echo ""
|
||||||
log_info "Export location: $EXPORT_FILE"
|
log_info "Export location: $EXPORT_FILE"
|
||||||
log_info "Package size: $FILE_SIZE"
|
log_info "Package size: $FILE_SIZE"
|
||||||
log_info "Unpacked directory: $EXPORT_DIR"
|
log_info "Unpacked directory: $EXPORT_DIR"
|
||||||
echo ""
|
echo ""
|
||||||
log_info "To transfer to another machine:"
|
log_info "To transfer to another machine:"
|
||||||
echo " 1. Copy the archive: scp $EXPORT_FILE user@target:~/"
|
echo " 1. Copy the archive: scp $EXPORT_FILE user@target:~/"
|
||||||
echo " 2. Extract: tar -xzf $(basename "$EXPORT_FILE")"
|
echo " 2. Extract: tar -xzf $(basename "$EXPORT_FILE")"
|
||||||
echo " 3. Run: cd $(basename "$EXPORT_DIR") && bash install-claude-customizations.sh"
|
echo " 3. Run: cd $(basename "$EXPORT_DIR") && bash install-claude-customizations.sh"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Ask if user wants to keep unpacked directory
|
# Ask if user wants to keep unpacked directory
|
||||||
read -p "Keep unpacked export directory? (y/N): " keep_unpacked
|
read -p "Keep unpacked export directory? (y/N): " keep_unpacked
|
||||||
if [[ ! "$keep_unpacked" =~ ^[Yy]$ ]]; then
|
if [[ ! "$keep_unpacked" =~ ^[Yy]$ ]]; then
|
||||||
rm -rf "$EXPORT_DIR"
|
rm -rf "$EXPORT_DIR"
|
||||||
log_info "Unpacked directory removed"
|
log_info "Unpacked directory removed"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,396 +1,396 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
################################################################################
|
################################################################################
|
||||||
# Claude Code Customizations Installer
|
# Claude Code Customizations Installer
|
||||||
# This script automates the setup of custom agents, MCP tools, and plugins
|
# This script automates the setup of custom agents, MCP tools, and plugins
|
||||||
# for Claude Code on a new machine.
|
# for Claude Code on a new machine.
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
set -e # Exit on error
|
set -e # Exit on error
|
||||||
|
|
||||||
# Colors for output
|
# Colors for output
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
GREEN='\033[0;32m'
|
GREEN='\033[0;32m'
|
||||||
YELLOW='\033[1;33m'
|
YELLOW='\033[1;33m'
|
||||||
BLUE='\033[0;34m'
|
BLUE='\033[0;34m'
|
||||||
NC='\033[0m' # No Color
|
NC='\033[0m' # No Color
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
CLAUDE_DIR="$HOME/.claude"
|
CLAUDE_DIR="$HOME/.claude"
|
||||||
AGENTS_DIR="$CLAUDE_DIR/agents"
|
AGENTS_DIR="$CLAUDE_DIR/agents"
|
||||||
PLUGINS_DIR="$CLAUDE_DIR/plugins"
|
PLUGINS_DIR="$CLAUDE_DIR/plugins"
|
||||||
BACKUP_DIR="$HOME/.claude-backup-$(date +%Y%m%d_%H%M%S)"
|
BACKUP_DIR="$HOME/.claude-backup-$(date +%Y%m%d_%H%M%S)"
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Helper Functions
|
# Helper Functions
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
log_info() {
|
log_info() {
|
||||||
echo -e "${BLUE}[INFO]${NC} $1"
|
echo -e "${BLUE}[INFO]${NC} $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
log_success() {
|
log_success() {
|
||||||
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
log_warning() {
|
log_warning() {
|
||||||
echo -e "${YELLOW}[WARNING]${NC} $1"
|
echo -e "${YELLOW}[WARNING]${NC} $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
log_error() {
|
log_error() {
|
||||||
echo -e "${RED}[ERROR]${NC} $1"
|
echo -e "${RED}[ERROR]${NC} $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
check_command() {
|
check_command() {
|
||||||
if ! command -v $1 &> /dev/null; then
|
if ! command -v $1 &> /dev/null; then
|
||||||
log_error "$1 is not installed. Please install it first."
|
log_error "$1 is not installed. Please install it first."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
backup_file() {
|
backup_file() {
|
||||||
local file="$1"
|
local file="$1"
|
||||||
if [ -f "$file" ]; then
|
if [ -f "$file" ]; then
|
||||||
mkdir -p "$BACKUP_DIR"
|
mkdir -p "$BACKUP_DIR"
|
||||||
cp "$file" "$BACKUP_DIR/"
|
cp "$file" "$BACKUP_DIR/"
|
||||||
log_info "Backed up $file to $BACKUP_DIR"
|
log_info "Backed up $file to $BACKUP_DIR"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Prerequisites Check
|
# Prerequisites Check
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
check_prerequisites() {
|
check_prerequisites() {
|
||||||
log_info "Checking prerequisites..."
|
log_info "Checking prerequisites..."
|
||||||
|
|
||||||
check_command "node"
|
check_command "node"
|
||||||
check_command "npm"
|
check_command "npm"
|
||||||
check_command "python3"
|
check_command "python3"
|
||||||
check_command "curl"
|
check_command "curl"
|
||||||
|
|
||||||
# Check Node.js version (need 14+)
|
# Check Node.js version (need 14+)
|
||||||
NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1)
|
NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1)
|
||||||
if [ "$NODE_VERSION" -lt 14 ]; then
|
if [ "$NODE_VERSION" -lt 14 ]; then
|
||||||
log_error "Node.js version 14 or higher required. Current: $(node -v)"
|
log_error "Node.js version 14 or higher required. Current: $(node -v)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log_success "Prerequisites check passed"
|
log_success "Prerequisites check passed"
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Directory Structure Setup
|
# Directory Structure Setup
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
setup_directories() {
|
setup_directories() {
|
||||||
log_info "Setting up directory structure..."
|
log_info "Setting up directory structure..."
|
||||||
|
|
||||||
mkdir -p "$AGENTS_DIR"/{engineering,marketing,product,studio-operations,project-management,testing,design,bonus}
|
mkdir -p "$AGENTS_DIR"/{engineering,marketing,product,studio-operations,project-management,testing,design,bonus}
|
||||||
|
|
||||||
mkdir -p "$PLUGINS_DIR"/{cache,marketplaces}
|
mkdir -p "$PLUGINS_DIR"/{cache,marketplaces}
|
||||||
mkdir -p "$CLAUDE_DIR"/{hooks,debug,file-history,paste-cache,projects,session-env,shell-snapshots,todos}
|
mkdir -p "$CLAUDE_DIR"/{hooks,debug,file-history,paste-cache,projects,session-env,shell-snapshots,todos}
|
||||||
|
|
||||||
log_success "Directory structure created"
|
log_success "Directory structure created"
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Settings Configuration
|
# Settings Configuration
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
setup_settings() {
|
setup_settings() {
|
||||||
log_info "Configuring Claude Code settings..."
|
log_info "Configuring Claude Code settings..."
|
||||||
|
|
||||||
local settings_file="$CLAUDE_DIR/settings.json"
|
local settings_file="$CLAUDE_DIR/settings.json"
|
||||||
|
|
||||||
backup_file "$settings_file"
|
backup_file "$settings_file"
|
||||||
|
|
||||||
# Prompt for API credentials
|
# Prompt for API credentials
|
||||||
read -p "Enter your ANTHROPIC_AUTH_TOKEN (or press Enter to skip): " API_TOKEN
|
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
|
read -p "Enter your ANTHROPIC_BASE_URL (default: https://api.anthropic.com): " API_BASE
|
||||||
API_BASE=${API_BASE:-https://api.anthropic.com}
|
API_BASE=${API_BASE:-https://api.anthropic.com}
|
||||||
|
|
||||||
# Create settings.json
|
# Create settings.json
|
||||||
cat > "$settings_file" << EOF
|
cat > "$settings_file" << EOF
|
||||||
{
|
{
|
||||||
"env": {
|
"env": {
|
||||||
"ANTHROPIC_AUTH_TOKEN": "${API_TOKEN}",
|
"ANTHROPIC_AUTH_TOKEN": "${API_TOKEN}",
|
||||||
"ANTHROPIC_BASE_URL": "${API_BASE}",
|
"ANTHROPIC_BASE_URL": "${API_BASE}",
|
||||||
"API_TIMEOUT_MS": "3000000",
|
"API_TIMEOUT_MS": "3000000",
|
||||||
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
|
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
|
||||||
},
|
},
|
||||||
"enabledPlugins": {
|
"enabledPlugins": {
|
||||||
"glm-plan-bug@zai-coding-plugins": true,
|
"glm-plan-bug@zai-coding-plugins": true,
|
||||||
"glm-plan-usage@zai-coding-plugins": true
|
"glm-plan-usage@zai-coding-plugins": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Create local settings for permissions
|
# Create local settings for permissions
|
||||||
local local_settings="$CLAUDE_DIR/settings.local.json"
|
local local_settings="$CLAUDE_DIR/settings.local.json"
|
||||||
backup_file "$local_settings"
|
backup_file "$local_settings"
|
||||||
|
|
||||||
cat > "$local_settings" << EOF
|
cat > "$local_settings" << EOF
|
||||||
{
|
{
|
||||||
"permissions": {
|
"permissions": {
|
||||||
"allow": [
|
"allow": [
|
||||||
"Bash(npm install:*)",
|
"Bash(npm install:*)",
|
||||||
"Bash(npm run content:*)",
|
"Bash(npm run content:*)",
|
||||||
"Bash(npm run build:*)",
|
"Bash(npm run build:*)",
|
||||||
"Bash(grep:*)",
|
"Bash(grep:*)",
|
||||||
"Bash(find:*)",
|
"Bash(find:*)",
|
||||||
"Bash(for:*)",
|
"Bash(for:*)",
|
||||||
"Bash(do sed:*)",
|
"Bash(do sed:*)",
|
||||||
"Bash(done)",
|
"Bash(done)",
|
||||||
"Bash(python3:*)",
|
"Bash(python3:*)",
|
||||||
"Bash(while read f)",
|
"Bash(while read f)",
|
||||||
"Bash(do echo \\"\\$f%-* \\$f\\")",
|
"Bash(do echo \\"\\$f%-* \\$f\\")",
|
||||||
"Bash(ls:*)",
|
"Bash(ls:*)",
|
||||||
"Bash(node:*)",
|
"Bash(node:*)",
|
||||||
"Bash(pm2 delete:*)",
|
"Bash(pm2 delete:*)",
|
||||||
"Bash(pm2 start npm:*)",
|
"Bash(pm2 start npm:*)",
|
||||||
"Bash(pm2 save:*)"
|
"Bash(pm2 save:*)"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
log_success "Settings configured"
|
log_success "Settings configured"
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# MCP Services Installation
|
# MCP Services Installation
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
install_mcp_services() {
|
install_mcp_services() {
|
||||||
log_info "Installing MCP services..."
|
log_info "Installing MCP services..."
|
||||||
|
|
||||||
# Install @z_ai/mcp-server globally for vision tools
|
# Install @z_ai/mcp-server globally for vision tools
|
||||||
log_info "Installing @z_ai/mcp-server (vision analysis tools)..."
|
log_info "Installing @z_ai/mcp-server (vision analysis tools)..."
|
||||||
npm install -g @z_ai/mcp-server 2>/dev/null || {
|
npm install -g @z_ai/mcp-server 2>/dev/null || {
|
||||||
log_warning "Global install failed, trying with npx..."
|
log_warning "Global install failed, trying with npx..."
|
||||||
# It's okay if this fails, the tools will use npx
|
# It's okay if this fails, the tools will use npx
|
||||||
}
|
}
|
||||||
|
|
||||||
# Install @z_ai/coding-helper for MCP management
|
# Install @z_ai/coding-helper for MCP management
|
||||||
log_info "Installing @z_ai/coding-helper..."
|
log_info "Installing @z_ai/coding-helper..."
|
||||||
npm install -g @z_ai/coding-helper 2>/dev/null || {
|
npm install -g @z_ai/coding-helper 2>/dev/null || {
|
||||||
log_warning "Global install failed, will use npx"
|
log_warning "Global install failed, will use npx"
|
||||||
}
|
}
|
||||||
|
|
||||||
log_success "MCP services installation completed"
|
log_success "MCP services installation completed"
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Agent Definitions
|
# Agent Definitions
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
install_agents() {
|
install_agents() {
|
||||||
log_info "Installing custom agents..."
|
log_info "Installing custom agents..."
|
||||||
|
|
||||||
# Note: In a production setup, these would be downloaded from a repository
|
# Note: In a production setup, these would be downloaded from a repository
|
||||||
# For now, we'll create placeholder agent definitions
|
# For now, we'll create placeholder agent definitions
|
||||||
# The actual agent content should be copied from the source machine
|
# The actual agent content should be copied from the source machine
|
||||||
|
|
||||||
log_info "Agent directory structure created at $AGENTS_DIR"
|
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_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_info "Run: scp -r user@source:~/.claude/agents/* $AGENTS_DIR/"
|
||||||
|
|
||||||
log_success "Agent structure ready"
|
log_success "Agent structure ready"
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Plugins Installation
|
# Plugins Installation
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
install_plugins() {
|
install_plugins() {
|
||||||
log_info "Installing Claude Code plugins..."
|
log_info "Installing Claude Code plugins..."
|
||||||
|
|
||||||
# Initialize plugin registry
|
# Initialize plugin registry
|
||||||
local installed_plugins="$PLUGINS_DIR/installed_plugins.json"
|
local installed_plugins="$PLUGINS_DIR/installed_plugins.json"
|
||||||
local known_marketplaces="$PLUGINS_DIR/known_marketplaces.json"
|
local known_marketplaces="$PLUGINS_DIR/known_marketplaces.json"
|
||||||
|
|
||||||
backup_file "$installed_plugins"
|
backup_file "$installed_plugins"
|
||||||
backup_file "$known_marketplaces"
|
backup_file "$known_marketplaces"
|
||||||
|
|
||||||
cat > "$known_marketplaces" << EOF
|
cat > "$known_marketplaces" << EOF
|
||||||
{
|
{
|
||||||
"marketplaces": {
|
"marketplaces": {
|
||||||
"https://github.com/anthropics/claude-plugins": {
|
"https://github.com/anthropics/claude-plugins": {
|
||||||
"displayName": "Official Claude Plugins",
|
"displayName": "Official Claude Plugins",
|
||||||
"contact": "support@anthropic.com"
|
"contact": "support@anthropic.com"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Install GLM plugins via npx
|
# Install GLM plugins via npx
|
||||||
log_info "Installing GLM Coding Plan plugins..."
|
log_info "Installing GLM Coding Plan plugins..."
|
||||||
|
|
||||||
# Create plugin cache structure
|
# Create plugin cache structure
|
||||||
mkdir -p "$PLUGINS_DIR/cache/zai-coding-plugins"/{glm-plan-bug,glm-plan-usage}
|
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
|
# Note: Actual plugin installation happens via the @z_ai/coding-helper
|
||||||
# which should already be installed
|
# which should already be installed
|
||||||
|
|
||||||
cat > "$installed_plugins" << EOF
|
cat > "$installed_plugins" << EOF
|
||||||
{
|
{
|
||||||
"version": 2,
|
"version": 2,
|
||||||
"plugins": {
|
"plugins": {
|
||||||
"glm-plan-bug@zai-coding-plugins": [
|
"glm-plan-bug@zai-coding-plugins": [
|
||||||
{
|
{
|
||||||
"scope": "user",
|
"scope": "user",
|
||||||
"installPath": "$PLUGINS_DIR/cache/zai-coding-plugins/glm-plan-bug/0.0.1",
|
"installPath": "$PLUGINS_DIR/cache/zai-coding-plugins/glm-plan-bug/0.0.1",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"installedAt": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)",
|
"installedAt": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)",
|
||||||
"lastUpdated": "$(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": [
|
"glm-plan-usage@zai-coding-plugins": [
|
||||||
{
|
{
|
||||||
"scope": "user",
|
"scope": "user",
|
||||||
"installPath": "$PLUGINS_DIR/cache/zai-coding-plugins/glm-plan-usage/0.0.1",
|
"installPath": "$PLUGINS_DIR/cache/zai-coding-plugins/glm-plan-usage/0.0.1",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"installedAt": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)",
|
"installedAt": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)",
|
||||||
"lastUpdated": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)"
|
"lastUpdated": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
log_success "Plugins configured"
|
log_success "Plugins configured"
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Download Agents from Repository
|
# Download Agents from Repository
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
download_agent_definitions() {
|
download_agent_definitions() {
|
||||||
log_info "Preparing to download agent definitions..."
|
log_info "Preparing to download agent definitions..."
|
||||||
|
|
||||||
# Create a temporary script to download agents
|
# Create a temporary script to download agents
|
||||||
# In production, this would download from a git repository or CDN
|
# In production, this would download from a git repository or CDN
|
||||||
|
|
||||||
cat > /tmp/download_agents.sh << 'DOWNLOAD_SCRIPT'
|
cat > /tmp/download_agents.sh << 'DOWNLOAD_SCRIPT'
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# This script would download agent definitions from a central repository
|
# This script would download agent definitions from a central repository
|
||||||
# For now, it creates a template structure
|
# For now, it creates a template structure
|
||||||
|
|
||||||
AGENT_CATEGORIES=("engineering" "marketing" "product" "studio-operations" "project-management" "testing" "design" "bonus")
|
AGENT_CATEGORIES=("engineering" "marketing" "product" "studio-operations" "project-management" "testing" "design" "bonus")
|
||||||
|
|
||||||
for category in "${AGENT_CATEGORIES[@]}"; do
|
for category in "${AGENT_CATEGORIES[@]}"; do
|
||||||
echo "Category: $category"
|
echo "Category: $category"
|
||||||
# Agents would be downloaded here
|
# Agents would be downloaded here
|
||||||
done
|
done
|
||||||
DOWNLOAD_SCRIPT
|
DOWNLOAD_SCRIPT
|
||||||
|
|
||||||
chmod +x /tmp/download_agents.sh
|
chmod +x /tmp/download_agents.sh
|
||||||
|
|
||||||
log_info "Agent download script created at /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"
|
log_warning "You need to provide the actual agent definitions"
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Verification
|
# Verification
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
verify_installation() {
|
verify_installation() {
|
||||||
log_info "Verifying installation..."
|
log_info "Verifying installation..."
|
||||||
|
|
||||||
local errors=0
|
local errors=0
|
||||||
|
|
||||||
# Check directories
|
# Check directories
|
||||||
[ -d "$CLAUDE_DIR" ] || { log_error "Claude directory missing"; errors=$((errors+1)); }
|
[ -d "$CLAUDE_DIR" ] || { log_error "Claude directory missing"; errors=$((errors+1)); }
|
||||||
[ -d "$AGENTS_DIR" ] || { log_error "Agents 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)); }
|
[ -d "$PLUGINS_DIR" ] || { log_error "Plugins directory missing"; errors=$((errors+1)); }
|
||||||
|
|
||||||
# Check files
|
# Check files
|
||||||
[ -f "$CLAUDE_DIR/settings.json" ] || { log_error "settings.json missing"; errors=$((errors+1)); }
|
[ -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 "$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)); }
|
[ -f "$PLUGINS_DIR/installed_plugins.json" ] || { log_error "installed_plugins.json missing"; errors=$((errors+1)); }
|
||||||
|
|
||||||
# Check MCP availability
|
# Check MCP availability
|
||||||
if command -v npx &> /dev/null; then
|
if command -v npx &> /dev/null; then
|
||||||
log_success "npx available for MCP tools"
|
log_success "npx available for MCP tools"
|
||||||
else
|
else
|
||||||
log_error "npx not available"
|
log_error "npx not available"
|
||||||
errors=$((errors+1))
|
errors=$((errors+1))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $errors -eq 0 ]; then
|
if [ $errors -eq 0 ]; then
|
||||||
log_success "Installation verification passed"
|
log_success "Installation verification passed"
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
log_error "Installation verification failed with $errors errors"
|
log_error "Installation verification failed with $errors errors"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Main Installation Flow
|
# Main Installation Flow
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
echo -e "${BLUE}╔════════════════════════════════════════════════════════════╗${NC}"
|
echo -e "${BLUE}╔════════════════════════════════════════════════════════════╗${NC}"
|
||||||
echo -e "${BLUE}║ Claude Code Customizations - Automated Installer ║${NC}"
|
echo -e "${BLUE}║ Claude Code Customizations - Automated Installer ║${NC}"
|
||||||
echo -e "${BLUE}╚════════════════════════════════════════════════════════════╝${NC}"
|
echo -e "${BLUE}╚════════════════════════════════════════════════════════════╝${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Parse command line arguments
|
# Parse command line arguments
|
||||||
SKIP_AGENTS_COPY=false
|
SKIP_AGENTS_COPY=false
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
--skip-agents)
|
--skip-agents)
|
||||||
SKIP_AGENTS_COPY=true
|
SKIP_AGENTS_COPY=true
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--help)
|
--help)
|
||||||
echo "Usage: $0 [OPTIONS]"
|
echo "Usage: $0 [OPTIONS]"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " --skip-agents Skip copying agent files (if already present)"
|
echo " --skip-agents Skip copying agent files (if already present)"
|
||||||
echo " --help Show this help message"
|
echo " --help Show this help message"
|
||||||
echo ""
|
echo ""
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
log_error "Unknown option: $1"
|
log_error "Unknown option: $1"
|
||||||
echo "Use --help for usage information"
|
echo "Use --help for usage information"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# Run installation steps
|
# Run installation steps
|
||||||
check_prerequisites
|
check_prerequisites
|
||||||
setup_directories
|
setup_directories
|
||||||
setup_settings
|
setup_settings
|
||||||
install_mcp_services
|
install_mcp_services
|
||||||
install_agents
|
install_agents
|
||||||
install_plugins
|
install_plugins
|
||||||
|
|
||||||
# Verify installation
|
# Verify installation
|
||||||
if verify_installation; then
|
if verify_installation; then
|
||||||
echo ""
|
echo ""
|
||||||
log_success "═══════════════════════════════════════════════════════════"
|
log_success "═══════════════════════════════════════════════════════════"
|
||||||
log_success "Installation completed successfully!"
|
log_success "Installation completed successfully!"
|
||||||
log_success "═══════════════════════════════════════════════════════════"
|
log_success "═══════════════════════════════════════════════════════════"
|
||||||
echo ""
|
echo ""
|
||||||
log_info "Next steps:"
|
log_info "Next steps:"
|
||||||
echo " 1. Copy agent definitions from source machine:"
|
echo " 1. Copy agent definitions from source machine:"
|
||||||
echo " scp -r user@source:~/.claude/agents/* $AGENTS_DIR/"
|
echo " scp -r user@source:~/.claude/agents/* $AGENTS_DIR/"
|
||||||
echo ""
|
echo ""
|
||||||
echo " 2. Restart Claude Code to load all customizations"
|
echo " 2. Restart Claude Code to load all customizations"
|
||||||
echo ""
|
echo ""
|
||||||
echo " 3. Verify MCP tools are working by starting a new session"
|
echo " 3. Verify MCP tools are working by starting a new session"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Backup location: $BACKUP_DIR"
|
echo "Backup location: $BACKUP_DIR"
|
||||||
echo ""
|
echo ""
|
||||||
else
|
else
|
||||||
log_error "Installation failed. Please check the errors above."
|
log_error "Installation failed. Please check the errors above."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Run main function
|
# Run main function
|
||||||
main "$@"
|
main "$@"
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,217 +1,217 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
################################################################################
|
################################################################################
|
||||||
# Claude Code Setup Verification Script
|
# Claude Code Setup Verification Script
|
||||||
# Checks if all customizations are properly installed
|
# Checks if all customizations are properly installed
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Colors
|
# Colors
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
GREEN='\033[0;32m'
|
GREEN='\033[0;32m'
|
||||||
YELLOW='\033[1;33m'
|
YELLOW='\033[1;33m'
|
||||||
BLUE='\033[0;34m'
|
BLUE='\033[0;34m'
|
||||||
NC='\033[0m'
|
NC='\033[0m'
|
||||||
|
|
||||||
CLAUDE_DIR="$HOME/.claude"
|
CLAUDE_DIR="$HOME/.claude"
|
||||||
AGENTS_DIR="$CLAUDE_DIR/agents"
|
AGENTS_DIR="$CLAUDE_DIR/agents"
|
||||||
PLUGINS_DIR="$CLAUDE_DIR/plugins"
|
PLUGINS_DIR="$CLAUDE_DIR/plugins"
|
||||||
|
|
||||||
PASSED=0
|
PASSED=0
|
||||||
FAILED=0
|
FAILED=0
|
||||||
WARNINGS=0
|
WARNINGS=0
|
||||||
|
|
||||||
check_pass() {
|
check_pass() {
|
||||||
echo -e "${GREEN}✓${NC} $1"
|
echo -e "${GREEN}✓${NC} $1"
|
||||||
PASSED=$((PASSED+1))
|
PASSED=$((PASSED+1))
|
||||||
}
|
}
|
||||||
|
|
||||||
check_fail() {
|
check_fail() {
|
||||||
echo -e "${RED}✗${NC} $1"
|
echo -e "${RED}✗${NC} $1"
|
||||||
FAILED=$((FAILED+1))
|
FAILED=$((FAILED+1))
|
||||||
}
|
}
|
||||||
|
|
||||||
check_warn() {
|
check_warn() {
|
||||||
echo -e "${YELLOW}⚠${NC} $1"
|
echo -e "${YELLOW}⚠${NC} $1"
|
||||||
WARNINGS=$((WARNINGS+1))
|
WARNINGS=$((WARNINGS+1))
|
||||||
}
|
}
|
||||||
|
|
||||||
check_info() {
|
check_info() {
|
||||||
echo -e "${BLUE}ℹ${NC} $1"
|
echo -e "${BLUE}ℹ${NC} $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
echo -e "${BLUE}╔════════════════════════════════════════════════════════════╗${NC}"
|
echo -e "${BLUE}╔════════════════════════════════════════════════════════════╗${NC}"
|
||||||
echo -e "${BLUE}║ Claude Code Customizations - Verification ║${NC}"
|
echo -e "${BLUE}║ Claude Code Customizations - Verification ║${NC}"
|
||||||
echo -e "${BLUE}╚════════════════════════════════════════════════════════════╝${NC}"
|
echo -e "${BLUE}╚════════════════════════════════════════════════════════════╝${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# 1. Check directory structure
|
# 1. Check directory structure
|
||||||
echo "═══════════════════════════════════════════════════════════"
|
echo "═══════════════════════════════════════════════════════════"
|
||||||
echo "Directory Structure"
|
echo "Directory Structure"
|
||||||
echo "═══════════════════════════════════════════════════════════"
|
echo "═══════════════════════════════════════════════════════════"
|
||||||
|
|
||||||
[ -d "$CLAUDE_DIR" ] && check_pass "Claude directory exists" || check_fail "Claude directory missing"
|
[ -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 "$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"
|
[ -d "$PLUGINS_DIR" ] && check_pass "Plugins directory exists" || check_fail "Plugins directory missing"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "═══════════════════════════════════════════════════════════"
|
echo "═══════════════════════════════════════════════════════════"
|
||||||
echo "Agent Categories"
|
echo "Agent Categories"
|
||||||
echo "═══════════════════════════════════════════════════════════"
|
echo "═══════════════════════════════════════════════════════════"
|
||||||
|
|
||||||
CATEGORIES=("engineering" "marketing" "product" "studio-operations" "project-management" "testing" "design" "bonus")
|
CATEGORIES=("engineering" "marketing" "product" "studio-operations" "project-management" "testing" "design" "bonus")
|
||||||
AGENT_COUNT=0
|
AGENT_COUNT=0
|
||||||
|
|
||||||
for category in "${CATEGORIES[@]}"; do
|
for category in "${CATEGORIES[@]}"; do
|
||||||
if [ -d "$AGENTS_DIR/$category" ]; then
|
if [ -d "$AGENTS_DIR/$category" ]; then
|
||||||
count=$(ls -1 "$AGENTS_DIR/$category"/*.md 2>/dev/null | wc -l)
|
count=$(ls -1 "$AGENTS_DIR/$category"/*.md 2>/dev/null | wc -l)
|
||||||
if [ $count -gt 0 ]; then
|
if [ $count -gt 0 ]; then
|
||||||
echo -e "${GREEN}✓${NC} $category: $count agents"
|
echo -e "${GREEN}✓${NC} $category: $count agents"
|
||||||
AGENT_COUNT=$((AGENT_COUNT + count))
|
AGENT_COUNT=$((AGENT_COUNT + count))
|
||||||
else
|
else
|
||||||
check_warn "$category: directory exists but no agents"
|
check_warn "$category: directory exists but no agents"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
check_fail "$category: directory missing"
|
check_fail "$category: directory missing"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
check_info "Total agents: $AGENT_COUNT"
|
check_info "Total agents: $AGENT_COUNT"
|
||||||
|
|
||||||
# 2. Check configuration files
|
# 2. Check configuration files
|
||||||
echo ""
|
echo ""
|
||||||
echo "═══════════════════════════════════════════════════════════"
|
echo "═══════════════════════════════════════════════════════════"
|
||||||
echo "Configuration Files"
|
echo "Configuration Files"
|
||||||
echo "═══════════════════════════════════════════════════════════"
|
echo "═══════════════════════════════════════════════════════════"
|
||||||
|
|
||||||
[ -f "$CLAUDE_DIR/settings.json" ] && check_pass "settings.json exists" || check_fail "settings.json missing"
|
[ -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 "$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/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"
|
[ -f "$PLUGINS_DIR/known_marketplaces.json" ] && check_pass "known_marketplaces.json exists" || check_fail "known_marketplaces.json missing"
|
||||||
|
|
||||||
# 3. Check MCP tools
|
# 3. Check MCP tools
|
||||||
echo ""
|
echo ""
|
||||||
echo "═══════════════════════════════════════════════════════════"
|
echo "═══════════════════════════════════════════════════════════"
|
||||||
echo "MCP Tools"
|
echo "MCP Tools"
|
||||||
echo "═══════════════════════════════════════════════════════════"
|
echo "═══════════════════════════════════════════════════════════"
|
||||||
|
|
||||||
if command -v npx &> /dev/null; then
|
if command -v npx &> /dev/null; then
|
||||||
check_pass "npx available"
|
check_pass "npx available"
|
||||||
|
|
||||||
# Check if @z_ai/mcp-server can be accessed
|
# Check if @z_ai/mcp-server can be accessed
|
||||||
if npx -y @z_ai/mcp-server --help &> /dev/null; then
|
if npx -y @z_ai/mcp-server --help &> /dev/null; then
|
||||||
check_pass "@z_ai/mcp-server accessible"
|
check_pass "@z_ai/mcp-server accessible"
|
||||||
else
|
else
|
||||||
check_warn "@z_ai/mcp-server not directly accessible (may download on first use)"
|
check_warn "@z_ai/mcp-server not directly accessible (may download on first use)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if @z_ai/coding-helper can be accessed
|
# Check if @z_ai/coding-helper can be accessed
|
||||||
if npx -y @z_ai/coding-helper --help &> /dev/null; then
|
if npx -y @z_ai/coding-helper --help &> /dev/null; then
|
||||||
check_pass "@z_ai/coding-helper accessible"
|
check_pass "@z_ai/coding-helper accessible"
|
||||||
else
|
else
|
||||||
check_warn "@z_ai/coding-helper not directly accessible (may download on first use)"
|
check_warn "@z_ai/coding-helper not directly accessible (may download on first use)"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
check_fail "npx not available - MCP tools may not work"
|
check_fail "npx not available - MCP tools may not work"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 4. Check plugins
|
# 4. Check plugins
|
||||||
echo ""
|
echo ""
|
||||||
echo "═══════════════════════════════════════════════════════════"
|
echo "═══════════════════════════════════════════════════════════"
|
||||||
echo "Plugins"
|
echo "Plugins"
|
||||||
echo "═══════════════════════════════════════════════════════════"
|
echo "═══════════════════════════════════════════════════════════"
|
||||||
|
|
||||||
if [ -f "$PLUGINS_DIR/installed_plugins.json" ]; then
|
if [ -f "$PLUGINS_DIR/installed_plugins.json" ]; then
|
||||||
# Check if GLM plugins are registered
|
# Check if GLM plugins are registered
|
||||||
if grep -q "glm-plan-bug" "$PLUGINS_DIR/installed_plugins.json" 2>/dev/null; then
|
if grep -q "glm-plan-bug" "$PLUGINS_DIR/installed_plugins.json" 2>/dev/null; then
|
||||||
check_pass "glm-plan-bug plugin registered"
|
check_pass "glm-plan-bug plugin registered"
|
||||||
else
|
else
|
||||||
check_warn "glm-plan-bug plugin not registered"
|
check_warn "glm-plan-bug plugin not registered"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if grep -q "glm-plan-usage" "$PLUGINS_DIR/installed_plugins.json" 2>/dev/null; then
|
if grep -q "glm-plan-usage" "$PLUGINS_DIR/installed_plugins.json" 2>/dev/null; then
|
||||||
check_pass "glm-plan-usage plugin registered"
|
check_pass "glm-plan-usage plugin registered"
|
||||||
else
|
else
|
||||||
check_warn "glm-plan-usage plugin not registered"
|
check_warn "glm-plan-usage plugin not registered"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 5. Sample agent check
|
# 5. Sample agent check
|
||||||
echo ""
|
echo ""
|
||||||
echo "═══════════════════════════════════════════════════════════"
|
echo "═══════════════════════════════════════════════════════════"
|
||||||
echo "Agent Content Verification"
|
echo "Agent Content Verification"
|
||||||
echo "═══════════════════════════════════════════════════════════"
|
echo "═══════════════════════════════════════════════════════════"
|
||||||
|
|
||||||
CRITICAL_AGENTS=(
|
CRITICAL_AGENTS=(
|
||||||
"engineering/test-writer-fixer.md"
|
"engineering/test-writer-fixer.md"
|
||||||
"engineering/frontend-developer.md"
|
"engineering/frontend-developer.md"
|
||||||
"marketing/tiktok-strategist.md"
|
"marketing/tiktok-strategist.md"
|
||||||
"product/sprint-prioritizer.md"
|
"product/sprint-prioritizer.md"
|
||||||
"studio-operations/studio-producer.md"
|
"studio-operations/studio-producer.md"
|
||||||
"project-management/project-shipper.md"
|
"project-management/project-shipper.md"
|
||||||
"design/whimsy-injector.md"
|
"design/whimsy-injector.md"
|
||||||
)
|
)
|
||||||
|
|
||||||
for agent in "${CRITICAL_AGENTS[@]}"; do
|
for agent in "${CRITICAL_AGENTS[@]}"; do
|
||||||
if [ -f "$AGENTS_DIR/$agent" ]; then
|
if [ -f "$AGENTS_DIR/$agent" ]; then
|
||||||
# Check file has content
|
# Check file has content
|
||||||
if [ -s "$AGENTS_DIR/$agent" ]; then
|
if [ -s "$AGENTS_DIR/$agent" ]; then
|
||||||
check_pass "$agent exists and has content"
|
check_pass "$agent exists and has content"
|
||||||
else
|
else
|
||||||
check_warn "$agent exists but is empty"
|
check_warn "$agent exists but is empty"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
check_warn "$agent missing"
|
check_warn "$agent missing"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# 6. Settings validation
|
# 6. Settings validation
|
||||||
echo ""
|
echo ""
|
||||||
echo "═══════════════════════════════════════════════════════════"
|
echo "═══════════════════════════════════════════════════════════"
|
||||||
echo "Settings Validation"
|
echo "Settings Validation"
|
||||||
echo "═══════════════════════════════════════════════════════════"
|
echo "═══════════════════════════════════════════════════════════"
|
||||||
|
|
||||||
if [ -f "$CLAUDE_DIR/settings.json" ]; then
|
if [ -f "$CLAUDE_DIR/settings.json" ]; then
|
||||||
# Check if JSON is valid
|
# Check if JSON is valid
|
||||||
if python3 -m json.tool "$CLAUDE_DIR/settings.json" &> /dev/null; then
|
if python3 -m json.tool "$CLAUDE_DIR/settings.json" &> /dev/null; then
|
||||||
check_pass "settings.json is valid JSON"
|
check_pass "settings.json is valid JSON"
|
||||||
|
|
||||||
# Check for API token placeholder
|
# Check for API token placeholder
|
||||||
if grep -q "YOUR_API_TOKEN_HERE\|YOUR_TOKEN_HERE" "$CLAUDE_DIR/settings.json" 2>/dev/null; then
|
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)"
|
check_warn "API token not configured (still placeholder)"
|
||||||
else
|
else
|
||||||
if grep -q "ANTHROPIC_AUTH_TOKEN" "$CLAUDE_DIR/settings.json" 2>/dev/null; then
|
if grep -q "ANTHROPIC_AUTH_TOKEN" "$CLAUDE_DIR/settings.json" 2>/dev/null; then
|
||||||
check_pass "ANTHROPIC_AUTH_TOKEN is set"
|
check_pass "ANTHROPIC_AUTH_TOKEN is set"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
check_fail "settings.json is not valid JSON"
|
check_fail "settings.json is not valid JSON"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 7. Summary
|
# 7. Summary
|
||||||
echo ""
|
echo ""
|
||||||
echo "═══════════════════════════════════════════════════════════"
|
echo "═══════════════════════════════════════════════════════════"
|
||||||
echo "Summary"
|
echo "Summary"
|
||||||
echo "═══════════════════════════════════════════════════════════"
|
echo "═══════════════════════════════════════════════════════════"
|
||||||
|
|
||||||
if [ $FAILED -eq 0 ]; then
|
if [ $FAILED -eq 0 ]; then
|
||||||
echo -e "${GREEN}✓ All critical checks passed!${NC}"
|
echo -e "${GREEN}✓ All critical checks passed!${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Passed: $PASSED"
|
echo "Passed: $PASSED"
|
||||||
echo "Warnings: $WARNINGS"
|
echo "Warnings: $WARNINGS"
|
||||||
echo "Failed: $FAILED"
|
echo "Failed: $FAILED"
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${GREEN}Your Claude Code setup is ready to use!${NC}"
|
echo -e "${GREEN}Your Claude Code setup is ready to use!${NC}"
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo -e "${RED}✗ Some checks failed${NC}"
|
echo -e "${RED}✗ Some checks failed${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Passed: $PASSED"
|
echo "Passed: $PASSED"
|
||||||
echo "Warnings: $WARNINGS"
|
echo "Warnings: $WARNINGS"
|
||||||
echo "Failed: $FAILED"
|
echo "Failed: $FAILED"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Please fix the failed checks above."
|
echo "Please fix the failed checks above."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,82 +1,82 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# WordPress Safe Content Update Script
|
# WordPress Safe Content Update Script
|
||||||
# Prevents encoding issues when updating WordPress post content
|
# Prevents encoding issues when updating WordPress post content
|
||||||
# Usage: ./wordpress_safe_update.sh <post_id> <html_file_path>
|
# Usage: ./wordpress_safe_update.sh <post_id> <html_file_path>
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
DB_NAME="wordpress"
|
DB_NAME="wordpress"
|
||||||
DB_USER="root"
|
DB_USER="root"
|
||||||
TABLE_PREFIX="wp_"
|
TABLE_PREFIX="wp_"
|
||||||
|
|
||||||
# Check arguments
|
# Check arguments
|
||||||
if [ $# -ne 2 ]; then
|
if [ $# -ne 2 ]; then
|
||||||
echo "Usage: $0 <post_id> <html_file_path>"
|
echo "Usage: $0 <post_id> <html_file_path>"
|
||||||
echo "Example: $0 112 /tmp/article_content.html"
|
echo "Example: $0 112 /tmp/article_content.html"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
POST_ID="$1"
|
POST_ID="$1"
|
||||||
HTML_FILE="$2"
|
HTML_FILE="$2"
|
||||||
|
|
||||||
# Verify file exists
|
# Verify file exists
|
||||||
if [ ! -f "$HTML_FILE" ]; then
|
if [ ! -f "$HTML_FILE" ]; then
|
||||||
echo "Error: File not found: $HTML_FILE"
|
echo "Error: File not found: $HTML_FILE"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Verify file is readable
|
# Verify file is readable
|
||||||
if [ ! -r "$HTML_FILE" ]; then
|
if [ ! -r "$HTML_FILE" ]; then
|
||||||
echo "Error: File is not readable: $HTML_FILE"
|
echo "Error: File is not readable: $HTML_FILE"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check file encoding
|
# Check file encoding
|
||||||
FILE_ENCODING=$(file -b --mime-encoding "$HTML_FILE")
|
FILE_ENCODING=$(file -b --mime-encoding "$HTML_FILE")
|
||||||
if [[ ! "$FILE_ENCODING" =~ utf-8 ]]; then
|
if [[ ! "$FILE_ENCODING" =~ utf-8 ]]; then
|
||||||
echo "Warning: File encoding is $FILE_ENCODING, expected utf-8"
|
echo "Warning: File encoding is $FILE_ENCODING, expected utf-8"
|
||||||
echo "Converting to UTF-8..."
|
echo "Converting to UTF-8..."
|
||||||
iconv -f UTF-8 -t UTF-8 "$HTML_FILE" > "${HTML_FILE}.utf8"
|
iconv -f UTF-8 -t UTF-8 "$HTML_FILE" > "${HTML_FILE}.utf8"
|
||||||
mv "${HTML_FILE}.utf8" "$HTML_FILE"
|
mv "${HTML_FILE}.utf8" "$HTML_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Verify no literal escape sequences
|
# Verify no literal escape sequences
|
||||||
if grep -q '\\n' "$HTML_FILE"; then
|
if grep -q '\\n' "$HTML_FILE"; then
|
||||||
echo "Error: File contains literal \\n escape sequences"
|
echo "Error: File contains literal \\n escape sequences"
|
||||||
echo "Please fix the file before updating WordPress"
|
echo "Please fix the file before updating WordPress"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Backup current content
|
# Backup current content
|
||||||
echo "Backing up current content..."
|
echo "Backing up current content..."
|
||||||
sudo mysql "${DB_NAME}" --skip-column-names --raw \
|
sudo mysql "${DB_NAME}" --skip-column-names --raw \
|
||||||
-e "SELECT post_content FROM ${TABLE_PREFIX}posts WHERE ID = ${POST_ID};" \
|
-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"
|
> "/tmp/wp_post_${POST_ID}_backup_$(date +%Y%m%d_%H%M%S).html"
|
||||||
|
|
||||||
# Update post content
|
# Update post content
|
||||||
echo "Updating post ID ${POST_ID}..."
|
echo "Updating post ID ${POST_ID}..."
|
||||||
sudo mysql "${DB_NAME}" \
|
sudo mysql "${DB_NAME}" \
|
||||||
-e "UPDATE ${TABLE_PREFIX}posts SET post_content = LOAD_FILE('${HTML_FILE}') WHERE ID = ${POST_ID};"
|
-e "UPDATE ${TABLE_PREFIX}posts SET post_content = LOAD_FILE('${HTML_FILE}') WHERE ID = ${POST_ID};"
|
||||||
|
|
||||||
# Verify update
|
# Verify update
|
||||||
RESULT=$(sudo mysql "${DB_NAME}" --skip-column-names --raw \
|
RESULT=$(sudo mysql "${DB_NAME}" --skip-column-names --raw \
|
||||||
-e "SELECT post_content FROM ${TABLE_PREFIX}posts WHERE ID = ${POST_ID};" \
|
-e "SELECT post_content FROM ${TABLE_PREFIX}posts WHERE ID = ${POST_ID};" \
|
||||||
| head -20)
|
| head -20)
|
||||||
|
|
||||||
if echo "$RESULT" | grep -q '<!DOCTYPE\|<section\|<div'; then
|
if echo "$RESULT" | grep -q '<!DOCTYPE\|<section\|<div'; then
|
||||||
echo "✓ Update successful!"
|
echo "✓ Update successful!"
|
||||||
echo "✓ Post ID ${POST_ID} has been updated"
|
echo "✓ Post ID ${POST_ID} has been updated"
|
||||||
echo "✓ Content verified"
|
echo "✓ Content verified"
|
||||||
else
|
else
|
||||||
echo "✗ Update may have failed - please verify manually"
|
echo "✗ Update may have failed - please verify manually"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Verification preview:"
|
echo "Verification preview:"
|
||||||
echo "$RESULT"
|
echo "$RESULT"
|
||||||
echo ""
|
echo ""
|
||||||
echo "To view full content:"
|
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};\""
|
echo "sudo mysql ${DB_NAME} --skip-column-names --raw -e \"SELECT post_content FROM ${TABLE_PREFIX}posts WHERE ID = ${POST_ID};\""
|
||||||
|
|||||||
880
supercharge.sh
880
supercharge.sh
@@ -1,440 +1,440 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
################################################################################
|
################################################################################
|
||||||
# SuperCharge Claude Code - Ultimate Installation Script
|
# SuperCharge Claude Code - Ultimate Installation Script
|
||||||
################################################################################
|
################################################################################
|
||||||
# This script transforms any Claude Code installation into a supercharged
|
# This script transforms any Claude Code installation into a supercharged
|
||||||
# version with all customizations, skills, agents, plugins, and integrations.
|
# version with all customizations, skills, agents, plugins, and integrations.
|
||||||
#
|
#
|
||||||
# Features:
|
# Features:
|
||||||
# - 30+ Custom Skills (cognitive, development, UI/UX, brainstorming)
|
# - 30+ Custom Skills (cognitive, development, UI/UX, brainstorming)
|
||||||
# - RalphLoop autonomous agent integration
|
# - RalphLoop autonomous agent integration
|
||||||
# - Multi-AI consultation (Qwen integration)
|
# - Multi-AI consultation (Qwen integration)
|
||||||
# - Agent management system with sync capabilities
|
# - Agent management system with sync capabilities
|
||||||
# - Custom hooks for session management
|
# - Custom hooks for session management
|
||||||
# - MCP servers integration
|
# - MCP servers integration
|
||||||
# - Plugin marketplace setup
|
# - Plugin marketplace setup
|
||||||
#
|
#
|
||||||
# Usage: ./supercharge.sh [options]
|
# Usage: ./supercharge.sh [options]
|
||||||
# --skip-deps Skip dependency installation
|
# --skip-deps Skip dependency installation
|
||||||
# --dev-mode Development mode (verbose output)
|
# --dev-mode Development mode (verbose output)
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Colors for output
|
# Colors for output
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
GREEN='\033[0;32m'
|
GREEN='\033[0;32m'
|
||||||
YELLOW='\033[1;33m'
|
YELLOW='\033[1;33m'
|
||||||
BLUE='\033[0;34m'
|
BLUE='\033[0;34m'
|
||||||
CYAN='\033[0;36m'
|
CYAN='\033[0;36m'
|
||||||
BOLD='\033[1m'
|
BOLD='\033[1m'
|
||||||
NC='\033[0m' # No Color
|
NC='\033[0m' # No Color
|
||||||
|
|
||||||
# Script directory
|
# Script directory
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
# Claude config directory
|
# Claude config directory
|
||||||
CLAUDE_DIR="${HOME}/.claude"
|
CLAUDE_DIR="${HOME}/.claude"
|
||||||
|
|
||||||
# Backup directory
|
# Backup directory
|
||||||
BACKUP_DIR="${HOME}/.claude-backup-$(date +%Y%m%d_%H%M%S)"
|
BACKUP_DIR="${HOME}/.claude-backup-$(date +%Y%m%d_%H%M%S)"
|
||||||
|
|
||||||
# Flags
|
# Flags
|
||||||
SKIP_DEPS=false
|
SKIP_DEPS=false
|
||||||
DEV_MODE=false
|
DEV_MODE=false
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Helper Functions
|
# Helper Functions
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
log_info() {
|
log_info() {
|
||||||
echo -e "${BLUE}[INFO]${NC} $1"
|
echo -e "${BLUE}[INFO]${NC} $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
log_success() {
|
log_success() {
|
||||||
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
log_warn() {
|
log_warn() {
|
||||||
echo -e "${YELLOW}[WARN]${NC} $1"
|
echo -e "${YELLOW}[WARN]${NC} $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
log_error() {
|
log_error() {
|
||||||
echo -e "${RED}[ERROR]${NC} $1"
|
echo -e "${RED}[ERROR]${NC} $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
log_step() {
|
log_step() {
|
||||||
echo -e "${CYAN}${BOLD}==>${NC} ${BOLD}$1${NC}"
|
echo -e "${CYAN}${BOLD}==>${NC} ${BOLD}$1${NC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
print_banner() {
|
print_banner() {
|
||||||
echo -e "${CYAN}${BOLD}"
|
echo -e "${CYAN}${BOLD}"
|
||||||
cat << "EOF"
|
cat << "EOF"
|
||||||
╔═══════════════════════════════════════════════════════════════╗
|
╔═══════════════════════════════════════════════════════════════╗
|
||||||
║ ║
|
║ ║
|
||||||
║ ███████╗██╗ █████╗ ██████╗ ║
|
║ ███████╗██╗ █████╗ ██████╗ ║
|
||||||
║ ██╔════╝██║ ██╔══██╗██╔════╝ ║
|
║ ██╔════╝██║ ██╔══██╗██╔════╝ ║
|
||||||
║ ███████╗██║ ███████║██║ ███╗ ║
|
║ ███████╗██║ ███████║██║ ███╗ ║
|
||||||
║ ╚════██║██║ ██╔══██║██║ ██║ ║
|
║ ╚════██║██║ ██╔══██║██║ ██║ ║
|
||||||
║ ███████║███████╗██║ ██║╚██████╔╝ ║
|
║ ███████║███████╗██║ ██║╚██████╔╝ ║
|
||||||
║ ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ║
|
║ ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ║
|
||||||
║ ║
|
║ ║
|
||||||
║ ███████╗██╗ ██╗███████╗███╗ ██╗ ║
|
║ ███████╗██╗ ██╗███████╗███╗ ██╗ ║
|
||||||
║ ██╔════╝╚██╗██╔╝██╔════╝████╗ ██║ ║
|
║ ██╔════╝╚██╗██╔╝██╔════╝████╗ ██║ ║
|
||||||
║ █████╗ ╚███╔╝ █████╗ ██╔██╗ ██║ ║
|
║ █████╗ ╚███╔╝ █████╗ ██╔██╗ ██║ ║
|
||||||
║ ██╔══╝ ██╔██╗ ██╔══╝ ██║╚██╗██║ ║
|
║ ██╔══╝ ██╔██╗ ██╔══╝ ██║╚██╗██║ ║
|
||||||
║ ███████╗██║██╗██║███████╗██║ ╚████║ ║
|
║ ███████╗██║██╗██║███████╗██║ ╚████║ ║
|
||||||
║ ╚══════╝╚═╝╚═╝╚═╝╚══════╝╚═╝ ╚═══╝ ║
|
║ ╚══════╝╚═╝╚═╝╚═╝╚══════╝╚═╝ ╚═══╝ ║
|
||||||
║ ║
|
║ ║
|
||||||
║ Ultimate Installation Script ║
|
║ Ultimate Installation Script ║
|
||||||
║ ║
|
║ ║
|
||||||
╚═══════════════════════════════════════════════════════════════╝
|
╚═══════════════════════════════════════════════════════════════╝
|
||||||
EOF
|
EOF
|
||||||
echo -e "${NC}"
|
echo -e "${NC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
check_claude_code() {
|
check_claude_code() {
|
||||||
log_step "Checking for Claude Code installation..."
|
log_step "Checking for Claude Code installation..."
|
||||||
|
|
||||||
if ! command -v claude &> /dev/null; then
|
if ! command -v claude &> /dev/null; then
|
||||||
log_error "Claude Code CLI not found!"
|
log_error "Claude Code CLI not found!"
|
||||||
echo "Please install Claude Code first: https://claude.com/claude-code"
|
echo "Please install Claude Code first: https://claude.com/claude-code"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log_success "Claude Code found: $(claude --version 2>/dev/null || echo 'installed')"
|
log_success "Claude Code found: $(claude --version 2>/dev/null || echo 'installed')"
|
||||||
}
|
}
|
||||||
|
|
||||||
backup_existing_config() {
|
backup_existing_config() {
|
||||||
log_step "Backing up existing configuration..."
|
log_step "Backing up existing configuration..."
|
||||||
|
|
||||||
if [ -d "$CLAUDE_DIR" ]; then
|
if [ -d "$CLAUDE_DIR" ]; then
|
||||||
mkdir -p "$BACKUP_DIR"
|
mkdir -p "$BACKUP_DIR"
|
||||||
cp -r "$CLAUDE_DIR" "$BACKUP_DIR/"
|
cp -r "$CLAUDE_DIR" "$BACKUP_DIR/"
|
||||||
log_success "Backup created at: $BACKUP_DIR"
|
log_success "Backup created at: $BACKUP_DIR"
|
||||||
else
|
else
|
||||||
log_info "No existing configuration to backup"
|
log_info "No existing configuration to backup"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_dependencies() {
|
install_dependencies() {
|
||||||
if [ "$SKIP_DEPS" = true ]; then
|
if [ "$SKIP_DEPS" = true ]; then
|
||||||
log_warn "Skipping dependency installation"
|
log_warn "Skipping dependency installation"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log_step "Checking and installing dependencies..."
|
log_step "Checking and installing dependencies..."
|
||||||
|
|
||||||
# Check Python 3
|
# Check Python 3
|
||||||
if ! command -v python3 &> /dev/null; then
|
if ! command -v python3 &> /dev/null; then
|
||||||
log_warn "Python 3 not found. Some features may not work."
|
log_warn "Python 3 not found. Some features may not work."
|
||||||
else
|
else
|
||||||
log_success "Python 3 found: $(python3 --version)"
|
log_success "Python 3 found: $(python3 --version)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check Node.js
|
# Check Node.js
|
||||||
if ! command -v node &> /dev/null; then
|
if ! command -v node &> /dev/null; then
|
||||||
log_warn "Node.js not found. Some features may not work."
|
log_warn "Node.js not found. Some features may not work."
|
||||||
else
|
else
|
||||||
log_success "Node.js found: $(node --version)"
|
log_success "Node.js found: $(node --version)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check Git
|
# Check Git
|
||||||
if ! command -v git &> /dev/null; then
|
if ! command -v git &> /dev/null; then
|
||||||
log_error "Git not found. Please install Git first."
|
log_error "Git not found. Please install Git first."
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
log_success "Git found: $(git --version)"
|
log_success "Git found: $(git --version)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install Ralph Orchestrator if not present
|
# Install Ralph Orchestrator if not present
|
||||||
if ! command -v ralph &> /dev/null; then
|
if ! command -v ralph &> /dev/null; then
|
||||||
log_info "Installing Ralph Orchestrator..."
|
log_info "Installing Ralph Orchestrator..."
|
||||||
if command -v pip3 &> /dev/null; then
|
if command -v pip3 &> /dev/null; then
|
||||||
pip3 install ralph-orchestrator 2>/dev/null || log_warn "Failed to install Ralph Orchestrator"
|
pip3 install ralph-orchestrator 2>/dev/null || log_warn "Failed to install Ralph Orchestrator"
|
||||||
else
|
else
|
||||||
log_warn "pip3 not found. Skipping Ralph Orchestrator installation."
|
log_warn "pip3 not found. Skipping Ralph Orchestrator installation."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
log_success "Ralph Orchestrator found"
|
log_success "Ralph Orchestrator found"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_skills() {
|
install_skills() {
|
||||||
log_step "Installing custom skills..."
|
log_step "Installing custom skills..."
|
||||||
|
|
||||||
mkdir -p "$CLAUDE_DIR/skills"
|
mkdir -p "$CLAUDE_DIR/skills"
|
||||||
|
|
||||||
# Copy all skills
|
# Copy all skills
|
||||||
if [ -d "$SCRIPT_DIR/skills" ]; then
|
if [ -d "$SCRIPT_DIR/skills" ]; then
|
||||||
cp -r "$SCRIPT_DIR/skills/"* "$CLAUDE_DIR/skills/" 2>/dev/null || true
|
cp -r "$SCRIPT_DIR/skills/"* "$CLAUDE_DIR/skills/" 2>/dev/null || true
|
||||||
local skill_count=$(find "$SCRIPT_DIR/skills" -name "SKILL.md" | wc -l)
|
local skill_count=$(find "$SCRIPT_DIR/skills" -name "SKILL.md" | wc -l)
|
||||||
log_success "Installed $skill_count custom skills"
|
log_success "Installed $skill_count custom skills"
|
||||||
else
|
else
|
||||||
log_warn "Skills directory not found"
|
log_warn "Skills directory not found"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_agents() {
|
install_agents() {
|
||||||
log_step "Installing agent management system..."
|
log_step "Installing agent management system..."
|
||||||
|
|
||||||
mkdir -p "$CLAUDE_DIR/agents"
|
mkdir -p "$CLAUDE_DIR/agents"
|
||||||
|
|
||||||
if [ -d "$SCRIPT_DIR/agents" ]; then
|
if [ -d "$SCRIPT_DIR/agents" ]; then
|
||||||
cp -r "$SCRIPT_DIR/agents/"* "$CLAUDE_DIR/agents/" 2>/dev/null || true
|
cp -r "$SCRIPT_DIR/agents/"* "$CLAUDE_DIR/agents/" 2>/dev/null || true
|
||||||
log_success "Agent management system installed"
|
log_success "Agent management system installed"
|
||||||
|
|
||||||
# Make scripts executable
|
# Make scripts executable
|
||||||
find "$CLAUDE_DIR/agents" -name "*.sh" -exec chmod +x {} \;
|
find "$CLAUDE_DIR/agents" -name "*.sh" -exec chmod +x {} \;
|
||||||
else
|
else
|
||||||
log_warn "Agents directory not found"
|
log_warn "Agents directory not found"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_hooks() {
|
install_hooks() {
|
||||||
log_step "Installing custom hooks..."
|
log_step "Installing custom hooks..."
|
||||||
|
|
||||||
mkdir -p "$CLAUDE_DIR/hooks"
|
mkdir -p "$CLAUDE_DIR/hooks"
|
||||||
|
|
||||||
if [ -d "$SCRIPT_DIR/hooks" ]; then
|
if [ -d "$SCRIPT_DIR/hooks" ]; then
|
||||||
cp -r "$SCRIPT_DIR/hooks/"* "$CLAUDE_DIR/hooks/" 2>/dev/null || true
|
cp -r "$SCRIPT_DIR/hooks/"* "$CLAUDE_DIR/hooks/" 2>/dev/null || true
|
||||||
|
|
||||||
# Make hook scripts executable
|
# Make hook scripts executable
|
||||||
find "$CLAUDE_DIR/hooks" -name "*.sh" -exec chmod +x {} \;
|
find "$CLAUDE_DIR/hooks" -name "*.sh" -exec chmod +x {} \;
|
||||||
|
|
||||||
log_success "Custom hooks installed"
|
log_success "Custom hooks installed"
|
||||||
else
|
else
|
||||||
log_warn "Hooks directory not found"
|
log_warn "Hooks directory not found"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install hooks.json if it doesn't exist
|
# Install hooks.json if it doesn't exist
|
||||||
if [ -f "$SCRIPT_DIR/templates/hooks.json" ] && [ ! -f "$CLAUDE_DIR/hooks.json" ]; then
|
if [ -f "$SCRIPT_DIR/templates/hooks.json" ] && [ ! -f "$CLAUDE_DIR/hooks.json" ]; then
|
||||||
cp "$SCRIPT_DIR/templates/hooks.json" "$CLAUDE_DIR/hooks.json"
|
cp "$SCRIPT_DIR/templates/hooks.json" "$CLAUDE_DIR/hooks.json"
|
||||||
log_success "Hooks configuration installed"
|
log_success "Hooks configuration installed"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_commands() {
|
install_commands() {
|
||||||
log_step "Installing custom commands..."
|
log_step "Installing custom commands..."
|
||||||
|
|
||||||
mkdir -p "$CLAUDE_DIR/commands"
|
mkdir -p "$CLAUDE_DIR/commands"
|
||||||
|
|
||||||
if [ -d "$SCRIPT_DIR/commands" ]; then
|
if [ -d "$SCRIPT_DIR/commands" ]; then
|
||||||
cp -r "$SCRIPT_DIR/commands/"* "$CLAUDE_DIR/commands/" 2>/dev/null || true
|
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)
|
local cmd_count=$(ls -1 "$SCRIPT_DIR/commands" 2>/dev/null | wc -l)
|
||||||
log_success "Installed $cmd_count custom commands"
|
log_success "Installed $cmd_count custom commands"
|
||||||
else
|
else
|
||||||
log_warn "Commands directory not found"
|
log_warn "Commands directory not found"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_plugins() {
|
install_plugins() {
|
||||||
log_step "Installing plugin references..."
|
log_step "Installing plugin references..."
|
||||||
|
|
||||||
mkdir -p "$CLAUDE_DIR/plugins"
|
mkdir -p "$CLAUDE_DIR/plugins"
|
||||||
|
|
||||||
if [ -d "$SCRIPT_DIR/plugins" ]; then
|
if [ -d "$SCRIPT_DIR/plugins" ]; then
|
||||||
cp -r "$SCRIPT_DIR/plugins/"* "$CLAUDE_DIR/plugins/" 2>/dev/null || true
|
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)
|
local plugin_count=$(find "$SCRIPT_DIR/plugins" -type d -mindepth 1 | wc -l)
|
||||||
log_success "Installed $plugin_count plugin references"
|
log_success "Installed $plugin_count plugin references"
|
||||||
else
|
else
|
||||||
log_warn "Plugins directory not found"
|
log_warn "Plugins directory not found"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_binaries() {
|
install_binaries() {
|
||||||
log_step "Installing custom binaries..."
|
log_step "Installing custom binaries..."
|
||||||
|
|
||||||
mkdir -p "$HOME/.local/bin"
|
mkdir -p "$HOME/.local/bin"
|
||||||
|
|
||||||
if [ -f "$SCRIPT_DIR/bin/ralphloop" ]; then
|
if [ -f "$SCRIPT_DIR/bin/ralphloop" ]; then
|
||||||
cp "$SCRIPT_DIR/bin/ralphloop" "$HOME/.local/bin/"
|
cp "$SCRIPT_DIR/bin/ralphloop" "$HOME/.local/bin/"
|
||||||
chmod +x "$HOME/.local/bin/ralphloop"
|
chmod +x "$HOME/.local/bin/ralphloop"
|
||||||
|
|
||||||
# Add to PATH if not already there
|
# Add to PATH if not already there
|
||||||
if ! echo "$PATH" | grep -q "$HOME/.local/bin"; then
|
if ! echo "$PATH" | grep -q "$HOME/.local/bin"; then
|
||||||
echo "" >> "$HOME/.bashrc"
|
echo "" >> "$HOME/.bashrc"
|
||||||
echo "# SuperCharge Claude Code - Add local bin to PATH" >> "$HOME/.bashrc"
|
echo "# SuperCharge Claude Code - Add local bin to PATH" >> "$HOME/.bashrc"
|
||||||
echo "export PATH=\"\$HOME/.local/bin:\$PATH\"" >> "$HOME/.bashrc"
|
echo "export PATH=\"\$HOME/.local/bin:\$PATH\"" >> "$HOME/.bashrc"
|
||||||
log_info "Added ~/.local/bin to PATH in .bashrc"
|
log_info "Added ~/.local/bin to PATH in .bashrc"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log_success "RalphLoop wrapper installed"
|
log_success "RalphLoop wrapper installed"
|
||||||
else
|
else
|
||||||
log_warn "RalphLoop binary not found"
|
log_warn "RalphLoop binary not found"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_scripts() {
|
install_scripts() {
|
||||||
log_step "Installing utility scripts..."
|
log_step "Installing utility scripts..."
|
||||||
|
|
||||||
mkdir -p "$CLAUDE_DIR/scripts"
|
mkdir -p "$CLAUDE_DIR/scripts"
|
||||||
|
|
||||||
if [ -d "$SCRIPT_DIR/scripts" ]; then
|
if [ -d "$SCRIPT_DIR/scripts" ]; then
|
||||||
cp -r "$SCRIPT_DIR/scripts/"* "$CLAUDE_DIR/scripts/" 2>/dev/null || true
|
cp -r "$SCRIPT_DIR/scripts/"* "$CLAUDE_DIR/scripts/" 2>/dev/null || true
|
||||||
|
|
||||||
# Make scripts executable
|
# Make scripts executable
|
||||||
find "$CLAUDE_DIR/scripts" -name "*.sh" -exec chmod +x {} \;
|
find "$CLAUDE_DIR/scripts" -name "*.sh" -exec chmod +x {} \;
|
||||||
|
|
||||||
log_success "Utility scripts installed"
|
log_success "Utility scripts installed"
|
||||||
else
|
else
|
||||||
log_warn "Scripts directory not found"
|
log_warn "Scripts directory not found"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_config_templates() {
|
install_config_templates() {
|
||||||
log_step "Installing configuration templates..."
|
log_step "Installing configuration templates..."
|
||||||
|
|
||||||
if [ -d "$SCRIPT_DIR/templates" ]; then
|
if [ -d "$SCRIPT_DIR/templates" ]; then
|
||||||
# Install config.json if not exists
|
# Install config.json if not exists
|
||||||
if [ -f "$SCRIPT_DIR/templates/config.json" ] && [ ! -f "$CLAUDE_DIR/config.json" ]; then
|
if [ -f "$SCRIPT_DIR/templates/config.json" ] && [ ! -f "$CLAUDE_DIR/config.json" ]; then
|
||||||
cp "$SCRIPT_DIR/templates/config.json" "$CLAUDE_DIR/config.json"
|
cp "$SCRIPT_DIR/templates/config.json" "$CLAUDE_DIR/config.json"
|
||||||
log_success "config.json installed"
|
log_success "config.json installed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Merge settings.json
|
# Merge settings.json
|
||||||
if [ -f "$SCRIPT_DIR/templates/settings.json" ]; then
|
if [ -f "$SCRIPT_DIR/templates/settings.json" ]; then
|
||||||
if [ -f "$CLAUDE_DIR/settings.json" ]; then
|
if [ -f "$CLAUDE_DIR/settings.json" ]; then
|
||||||
# Merge existing settings with template
|
# Merge existing settings with template
|
||||||
local temp_file=$(mktemp)
|
local temp_file=$(mktemp)
|
||||||
python3 -c "
|
python3 -c "
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open('$CLAUDE_DIR/settings.json', 'r') as f:
|
with open('$CLAUDE_DIR/settings.json', 'r') as f:
|
||||||
existing = json.load(f)
|
existing = json.load(f)
|
||||||
except:
|
except:
|
||||||
existing = {}
|
existing = {}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open('$SCRIPT_DIR/templates/settings.json', 'r') as f:
|
with open('$SCRIPT_DIR/templates/settings.json', 'r') as f:
|
||||||
template = json.load(f)
|
template = json.load(f)
|
||||||
except:
|
except:
|
||||||
template = {}
|
template = {}
|
||||||
|
|
||||||
# Merge: template values take precedence for keys that exist in template
|
# Merge: template values take precedence for keys that exist in template
|
||||||
for key in template:
|
for key in template:
|
||||||
if key != 'permissions': # Don't override permissions
|
if key != 'permissions': # Don't override permissions
|
||||||
existing[key] = template[key]
|
existing[key] = template[key]
|
||||||
|
|
||||||
with open('$temp_file', 'w') as f:
|
with open('$temp_file', 'w') as f:
|
||||||
json.dump(existing, f, indent=2)
|
json.dump(existing, f, indent=2)
|
||||||
" 2>/dev/null || cp "$SCRIPT_DIR/templates/settings.json" "$temp_file"
|
" 2>/dev/null || cp "$SCRIPT_DIR/templates/settings.json" "$temp_file"
|
||||||
mv "$temp_file" "$CLAUDE_DIR/settings.json"
|
mv "$temp_file" "$CLAUDE_DIR/settings.json"
|
||||||
else
|
else
|
||||||
cp "$SCRIPT_DIR/templates/settings.json" "$CLAUDE_DIR/settings.json"
|
cp "$SCRIPT_DIR/templates/settings.json" "$CLAUDE_DIR/settings.json"
|
||||||
fi
|
fi
|
||||||
log_success "settings.json configured"
|
log_success "settings.json configured"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install settings.local.json if not exists
|
# Install settings.local.json if not exists
|
||||||
if [ -f "$SCRIPT_DIR/templates/settings.local.json" ] && [ ! -f "$CLAUDE_DIR/settings.local.json" ]; then
|
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"
|
cp "$SCRIPT_DIR/templates/settings.local.json" "$CLAUDE_DIR/settings.local.json"
|
||||||
log_success "settings.local.json installed"
|
log_success "settings.local.json installed"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
sync_agents() {
|
sync_agents() {
|
||||||
log_step "Syncing agents from repository..."
|
log_step "Syncing agents from repository..."
|
||||||
|
|
||||||
if [ -f "$CLAUDE_DIR/scripts/sync-agents.sh" ]; then
|
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"
|
bash "$CLAUDE_DIR/scripts/sync-agents.sh" 2>/dev/null || log_warn "Agent sync completed with warnings"
|
||||||
log_success "Agent sync completed"
|
log_success "Agent sync completed"
|
||||||
else
|
else
|
||||||
log_warn "sync-agents.sh not found"
|
log_warn "sync-agents.sh not found"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
print_summary() {
|
print_summary() {
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${GREEN}${BOLD}╔═══════════════════════════════════════════════════════════════╗${NC}"
|
echo -e "${GREEN}${BOLD}╔═══════════════════════════════════════════════════════════════╗${NC}"
|
||||||
echo -e "${GREEN}${BOLD}║ INSTALLATION COMPLETE! ║${NC}"
|
echo -e "${GREEN}${BOLD}║ INSTALLATION COMPLETE! ║${NC}"
|
||||||
echo -e "${GREEN}${BOLD}╚═══════════════════════════════════════════════════════════════╝${NC}"
|
echo -e "${GREEN}${BOLD}╚═══════════════════════════════════════════════════════════════╝${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${BOLD}Your Claude Code installation is now SUPERCHARGED!${NC}"
|
echo -e "${BOLD}Your Claude Code installation is now SUPERCHARGED!${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${CYAN}Installed Features:${NC}"
|
echo -e "${CYAN}Installed Features:${NC}"
|
||||||
echo -e " ${GREEN}✓${NC} 30+ Custom Skills (cognitive, development, UI/UX)"
|
echo -e " ${GREEN}✓${NC} 30+ Custom Skills (cognitive, development, UI/UX)"
|
||||||
echo -e " ${GREEN}✓${NC} RalphLoop Autonomous Agent Integration"
|
echo -e " ${GREEN}✓${NC} RalphLoop Autonomous Agent Integration"
|
||||||
echo -e " ${GREEN}✓${NC} Multi-AI Consultation (Qwen)"
|
echo -e " ${GREEN}✓${NC} Multi-AI Consultation (Qwen)"
|
||||||
echo -e " ${GREEN}✓${NC} Agent Management System"
|
echo -e " ${GREEN}✓${NC} Agent Management System"
|
||||||
echo -e " ${GREEN}✓${NC} Custom Hooks & Commands"
|
echo -e " ${GREEN}✓${NC} Custom Hooks & Commands"
|
||||||
echo -e " ${GREEN}✓${NC} Plugin Marketplace Setup"
|
echo -e " ${GREEN}✓${NC} Plugin Marketplace Setup"
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${CYAN}New Commands Available:${NC}"
|
echo -e "${CYAN}New Commands Available:${NC}"
|
||||||
echo -e " ${YELLOW}/ralph${NC} - Autonomous \"Tackle Until Solved\" agent"
|
echo -e " ${YELLOW}/ralph${NC} - Autonomous \"Tackle Until Solved\" agent"
|
||||||
echo -e " ${YELLOW}/brainstorm${NC} - Multi-AI brainstorming session"
|
echo -e " ${YELLOW}/brainstorm${NC} - Multi-AI brainstorming session"
|
||||||
echo -e " ${YELLOW}/write-plan${NC} - Create implementation plans"
|
echo -e " ${YELLOW}/write-plan${NC} - Create implementation plans"
|
||||||
echo -e " ${YELLOW}/execute-plan${NC} - Execute written plans"
|
echo -e " ${YELLOW}/execute-plan${NC} - Execute written plans"
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${CYAN}Quick Start:${NC}"
|
echo -e "${CYAN}Quick Start:${NC}"
|
||||||
echo -e " 1. Restart your terminal or run: ${YELLOW}source ~/.bashrc${NC}"
|
echo -e " 1. Restart your terminal or run: ${YELLOW}source ~/.bashrc${NC}"
|
||||||
echo -e " 2. Run Claude Code: ${YELLOW}claude${NC}"
|
echo -e " 2. Run Claude Code: ${YELLOW}claude${NC}"
|
||||||
echo -e " 3. Try: ${YELLOW}/ralph \"Design a microservices architecture\"${NC}"
|
echo -e " 3. Try: ${YELLOW}/ralph \"Design a microservices architecture\"${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${CYAN}Configuration:${NC}"
|
echo -e "${CYAN}Configuration:${NC}"
|
||||||
echo -e " Config dir: ${YELLOW}$CLAUDE_DIR${NC}"
|
echo -e " Config dir: ${YELLOW}$CLAUDE_DIR${NC}"
|
||||||
echo -e " Backup: ${YELLOW}$BACKUP_DIR${NC}"
|
echo -e " Backup: ${YELLOW}$BACKUP_DIR${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${CYAN}Optional Configuration:${NC}"
|
echo -e "${CYAN}Optional Configuration:${NC}"
|
||||||
echo -e " ${YELLOW}export RALPH_AGENT=claude${NC} # Set Ralph agent"
|
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 RALPH_MAX_ITERATIONS=100${NC} # Set max iterations"
|
||||||
echo -e " ${YELLOW}export QWEN_CONSULT_MODE=always${NC} # Qwen consultation mode"
|
echo -e " ${YELLOW}export QWEN_CONSULT_MODE=always${NC} # Qwen consultation mode"
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${GREEN}${BOLD}Enjoy your supercharged Claude Code experience!${NC}"
|
echo -e "${GREEN}${BOLD}Enjoy your supercharged Claude Code experience!${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Main Installation
|
# Main Installation
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
print_banner
|
print_banner
|
||||||
|
|
||||||
# Parse arguments
|
# Parse arguments
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
--skip-deps)
|
--skip-deps)
|
||||||
SKIP_DEPS=true
|
SKIP_DEPS=true
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--dev-mode)
|
--dev-mode)
|
||||||
DEV_MODE=true
|
DEV_MODE=true
|
||||||
set -x
|
set -x
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-h|--help)
|
-h|--help)
|
||||||
echo "Usage: $0 [options]"
|
echo "Usage: $0 [options]"
|
||||||
echo " --skip-deps Skip dependency installation"
|
echo " --skip-deps Skip dependency installation"
|
||||||
echo " --dev-mode Development mode (verbose output)"
|
echo " --dev-mode Development mode (verbose output)"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
log_error "Unknown option: $1"
|
log_error "Unknown option: $1"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# Run installation steps
|
# Run installation steps
|
||||||
check_claude_code
|
check_claude_code
|
||||||
backup_existing_config
|
backup_existing_config
|
||||||
install_dependencies
|
install_dependencies
|
||||||
install_skills
|
install_skills
|
||||||
install_agents
|
install_agents
|
||||||
install_hooks
|
install_hooks
|
||||||
install_commands
|
install_commands
|
||||||
install_plugins
|
install_plugins
|
||||||
install_binaries
|
install_binaries
|
||||||
install_scripts
|
install_scripts
|
||||||
install_config_templates
|
install_config_templates
|
||||||
sync_agents
|
sync_agents
|
||||||
|
|
||||||
print_summary
|
print_summary
|
||||||
}
|
}
|
||||||
|
|
||||||
# Run main function
|
# Run main function
|
||||||
main "$@"
|
main "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user