forked from wshobson/agents
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.sh
More file actions
executable file
·119 lines (101 loc) · 3.61 KB
/
uninstall.sh
File metadata and controls
executable file
·119 lines (101 loc) · 3.61 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
#!/bin/bash
# Claude Code Agents Uninstallation Script
# This script removes Claude Code agents and their configuration
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Default Claude Code directory
CLAUDE_DIR="$HOME/.claude"
AGENTS_DIR="$CLAUDE_DIR/agents"
CONFIG_FILE="$CLAUDE_DIR/claude_code_config.json"
BACKUP_PATTERN="*.backup.*"
# Function to print colored output
print_color() {
echo -e "${2}${1}${NC}"
}
# Function to print header
print_header() {
echo ""
print_color "=====================================" "$BLUE"
print_color "$1" "$BLUE"
print_color "=====================================" "$BLUE"
echo ""
}
# Welcome message
print_header "Claude Code Agents Uninstaller"
print_color "This script will remove Claude Code agents from your system." "$YELLOW"
echo ""
# Confirmation
read -p "Are you sure you want to uninstall Claude Code agents? (y/n): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
print_color "Uninstallation cancelled." "$YELLOW"
exit 0
fi
# Remove agents configuration from claude_code_config.json
print_header "Removing Configuration"
if [ -f "$CONFIG_FILE" ]; then
# Check if jq is available
if command -v jq >/dev/null 2>&1; then
# Remove agents section using jq
jq 'del(.agents)' "$CONFIG_FILE" > "$CONFIG_FILE.tmp" && mv "$CONFIG_FILE.tmp" "$CONFIG_FILE"
print_color "✓ Removed agents configuration from claude_code_config.json" "$GREEN"
else
# Manual removal warning
print_color "⚠ jq not found. Please manually remove the 'agents' section from:" "$YELLOW"
print_color " $CONFIG_FILE" "$YELLOW"
fi
else
print_color "⚠ Configuration file not found at $CONFIG_FILE" "$YELLOW"
fi
# Remove agents directory
print_header "Removing Agents Directory"
if [ -d "$AGENTS_DIR" ]; then
# Check for local modifications
cd "$AGENTS_DIR"
if [ -d ".git" ]; then
if ! git diff --quiet || ! git diff --cached --quiet; then
print_color "⚠ Local modifications detected in agents directory" "$YELLOW"
read -p "Do you want to save these changes before removing? (y/n): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
SAVE_DIR="$HOME/claude-agents-backup-$(date +%Y%m%d-%H%M%S)"
cp -r "$AGENTS_DIR" "$SAVE_DIR"
print_color "✓ Saved agents directory to: $SAVE_DIR" "$GREEN"
fi
fi
fi
cd "$CLAUDE_DIR"
rm -rf "$AGENTS_DIR"
print_color "✓ Removed agents directory" "$GREEN"
else
print_color "⚠ Agents directory not found at $AGENTS_DIR" "$YELLOW"
fi
# Clean up backups
print_header "Cleaning Up"
read -p "Do you want to remove backup files? (y/n): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
# Remove backup files
find "$CLAUDE_DIR" -name "$BACKUP_PATTERN" -type f -delete 2>/dev/null || true
print_color "✓ Removed backup files" "$GREEN"
else
print_color "Backup files retained." "$YELLOW"
fi
# Final summary
print_header "Uninstallation Complete"
print_color "✅ Claude Code agents have been successfully uninstalled" "$GREEN"
echo ""
print_color "The following items were removed:" "$BLUE"
print_color " • Agents directory at $AGENTS_DIR" "$BLUE"
print_color " • Agents configuration from $CONFIG_FILE" "$BLUE"
echo ""
print_color "💡 To reinstall agents, run:" "$YELLOW"
print_color " curl -sSL https://raw.githubusercontent.com/OrrisTech/agents/main/install.sh | bash" "$YELLOW"
echo ""
# Cleanup
unset RED GREEN YELLOW BLUE NC CLAUDE_DIR AGENTS_DIR CONFIG_FILE BACKUP_PATTERN