Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/mrgnw/scripts.
Something went wrong. Try again.
scripts ccpm
2.0 kB · 88 lines
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889#!/bin/bash
SOURCE_DIR="$HOME/dev/src/ccpm/ccpm"CLAUDE_DIR=".claude"
function show_help { echo "Usage: ccpm [init|update|help]" echo "" echo " init - Install CCPM into the current project" echo " update - Refresh symlinks (e.g. after source adds new files)" echo " help - Show this message"}
function ensure_symlink { local link_path="$1" local target="$2"
if [ -L "$link_path" ]; then rm "$link_path" elif [ -e "$link_path" ]; then echo " Skipping $link_path (already exists)" return fi ln -s "$target" "$link_path"}
function init_project { if [ ! -d "$SOURCE_DIR" ]; then echo "Error: Source not found at $SOURCE_DIR" exit 1 fi
echo "Installing CCPM..."
# Symlink ccpm/ at project root (commands reference "ccpm/scripts/pm/...") ensure_symlink "ccpm" "$SOURCE_DIR" echo " Linked ccpm/ -> $SOURCE_DIR"
# Create .claude/ and data directories mkdir -p "$CLAUDE_DIR/commands" mkdir -p "$CLAUDE_DIR/context" mkdir -p "$CLAUDE_DIR/epics" mkdir -p "$CLAUDE_DIR/prds"
# Symlink command subdirectories (pm, context, testing) for dir in ccpm/commands/*/; do local name name=$(basename "$dir") ensure_symlink "$CLAUDE_DIR/commands/$name" "../../ccpm/commands/$name" done
# Symlink individual command files (prompt.md, re-init.md, etc.) for file in ccpm/commands/*.md; do local name name=$(basename "$file") ensure_symlink "$CLAUDE_DIR/commands/$name" "../../ccpm/commands/$name" done echo " Linked commands into $CLAUDE_DIR/commands/"
# Symlink agents, rules, hooks for dir in agents rules hooks; do if [ -d "ccpm/$dir" ]; then ensure_symlink "$CLAUDE_DIR/$dir" "../ccpm/$dir" echo " Linked $dir/" fi done
# Add ccpm to .gitignore if ! grep -q "^ccpm$" .gitignore 2>/dev/null; then echo "ccpm" >> .gitignore echo " Added ccpm to .gitignore" fi
echo "" echo "Done. Run /pm:init inside Claude Code to finish setup."}
case "$1" in init) init_project ;; update) init_project ;; *) show_help ;;esac