From bf5b5e3034211cbb49b0aa0d1130557435a2657b Mon Sep 17 00:00:00 2001 From: Lars Date: Mon, 20 Oct 2025 21:21:00 +0100 Subject: [PATCH 1/2] Fix installation script to properly organize CCPM files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes multiple installation issues: - Fixes #966 - Installation error with automaze.io URL - Fixes #961 - Installation errors - Fixes #971 - Slash commands not functioning after installation Problems solved: 1. Proper directory structure: Creates .claude/ccpm/ and .claude/commands/ 2. Copies command files to correct location for Claude Code to discover 3. Sets up permissions and .gitignore automatically 4. Adds clear user feedback and next steps 5. Documents restart requirement for slash commands to load The fixed script: - Downloads CCPM to temp directory (avoids path issues) - Creates proper .claude/ccpm/ structure (scripts go here) - Copies commands to .claude/commands/ (where Claude Code scans) - Sets up settings.local.json with proper bash permissions - Creates .gitignore with .claude/epics/ excluded - Provides step-by-step visual feedback - Works on first try without manual intervention Tested successfully on macOS with Claude Code v2.0.24. Related issue with full details: #978 ๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- install/ccpm.sh | 127 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 118 insertions(+), 9 deletions(-) diff --git a/install/ccpm.sh b/install/ccpm.sh index ded501eab..2c707fc3a 100644 --- a/install/ccpm.sh +++ b/install/ccpm.sh @@ -1,16 +1,125 @@ #!/bin/bash +# CCPM Installation Script +# Installs Claude Code Project Manager correctly into .claude directory +# Usage: curl -fsSL https://raw.githubusercontent.com/YOUR_REPO/main/install-ccpm.sh | bash + +set -e # Exit on error + REPO_URL="https://github.com/automazeio/ccpm.git" -TARGET_DIR="." +TEMP_DIR=$(mktemp -d) +PROJECT_ROOT=$(pwd) -echo "Cloning repository from $REPO_URL..." -git clone "$REPO_URL" "$TARGET_DIR" +echo "" +echo "โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—" +echo "โ•‘ CCPM Installation Script v1.0 โ•‘" +echo "โ•‘ Claude Code Project Manager โ•‘" +echo "โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•" +echo "" -if [ $? -eq 0 ]; then - echo "Clone successful. Removing .git directory..." - rm -rf .git .gitignore install - echo "Git directory removed. Repository is now untracked." -else - echo "Error: Failed to clone repository." +# Check if we're in a project directory +if [ ! -w "$PROJECT_ROOT" ]; then + echo "โŒ Error: No write permission in current directory" exit 1 fi + +echo "๐Ÿ“‚ Installation directory: $PROJECT_ROOT" +echo "" + +# Step 1: Clone the repository to temp location +echo "๐Ÿ“ฅ Step 1/5: Downloading CCPM..." +if ! git clone --quiet --depth 1 "$REPO_URL" "$TEMP_DIR"; then + echo "โŒ Error: Failed to clone repository from $REPO_URL" + rm -rf "$TEMP_DIR" + exit 1 +fi +echo " โœ… Download complete" +echo "" + +# Step 2: Create .claude directory structure +echo "๐Ÿ“ Step 2/5: Creating directory structure..." +mkdir -p "$PROJECT_ROOT/.claude/ccpm" +mkdir -p "$PROJECT_ROOT/.claude/commands" +echo " โœ… Directory structure created" +echo "" + +# Step 3: Copy CCPM files to .claude/ccpm/ +echo "๐Ÿ“‹ Step 3/5: Installing CCPM files..." +cp -r "$TEMP_DIR/ccpm/"* "$PROJECT_ROOT/.claude/ccpm/" +echo " โœ… CCPM files installed to .claude/ccpm/" +echo "" + +# Step 4: Create symlinks for commands (or copy them) +echo "๐Ÿ”— Step 4/5: Setting up slash commands..." +# Copy command files to .claude/commands/ so Claude Code can find them +if [ -d "$PROJECT_ROOT/.claude/ccpm/commands" ]; then + cp -r "$PROJECT_ROOT/.claude/ccpm/commands/"* "$PROJECT_ROOT/.claude/commands/" + echo " โœ… Slash commands installed to .claude/commands/" +else + echo " โš ๏ธ No commands directory found in CCPM" +fi +echo "" + +# Step 5: Update settings if needed +echo "โš™๏ธ Step 5/5: Configuring permissions..." +if [ -f "$PROJECT_ROOT/.claude/ccpm/settings.local.json" ]; then + cp "$PROJECT_ROOT/.claude/ccpm/settings.local.json" "$PROJECT_ROOT/.claude/settings.local.json" + echo " โœ… Settings configured" +else + echo " โš ๏ธ No default settings found, skipping" +fi +echo "" + +# Cleanup +echo "๐Ÿงน Cleaning up..." +rm -rf "$TEMP_DIR" +echo " โœ… Cleanup complete" +echo "" + +# Create .gitignore if it doesn't exist +if [ ! -f "$PROJECT_ROOT/.gitignore" ]; then + echo "๐Ÿ“ Creating .gitignore..." + cat > "$PROJECT_ROOT/.gitignore" << 'EOF' +# CCPM - Local workspace files +.claude/epics/ + +# Mac files +.DS_Store + +# Local settings +.claude/settings.local.json +EOF + echo " โœ… .gitignore created" + echo "" +fi + +# Success message +echo "โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—" +echo "โ•‘ โœ… CCPM Installation Complete! โ•‘" +echo "โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•" +echo "" +echo "๐Ÿ“Š Installation Summary:" +echo " โ€ข CCPM files: .claude/ccpm/" +echo " โ€ข Commands: .claude/commands/" +echo " โ€ข Settings: .claude/settings.local.json" +echo "" +echo "๐ŸŽฏ Next Steps:" +echo "" +echo " 1. Initialize CCPM:" +echo " bash .claude/ccpm/scripts/pm/init.sh" +echo "" +echo " 2. Restart Claude Code to load slash commands" +echo "" +echo " 3. Verify installation:" +echo " /pm:help" +echo "" +echo " 4. Create your first PRD:" +echo " /pm:prd-new " +echo "" +echo "โš ๏ธ IMPORTANT: You must restart Claude Code for slash" +echo " commands to be recognized!" +echo "" +echo "๐Ÿ“š Documentation: https://github.com/automazeio/ccpm" +echo "" + +exit 0 From c63245c0834bfddc88d6d4839e02d0ea9dd7476b Mon Sep 17 00:00:00 2001 From: Lars Date: Mon, 20 Oct 2025 21:28:21 +0100 Subject: [PATCH 2/2] Address CodeRabbit review feedback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes identified issues: 1. Fix glob expansion bugs (lines 48, 56) - removed quotes around wildcards 2. Update placeholder URL to actual GitHub raw URL 3. Improve .gitignore handling - append to existing file instead of only creating new 4. Add trap for cleanup to ensure temp directory removal even on failure 5. Remove redundant manual cleanup code Changes: - Line 48: "$TEMP_DIR/ccpm/"* โ†’ "$TEMP_DIR/ccpm"/* - Line 56: commands/"* โ†’ commands/* - Line 5: Updated URL from placeholder to real GitHub raw URL - Added cleanup() function with trap EXIT for robust cleanup - Enhanced .gitignore to append entries if file exists These changes ensure the installation script is more robust and handles edge cases properly. ๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- install/ccpm.sh | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/install/ccpm.sh b/install/ccpm.sh index 2c707fc3a..6390ee506 100644 --- a/install/ccpm.sh +++ b/install/ccpm.sh @@ -2,7 +2,7 @@ # CCPM Installation Script # Installs Claude Code Project Manager correctly into .claude directory -# Usage: curl -fsSL https://raw.githubusercontent.com/YOUR_REPO/main/install-ccpm.sh | bash +# Usage: curl -fsSL https://raw.githubusercontent.com/automazeio/ccpm/main/install/ccpm.sh | bash set -e # Exit on error @@ -10,6 +10,14 @@ REPO_URL="https://github.com/automazeio/ccpm.git" TEMP_DIR=$(mktemp -d) PROJECT_ROOT=$(pwd) +# Ensure cleanup on exit (success or failure) +cleanup() { + if [ -d "$TEMP_DIR" ]; then + rm -rf "$TEMP_DIR" + fi +} +trap cleanup EXIT + echo "" echo "โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—" echo "โ•‘ CCPM Installation Script v1.0 โ•‘" @@ -45,15 +53,14 @@ echo "" # Step 3: Copy CCPM files to .claude/ccpm/ echo "๐Ÿ“‹ Step 3/5: Installing CCPM files..." -cp -r "$TEMP_DIR/ccpm/"* "$PROJECT_ROOT/.claude/ccpm/" +cp -r "$TEMP_DIR/ccpm"/* "$PROJECT_ROOT/.claude/ccpm/" echo " โœ… CCPM files installed to .claude/ccpm/" echo "" -# Step 4: Create symlinks for commands (or copy them) +# Step 4: Copy commands to .claude/commands/ for Claude Code discovery echo "๐Ÿ”— Step 4/5: Setting up slash commands..." -# Copy command files to .claude/commands/ so Claude Code can find them if [ -d "$PROJECT_ROOT/.claude/ccpm/commands" ]; then - cp -r "$PROJECT_ROOT/.claude/ccpm/commands/"* "$PROJECT_ROOT/.claude/commands/" + cp -r "$PROJECT_ROOT/.claude/ccpm/commands"/* "$PROJECT_ROOT/.claude/commands/" echo " โœ… Slash commands installed to .claude/commands/" else echo " โš ๏ธ No commands directory found in CCPM" @@ -70,28 +77,33 @@ else fi echo "" -# Cleanup -echo "๐Ÿงน Cleaning up..." -rm -rf "$TEMP_DIR" -echo " โœ… Cleanup complete" -echo "" +# Note: Cleanup of temp directory handled automatically by trap on exit -# Create .gitignore if it doesn't exist +# Update .gitignore +echo "๐Ÿ“ Updating .gitignore..." if [ ! -f "$PROJECT_ROOT/.gitignore" ]; then - echo "๐Ÿ“ Creating .gitignore..." + # Create new .gitignore cat > "$PROJECT_ROOT/.gitignore" << 'EOF' # CCPM - Local workspace files .claude/epics/ -# Mac files -.DS_Store - # Local settings .claude/settings.local.json EOF echo " โœ… .gitignore created" - echo "" +else + # Append CCPM entries if they don't exist + if ! grep -q ".claude/epics/" "$PROJECT_ROOT/.gitignore" 2>/dev/null; then + echo "" >> "$PROJECT_ROOT/.gitignore" + echo "# CCPM - Local workspace files" >> "$PROJECT_ROOT/.gitignore" + echo ".claude/epics/" >> "$PROJECT_ROOT/.gitignore" + echo ".claude/settings.local.json" >> "$PROJECT_ROOT/.gitignore" + echo " โœ… .gitignore updated with CCPM exclusions" + else + echo " โœ… .gitignore already contains CCPM exclusions" + fi fi +echo "" # Success message echo "โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—"