#!/bin/sh
# Remove the Adom statusline: delete the script and drop the statusLine key
# from ~/.claude/settings.json (every other setting preserved).
set -e

CLAUDE_DIR="$HOME/.claude"
rm -f "$CLAUDE_DIR/statusline.sh"
echo "removed $CLAUDE_DIR/statusline.sh"

SETTINGS="$CLAUDE_DIR/settings.json"
if [ -f "$SETTINGS" ]; then
python3 - "$SETTINGS" <<'PY'
import json, os, sys
path = sys.argv[1]
with open(path, encoding="utf-8") as f:
    settings = json.load(f)
if settings.pop("statusLine", None) is not None:
    tmp = path + ".new"
    with open(tmp, "w", encoding="utf-8") as f:
        json.dump(settings, f, indent=2)
        f.write("\n")
    os.replace(tmp, path)
    print(f"removed statusLine from {path}")
else:
    print("no statusLine key in settings.json — nothing to do")
PY
fi
echo "uninstalled"