-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup
More file actions
executable file
·150 lines (131 loc) · 3.81 KB
/
setup
File metadata and controls
executable file
·150 lines (131 loc) · 3.81 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/usr/bin/env bash
set -euo pipefail
shopt -s nocasematch 2>/dev/null || true
# Playbooks — Setup Script
# Registers all skills as Claude Code slash commands via directory symlinks.
# Idempotent — safe to run multiple times.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
PLAYBOOKS_DIR="$SCRIPT_DIR/playbooks"
SKILLS_DIR="${HOME}/.claude/skills"
# The playbooks to register (order = chain sequence)
PLAYBOOKS=(
app
discover
plan
setup
define
design
build
test
launch
wrap
status
upgrade
)
echo ""
echo " Playbooks — Setup"
echo " ======================="
echo ""
# --- Create directories if needed ---
if ! mkdir -p "$SKILLS_DIR" 2>/dev/null; then
echo " ERROR: Could not create $SKILLS_DIR — check permissions."
exit 1
fi
# --- Cleanup old symlinks ---
# Remove any symlink in ~/.claude/skills/ that points into our repo.
# Catches both old "playbooks-{name}" pattern and current "{name}" pattern.
echo " Cleaning up old symlinks..."
CLEANED=0
for entry in "$SKILLS_DIR"/*/; do
[ -d "$entry" ] || continue
entry="${entry%/}"
# Only touch symlinks (not real directories)
if [ -L "$entry" ]; then
target="$(readlink "$entry" 2>/dev/null || true)"
# Check if this symlink points into our playbooks directory (nocasematch handles macOS)
if [[ "$target" == "$PLAYBOOKS_DIR"* ]]; then
rm "$entry"
CLEANED=$((CLEANED + 1))
fi
fi
done
if [ "$CLEANED" -gt 0 ]; then
echo " Removed $CLEANED old symlink(s)."
else
echo " No old symlinks found."
fi
echo ""
# --- Create new symlinks ---
# Each playbook directory is symlinked as:
# ~/.claude/skills/{playbook-name} → /path/to/repo/playbooks/{playbook-name}
#
# This means ~/.claude/skills/discover/SKILL.md resolves correctly,
# AND relative paths inside SKILL.md (like "Read CLAUDE.md") resolve
# because CLAUDE.md lives in the same real directory.
echo " Registering playbooks..."
echo ""
REGISTERED=0
FAILED=0
for playbook in "${PLAYBOOKS[@]}"; do
source_dir="$PLAYBOOKS_DIR/$playbook"
skill_file="$source_dir/SKILL.md"
link_path="$SKILLS_DIR/$playbook"
if [ ! -d "$source_dir" ]; then
echo " SKIP /$playbook — directory not found: $source_dir"
FAILED=$((FAILED + 1))
continue
fi
if [ ! -f "$skill_file" ]; then
echo " SKIP /$playbook — no SKILL.md found"
FAILED=$((FAILED + 1))
continue
fi
# Remove stale link/dir if it exists (shouldn't after cleanup, but be safe)
if [ -L "$link_path" ] || [ -e "$link_path" ]; then
rm -rf "$link_path"
fi
if ln -s "$source_dir" "$link_path" 2>/dev/null; then
echo " OK /$playbook"
REGISTERED=$((REGISTERED + 1))
else
echo " FAIL /$playbook — could not create symlink (permissions?)"
FAILED=$((FAILED + 1))
fi
done
echo ""
echo " ---"
echo " Registered: $REGISTERED skill(s)"
if [ "$FAILED" -gt 0 ]; then
echo " Failed: $FAILED skill(s)"
fi
echo ""
# --- Playbook chain ---
echo " Skill Chain"
echo " ==========="
echo ""
echo " /app → Start here (routes to the right skill)"
echo " │"
echo " /discover → Validate problem / refine idea"
echo " │"
echo " /plan → Stress-test the direction"
echo " │"
echo " /setup → GitHub + hosting"
echo " │"
echo " /define → Product requirements"
echo " │"
echo " /design → Visual design"
echo " │"
echo " /build → Build the app"
echo " │"
echo " /test → Find every bug"
echo " │"
echo " /launch → Deploy and go live"
echo " │"
echo " /wrap → Pause and resume later"
echo ""
echo " Utilities:"
echo " /status → See where you are"
echo " /upgrade → Get the latest playbooks"
echo ""
echo " Type /app in Claude Code to start."
echo ""