Fix default agent setup edge cases
This commit is contained in:
@@ -17,7 +17,7 @@ fi
|
|||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
pi) agent="pi"; name="Pi" ;;
|
pi) agent="pi"; name="Pi" ;;
|
||||||
omp | oh-my-pi) agent="omp"; name="Oh My Pi"; agent_package="oh-my-pi" ;;
|
omp | oh-my-pi) agent="omp"; name="Oh My Pi"; agent_package="github:can1357/oh-my-pi" ;;
|
||||||
opencode | open-code) agent="opencode"; name="OpenCode" ;;
|
opencode | open-code) agent="opencode"; name="OpenCode" ;;
|
||||||
claude | claude-code) agent="claude"; name="Claude Code" ;;
|
claude | claude-code) agent="claude"; name="Claude Code" ;;
|
||||||
codex) agent="codex"; name="Codex" ;;
|
codex) agent="codex"; name="Codex" ;;
|
||||||
@@ -40,7 +40,11 @@ if ! mise where "$agent_package" &>/dev/null; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if ! mise use -g "$agent_package"; then
|
if ! mise use -g "$agent_package"; then
|
||||||
[[ $installing == "true" ]] && omarchy-notification-send -g "Could not install $name with mise"
|
if [[ $installing == "true" ]]; then
|
||||||
|
omarchy-notification-send -g "Could not install $name with mise"
|
||||||
|
else
|
||||||
|
omarchy-notification-send -g "Could not set $name as the default coding agent"
|
||||||
|
fi
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ if gum confirm "Are you sure you want to remove all preinstalled web apps, TUI w
|
|||||||
# Remove mise stubs
|
# Remove mise stubs
|
||||||
rm -f ~/.local/bin/codex ~/.local/bin/claude ~/.local/bin/gemini ~/.local/bin/copilot \
|
rm -f ~/.local/bin/codex ~/.local/bin/claude ~/.local/bin/gemini ~/.local/bin/copilot \
|
||||||
~/.local/bin/gh ~/.local/bin/opencode ~/.local/bin/playwright ~/.local/bin/playwright-cli ~/.local/bin/pi \
|
~/.local/bin/gh ~/.local/bin/opencode ~/.local/bin/playwright ~/.local/bin/playwright-cli ~/.local/bin/pi \
|
||||||
~/.local/bin/ghui ~/.local/bin/hunk
|
~/.local/bin/omp ~/.local/bin/grok ~/.local/bin/crush ~/.local/bin/ghui ~/.local/bin/hunk
|
||||||
|
|
||||||
omarchy-pkg-drop \
|
omarchy-pkg-drop \
|
||||||
aether \
|
aether \
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ omarchy-mise-install copilot
|
|||||||
omarchy-mise-install opencode
|
omarchy-mise-install opencode
|
||||||
omarchy-mise-install npm:playwright playwright
|
omarchy-mise-install npm:playwright playwright
|
||||||
omarchy-mise-install pi
|
omarchy-mise-install pi
|
||||||
omarchy-mise-install oh-my-pi omp
|
omarchy-mise-install github:can1357/oh-my-pi omp
|
||||||
omarchy-mise-install npm:@xai-official/grok grok
|
omarchy-mise-install npm:@xai-official/grok grok
|
||||||
omarchy-mise-install npm:@kitlangton/ghui ghui
|
omarchy-mise-install npm:@kitlangton/ghui ghui
|
||||||
omarchy-mise-install aqua:modem-dev/hunk hunk
|
omarchy-mise-install aqua:modem-dev/hunk hunk
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
echo "Install oh-my-pi (omp) via mise wrapper"
|
echo "Install oh-my-pi (omp) via mise wrapper"
|
||||||
|
|
||||||
omarchy-mise-install oh-my-pi omp
|
if [[ ! -f $HOME/.local/state/omarchy/preinstalls-removed ]]; then
|
||||||
|
omarchy-mise-install github:can1357/oh-my-pi omp
|
||||||
|
fi
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
echo "Install Grok and Crush via mise wrappers"
|
echo "Install default coding agent mise wrappers"
|
||||||
|
|
||||||
omarchy-mise-install npm:@xai-official/grok grok
|
if [[ ! -f $HOME/.local/state/omarchy/preinstalls-removed ]]; then
|
||||||
omarchy-mise-install crush
|
omarchy-mise-install github:can1357/oh-my-pi omp
|
||||||
|
omarchy-mise-install npm:@xai-official/grok grok
|
||||||
|
omarchy-mise-install crush
|
||||||
|
elif [[ -f $HOME/.local/bin/omp ]] && grep -Fq 'mise use -g "oh-my-pi"' "$HOME/.local/bin/omp"; then
|
||||||
|
rm -f "$HOME/.local/bin/omp"
|
||||||
|
fi
|
||||||
|
|||||||
@@ -51,6 +51,15 @@ fi
|
|||||||
[[ ${OMARCHY_TEST_MISE_FAIL:-false} != "true" ]]
|
[[ ${OMARCHY_TEST_MISE_FAIL:-false} != "true" ]]
|
||||||
SH
|
SH
|
||||||
|
|
||||||
|
cat >"$mock_bin/omarchy-test-noop" <<'SH'
|
||||||
|
#!/bin/bash
|
||||||
|
exit 0
|
||||||
|
SH
|
||||||
|
|
||||||
|
for command in gum hyprctl omarchy-webapp-remove-all omarchy-tui-remove-all omarchy-pkg-drop; do
|
||||||
|
ln -s omarchy-test-noop "$mock_bin/$command"
|
||||||
|
done
|
||||||
|
|
||||||
chmod +x "$mock_bin"/*
|
chmod +x "$mock_bin"/*
|
||||||
|
|
||||||
export HOME="$test_home"
|
export HOME="$test_home"
|
||||||
@@ -63,7 +72,7 @@ export OMARCHY_TEST_MISE_HISTORY="$mise_history"
|
|||||||
export OMARCHY_TEST_STUB_LOG="$stub_log"
|
export OMARCHY_TEST_STUB_LOG="$stub_log"
|
||||||
|
|
||||||
grok_package="npm:@xai-official/grok"
|
grok_package="npm:@xai-official/grok"
|
||||||
omp_package="oh-my-pi"
|
omp_package="github:can1357/oh-my-pi"
|
||||||
crush_package="crush"
|
crush_package="crush"
|
||||||
|
|
||||||
assert_lazy_stub() {
|
assert_lazy_stub() {
|
||||||
@@ -90,6 +99,33 @@ grep -Fx "$omp_package omp" "$stub_log" >/dev/null || fail "user setup creates t
|
|||||||
grep -Fx "$crush_package" "$stub_log" >/dev/null || fail "user setup creates the Crush lazy stub"
|
grep -Fx "$crush_package" "$stub_log" >/dev/null || fail "user setup creates the Crush lazy stub"
|
||||||
pass "user setup creates the custom agent lazy stubs"
|
pass "user setup creates the custom agent lazy stubs"
|
||||||
|
|
||||||
|
: >"$stub_log"
|
||||||
|
source "$ROOT/migrations/1785617047.sh" >/dev/null
|
||||||
|
grep -Fx "$omp_package omp" "$stub_log" >/dev/null || fail "Oh My Pi migration creates a working lazy stub"
|
||||||
|
|
||||||
|
: >"$stub_log"
|
||||||
|
source "$ROOT/migrations/1785633225.sh" >/dev/null
|
||||||
|
grep -Fx "$omp_package omp" "$stub_log" >/dev/null || fail "agent migration repairs the Oh My Pi lazy stub"
|
||||||
|
grep -Fx "$grok_package grok" "$stub_log" >/dev/null || fail "agent migration creates the Grok lazy stub"
|
||||||
|
grep -Fx "$crush_package" "$stub_log" >/dev/null || fail "agent migration creates the Crush lazy stub"
|
||||||
|
|
||||||
|
mkdir -p "$test_home/.local/state/omarchy"
|
||||||
|
touch "$test_home/.local/state/omarchy/preinstalls-removed"
|
||||||
|
"$ROOT/bin/omarchy-mise-install" oh-my-pi omp
|
||||||
|
: >"$stub_log"
|
||||||
|
source "$ROOT/migrations/1785617047.sh" >/dev/null
|
||||||
|
source "$ROOT/migrations/1785633225.sh" >/dev/null
|
||||||
|
[[ ! -s $stub_log ]] || fail "agent migrations respect the preinstall opt-out"
|
||||||
|
[[ ! -e $test_home/.local/bin/omp ]] || fail "agent migration removes the obsolete Oh My Pi wrapper after opt-out"
|
||||||
|
rm "$test_home/.local/state/omarchy/preinstalls-removed"
|
||||||
|
pass "agent migrations install working wrappers without overriding the preinstall opt-out"
|
||||||
|
|
||||||
|
omarchy-remove-preinstalls >/dev/null
|
||||||
|
for command in omp grok crush; do
|
||||||
|
[[ ! -e $test_home/.local/bin/$command ]] || fail "Remove Preinstalls deletes the $command lazy stub"
|
||||||
|
done
|
||||||
|
pass "Remove Preinstalls deletes every optional agent lazy stub"
|
||||||
|
|
||||||
[[ $(omarchy-default-agent) == "opencode" ]] || fail "default agent falls back to OpenCode"
|
[[ $(omarchy-default-agent) == "opencode" ]] || fail "default agent falls back to OpenCode"
|
||||||
pass "default agent falls back to OpenCode"
|
pass "default agent falls back to OpenCode"
|
||||||
|
|
||||||
@@ -170,6 +206,19 @@ mapfile -d '' -t notification_args <"$notification_log"
|
|||||||
fail "default agent reports a failed mise installation"
|
fail "default agent reports a failed mise installation"
|
||||||
pass "default agent changes selection only after mise installs the provider"
|
pass "default agent changes selection only after mise installs the provider"
|
||||||
|
|
||||||
|
: >"$notification_history"
|
||||||
|
if OMARCHY_TEST_AGENT_INSTALLED=true OMARCHY_TEST_MISE_FAIL=true omarchy-default-agent codex >"$test_tmp/setup-failure-output" 2>&1; then
|
||||||
|
fail "default agent rejects a failed mise activation"
|
||||||
|
fi
|
||||||
|
[[ $(omarchy-default-agent) == "copilot" ]] || fail "failed activation preserves the current default agent"
|
||||||
|
mapfile -d '' -t notification_args <"$notification_log"
|
||||||
|
[[ ${notification_args[2]} == "Could not set Codex as the default coding agent" ]] ||
|
||||||
|
fail "default agent reports a failed activation for an installed provider"
|
||||||
|
mapfile -d '' -t notification_history_args <"$notification_history"
|
||||||
|
[[ ${#notification_history_args[@]} == 3 ]] ||
|
||||||
|
fail "failed activation sends only the selection failure notification"
|
||||||
|
pass "default agent reports mise failures for installed providers"
|
||||||
|
|
||||||
assert_launch() {
|
assert_launch() {
|
||||||
local agent=$1
|
local agent=$1
|
||||||
shift
|
shift
|
||||||
|
|||||||
Reference in New Issue
Block a user