-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuninstall.sh
More file actions
executable file
·62 lines (53 loc) · 2.14 KB
/
uninstall.sh
File metadata and controls
executable file
·62 lines (53 loc) · 2.14 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
#!/usr/bin/env bash
# uninstall.sh — Cleans up the legacy manual installation of clauding-afk
set -e
HOOKS_DIR="$HOME/.claude/hooks"
CLAUDE_SETTINGS="$HOME/.claude/settings.json"
echo "🤖 clauding-afk — Legacy Uninstaller"
echo "=================================="
echo "1. Removing hook from $CLAUDE_SETTINGS..."
if [ -f "$CLAUDE_SETTINGS" ]; then
python3 - <<PYEOF
import json, pathlib
settings_path = pathlib.Path("$CLAUDE_SETTINGS")
try:
settings = json.loads(settings_path.read_text())
hooks = settings.get("hooks", {})
if "PermissionRequest" in hooks:
# Keep hooks that aren't watch_approver.py
filtered_pr = []
for h in hooks["PermissionRequest"]:
if not any("watch_approver.py" in cmd.get("command", "") for cmd in h.get("hooks", [])):
filtered_pr.append(h)
if len(filtered_pr) == 0:
del hooks["PermissionRequest"]
else:
hooks["PermissionRequest"] = filtered_pr
settings["hooks"] = hooks
settings_path.write_text(json.dumps(settings, indent=2))
print("✅ Cleaned settings.json")
else:
print("⏭️ No PermissionRequest hooks found in settings.")
except Exception as e:
print(f"⚠️ Could not clean settings.json: {e}")
PYEOF
fi
echo "2. Removing legacy scripts from $HOOKS_DIR..."
rm -f "$HOOKS_DIR/watch_approver.py"
rm -f "$HOOKS_DIR/summarizer.py"
echo "✅ Scripts removed."
if [ -f "$HOOKS_DIR/config.json" ]; then
echo "⚠️ Found legacy config at $HOOKS_DIR/config.json."
read -p "Do you want to move it to the new plugin config location (~/.config/clauding-afk/config.json)? [Y/n] " MOVE_CONFIG
MOVE_CONFIG=${MOVE_CONFIG:-Y}
if [[ "$MOVE_CONFIG" =~ ^[Yy]$ ]]; then
mkdir -p ~/.config/clauding-afk
mv "$HOOKS_DIR/config.json" ~/.config/clauding-afk/config.json
echo "✅ Config moved to ~/.config/clauding-afk/config.json"
else
echo "⏭️ Leaving config in $HOOKS_DIR."
fi
fi
echo ""
echo "Uninstall complete! You can now safely install the plugin version:"
echo "claude /plugin install https://github.com/fomyio/clauding-afk"