-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.sh
More file actions
executable file
·50 lines (43 loc) · 1.24 KB
/
Copy pathuninstall.sh
File metadata and controls
executable file
·50 lines (43 loc) · 1.24 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
#!/usr/bin/env bash
# avoid-ai -- uninstall script
# Removes plugin directory and deregisters from settings.json.
set -euo pipefail
PLUGIN_NAME="avoid-ai"
CLAUDE_DIR="${CLAUDE_CONFIG_DIR:-$HOME/.claude}"
PLUGIN_DIR="$CLAUDE_DIR/plugins/$PLUGIN_NAME"
SETTINGS="$CLAUDE_DIR/settings.json"
FLAG="$CLAUDE_DIR/.avoid-ai-active"
echo "Uninstalling $PLUGIN_NAME..."
# 1. Remove flag file
if [ -f "$FLAG" ]; then
rm "$FLAG"
echo " Removed flag file"
fi
# 2. Deregister from settings.json
if [ -f "$SETTINGS" ]; then
node - <<EOF
const fs = require('fs');
const p = '$SETTINGS';
let s = {};
try { s = JSON.parse(fs.readFileSync(p, 'utf8')); } catch(e) {}
if (s.plugins) {
const before = s.plugins.length;
s.plugins = s.plugins.filter(pl => (typeof pl === 'string' ? pl : pl.path) !== '$PLUGIN_DIR');
if (s.plugins.length < before) {
fs.writeFileSync(p, JSON.stringify(s, null, 2) + '\n', 'utf8');
console.log(' Deregistered from ' + p);
} else {
console.log(' Plugin was not in ' + p);
}
}
EOF
fi
# 3. Remove plugin directory
if [ -d "$PLUGIN_DIR" ]; then
rm -rf "$PLUGIN_DIR"
echo " Removed $PLUGIN_DIR"
else
echo " Plugin directory not found (already removed?)"
fi
echo ""
echo "Done. Restart Claude Code to complete removal."