claude-hooks/scripts/uninstall.sh
Ryan Malloy 162ca67098 Initial commit: Claude Code Hooks with Diátaxis documentation
 Features:
- 🧠 Shadow learner that builds intelligence from command patterns
- 🛡️ Smart command validation with safety checks
- 💾 Automatic context monitoring and backup system
- 🔄 Session continuity across Claude restarts

📚 Documentation:
- Complete Diátaxis-organized documentation
- Learning-oriented tutorial for getting started
- Task-oriented how-to guides for specific problems
- Information-oriented reference for quick lookup
- Understanding-oriented explanations of architecture

🚀 Installation:
- One-command installation script
- Bootstrap prompt for installation via Claude
- Cross-platform compatibility
- Comprehensive testing suite

🎯 Ready for real-world use and community feedback!

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-19 18:25:34 -06:00

112 lines
3.0 KiB
Bash
Executable File

#!/bin/bash
# Claude Hooks Uninstallation Script
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
CLAUDE_CONFIG_DIR="$HOME/.config/claude"
HOOKS_CONFIG_FILE="$CLAUDE_CONFIG_DIR/hooks.json"
echo -e "${BLUE}Claude Code Hooks Uninstallation${NC}"
echo "===================================="
# Warn user about data loss
echo -e "${YELLOW}WARNING:${NC} This will remove:"
echo "- Hook configuration from Claude Code"
echo "- All learned patterns and session data"
echo "- Backup files (if in project directory)"
echo ""
read -p "Are you sure you want to continue? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Uninstallation cancelled."
exit 0
fi
# Remove hooks from Claude settings
if [ -f "$HOME/.config/claude/settings.json" ]; then
echo -n "Removing hooks from Claude settings... "
# Backup settings
cp "$HOME/.config/claude/settings.json" "$HOME/.config/claude/settings.json.backup"
# Remove hooks configuration
python3 << 'EOF'
import json
import sys
try:
with open('/home/usr/.config/claude/settings.json', 'r') as f:
settings = json.load(f)
# Remove hooks section
if 'hooks' in settings:
del settings['hooks']
with open('/home/usr/.config/claude/settings.json', 'w') as f:
json.dump(settings, f, indent=2)
print("SUCCESS")
else:
print("NO HOOKS FOUND")
except Exception as e:
print(f"ERROR: {e}")
sys.exit(1)
EOF
echo -e "${GREEN}Hooks removed from Claude settings${NC}"
else
echo -e "${YELLOW}No Claude settings file found${NC}"
fi
# Remove hooks configuration file
if [ -f "$HOOKS_CONFIG_FILE" ]; then
echo -n "Removing hooks configuration file... "
rm -f "$HOOKS_CONFIG_FILE"
echo -e "${GREEN}SUCCESS${NC}"
fi
# Ask about removing data
echo ""
read -p "Remove learned patterns and session data? (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo -n "Removing hook data... "
rm -rf ".claude_hooks"
rm -f "LAST_SESSION.md" "ACTIVE_TODOS.md" "RECOVERY_GUIDE.md"
echo -e "${GREEN}SUCCESS${NC}"
fi
# Ask about removing project files
echo ""
read -p "Remove project files (hooks, scripts, etc.)? This cannot be undone! (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
CLAUDE_HOOKS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
echo -n "Removing project files... "
cd ..
rm -rf "$CLAUDE_HOOKS_DIR"
echo -e "${GREEN}SUCCESS${NC}"
echo ""
echo -e "${GREEN}Complete uninstallation finished!${NC}"
echo "All files have been removed."
else
echo ""
echo -e "${GREEN}Partial uninstallation finished!${NC}"
echo "Hooks disabled, but project files remain."
fi
echo ""
echo -e "${BLUE}Post-uninstallation:${NC}"
echo "1. Restart Claude Code to ensure hooks are disabled"
echo "2. Check that no hook-related errors appear"
echo "3. Your backup files (if any) remain in git history"
echo ""
echo -e "${GREEN}Claude Code Hooks successfully removed.${NC}"