-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.sh
More file actions
162 lines (136 loc) · 4.45 KB
/
Copy pathuninstall.sh
File metadata and controls
162 lines (136 loc) · 4.45 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
#!/usr/bin/env bash
set -euo pipefail
# ── SoloForge Uninstaller ────────────────────────────────────────────
# Removes only SoloForge-managed files from ~/.claude/
# Does NOT touch CLAUDE.md (user may have customized it)
# ──────────────────────────────────────────────────────────────────────
# ── Colors (degrade gracefully) ──────────────────────────────────────
if [ -t 1 ] && command -v tput >/dev/null 2>&1 && [ "$(tput colors 2>/dev/null || printf '0')" -ge 8 ]; then
GREEN=$(tput setaf 2)
YELLOW=$(tput setaf 3)
RED=$(tput setaf 1)
BOLD=$(tput bold)
RESET=$(tput sgr0)
else
GREEN="" YELLOW="" RED="" BOLD="" RESET=""
fi
info() { printf "%s[INFO]%s %s\n" "$GREEN" "$RESET" "$1"; }
warn() { printf "%s[WARN]%s %s\n" "$YELLOW" "$RESET" "$1"; }
error() { printf "%s[ERROR]%s %s\n" "$RED" "$RESET" "$1"; }
header(){ printf "\n%s%s%s\n" "$BOLD" "$1" "$RESET"; }
CLAUDE_DIR="$HOME/.claude"
header "SoloForge Uninstaller"
if [ ! -d "$CLAUDE_DIR" ]; then
error "~/.claude/ directory not found. Nothing to uninstall."
exit 1
fi
REMOVED=0
# ── Remove SoloForge skills ─────────────────────────────────────────
header "Removing skills..."
SKILLS=(
biz-think
biz-validate
brand-build
community-engage
content-create
content-distribute
copy-craft
data-decide
finance-ops
growth-track
infra-ops
issue-create
legal-guard
post-merge
pre-code
pre-commit
pre-pr
product-eval
project-init
retro
roadmap-steer
sales-close
search-eval
self-review
sop
staging-verify
support-ops
test-gate
ux-audit
work-breakdown
)
for skill in "${SKILLS[@]}"; do
if [ -d "$CLAUDE_DIR/skills/$skill" ]; then
rm -rf "$CLAUDE_DIR/skills/$skill"
info "Removed skill: $skill"
REMOVED=$((REMOVED + 1))
else
warn "Skill not found (already removed?): $skill"
fi
done
# ── Remove SoloForge hooks ──────────────────────────────────────────
header "Removing hooks..."
HOOKS=(
post-edit-review.sh
safety-guard.sh
skill-eval.sh
)
for hook in "${HOOKS[@]}"; do
if [ -f "$CLAUDE_DIR/hooks/$hook" ]; then
rm "$CLAUDE_DIR/hooks/$hook"
info "Removed hook: $hook"
REMOVED=$((REMOVED + 1))
else
warn "Hook not found (already removed?): $hook"
fi
done
# ── Remove hooks config from settings.json ───────────────────────────
header "Cleaning settings.json..."
SETTINGS_FILE="$CLAUDE_DIR/settings.json"
if [ ! -f "$SETTINGS_FILE" ]; then
warn "settings.json not found — nothing to clean."
else
PYTHON=""
if command -v python3 >/dev/null 2>&1; then
PYTHON="python3"
elif command -v python >/dev/null 2>&1; then
PYTHON="python"
fi
if [ -z "$PYTHON" ]; then
error "Python not found. Cannot clean settings.json."
error "Please manually remove the \"hooks\" key from $SETTINGS_FILE"
else
"$PYTHON" - "$SETTINGS_FILE" <<'PYEOF'
import json
import sys
import os
settings_path = sys.argv[1]
if not os.path.exists(settings_path):
sys.exit(0)
with open(settings_path, "r", encoding="utf-8") as f:
try:
settings = json.load(f)
except json.JSONDecodeError:
print("Warning: settings.json is invalid JSON — leaving it alone.", file=sys.stderr)
sys.exit(0)
if "hooks" not in settings:
sys.exit(0)
del settings["hooks"]
if settings:
with open(settings_path, "w", encoding="utf-8") as f:
json.dump(settings, f, indent=2, ensure_ascii=False)
f.write("\n")
else:
# If settings is now empty, write empty object
with open(settings_path, "w", encoding="utf-8") as f:
f.write("{}\n")
PYEOF
info "Removed hooks config from settings.json"
REMOVED=$((REMOVED + 1))
fi
fi
# ── Summary ──────────────────────────────────────────────────────────
header "Uninstall complete!"
info "Items removed: $REMOVED"
warn "CLAUDE.md was NOT touched (may contain your customizations)."
printf "\n"