diff --git a/bin/omarchy-remove-ai-t3-code b/bin/omarchy-remove-ai-t3-code new file mode 100755 index 00000000..d9d6df20 --- /dev/null +++ b/bin/omarchy-remove-ai-t3-code @@ -0,0 +1,18 @@ +#!/bin/bash + +# omarchy:summary=Remove T3 Code along with its configuration and workspaces. +# omarchy:requires-sudo=true + +set -e + +omarchy-pkg-drop t3code-bin + +# T3 Code drives agents that keep their own state -- ~/.claude.json, ~/.grok, +# ~/.local/share/opencode -- and those outlive it, so only its own goes. +rm -rf \ + "$HOME/.config/t3code" \ + "$HOME/.t3" +rm -f "$HOME/.config/t3code-flags.conf" + +echo "" +echo "T3 Code has been removed." diff --git a/default/omarchy/omarchy-menu.jsonc b/default/omarchy/omarchy-menu.jsonc index d4132524..df07a0e3 100644 --- a/default/omarchy/omarchy-menu.jsonc +++ b/default/omarchy/omarchy-menu.jsonc @@ -23,6 +23,8 @@ "setup": {"icon":"","label":"Setup","aliases":["settings"]}, "install": {"icon":"󰉉","label":"Install"}, "remove": {"icon":"󰭌","label":"Remove","aliases":["uninstall"]}, + "remove.ai": {"icon":"󱚤","label":"AI","title":"Remove"}, + "remove.ai.t3-code": {"icon":"","iconFont":"omarchy","label":"T3 Code","when":"omarchy-pkg-present t3code-bin","action":"omarchy-launch-floating-terminal-with-presentation omarchy-remove-ai-t3-code"}, "update": {"icon":"","label":"Update","aliases":["restart","refresh"]}, "about": {"icon":"","label":"About","action":"omarchy-launch-about"}, "system": {"icon":"","label":"System","aliases":["power-menu"]}, diff --git a/test/shell.d/remove-ai-test.sh b/test/shell.d/remove-ai-test.sh new file mode 100644 index 00000000..b77dce34 --- /dev/null +++ b/test/shell.d/remove-ai-test.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +set -euo pipefail + +source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh" + +tmp_dir="$(mktemp -d)" +trap 'rm -rf "$tmp_dir"' EXIT + +mkdir -p "$tmp_dir/bin" + +cat >"$tmp_dir/bin/omarchy-pkg-drop" <<'SCRIPT' +#!/bin/bash +printf 'drop:%s\n' "$*" >>"$TEST_LOG" +SCRIPT +chmod +x "$tmp_dir/bin/omarchy-pkg-drop" + +export TEST_LOG="$tmp_dir/log" +export PATH="$tmp_dir/bin:$PATH" + +fresh_home() { + rm -rf "$tmp_dir/home" + mkdir -p "$tmp_dir/home" + export HOME="$tmp_dir/home" +} + +# T3 Code bootstraps the agents it drives; their state outlives it. +fresh_home +mkdir -p "$HOME/.config/t3code" "$HOME/.t3" "$HOME/.grok" "$HOME/.local/share/opencode" "$HOME/.npm" +touch "$HOME/.claude.json" +"$ROOT/bin/omarchy-remove-ai-t3-code" >/dev/null + +[[ ! -e $HOME/.t3 ]] || fail "T3 Code removal deletes its own data" +pass "T3 Code removal deletes its own data" + +for kept in .grok .claude.json .npm .local/share/opencode; do + [[ -e $HOME/$kept ]] || fail "T3 Code removal keeps the agent state it bootstrapped" "$kept" +done +pass "T3 Code removal keeps the agent state it bootstrapped" +