-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·413 lines (366 loc) · 11.3 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·413 lines (366 loc) · 11.3 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
#!/bin/bash
# Squire -- Agent Operating System Installer
# Installs commands, skills, agents, prompts, and templates into your Claude Code config.
#
# Usage: ./install.sh [OPTIONS]
#
# Examples:
# ./install.sh # Install everything
# ./install.sh --commands # Commands only
# ./install.sh --skills # Skills only
# ./install.sh --agents # Agents only
# ./install.sh --rules # Just squire.md to project root
# ./install.sh --dry-run # Preview without changes
set -euo pipefail
# -- Colors --
RED='\033[0;31m'
GREEN='\033[0;32m'
AMBER='\033[0;33m'
CYAN='\033[0;36m'
BOLD='\033[1m'
DIM='\033[2m'
RESET='\033[0m'
# -- Config --
CLAUDE_DIR="$HOME/.claude"
COMMANDS_DIR="$CLAUDE_DIR/commands"
SKILLS_DIR="$CLAUDE_DIR/skills"
AGENTS_DIR="$CLAUDE_DIR/agents"
PROMPTS_DIR="$CLAUDE_DIR/prompts"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# -- Flags --
DRY_RUN=false
UNINSTALL=false
INSTALL_COMMANDS=false
INSTALL_SKILLS=false
INSTALL_AGENTS=false
INSTALL_PROMPTS=false
INSTALL_RULES=false
INSTALL_PIPELINE=false
INSTALL_ALL=true
# -- Parse args --
for arg in "$@"; do
case "$arg" in
--dry-run) DRY_RUN=true ;;
--uninstall) UNINSTALL=true ;;
--commands) INSTALL_COMMANDS=true; INSTALL_ALL=false ;;
--skills) INSTALL_SKILLS=true; INSTALL_ALL=false ;;
--agents) INSTALL_AGENTS=true; INSTALL_ALL=false ;;
--prompts) INSTALL_PROMPTS=true; INSTALL_ALL=false ;;
--rules) INSTALL_RULES=true; INSTALL_ALL=false ;;
--pipeline) INSTALL_PIPELINE=true; INSTALL_ALL=false ;;
--help|-h)
echo "Squire -- Agent Operating System Installer"
echo ""
echo "Usage: ./install.sh [OPTIONS]"
echo ""
echo "Install options (mix and match):"
echo " --commands Install slash commands to ~/.claude/commands/"
echo " --skills Install skills to ~/.claude/skills/"
echo " --agents Install agents to ~/.claude/agents/"
echo " --prompts Install thinking frameworks to ~/.claude/prompts/"
echo " --rules Copy squire.md to current directory"
echo " --pipeline Copy pipeline + templates to current directory"
echo ""
echo " (no flags) Install everything"
echo ""
echo "Other options:"
echo " --dry-run Show what would be installed without making changes"
echo " --uninstall Remove all Squire-installed files"
echo " -h, --help Show this help message"
exit 0
;;
*)
echo -e "${RED}Unknown option: $arg${RESET}"
echo "Run ./install.sh --help for usage"
exit 1
;;
esac
done
# If --all, enable everything
if $INSTALL_ALL; then
INSTALL_COMMANDS=true
INSTALL_SKILLS=true
INSTALL_AGENTS=true
INSTALL_PROMPTS=true
fi
# -- Banner --
echo ""
echo -e "${BOLD}Squire${RESET}"
echo -e "${DIM}Agent operating system for AI-assisted development${RESET}"
echo -e "${DIM}318 skills | 56 commands | 23 agents | 6 frameworks${RESET}"
echo ""
# -- Uninstall flow --
if $UNINSTALL; then
echo -e "${AMBER}Uninstalling Squire...${RESET}"
echo ""
removed=0
# Remove commands
if [ -d "$COMMANDS_DIR" ]; then
for cmd in "$SCRIPT_DIR"/commands/*.md; do
[ -f "$cmd" ] || continue
name=$(basename "$cmd")
target="$COMMANDS_DIR/$name"
if [ -f "$target" ]; then
if $DRY_RUN; then
echo -e " ${DIM}Would remove:${RESET} $target"
else
rm "$target"
echo -e " ${RED}Removed:${RESET} commands/$name"
fi
removed=$((removed + 1))
fi
done
fi
# Remove skills
if [ -d "$SKILLS_DIR" ]; then
for skill_dir in "$SCRIPT_DIR"/skills/*/; do
[ -d "$skill_dir" ] || continue
name=$(basename "$skill_dir")
target="$SKILLS_DIR/$name"
if [ -d "$target" ]; then
if $DRY_RUN; then
echo -e " ${DIM}Would remove:${RESET} $target/"
else
rm -rf "$target"
echo -e " ${RED}Removed:${RESET} skills/$name/"
fi
removed=$((removed + 1))
fi
done
fi
# Remove agents
if [ -d "$AGENTS_DIR" ]; then
for agent in "$SCRIPT_DIR"/agents/*.md; do
[ -f "$agent" ] || continue
name=$(basename "$agent")
target="$AGENTS_DIR/$name"
if [ -f "$target" ]; then
if $DRY_RUN; then
echo -e " ${DIM}Would remove:${RESET} $target"
else
rm "$target"
echo -e " ${RED}Removed:${RESET} agents/$name"
fi
removed=$((removed + 1))
fi
done
fi
# Remove prompts
if [ -d "$PROMPTS_DIR" ]; then
for prompt in "$SCRIPT_DIR"/prompts/*.md; do
[ -f "$prompt" ] || continue
name=$(basename "$prompt")
target="$PROMPTS_DIR/$name"
if [ -f "$target" ]; then
if $DRY_RUN; then
echo -e " ${DIM}Would remove:${RESET} $target"
else
rm "$target"
echo -e " ${RED}Removed:${RESET} prompts/$name"
fi
removed=$((removed + 1))
fi
done
fi
echo ""
if [ "$removed" -eq 0 ]; then
echo -e "${DIM}Nothing to remove -- Squire was not installed.${RESET}"
elif $DRY_RUN; then
echo -e "${AMBER}Dry run complete. $removed file(s) would be removed.${RESET}"
else
echo -e "${GREEN}Uninstalled $removed file(s). Squire removed.${RESET}"
fi
exit 0
fi
# -- Pre-flight checks --
echo -e "${DIM}Checking environment...${RESET}"
if [ ! -d "$CLAUDE_DIR" ]; then
echo -e "${AMBER}~/.claude/ directory not found.${RESET}"
echo ""
echo "Claude Code stores its configuration in ~/.claude/"
echo "This directory is created automatically when you first run Claude Code."
echo ""
read -p "Create ~/.claude/ now? (y/N) " -n 1 -r
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]; then
if $DRY_RUN; then
echo -e " ${DIM}Would create:${RESET} $CLAUDE_DIR"
else
mkdir -p "$CLAUDE_DIR"
echo -e " ${GREEN}Created:${RESET} $CLAUDE_DIR"
fi
else
echo -e "${RED}Cannot install without ~/.claude/ directory. Exiting.${RESET}"
exit 1
fi
fi
echo -e " ${GREEN}Claude Code directory:${RESET} $CLAUDE_DIR"
echo ""
installed=0
# -- Install commands --
if $INSTALL_COMMANDS; then
echo -e "${BOLD}Installing commands...${RESET}"
if $DRY_RUN; then
echo -e " ${DIM}Would create:${RESET} $COMMANDS_DIR/"
else
mkdir -p "$COMMANDS_DIR"
fi
cmd_count=0
for cmd in "$SCRIPT_DIR"/commands/*.md; do
[ -f "$cmd" ] || continue
name=$(basename "$cmd" .md)
dest="$COMMANDS_DIR/$(basename "$cmd")"
if $DRY_RUN; then
echo -e " ${DIM}Would install:${RESET} /$name"
else
cp "$cmd" "$dest"
fi
cmd_count=$((cmd_count + 1))
installed=$((installed + 1))
done
echo -e " ${GREEN}$cmd_count commands${RESET}"
echo ""
fi
# -- Install skills --
if $INSTALL_SKILLS; then
echo -e "${BOLD}Installing skills...${RESET}"
skill_count=0
for skill_dir in "$SCRIPT_DIR"/skills/*/; do
[ -d "$skill_dir" ] || continue
name=$(basename "$skill_dir")
dest="$SKILLS_DIR/$name"
if $DRY_RUN; then
:
else
mkdir -p "$dest"
cp -r "$skill_dir"* "$dest/" 2>/dev/null || true
fi
skill_count=$((skill_count + 1))
installed=$((installed + 1))
done
echo -e " ${GREEN}$skill_count skills${RESET}"
echo ""
fi
# -- Install agents --
if $INSTALL_AGENTS; then
echo -e "${BOLD}Installing agents...${RESET}"
if $DRY_RUN; then
echo -e " ${DIM}Would create:${RESET} $AGENTS_DIR/"
else
mkdir -p "$AGENTS_DIR"
fi
agent_count=0
for agent in "$SCRIPT_DIR"/agents/*.md; do
[ -f "$agent" ] || continue
name=$(basename "$agent" .md)
dest="$AGENTS_DIR/$(basename "$agent")"
if $DRY_RUN; then
echo -e " ${DIM}Would install:${RESET} $name"
else
cp "$agent" "$dest"
fi
agent_count=$((agent_count + 1))
installed=$((installed + 1))
done
echo -e " ${GREEN}$agent_count agents${RESET}"
echo ""
fi
# -- Install prompts --
if $INSTALL_PROMPTS; then
echo -e "${BOLD}Installing thinking frameworks...${RESET}"
if $DRY_RUN; then
echo -e " ${DIM}Would create:${RESET} $PROMPTS_DIR/"
else
mkdir -p "$PROMPTS_DIR"
fi
prompt_count=0
for prompt in "$SCRIPT_DIR"/prompts/*.md; do
[ -f "$prompt" ] || continue
name=$(basename "$prompt" .md)
dest="$PROMPTS_DIR/$(basename "$prompt")"
if $DRY_RUN; then
echo -e " ${DIM}Would install:${RESET} $name"
else
cp "$prompt" "$dest"
fi
prompt_count=$((prompt_count + 1))
installed=$((installed + 1))
done
echo -e " ${GREEN}$prompt_count frameworks${RESET}"
echo ""
fi
# -- Install rules --
if $INSTALL_RULES; then
echo -e "${BOLD}Installing behavioral rules...${RESET}"
src="$SCRIPT_DIR/squire.md"
dest="./squire.md"
if [ -f "$src" ]; then
if $DRY_RUN; then
echo -e " ${DIM}Would copy:${RESET} squire.md -> ./squire.md"
else
cp "$src" "$dest"
echo -e " ${GREEN}Copied:${RESET} squire.md to project root"
fi
installed=$((installed + 1))
fi
echo ""
fi
# -- Install pipeline --
if $INSTALL_PIPELINE; then
echo -e "${BOLD}Installing pipeline + templates...${RESET}"
if [ -d "$SCRIPT_DIR/pipeline" ]; then
if $DRY_RUN; then
echo -e " ${DIM}Would copy:${RESET} pipeline/"
else
cp -r "$SCRIPT_DIR/pipeline" ./
echo -e " ${GREEN}Copied:${RESET} pipeline/"
fi
installed=$((installed + 1))
fi
if [ -d "$SCRIPT_DIR/templates" ]; then
if $DRY_RUN; then
echo -e " ${DIM}Would copy:${RESET} templates/"
else
cp -r "$SCRIPT_DIR/templates" ./
echo -e " ${GREEN}Copied:${RESET} templates/ (VISION.md, SPEC.md, TRIAD.md)"
fi
installed=$((installed + 1))
fi
if [ -f "$SCRIPT_DIR/BUILDING-SETUP.md" ]; then
if $DRY_RUN; then
echo -e " ${DIM}Would copy:${RESET} BUILDING-SETUP.md"
else
cp "$SCRIPT_DIR/BUILDING-SETUP.md" ./
echo -e " ${GREEN}Copied:${RESET} BUILDING-SETUP.md (self-installing build journal)"
fi
installed=$((installed + 1))
fi
echo ""
fi
# -- Summary --
echo -e "${DIM}────────────────────────────────────────────────${RESET}"
echo ""
if $DRY_RUN; then
echo -e "${AMBER}Dry run complete.${RESET} $installed item(s) would be installed."
echo "Run without --dry-run to install."
else
echo -e "${GREEN}${BOLD}Done.${RESET} $installed item(s) installed."
echo ""
if $INSTALL_COMMANDS || $INSTALL_ALL; then
echo -e "${BOLD}Top commands:${RESET}"
echo -e " ${CYAN}/ship${RESET} Full delivery pipeline (preflight -> commit -> PR -> merge)"
echo -e " ${CYAN}/fix${RESET} Systematic bug diagnosis"
echo -e " ${CYAN}/visualize${RESET} Interactive HTML visualizations"
echo -e " ${CYAN}/blueprint${RESET} Build plans with progress tracking"
echo -e " ${CYAN}/deploy${RESET} Production deployment with rollback"
echo -e " ${CYAN}/research${RESET} Research orchestrator"
echo -e " ${CYAN}/reconcile${RESET} Triad document maintenance"
echo ""
fi
echo -e "${BOLD}Standalone (no install needed):${RESET}"
echo -e " ${CYAN}squire.md${RESET} Copy to project root for behavioral rules"
echo -e " ${CYAN}BUILDING-SETUP.md${RESET} Copy to project root for self-installing build journal"
echo ""
echo -e "${DIM}Open Claude Code and type any command to get started.${RESET}"
fi
echo ""