-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathccpm
More file actions
executable file
·88 lines (74 loc) · 1.96 KB
/
ccpm
File metadata and controls
executable file
·88 lines (74 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/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