#!/usr/bin/env bash
rm -rf "$HOME/.claude/skills/adom-theme" "$HOME/.claude/skills/adom-theme-system"

# Remove the theme pack through code-server so extensions.json loses the
# registration too; a bare rm would leave a dangling entry behind.
EXT_DIR="$HOME/.local/share/code-server/extensions"
for cs in /usr/lib/code-server/bin/code-server \
          /usr/local/lib/code-server/bin/code-server \
          "$HOME/.local/lib/code-server/bin/code-server"; do
    if [ -x "$cs" ]; then
        env -u CODE_SERVER_PARENT_PID -u VSCODE_IPC_HOOK_CLI \
            "$cs" --extensions-dir "$EXT_DIR" \
            --uninstall-extension adom.adom-theme >/dev/null 2>&1 || true
            env -u CODE_SERVER_PARENT_PID -u VSCODE_IPC_HOOK_CLI \
            "$cs" --extensions-dir "$EXT_DIR" \
            --uninstall-extension adom.adom-themes >/dev/null 2>&1 || true
        break
    fi
done
rm -rf "$EXT_DIR"/adom.adom-theme-* "$EXT_DIR"/adom.adom-themes-* 2>/dev/null || true

rm -rf "$HOME/.local/share/fonts/adom-theme" "$HOME/.local/share/fonts/adom-theme-system" 2>/dev/null || true
command -v fc-cache >/dev/null 2>&1 && fc-cache -f >/dev/null 2>&1 || true
echo "removed: skill, VS Code theme pack, OFL fonts"
