diff --git a/README.md b/README.md index bd71eb6..7184cba 100644 --- a/README.md +++ b/README.md @@ -28,10 +28,13 @@ Think of it as a brain upgrade for Claude Code. Drop it in once, and suddenly Cl ```bash git clone https://github.com/NomenAK/SuperClaude.git cd SuperClaude -./install.sh +./install.sh # Default: ~/.claude/ +# OR +./install.sh --dir /opt/claude # Custom location +./install.sh --dir ./project-claude # Project-specific ``` -That's it. No databases, no services, no dependencies. It quietly installs to `~/.claude/` and works in every project. The installer even backs up your existing config automatically! +That's it. No databases, no services, no dependencies. Installs to `~/.claude/` by default or any directory you choose. The installer even backs up your existing config automatically! ## 💡 Why You'll Love It @@ -212,6 +215,7 @@ Skip if you: 1. **Install** ```bash git clone https://github.com/NomenAK/SuperClaude.git && cd SuperClaude && ./install.sh + # Or custom location: ./install.sh --dir /your/path ``` 2. **Test Drive** @@ -227,7 +231,7 @@ Skip if you: ## 🛟 Need Help? -- **Installation issues?** Run `./install.sh` again – it's idempotent +- **Installation issues?** Run `./install.sh` again – it's idempotent. Use `./install.sh --help` for options - **Commands not working?** Check `ls ~/.claude/commands/` - **Want to contribute?** See [CONTRIBUTING.md](CONTRIBUTING.md) - **Found a bug?** [Open an issue](https://github.com/NomenAK/SuperClaude/issues) diff --git a/install.sh b/install.sh index d2ff34b..2a41fb6 100755 --- a/install.sh +++ b/install.sh @@ -11,8 +11,60 @@ YELLOW='\033[1;33m' RED='\033[0;31m' NC='\033[0m' # No Color +# Default installation directory +INSTALL_DIR="$HOME/.claude" + +# Function to show usage +show_usage() { + echo "Usage: $0 [OPTIONS]" + echo "" + echo "Options:" + echo " --dir Install to custom directory (default: $HOME/.claude)" + echo " -h, --help Show this help message" + echo "" + echo "Examples:" + echo " $0 # Install to default location" + echo " $0 --dir /opt/claude # Install to /opt/claude" + echo " $0 --dir ./local-claude # Install to ./local-claude" +} + +# Parse command line arguments +while [[ $# -gt 0 ]]; do + case $1 in + --dir) + INSTALL_DIR="$2" + shift 2 + ;; + -h|--help) + show_usage + exit 0 + ;; + *) + echo -e "${RED}Error: Unknown option $1${NC}" + show_usage + exit 1 + ;; + esac +done + +# Convert to absolute path if relative +if [[ ! "$INSTALL_DIR" = /* ]]; then + INSTALL_DIR="$(cd "$(dirname "$INSTALL_DIR")" && pwd)/$(basename "$INSTALL_DIR")" +fi + echo -e "${GREEN}SuperClaude Installer${NC}" echo "======================" +echo -e "Installation directory: ${YELLOW}$INSTALL_DIR${NC}" +echo "" + +# Confirmation prompt +echo -e "${YELLOW}This will install SuperClaude in $INSTALL_DIR${NC}" +echo -n "Are you sure you want to continue? (y/n): " +read -r confirm_install +if [ "$confirm_install" != "y" ]; then + echo "Installation cancelled." + exit 0 +fi echo "" # Check if we're in SuperClaude directory @@ -22,21 +74,21 @@ if [ ! -f "CLAUDE.md" ] || [ ! -d ".claude/commands" ]; then exit 1 fi -# Check if existing .claude directory exists -if [ -d "$HOME/.claude" ]; then - echo -e "${YELLOW}Existing Claude configuration found${NC}" +# Check if existing directory exists and has files +if [ -d "$INSTALL_DIR" ] && [ "$(ls -A "$INSTALL_DIR" 2>/dev/null)" ]; then + echo -e "${YELLOW}Existing configuration found at $INSTALL_DIR${NC}" echo -n "Backup existing configuration? (y/n): " read -r backup_choice if [ "$backup_choice" = "y" ]; then - # Create backup directory inside .claude - backup_dir="$HOME/.claude/backup.$(date +%Y%m%d_%H%M%S)" + # Create backup directory inside installation directory + backup_dir="$INSTALL_DIR/backup.$(date +%Y%m%d_%H%M%S)" mkdir -p "$backup_dir" # Backup ALL existing files echo "Backing up all existing files..." # Copy everything except backup directories - for item in "$HOME/.claude"/*; do + for item in "$INSTALL_DIR"/*; do basename_item=$(basename "$item") # Skip backup directories to avoid nested backups if [[ ! "$basename_item" =~ ^backup\. ]]; then @@ -48,6 +100,8 @@ if [ -d "$HOME/.claude" ]; then echo -e "${GREEN}Backed up existing files to: $backup_dir${NC}" fi +elif [ -d "$INSTALL_DIR" ]; then + echo -e "${YELLOW}Directory $INSTALL_DIR exists but is empty${NC}" fi echo "" @@ -55,28 +109,28 @@ echo "Installing SuperClaude..." # Create directory structure echo "Creating directories..." -mkdir -p "$HOME/.claude/commands/shared" +mkdir -p "$INSTALL_DIR/commands/shared" # Copy main configuration files echo "Copying configuration files..." -cp CLAUDE.md RULES.md PERSONAS.md MCP.md "$HOME/.claude/" +cp CLAUDE.md RULES.md PERSONAS.md MCP.md "$INSTALL_DIR/" # Copy command files echo "Copying slash commands..." -cp .claude/commands/*.md "$HOME/.claude/commands/" 2>/dev/null || true +cp .claude/commands/*.md "$INSTALL_DIR/commands/" 2>/dev/null || true # Copy shared resources echo "Copying shared resources..." -cp .claude/commands/shared/*.yml "$HOME/.claude/commands/shared/" +cp .claude/commands/shared/*.yml "$INSTALL_DIR/commands/shared/" # Verify installation echo "" echo "Verifying installation..." # Count installed files -main_files=$(ls -1 "$HOME/.claude/"*.md 2>/dev/null | wc -l) -command_files=$(ls -1 "$HOME/.claude/commands/"*.md 2>/dev/null | wc -l) -shared_files=$(ls -1 "$HOME/.claude/commands/shared/"*.yml 2>/dev/null | wc -l) +main_files=$(ls -1 "$INSTALL_DIR/"*.md 2>/dev/null | wc -l) +command_files=$(ls -1 "$INSTALL_DIR/commands/"*.md 2>/dev/null | wc -l) +shared_files=$(ls -1 "$INSTALL_DIR/commands/shared/"*.yml 2>/dev/null | wc -l) echo -e "Main config files: ${GREEN}$main_files${NC} (expected: 4)" echo -e "Command files: ${GREEN}$command_files${NC} (expected: 18)"