-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·614 lines (552 loc) · 22.7 KB
/
install.sh
File metadata and controls
executable file
·614 lines (552 loc) · 22.7 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
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
#!/usr/bin/env bash
# install.sh — Stream Coding v6.0 installer
# Supports: Antigravity, Gemini CLI, Claude Code
#
# Usage:
# ./install.sh <target-repo>
# curl -fsSL https://raw.githubusercontent.com/.../install.sh | bash -s -- .
#
# Options:
# --force Overwrite existing files
# --dry-run Show what would be installed without copying
# --all Install all platforms (skip selection)
# --platforms Comma-separated: agy,gemini,claude
set -euo pipefail
# ── Constants ──────────────────────────────────────────────────
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SOURCE_DIR="$SCRIPT_DIR/.agents"
VERSION="2.1.0"
SENTRUX_VERSION="v0.5.7"
# ── Colors & Symbols ──────────────────────────────────────────
RED='\033[0;31m'; GREEN='\033[0;32m'; BLUE='\033[0;34m'
YELLOW='\033[1;33m'; CYAN='\033[0;36m'; MAGENTA='\033[0;35m'
BOLD='\033[1m'; DIM='\033[2m'; NC='\033[0m'
CHECK="✓"; CROSS="✗"; ARROW="→"; DOT="·"
# ── State ─────────────────────────────────────────────────────
FORCE=false; DRY_RUN=false; ALL_PLATFORMS=false
TARGET=""; PLATFORMS_ARG=""
INSTALL_AGY=false; INSTALL_GEMINI=false; INSTALL_CLAUDE=false
STEP=0; TOTAL_STEPS=0; FILE_COUNT=0
# ── Helpers ───────────────────────────────────────────────────
banner() {
echo ""
echo -e "${CYAN}${BOLD}"
cat <<'EOF'
_____ __ ______ ___
/ ___// /_________ ____ _____ ___ / ____/___ ____/ (_)___ ____ _
\__ \/ __/ ___/ _ \/ __ `/ __ `__ \/ / / __ \/ __ / / __ \/ __ `/
___/ / /_/ / / __/ /_/ / / / / / / /___/ /_/ / /_/ / / / / / /_/ /
/____/\__/_/ \___/\__,_/_/ /_/ /_/\____/\____/\__,_/_/_/ /_/\__, /
/____/
EOF
echo -e "${NC}"
echo -e " ${DIM}Documentation-first methodology for AI coding agents${NC}"
echo -e " ${DIM}v${VERSION} · github.com/Pyl-Tech/stream-coding${NC}"
echo ""
}
step_header() {
STEP=$((STEP + 1))
echo ""
echo -e " ${CYAN}${BOLD}[$STEP/$TOTAL_STEPS]${NC} ${BOLD}$1${NC}"
echo -e " ${DIM}$(printf '%.0s─' {1..50})${NC}"
}
ok() { echo -e " ${GREEN}${CHECK}${NC} $1"; }
skip() { echo -e " ${YELLOW}${DOT}${NC} $1 ${DIM}(exists, use --force)${NC}"; }
add() { echo -e " ${GREEN}+${NC} $1"; }
del() { echo -e " ${RED}${CROSS}${NC} $1 ${DIM}(removed)${NC}"; }
info() { echo -e " ${DIM}${ARROW} $1${NC}"; }
err() { echo -e " ${RED}${CROSS} $1${NC}"; }
spinner() {
local pid=$1 msg=$2
local frames=("⠋" "⠙" "⠹" "⠸" "⠼" "⠴" "⠦" "⠧" "⠇" "⠏")
local i=0
tput civis 2>/dev/null || true
while kill -0 "$pid" 2>/dev/null; do
printf "\r ${CYAN}%s${NC} %s" "${frames[$i]}" "$msg"
i=$(( (i + 1) % ${#frames[@]} ))
sleep 0.08
done
printf "\r\033[K"
tput cnorm 2>/dev/null || true
}
copy_file() {
local src="$1" dest="$2" label="$3"
if $DRY_RUN; then
[[ -f "$dest" ]] && skip "$label" || add "$label"
return
fi
if [[ -f "$dest" && "$FORCE" != true ]]; then
skip "$label"; return
fi
mkdir -p "$(dirname "$dest")"
cp "$src" "$dest"
FILE_COUNT=$((FILE_COUNT + 1))
ok "$label"
}
# Upserts MCP server entries into a JSON config file.
# Creates the file if it doesn't exist. Preserves existing entries.
# Always overwrites learnings-hub and sentrux entries — other entries are preserved.
# Normalizes to 2-space indent.
#
# Usage: upsert_mcp_servers <json_file> <name> <command> [args...] [-- <name> <command> [args...]]
upsert_mcp_servers() {
local mcp_file="$1"; shift
python3 - "$mcp_file" "$@" <<'PYTHON'
import json, sys, os, shutil, time
cf = sys.argv[1]
raw_args = sys.argv[2:]
# Parse: name cmd [args...] [-- name cmd [args...]]
servers = []
current = []
for a in raw_args:
if a == "--":
if current:
servers.append(current)
current = []
else:
current.append(a)
if current:
servers.append(current)
# Read existing config
c = {}
if os.path.exists(cf):
try:
with open(cf) as f:
c = json.load(f)
except json.JSONDecodeError:
backup = cf + ".backup." + str(int(time.time()))
shutil.copy2(cf, backup)
print(f" WARN: {cf} is malformed JSON. Backed up to {backup}. Starting fresh.", file=sys.stderr)
c = {}
except OSError as e:
print(f" WARN: Cannot read {cf}: {e}. Skipping.", file=sys.stderr)
sys.exit(0)
c.setdefault("mcpServers", {})
modified = False
for parts in servers:
name = parts[0]
command = parts[1]
args = parts[2:]
new_entry = {"command": command, "args": args, "env": {}}
if c["mcpServers"].get(name) != new_entry:
c["mcpServers"][name] = new_entry
modified = True
if modified:
os.makedirs(os.path.dirname(cf) or ".", exist_ok=True)
with open(cf, "w") as f:
json.dump(c, f, indent=2)
f.write("\n")
PYTHON
}
# ── Argument Parsing ──────────────────────────────────────────
while [[ $# -gt 0 ]]; do
case $1 in
--force) FORCE=true; shift ;;
--dry-run) DRY_RUN=true; shift ;;
--all) ALL_PLATFORMS=true; shift ;;
--platforms) PLATFORMS_ARG="$2"; shift 2 ;;
--help|-h)
banner
printf " ${BOLD}Usage:${NC} %s [options] <target-repo>\n" "$0"
echo ""
printf " ${BOLD}Options:${NC}\n"
echo " --force Overwrite existing files"
echo " --dry-run Preview what would be installed"
echo " --all Install all platforms (skip selection)"
echo " --platforms Comma-separated: agy,gemini,claude"
echo ""
printf " ${BOLD}Examples:${NC}\n"
printf " %s . # Interactive setup\n" "$0"
printf " %s . --all # All platforms\n" "$0"
printf " %s . --platforms agy,claude . # Specific platforms\n" "$0"
printf " %s . --dry-run # Preview only\n" "$0"
exit 0 ;;
*)
if [[ -z "$TARGET" && "$1" != -* ]]; then
TARGET="$1"
else
echo -e " ${RED}Unknown option: $1${NC}"; exit 1
fi
shift ;;
esac
done
# ── Validate ──────────────────────────────────────────────────
if [[ -z "$TARGET" ]]; then
banner
echo -e " ${RED}Error: target repository path required${NC}"
echo -e " Usage: $0 <target-repo>"
exit 1
fi
TARGET="$(cd "$TARGET" 2>/dev/null && pwd || echo "$TARGET")"
DEST_DIR="$TARGET/.agents"
if [[ ! -d "$SOURCE_DIR" ]]; then
echo -e " ${RED}Error: source .agents/ not found at $SOURCE_DIR${NC}"
exit 1
fi
# ── Platform Selection ────────────────────────────────────────
banner
echo -e " ${BOLD}Target:${NC} $TARGET"
echo ""
if [[ -n "$PLATFORMS_ARG" ]]; then
IFS=',' read -ra PLATS <<< "$PLATFORMS_ARG"
for p in "${PLATS[@]}"; do
case "$p" in
agy|antigravity) INSTALL_AGY=true ;;
gemini|ge) INSTALL_GEMINI=true ;;
claude|cc) INSTALL_CLAUDE=true ;;
*) echo -e " ${RED}Unknown platform: $p${NC}"; exit 1 ;;
esac
done
elif $ALL_PLATFORMS; then
INSTALL_AGY=true; INSTALL_GEMINI=true; INSTALL_CLAUDE=true
else
# Interactive selection
echo -e " ${BOLD}Select platforms to configure:${NC}"
echo ""
echo -e " ${CYAN}[1]${NC} Antigravity ${DIM}GEMINI.md → ~/.gemini/${NC}"
echo -e " ${CYAN}[2]${NC} Gemini CLI ${DIM}GEMINI.md → project root${NC}"
echo -e " ${CYAN}[3]${NC} Claude Code ${DIM}CLAUDE.md + .claude/${NC}"
echo -e " ${CYAN}[A]${NC} All of the above"
echo ""
read -rp " Choose (e.g. 1,3 or A): " choice
case "$choice" in
[Aa]|[Aa][Ll][Ll]) INSTALL_AGY=true; INSTALL_GEMINI=true; INSTALL_CLAUDE=true ;;
*)
IFS=',' read -ra PICKS <<< "$choice"
for p in "${PICKS[@]}"; do
p="$(echo "$p" | tr -d ' ')"
case "$p" in
1) INSTALL_AGY=true ;;
2) INSTALL_GEMINI=true ;;
3) INSTALL_CLAUDE=true ;;
*) echo -e " ${RED}Invalid choice: $p${NC}"; exit 1 ;;
esac
done
;;
esac
echo ""
fi
# Count platforms for display
PLAT_LIST=""
$INSTALL_AGY && PLAT_LIST+="Antigravity "
$INSTALL_GEMINI && PLAT_LIST+="Gemini-CLI "
$INSTALL_CLAUDE && PLAT_LIST+="Claude-Code "
if [[ -z "$PLAT_LIST" ]]; then
echo -e " ${RED}No platforms selected. Aborting.${NC}"
exit 1
fi
echo -e " ${GREEN}${CHECK}${NC} Platforms: ${BOLD}${PLAT_LIST}${NC}"
# Calculate steps
TOTAL_STEPS=3 # rules + skills + templates (always)
$INSTALL_AGY && TOTAL_STEPS=$((TOTAL_STEPS + 1)) || true
$INSTALL_GEMINI && TOTAL_STEPS=$((TOTAL_STEPS + 1)) || true
$INSTALL_CLAUDE && TOTAL_STEPS=$((TOTAL_STEPS + 1)) || true
TOTAL_STEPS=$((TOTAL_STEPS + 1)) # sentrux
TOTAL_STEPS=$((TOTAL_STEPS + 1)) # cleanup
if $DRY_RUN; then
echo -e " ${YELLOW}⚡ Dry run — no files will be modified${NC}"
fi
# ═══════════════════════════════════════════════════════════════
# INSTALL
# ═══════════════════════════════════════════════════════════════
# ── Antigravity ───────────────────────────────────────────────
if $INSTALL_AGY; then
step_header "Antigravity — ~/.gemini/GEMINI.md (global)"
GEMINI_DEST="$HOME/.gemini/GEMINI.md"
copy_file "$SCRIPT_DIR/GEMINI.md" "$GEMINI_DEST" "~/.gemini/GEMINI.md"
# MCP config
MCP_FILE="$HOME/.gemini/antigravity/mcp_config.json"
if [[ -x "$HOME/.local/bin/sentrux" ]] || ! $DRY_RUN; then
info "MCP config: ~/.gemini/antigravity/mcp_config.json"
fi
fi
# ── Gemini CLI ────────────────────────────────────────────────
if $INSTALL_GEMINI; then
step_header "Gemini CLI — GEMINI.md (project root)"
copy_file "$SCRIPT_DIR/GEMINI.md" "$TARGET/GEMINI.md" "GEMINI.md"
fi
# ── Claude Code ───────────────────────────────────────────────
if $INSTALL_CLAUDE; then
step_header "Claude Code — CLAUDE.md + .claude/"
# CLAUDE.md
if [[ -f "$SCRIPT_DIR/CLAUDE.md" ]]; then
copy_file "$SCRIPT_DIR/CLAUDE.md" "$TARGET/CLAUDE.md" "CLAUDE.md"
fi
# .claude/settings.json
if [[ -f "$SCRIPT_DIR/.claude/settings.json" ]]; then
copy_file "$SCRIPT_DIR/.claude/settings.json" "$TARGET/.claude/settings.json" ".claude/settings.json"
fi
# Hooks
if [[ -d "$SCRIPT_DIR/.claude/hooks" ]]; then
for hook in "$SCRIPT_DIR"/.claude/hooks/*.sh; do
[[ -f "$hook" ]] || continue
bn=$(basename "$hook")
copy_file "$hook" "$TARGET/.claude/hooks/$bn" ".claude/hooks/$bn"
chmod +x "$TARGET/.claude/hooks/$bn" 2>/dev/null || true
done
fi
# Slash commands
if [[ -d "$SCRIPT_DIR/.claude/commands" ]]; then
for cmd in "$SCRIPT_DIR"/.claude/commands/*.md; do
[[ -f "$cmd" ]] || continue
bn=$(basename "$cmd")
copy_file "$cmd" "$TARGET/.claude/commands/$bn" ".claude/commands/$bn"
done
fi
# Skills symlink
if [[ ! -L "$TARGET/.claude/skills" ]]; then
if ! $DRY_RUN; then
mkdir -p "$TARGET/.claude"
ln -sf ../.agents/skills "$TARGET/.claude/skills"
fi
ok ".claude/skills ${ARROW} ../.agents/skills (symlink)"
else
skip ".claude/skills (symlink exists)"
fi
fi
# ── Rules ─────────────────────────────────────────────────────
step_header "Rules (methodology core)"
for rule in "$SOURCE_DIR"/rules/*.md; do
bn=$(basename "$rule")
copy_file "$rule" "$DEST_DIR/rules/$bn" "rules/$bn"
done
# ── Skills ────────────────────────────────────────────────────
step_header "Skills (59 capabilities)"
for skill_dir in "$SOURCE_DIR"/skills/*/; do
skill_name=$(basename "$skill_dir")
while IFS= read -r -d '' file; do
rel_path="${file#$skill_dir}"
case "$rel_path" in
*__pycache__*|*.pyc) continue ;;
esac
copy_file "$file" "$DEST_DIR/skills/$skill_name/$rel_path" "skills/$skill_name/$rel_path"
done < <(find "$skill_dir" -type f -print0)
done
# ── Templates ─────────────────────────────────────────────────
step_header "Templates"
for tmpl in "$SOURCE_DIR"/templates/*; do
bn=$(basename "$tmpl")
copy_file "$tmpl" "$DEST_DIR/templates/$bn" "templates/$bn"
done
# ── Sentrux ───────────────────────────────────────────────────
step_header "Sentrux (architectural sensor)"
SENTRUX_INSTALL_DIR="${HOME}/.local/bin"
SENTRUX_BINARY="$SENTRUX_INSTALL_DIR/sentrux"
install_sentrux() {
mkdir -p "$SENTRUX_INSTALL_DIR"
local os arch asset_name
os="$(uname -s | tr '[:upper:]' '[:lower:]')"
arch="$(uname -m)"
case "$os" in
linux) os="linux" ;;
darwin) os="darwin" ;;
*) info "Unsupported OS: $os — skipping binary"; return 1 ;;
esac
case "$arch" in
x86_64|amd64) arch="x86_64" ;;
aarch64|arm64) arch="arm64" ;;
*) info "Unsupported arch: $arch — skipping binary"; return 1 ;;
esac
[[ "$os" == "linux" && "$arch" == "arm64" ]] && arch="aarch64"
asset_name="sentrux-${os}-${arch}"
local url="https://github.com/sentrux/sentrux/releases/download/${SENTRUX_VERSION}/${asset_name}"
if [[ -x "$SENTRUX_BINARY" ]]; then
local cur; cur="$("$SENTRUX_BINARY" --version 2>/dev/null | awk '{print $2}' || echo "unknown")"
if [[ "$cur" == "${SENTRUX_VERSION#v}" ]]; then
ok "Binary at ${SENTRUX_VERSION} ($SENTRUX_BINARY)"
return 0
fi
fi
if $DRY_RUN; then
add "Download sentrux ${SENTRUX_VERSION} ${ARROW} $SENTRUX_BINARY"
return 0
fi
(curl -fsSL "$url" -o "$SENTRUX_BINARY" && chmod +x "$SENTRUX_BINARY") &
spinner $! "Downloading sentrux ${SENTRUX_VERSION}..."
wait $! && ok "Binary installed: $SENTRUX_BINARY" || { err "Download failed"; return 1; }
}
install_sentrux
SENTRUX_OK=$?
# .sentrux/rules.toml
rules_file="$TARGET/.sentrux/rules.toml"
template="$SOURCE_DIR/templates/sentrux-rules.toml"
if [[ -f "$rules_file" && "$FORCE" != true ]]; then
skip ".sentrux/rules.toml"
elif $DRY_RUN; then
add ".sentrux/rules.toml"
else
mkdir -p "$TARGET/.sentrux"
if [[ -f "$template" ]]; then
cp "$template" "$rules_file"
ok ".sentrux/rules.toml (from template)"
else
cat > "$rules_file" <<'TOML'
[constraints]
min_quality = 0.65
max_cycles = 0
max_cc = 20
max_fn_lines = 80
no_god_files = true
TOML
ok ".sentrux/rules.toml (minimal)"
fi
fi
# ── MCP: Learnings Hub + Sentrux ─────────────────────────────
# Always overwrites learnings-hub and sentrux entries.
# Other user-defined MCP entries are preserved.
LEARNINGS_HUB_URL="https://learnings-hub-xkb3kzjhxa-ew.a.run.app/mcp"
if ! $DRY_RUN; then
# Antigravity (global config)
if $INSTALL_AGY; then
AGY_MCP="$HOME/.gemini/antigravity/mcp_config.json"
if [[ "$SENTRUX_OK" -eq 0 ]]; then
upsert_mcp_servers "$AGY_MCP" \
"learnings-hub" "npx" "-y" "mcp-remote" "$LEARNINGS_HUB_URL" \
-- "sentrux" "$SENTRUX_BINARY" "mcp"
else
upsert_mcp_servers "$AGY_MCP" \
"learnings-hub" "npx" "-y" "mcp-remote" "$LEARNINGS_HUB_URL"
fi
ok "MCP config: ~/.gemini/antigravity/mcp_config.json"
fi
# Gemini CLI (project-level config)
if $INSTALL_GEMINI; then
GEMINI_MCP="$TARGET/.gemini/settings.json"
if [[ "$SENTRUX_OK" -eq 0 ]]; then
upsert_mcp_servers "$GEMINI_MCP" \
"learnings-hub" "npx" "-y" "mcp-remote" "$LEARNINGS_HUB_URL" \
-- "sentrux" "$SENTRUX_BINARY" "mcp"
else
upsert_mcp_servers "$GEMINI_MCP" \
"learnings-hub" "npx" "-y" "mcp-remote" "$LEARNINGS_HUB_URL"
fi
ok "MCP config: .gemini/settings.json"
fi
# Claude Code (project-level config)
if $INSTALL_CLAUDE; then
CLAUDE_MCP="$TARGET/.mcp.json"
if [[ "$SENTRUX_OK" -eq 0 ]]; then
upsert_mcp_servers "$CLAUDE_MCP" \
"learnings-hub" "npx" "-y" "mcp-remote" "$LEARNINGS_HUB_URL" \
-- "sentrux" "$SENTRUX_BINARY" "mcp"
else
upsert_mcp_servers "$CLAUDE_MCP" \
"learnings-hub" "npx" "-y" "mcp-remote" "$LEARNINGS_HUB_URL"
fi
ok "MCP config: .mcp.json"
fi
fi
# Baseline
if [[ "$SENTRUX_OK" -eq 0 ]] && ! $DRY_RUN && [[ -x "$SENTRUX_BINARY" ]]; then
if "$SENTRUX_BINARY" gate --save "$TARGET" 2>&1 | grep -q "Baseline saved"; then
ok ".sentrux/baseline.json"
else
info "Configure layers in rules.toml, then run: sentrux gate --save ."
fi
fi
# .gitignore
if ! $DRY_RUN; then
if [[ -f "$TARGET/.gitignore" ]]; then
if ! grep -qF ".sentrux/baseline.json" "$TARGET/.gitignore"; then
printf '\n# Sentrux baseline\n.sentrux/baseline.json\n' >> "$TARGET/.gitignore"
ok ".gitignore (added baseline exclusion)"
fi
else
echo ".sentrux/baseline.json" > "$TARGET/.gitignore"
ok ".gitignore (created)"
fi
fi
# ── Cleanup ───────────────────────────────────────────────────
if ! $DRY_RUN; then
step_header "Cleanup (orphaned files)"
ORPHAN_COUNT=0
# Remove legacy workflows directory
if [[ -d "$DEST_DIR/workflows" ]]; then
rm -rf "$DEST_DIR/workflows"
del "workflows/ (migrated to skills in v6.0)"
ORPHAN_COUNT=$((ORPHAN_COUNT + 1))
fi
# Remove orphaned skills
if [[ -d "$DEST_DIR/skills" ]]; then
for dest_skill in "$DEST_DIR"/skills/*/; do
[[ -d "$dest_skill" ]] || continue
skill_name=$(basename "$dest_skill")
if [[ ! -d "$SOURCE_DIR/skills/$skill_name" ]]; then
rm -rf "$dest_skill"
del "skills/$skill_name/"
ORPHAN_COUNT=$((ORPHAN_COUNT + 1))
else
while IFS= read -r -d '' df; do
rp="${df#$dest_skill}"
case "$rp" in *__pycache__*|*.pyc) continue ;; esac
if [[ ! -f "$SOURCE_DIR/skills/$skill_name/$rp" ]]; then
rm "$df"
del "skills/$skill_name/$rp"
ORPHAN_COUNT=$((ORPHAN_COUNT + 1))
fi
done < <(find "$dest_skill" -type f -print0)
find "$dest_skill" -type d -empty -delete 2>/dev/null || true
fi
done
fi
# Remove orphaned rules
if [[ -d "$DEST_DIR/rules" ]]; then
for df in "$DEST_DIR"/rules/*.md; do
[[ -f "$df" ]] || continue
bn=$(basename "$df")
if [[ ! -f "$SOURCE_DIR/rules/$bn" ]]; then
rm "$df"
del "rules/$bn"
ORPHAN_COUNT=$((ORPHAN_COUNT + 1))
fi
done
fi
# Remove orphaned templates
if [[ -d "$DEST_DIR/templates" ]]; then
for df in "$DEST_DIR"/templates/*; do
[[ -f "$df" ]] || continue
bn=$(basename "$df")
if [[ ! -f "$SOURCE_DIR/templates/$bn" ]]; then
rm "$df"
del "templates/$bn"
ORPHAN_COUNT=$((ORPHAN_COUNT + 1))
fi
done
fi
[[ $ORPHAN_COUNT -eq 0 ]] && ok "No orphaned files"
fi
# ═══════════════════════════════════════════════════════════════
# Summary
# ═══════════════════════════════════════════════════════════════
echo ""
echo -e " ${DIM}$(printf '%.0s═' {1..52})${NC}"
if $DRY_RUN; then
echo -e " ${YELLOW}${BOLD}Dry run complete — no files were modified.${NC}"
else
echo ""
echo -e " ${GREEN}${BOLD}${CHECK} Stream Coding v${VERSION} installed successfully!${NC}"
echo ""
echo -e " ${BOLD}Installed to:${NC} $TARGET"
echo ""
# Per-platform summary
if $INSTALL_AGY; then
echo -e " ${CYAN}Antigravity${NC} ~/.gemini/GEMINI.md + MCP config"
fi
if $INSTALL_GEMINI; then
echo -e " ${CYAN}Gemini CLI${NC} GEMINI.md + .gemini/settings.json"
fi
if $INSTALL_CLAUDE; then
echo -e " ${CYAN}Claude Code${NC} CLAUDE.md + .claude/ + .mcp.json"
fi
echo ""
echo -e " ${BOLD}Shared:${NC}"
echo -e " .agents/rules/ ${DIM}← 8 always-on methodology rules${NC}"
echo -e " .agents/skills/ ${DIM}← 59 on-demand skills${NC}"
echo -e " .agents/templates/ ${DIM}← Document templates${NC}"
echo -e " .sentrux/rules.toml ${DIM}← Architectural rules${NC}"
echo -e " MCP servers ${DIM}← Learnings Hub + Sentrux${NC}"
echo ""
echo -e " ${BOLD}Triggers:${NC} \"Build\", \"Create\", \"Implement\", \"Document\", \"Spec out\""
echo -e " ${DIM}The methodology activates automatically and guides each stage.${NC}"
fi
echo ""