Choosing Hermes as the default agent built it through mise: a pipx environment with no checkout, so `hermes update` had nothing to move, and the only Hermes that could update itself was the one Hermes Desktop set up. Both paths now run the same setup. omarchy-install-hermes-cli installs the hermes-desktop package and runs upstream's installer from it, pinned to the packaged release and started on main, exactly as Install > AI did; omarchy-install-ai-hermes is that plus opening the app. The terminal, the default agent and the app share one runtime, and it updates itself. --check answers whether --now has anything left to do, not merely whether a hermes runs: choosing Hermes from the menu asks first and opens a terminal only on a no, so a yes has to mean no minutes-long step would run where nobody can see it. With the app installed that means the runtime's own command, its completion marker and the seeded packaged app; a finished runtime whose command is gone, somebody else's, or its own but unable to run gets it back from upstream's path stage without bootstrapping again. Either way the command has to be the one PATH finds, because omarchy-agent runs bare `hermes` and Omarchy puts mise's shims ahead of ~/.local/bin; a command in the way is named rather than installed over. The modes are named outright because the app's launcher used to call this command with no arguments to reconcile a mise copy; a default of --now would turn every launch into an install. --check still refuses to run the retired wrapper, since running it built Hermes through mise, and a machine whose migration is pending can still have it on PATH. Provisioning no longer writes the wrapper, Remove Preinstalls no longer looks for it, and the wrapper, the environment it built and what proves them Omarchy's are known to the installer alone: --retire-mise is the migration's whole job, and --now runs the same removal once the runtime installer has saved the wrapper aside, so a user who chose Hermes before their migration ran is not left with mise's shim answering `hermes`. Only the wrapper proves the environment is Omarchy's, at its path or in that saved copy, so the environment goes first and the wrapper last, judged by mise neither having it installed nor still requesting it; a removal that leaves either behind, or a listing that cannot be read, mise missing included, stops with the commands to finish by hand and leaves the migration pending. The migration that once installed the wrapper is kept as a no-op for late updaters, and one whose default agent was Hermes is told to choose it again. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Co-Authored-By: Codex XHigh <noreply@openai.com>
94 lines
3.3 KiB
Bash
Executable File
94 lines
3.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"
|
|
|
|
test_tmp=$(mktemp -d)
|
|
trap 'rm -rf "$test_tmp"' EXIT
|
|
|
|
mock_bin="$test_tmp/bin"
|
|
test_home="$test_tmp/home"
|
|
marker="$test_home/.local/state/omarchy/preinstalls-removed"
|
|
pkg_log="$test_tmp/packages"
|
|
mkdir -p "$mock_bin" "$test_home/.local/state/omarchy"
|
|
|
|
for command in omarchy-webapp-remove-all omarchy-tui-remove-all omarchy-refresh-applications hyprctl; do
|
|
printf '#!/bin/bash\nexit 0\n' >"$mock_bin/$command"
|
|
done
|
|
|
|
cat >"$mock_bin/gum" <<'SH'
|
|
#!/bin/bash
|
|
[[ $1 == confirm ]] && exit "${OMARCHY_TEST_CONFIRM:-0}"
|
|
exit 0
|
|
SH
|
|
|
|
cat >"$mock_bin/omarchy-pkg-add" <<'SH'
|
|
#!/bin/bash
|
|
printf '%s\n' "$@" >"$OMARCHY_TEST_PKG_LOG"
|
|
exit "${OMARCHY_TEST_PKG_ADD_STATUS:-0}"
|
|
SH
|
|
|
|
cat >"$mock_bin/omarchy-pkg-drop" <<'SH'
|
|
#!/bin/bash
|
|
printf '%s\n' "$@" >"$OMARCHY_TEST_PKG_LOG"
|
|
SH
|
|
|
|
chmod +x "$mock_bin"/*
|
|
|
|
# $ROOT/bin after the mocks, so the real helpers answer wherever a mock does not
|
|
# shadow them.
|
|
export PATH="$mock_bin:$ROOT/bin:$PATH"
|
|
export HOME="$test_home"
|
|
export OMARCHY_TEST_PKG_LOG="$pkg_log"
|
|
|
|
# Both scripts restore and remove the same set, and every package in it has to be
|
|
# one Omarchy actually ships, or Remove Preinstalls takes out an app the user
|
|
# chose from the menu and Install Preinstalls puts back one we retired.
|
|
mapfile -t shipped < <(sed -e 's/[[:space:]]*#.*$//' -e '/^[[:space:]]*$/d' "$ROOT/install/omarchy-base.packages")
|
|
|
|
"$ROOT/bin/omarchy-install-preinstalls" >/dev/null
|
|
mapfile -t restored <"$pkg_log"
|
|
|
|
"$ROOT/bin/omarchy-remove-preinstalls" >/dev/null
|
|
mapfile -t dropped <"$pkg_log"
|
|
|
|
[[ ${restored[*]} == "${dropped[*]}" ]] ||
|
|
fail "Install and Remove Preinstalls cover the same packages" \
|
|
"restored: ${restored[*]}
|
|
dropped: ${dropped[*]}"
|
|
pass "Install and Remove Preinstalls cover the same packages"
|
|
|
|
for package in "${restored[@]}"; do
|
|
printf '%s\n' "${shipped[@]}" | grep -qxF "$package" ||
|
|
fail "every preinstall is shipped in omarchy-base.packages" "$package is not shipped"
|
|
done
|
|
pass "every preinstall is shipped in omarchy-base.packages"
|
|
|
|
for package in omacut omacalc omawrite; do
|
|
printf '%s\n' "${restored[@]}" | grep -qxF "$package" ||
|
|
fail "preinstalls cover the Omacom apps" "$package is missing"
|
|
done
|
|
pass "preinstalls cover the Omacom apps"
|
|
|
|
# The bindings key off the marker, so clearing it before the packages land would
|
|
# point them at apps that never came back.
|
|
touch "$marker"
|
|
OMARCHY_TEST_PKG_ADD_STATUS=1 "$ROOT/bin/omarchy-install-preinstalls" >/dev/null && status=0 || status=$?
|
|
(( status == 1 )) || fail "restore reports a failed package transaction" "exit status was $status"
|
|
[[ -f $marker ]] || fail "restore keeps the opt-out marker when packages fail to install"
|
|
pass "restore keeps the opt-out marker when packages fail to install"
|
|
|
|
"$ROOT/bin/omarchy-install-preinstalls" >/dev/null
|
|
[[ ! -e $marker ]] || fail "restore clears the opt-out marker once the packages are back"
|
|
pass "restore clears the opt-out marker once the packages are back"
|
|
|
|
rm -f "$marker"
|
|
OMARCHY_TEST_CONFIRM=1 "$ROOT/bin/omarchy-remove-preinstalls" >/dev/null
|
|
[[ ! -e $marker ]] || fail "declining Remove Preinstalls changes nothing"
|
|
pass "declining Remove Preinstalls changes nothing"
|
|
|
|
"$ROOT/bin/omarchy-remove-preinstalls" >/dev/null
|
|
[[ -f $marker ]] || fail "Remove Preinstalls records the opt-out"
|
|
pass "Remove Preinstalls records the opt-out"
|