install.sh 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. #!/usr/bin/env bash
  2. #
  3. # claude-mods Installer (Linux/macOS)
  4. # Copies commands, skills, agents, and rules to ~/.claude/
  5. # Handles cleanup of deprecated items and command-to-skill migrations.
  6. #
  7. # Usage: ./scripts/install.sh
  8. set -e
  9. BLUE='\033[0;34m'
  10. GREEN='\033[0;32m'
  11. YELLOW='\033[1;33m'
  12. RED='\033[0;31m'
  13. NC='\033[0m'
  14. echo -e "${BLUE}╔══════════════════════════════════════════════════════════════╗${NC}"
  15. echo -e "${BLUE}║ claude-mods Installer (Unix) ║${NC}"
  16. echo -e "${BLUE}╚══════════════════════════════════════════════════════════════╝${NC}"
  17. echo ""
  18. SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  19. PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
  20. CLAUDE_DIR="$HOME/.claude"
  21. # Ensure ~/.claude directories exist
  22. for dir in commands skills agents rules output-styles; do
  23. mkdir -p "$CLAUDE_DIR/$dir"
  24. done
  25. # =============================================================================
  26. # DEPRECATED ITEMS - Remove these from user's config
  27. # =============================================================================
  28. echo -e "${YELLOW}Cleaning up deprecated items...${NC}"
  29. deprecated_items=(
  30. # Removed commands (migrated to skills or deleted)
  31. "$CLAUDE_DIR/commands/review.md" # Migrated to skill
  32. "$CLAUDE_DIR/commands/testgen.md" # Migrated to skill
  33. "$CLAUDE_DIR/commands/conclave.md" # Deprecated
  34. "$CLAUDE_DIR/commands/pulse.md" # Now a skill only
  35. # Removed skills
  36. "$CLAUDE_DIR/skills/conclave" # Deprecated
  37. )
  38. for item in "${deprecated_items[@]}"; do
  39. if [ -e "$item" ]; then
  40. rm -rf "$item"
  41. echo -e " ${RED}Removed: $item${NC}"
  42. fi
  43. done
  44. echo ""
  45. # =============================================================================
  46. # COMMANDS - Only copy commands that haven't been migrated to skills
  47. # =============================================================================
  48. echo -e "${BLUE}Installing commands...${NC}"
  49. # Commands that should NOT be copied (migrated to skills)
  50. skip_commands=("review.md" "testgen.md")
  51. for file in "$PROJECT_ROOT/commands"/*.md; do
  52. [ -f "$file" ] || continue
  53. filename=$(basename "$file")
  54. # Skip migrated commands
  55. skip=false
  56. for skip_cmd in "${skip_commands[@]}"; do
  57. if [ "$filename" = "$skip_cmd" ]; then
  58. skip=true
  59. break
  60. fi
  61. done
  62. # Skip archive directory contents
  63. [[ "$file" == *"/archive/"* ]] && continue
  64. if [ "$skip" = false ]; then
  65. cp "$file" "$CLAUDE_DIR/commands/"
  66. echo -e " ${GREEN}$filename${NC}"
  67. fi
  68. done
  69. echo ""
  70. # =============================================================================
  71. # SKILLS - Copy all skill directories
  72. # =============================================================================
  73. echo -e "${BLUE}Installing skills...${NC}"
  74. for skill_dir in "$PROJECT_ROOT/skills"/*/; do
  75. [ -d "$skill_dir" ] || continue
  76. skill_name=$(basename "$skill_dir")
  77. # Remove existing and copy fresh
  78. rm -rf "$CLAUDE_DIR/skills/$skill_name"
  79. cp -r "$skill_dir" "$CLAUDE_DIR/skills/"
  80. echo -e " ${GREEN}$skill_name/${NC}"
  81. done
  82. echo ""
  83. # =============================================================================
  84. # AGENTS - Copy all agent files
  85. # =============================================================================
  86. echo -e "${BLUE}Installing agents...${NC}"
  87. for file in "$PROJECT_ROOT/agents"/*.md; do
  88. [ -f "$file" ] || continue
  89. cp "$file" "$CLAUDE_DIR/agents/"
  90. echo -e " ${GREEN}$(basename "$file")${NC}"
  91. done
  92. echo ""
  93. # =============================================================================
  94. # RULES - Copy all rule files
  95. # =============================================================================
  96. echo -e "${BLUE}Installing rules...${NC}"
  97. for file in "$PROJECT_ROOT/rules"/*.md; do
  98. [ -f "$file" ] || continue
  99. cp "$file" "$CLAUDE_DIR/rules/"
  100. echo -e " ${GREEN}$(basename "$file")${NC}"
  101. done
  102. echo ""
  103. # =============================================================================
  104. # OUTPUT STYLES - Copy all output style files
  105. # =============================================================================
  106. echo -e "${BLUE}Installing output styles...${NC}"
  107. if [ -d "$PROJECT_ROOT/output-styles" ]; then
  108. for file in "$PROJECT_ROOT/output-styles"/*.md; do
  109. [ -f "$file" ] || continue
  110. cp "$file" "$CLAUDE_DIR/output-styles/"
  111. echo -e " ${GREEN}$(basename "$file")${NC}"
  112. done
  113. fi
  114. echo ""
  115. # =============================================================================
  116. # SUMMARY
  117. # =============================================================================
  118. echo -e "${BLUE}════════════════════════════════════════════════════════════════${NC}"
  119. echo -e " ${GREEN}Installation complete!${NC}"
  120. echo -e "${BLUE}════════════════════════════════════════════════════════════════${NC}"
  121. echo ""
  122. echo -e "${YELLOW}Restart Claude Code to load the new extensions.${NC}"
  123. echo ""