Files
claude-adam/adam-uninstall.sh
T
lukaszraczylo 6d8ff37cb2 v0.3.1: code review pass + DX overhaul
Bug fixes (HIGH):
- adam-observe.mjs: errorFingerprint no longer false-positives when
  toolResponse.is_error === false; ERROR_RE only used as fallback when
  is_error is undefined.
- adam-observe.mjs: resetSessionLocal now clears tool_window so retry_loop
  cannot fire on the first tool of a new session by matching prior session.
- adam-archive.mjs: ts dedup uses Map<ts, count> instead of Set<ts>; two
  journal entries sharing a millisecond are no longer both archived when
  only one is referenced in source_entries.
- adam-nudge.mjs: only counts proposal filenames matching
  /^\d{4}-\d{2}-\d{3}-/ pattern; README/notes in proposals/ no longer bump.
- skills/adam-self-improvement/SKILL.md: contradiction_flag veto now applied
  at apply time (carry-over from earlier review).

Test isolation:
- adam/tests/run-tests.sh: ALWAYS runs against an isolated $HOME under
  mktemp -d. Previously truncated live ~/.claude/adam/journal.jsonl on
  every run — destructive on production state.

Conciseness:
- agents/adam.md: -19 LOC (cuts: vestigial cursor sentence, duplicate
  not-do bullets, blast-radius bullet collapse, Inputs paths delegate to
  SKILL.md, win-cluster-vs-struggle-cluster commentary already enforced
  by cluster-key separation, # Overlap section spec compressed).
- skills/adam-self-improvement/SKILL.md: -4 LOC (framing paragraph, dead
  catch-all bullet for non-eligible types).

Auto-prune script DELETED:
- The cumulative-count primitive cannot distinguish "never used" from
  "used before tracking began"; mtime gate is meaningless for installed
  files. Auto-prune deferred to v0.4 with a per-key lastSeen schema.

Cross-platform:
- macOS (BSD coreutils) and Linux (Alpine, glibc + musl) verified.
- All scripts use portable forms (stat -f || stat -c, mktemp -d -t).
- README documents platform support explicitly.

DX overhaul:
- install.sh: hardened — supports `curl | bash` via auto-clone,
  --version=vX.Y.Z pinning, --yes / --dry-run flags, jq-based
  settings.json merge with diff prompt and backup, conservative file
  copy that detects local mtime drift and writes <file>.adam-new
  instead of clobbering, idempotent across re-runs.
- adam-uninstall.sh: NEW. Soft-archives ~/.claude/adam/ to .bak.<ts>/
  by default; --purge to delete; --yes for non-interactive; jq-based
  settings.json cleanup with diff prompt.
- README.md: curl one-liner install + version-pinned variant at top,
  What's New section through v0.3.1, upgrade-safe data files callout,
  uninstaller documentation, platform support note, expanded rubric
  showing skill_edit gate.

Test count: 27 passed, 0 failed (was 27 — no regression).
2026-05-10 21:33:17 +01:00

89 lines
2.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# ADAM uninstaller — reverses install.sh.
# Soft-archives ~/.claude/adam/ (your journal/proposals are preserved by default).
# Removes hook entries from settings.json with a diff prompt.
#
# Usage: ./adam-uninstall.sh [--yes] [--purge]
# --purge: also delete ~/.claude/adam/ data (destructive)
set -euo pipefail
DEST="${HOME}/.claude"
ASSUME_YES=0
PURGE=0
BAK=""
for arg in "$@"; do
case "$arg" in
--yes|-y) ASSUME_YES=1 ;;
--purge) PURGE=1 ;;
--help|-h) sed -n '2,8p' "$0"; exit 0 ;;
*) echo "unknown: $arg" >&2; exit 1 ;;
esac
done
log() { printf ' %s\n' "$*"; }
need() { command -v "$1" >/dev/null 2>&1 || { echo "missing: $1" >&2; exit 1; }; }
need jq
[ -d "$DEST" ] || { echo "$DEST not found"; exit 1; }
log "removing ADAM files"
rm -f "$DEST/hooks/adam-observe.mjs" "$DEST/hooks/adam-nudge.mjs"
rm -f "$DEST/agents/adam.md" "$DEST/commands/reflect.md"
rm -rf "$DEST/skills/adam-self-improvement"
if [ -d "$DEST/adam" ]; then
if [ "$PURGE" = 1 ]; then
log "purging $DEST/adam (--purge)"
rm -rf "$DEST/adam"
else
BAK="$DEST/adam.bak.$(date +%s)"
log "archiving $DEST/adam -> $BAK"
mv "$DEST/adam" "$BAK"
fi
fi
# settings.json — strip ADAM hook entries
SETTINGS="$DEST/settings.json"
if [ -f "$SETTINGS" ]; then
TMP="$(mktemp -t adam-uninstall.XXXXXX)"
jq '
.hooks //= {}
| .hooks |= with_entries(
.value |= (
map(.hooks |= map(select(
(.command // "") | test("adam-(observe|nudge)\\.mjs") | not
)))
| map(select((.hooks // []) | length > 0))
)
)
| .hooks |= with_entries(select((.value | length) > 0))
' "$SETTINGS" > "$TMP"
if cmp -s "$SETTINGS" "$TMP"; then
log "settings.json already clean"
rm -f "$TMP"
else
log ""
log "settings.json changes:"
diff -u "$SETTINGS" "$TMP" | sed 's/^/ /' || true
log ""
if [ "$ASSUME_YES" = 1 ]; then REPLY=y
else printf ' apply? [y/N] '; read -r REPLY </dev/tty || REPLY=n
fi
case "$REPLY" in
y|Y|yes|YES)
cp "$SETTINGS" "$SETTINGS.adam-bak.$(date +%s)"
mv "$TMP" "$SETTINGS"
log " settings.json cleaned"
;;
*) rm -f "$TMP"; log " skipped — edit settings.json manually" ;;
esac
fi
fi
log ""
log "ADAM uninstalled."
[ "$PURGE" = 0 ] && [ -n "$BAK" ] && [ -d "$BAK" ] && log "data archive: $BAK"