cc-agents-iterm-plugin/uninstall.sh
Andrey Epifancev 0d2380d36d chore: import existing iTerm2 Claude panel code
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 19:12:16 +04:00

34 lines
1.4 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Удаление панели «Claude». С --purge удаляет ещё настройки и логи хука.
set -euo pipefail
HERE="$(cd "$(dirname "$0")" && pwd)"
AUTOLAUNCH="$HOME/Library/Application Support/iTerm2/Scripts/AutoLaunch"
SETTINGS="$HOME/.claude/settings.json"
BACKUP_DIR="$HOME/.claude-panel-backup/$(date +%Y%m%d-%H%M%S)-$$-uninstall"
PORT=8766
ok() { printf ' \033[32m✓\033[0m %s\n' "$*"; }
if command -v lsof >/dev/null; then
pids=$(lsof -ti "tcp:$PORT" -sTCP:LISTEN 2>/dev/null || true)
[ -n "$pids" ] && kill $pids 2>/dev/null && ok "панель остановлена"
fi
rm -f "$AUTOLAUNCH/claude_agents.py" && ok "скрипт убран из AutoLaunch"
if [ -f "$SETTINGS" ]; then
mkdir -p "$BACKUP_DIR" && cp -p "$SETTINGS" "$BACKUP_DIR/"
removed=$(python3 "$HERE/files/settings_hooks.py" remove "$SETTINGS")
ok "settings.json: убраны хуки ${removed} (копия — в $BACKUP_DIR)"
fi
rm -f "$HOME/.claude/hooks/agents_panel_hook.sh" && ok "хук удалён"
if [ "${1:-}" = "--purge" ]; then
rm -rf "$HOME/.config/claude-agents" "$HOME/.cache/claude-agents"
ok "настройки и логи удалены"
else
echo " Настройки (~/.config/claude-agents) и логи (~/.cache/claude-agents) оставлены; --purge удалит и их."
fi
echo "Панель «Claude» исчезнет из меню Toolbelt после перезапуска iTerm2."