From 82de446713791046aab15b65b7cd2d28f5da85e8 Mon Sep 17 00:00:00 2001 From: Ryan Hughes Date: Mon, 7 Sep 2026 19:46:11 -0400 Subject: [PATCH] Port the selected AI removal scaffold for 4.0.3 Port only Remove > AI and T3 removal/tests from #7504 (023021ad2d819c9d4e6bd374d3cc2e8963dcb253). Keep Dictation in its baseline location and omit unrelated removers. (cherry picked from commit 73480ffabc091b812a0cfbe7bc845799c6078a88) --- bin/omarchy-remove-ai-t3-code | 18 ++++++++++++++ default/omarchy/omarchy-menu.jsonc | 2 ++ test/shell.d/remove-ai-test.sh | 40 ++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100755 bin/omarchy-remove-ai-t3-code create mode 100644 test/shell.d/remove-ai-test.sh 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" +