diff --git a/bin/omarchy-remove-ai-claude b/bin/omarchy-remove-ai-claude index 9c66c5d0..3df3c105 100755 --- a/bin/omarchy-remove-ai-claude +++ b/bin/omarchy-remove-ai-claude @@ -6,6 +6,10 @@ # -u so an unset HOME is an error rather than a set of rm -rf paths rooted at /. set -euo pipefail +# The app rewrites ~/.config/Claude for as long as it runs, so a removal that +# leaves it running deletes the directory and watches it come straight back. +pkill -x claude-desktop || true + omarchy-pkg-drop claude-desktop # Not ~/.claude, ~/.claude.json, or ~/.cache/claude-cli-nodejs: those belong diff --git a/test/shell.d/remove-ai-test.sh b/test/shell.d/remove-ai-test.sh index 7c8ae043..d81e6ca6 100644 --- a/test/shell.d/remove-ai-test.sh +++ b/test/shell.d/remove-ai-test.sh @@ -15,6 +15,14 @@ printf 'drop:%s\n' "$*" >>"$TEST_LOG" SCRIPT chmod +x "$tmp_dir/bin/omarchy-pkg-drop" +# omarchy-remove-ai-claude quits the running app before deleting its state; +# a real pkill here would take the developer's own Claude with it. +cat >"$tmp_dir/bin/pkill" <<'SCRIPT' +#!/bin/bash +printf 'pkill:%s\n' "$*" >>"$TEST_LOG" +SCRIPT +chmod +x "$tmp_dir/bin/pkill" + # omarchy-remove-ai-perplexity asks through gum whether the user's data goes # too. The stub answers "no" unless a test says otherwise and logs the call: a # real gum would hang the run, and one that answered "yes" on its own would be @@ -73,6 +81,9 @@ for kept in .claude .claude.json .cache/claude-cli-nodejs; do done pass "Claude removal keeps the Claude Code CLI's state" +grep -qx 'pkill:-x claude-desktop' "$TEST_LOG" || fail "Claude removal quits the running app before deleting its state" +pass "Claude removal quits the running app before deleting its state" + # LM Studio's models follow a relocatable home, named only by the pointer file. fresh_home mkdir -p "$tmp_dir/relocated-models/models"