Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion bin/omarchy-default-agent
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ esac

agent_package=${agent_package:-$agent}

if [[ $agent == claude || $agent == pi ]] && ! omarchy-hw-cpu-sse4_2; then
echo "Cannot install $name: this CPU lacks SSE4.2/POPCNT, which Bun's linux-x64 builds need" >&2
exit 1
fi

# Hermes and OpenClaw are not mise tools: each is a self-updating runtime in
# the user's home, Hermes the desktop app's and OpenClaw the one its Control
# UI updates. Each has its own installer with the same --check/--now contract
Expand All @@ -66,9 +71,18 @@ else
# Anything at the wrapper's path other than the wrapper is the user's own
# install, such as the symlink Cursor's installer leaves. A mise copy would
# only shadow it, since the mise shims precede ~/.local/bin on PATH.
managed_wrapper() {
local wrapper="$HOME/.local/bin/$agent"
grep -Eq '^mise use -g|^# omarchy:mise-managed=true$' "$wrapper" && return 0
# Recognize the exact two-line read-only template written before the marker
# was added, while leaving wrappers with user setup outside that template.
[[ $(head -n 1 "$wrapper") == '#!/bin/bash' ]] &&
(( $(wc -l <"$wrapper") == 2 )) &&
grep -Eq '^exec mise x .+ -- .+ "\$@"$' "$wrapper"
Comment thread
chessing234 marked this conversation as resolved.
Resolved
}
user_install() {
[[ -x $HOME/.local/bin/$agent ]] &&
{ [[ -L $HOME/.local/bin/$agent ]] || ! grep -q '^mise use -g' "$HOME/.local/bin/$agent"; }
{ [[ -L $HOME/.local/bin/$agent ]] || ! managed_wrapper; }
}
agent_present() { user_install || mise where "$agent_package" &>/dev/null; }
agent_install() { user_install || mise use -g "$agent_package"; }
Expand Down
47 changes: 47 additions & 0 deletions bin/omarchy-hw-cpu-sse4_2
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

# omarchy:summary=Returns true when the CPU has SSE4.2 and POPCNT, or is not x86_64.

# Bun's linux-x64 target needs SSE4.2 and POPCNT. x86-64-v1 CPUs (Core 2 Duo,
# first-gen Atom, …) install the natives then SIGILL. ARM/aarch64 — including
# Apple Silicon and Asahi — uses a different build and should still install.
#
# OMARCHY_CPUINFO and OMARCHY_ARCH override /proc/cpuinfo and uname for tests.

cpuinfo=${OMARCHY_CPUINFO:-/proc/cpuinfo}
arch=${OMARCHY_ARCH:-}

cpu_has_bun_x64_flags() {
local flags=$1

[[ " $flags " == *" sse4_2 "* && " $flags " == *" popcnt "* ]]
}

if [[ -z $arch && -r $cpuinfo ]]; then
if grep -q '^flags[[:space:]]*:' "$cpuinfo"; then
arch=x86_64
elif grep -qiE '^(features|cpu architecture)[[:space:]]*:' "$cpuinfo"; then
arch=aarch64
fi
fi

if [[ -z $arch ]]; then
arch=$(uname -m)
fi

case $arch in
aarch64 | arm64)
exit 0
;;
esac

flags=""
if [[ -r $cpuinfo ]]; then
flags=$(awk -F: '/^flags[[:space:]]*:/{print $2; exit}' "$cpuinfo")
fi

if [[ -z $flags ]] && command -v lscpu >/dev/null; then
flags=$(lscpu 2>/dev/null | awk -F: '/^Flags:/{print $2; exit}')
fi

cpu_has_bun_x64_flags "$flags"
12 changes: 12 additions & 0 deletions bin/omarchy-launch-openclaw
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@

set -euo pipefail

# /usr/bin usually precedes ~/.npm-global/bin. When both a packaged and a
# user-installed openclaw are on PATH, bare `openclaw` can be the older one
# and refuse a migrated state database. Surface that before we talk to it.
_openclaw_bins=()
while IFS= read -r _openclaw_bin; do
_openclaw_bins+=("$_openclaw_bin")
done < <(type -aP openclaw 2>/dev/null || true)
if ((${#_openclaw_bins[@]} > 1)); then
echo "warning: multiple openclaw binaries on PATH; using ${_openclaw_bins[0]}" >&2
printf ' %s\n' "${_openclaw_bins[@]}" >&2
fi

tui=false
message=()
if [[ ${1:-} == "--tui" ]]; then
Expand Down
13 changes: 7 additions & 6 deletions bin/omarchy-mise-install
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,16 @@ case "$bin" in
*) bin_arg="\"$bin\"" ;;
esac

# These tools install and upgrade on first run, so mise's release cooldown would
# hold a new version back for days after it ships. Exported rather than set on
# the install line alone, so resolving the version to execute agrees with the
# one just installed.
# Install / pin once here. The generated wrapper must not rewrite global mise
# config (or disable release cooldowns) on every ordinary invocation — that is
# what left machines racing on shared mise locks when a caller timed out mid
# `mise use` (#11886).
mise use -g --quiet "$package" || exit 1
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved

rm -f "$HOME/.local/bin/$command"
cat >"$HOME/.local/bin/$command" <<EOF
#!/bin/bash
export MISE_MINIMUM_RELEASE_AGE=0
mise use -g --quiet $package_arg || exit 1
# omarchy:mise-managed=true
exec mise x $package_arg -- $bin_arg "\$@"
Comment thread
chessing234 marked this conversation as resolved.
Resolved
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved
EOF

Expand Down
19 changes: 19 additions & 0 deletions bin/omarchy-mise-install-bun
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# omarchy:summary=Install a Bun linux-x64 agent when the CPU can run it.
# omarchy:args=<package> [command-name [bin-name]]
# omarchy:hidden=true

# Claude and Pi ship Bun linux-x64 natives that SIGILL without SSE4.2/POPCNT.
# Skip (don't install) on incompatible x86; ARM/aarch64 still installs.

if [[ -z $1 ]]; then
echo "Usage: omarchy-mise-install-bun <package> [command-name [bin-name]]"
exit 1
fi

if omarchy-hw-cpu-sse4_2; then
omarchy-mise-install "$@"
else
echo "Skipping $1: this CPU lacks SSE4.2/POPCNT, which Bun's linux-x64 builds need"
fi
20 changes: 20 additions & 0 deletions bin/omarchy-openclaw-present
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# omarchy:summary=True when OpenClaw is already available (package or PATH)
# omarchy:hidden=true

# The Install > AI entry used to key only on the pacman package. A newer
# OpenClaw installed outside the package (npm, a manual build) still puts
# `openclaw` on PATH and may already be running a gateway. Re-offering the
# package in that state can put an older /usr/bin/openclaw ahead of the
# working one and break a migrated state database.

if omarchy-pkg-present openclaw 2>/dev/null; then
exit 0
fi

if command -v openclaw >/dev/null 2>&1; then
exit 0
fi

exit 1
4 changes: 2 additions & 2 deletions bin/omarchy-remove-preinstalls
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ if gum confirm "Are you sure you want to remove all preinstalled web apps, TUI w
# Cursor's own installer links ~/.local/bin/cursor-agent as well, so only
# the mise wrapper omarchy-mise-install wrote is a preinstall.
if [[ -f ~/.local/bin/cursor-agent && ! -L ~/.local/bin/cursor-agent ]] &&
grep -Eq '^mise use -g .*"cursor-agent"' ~/.local/bin/cursor-agent; then
grep -Eq '(^mise use -g .*"cursor-agent"|^exec mise x "cursor-agent" -- "cursor-agent" "\$@"$)' ~/.local/bin/cursor-agent; then
rm -f ~/.local/bin/cursor-agent
fi

# Preserve a user-managed Muse launcher at the same path.
if [[ -f ~/.local/bin/muse && ! -L ~/.local/bin/muse ]] &&
grep -Eq '^mise use -g .*"http:muse\[' ~/.local/bin/muse; then
grep -Eq '^(mise use -g .*"http:muse\[|exec mise x "http:muse\[)' ~/.local/bin/muse; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Muse match deletes custom launchers

If a user-maintained Muse launcher contains a line beginning exec mise x "http:muse[, this prefix check treats it as an Omarchy preinstall and deletes the entire file. That can remove a launcher with additional user setup, despite the stated intent to preserve user-managed launchers.

Knowledge Base Used: Migration framework

rm -f ~/.local/bin/muse
fi

Expand Down
9 changes: 5 additions & 4 deletions bin/omarchy-update-mise
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
if omarchy-cmd-present mise; then
echo -e "\e[32m\nUpdate mise tools\e[0m"

# mise withholds releases younger than its cooldown, so tools stay behind for
# days after they ship. Running omarchy update is the user asking for current
# versions now, which is the same call the mup alias makes by hand.
MISE_MINIMUM_RELEASE_AGE=0 mise up
# Honor mise / npm release cooldowns. Do not force MISE_MINIMUM_RELEASE_AGE=0.
if ! mise up; then
echo -e "\e[33mmise up could not refresh every tool (often a release cooldown). Retry later or adjust MISE_MINIMUM_RELEASE_AGE / npm min-release-age.\e[0m" >&2
exit 1
fi
Comment thread
chessing234 marked this conversation as resolved.
Resolved
fi
2 changes: 1 addition & 1 deletion default/bash/aliases
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ alias h='herdr'
alias ic='tdl c'
alias ix='tdl cx'
alias icx='tdl c cx'
alias mup='MISE_MINIMUM_RELEASE_AGE=0 mise up'
alias mup='mise up'
n() { if [ "$#" -eq 0 ]; then command nvim . ; else command nvim "$@"; fi; }

# Git
Expand Down
6 changes: 3 additions & 3 deletions default/omarchy/omarchy-menu.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
"setup.default": {"icon":"","label":"Defaults","aliases":["default","defaults"]},
"setup.default.agent": {"icon":"󰚩","label":"Agent","title":"Default Agent"},
"setup.default.agent.agy": {"icon":"󰫢","label":"Antigravity","checked":"[[ \"$(omarchy-default-agent)\" == \"agy\" ]]","action":"omarchy-default-agent agy"},
"setup.default.agent.claude": {"icon":"󰛄","label":"Claude","checked":"[[ \"$(omarchy-default-agent)\" == \"claude\" ]]","action":"omarchy-default-agent claude"},
"setup.default.agent.claude": {"icon":"󰛄","label":"Claude","when":"omarchy-hw-cpu-sse4_2","checked":"[[ \"$(omarchy-default-agent)\" == \"claude\" ]]","action":"omarchy-default-agent claude"},
"setup.default.agent.codex": {"icon":"","iconFont":"omarchy","label":"Codex","checked":"[[ \"$(omarchy-default-agent)\" == \"codex\" ]]","action":"omarchy-default-agent codex"},
"setup.default.agent.copilot": {"icon":"","label":"Copilot","checked":"[[ \"$(omarchy-default-agent)\" == \"copilot\" ]]","action":"omarchy-default-agent copilot"},
"setup.default.agent.crush": {"icon":"󰋑","label":"Crush","checked":"[[ \"$(omarchy-default-agent)\" == \"crush\" ]]","action":"omarchy-default-agent crush"},
Expand All @@ -150,7 +150,7 @@
"setup.default.agent.openclaw": {"icon":"","iconFont":"omarchy","label":"OpenClaw","checked":"[[ \"$(omarchy-default-agent)\" == \"openclaw\" ]]","action":"omarchy-default-agent openclaw"},
"setup.default.agent.opencode": {"icon":"","iconFont":"omarchy","label":"OpenCode","checked":"[[ \"$(omarchy-default-agent)\" == \"opencode\" ]]","action":"omarchy-default-agent opencode"},
"setup.default.agent.ori": {"icon":"","iconFont":"omarchy","label":"Ori","checked":"[[ \"$(omarchy-default-agent)\" == \"ori\" ]]","action":"omarchy-default-agent ori"},
"setup.default.agent.pi": {"icon":"","iconFont":"omarchy","label":"Pi","checked":"[[ \"$(omarchy-default-agent)\" == \"pi\" ]]","action":"omarchy-default-agent pi"},
"setup.default.agent.pi": {"icon":"","iconFont":"omarchy","label":"Pi","when":"omarchy-hw-cpu-sse4_2","checked":"[[ \"$(omarchy-default-agent)\" == \"pi\" ]]","action":"omarchy-default-agent pi"},
"setup.default.browser": {"icon":"","label":"Browser","title":"Default Browser"},
"setup.default.browser.chromium": {"icon":"","label":"Chromium","checked":"[[ \"$(omarchy-default-browser)\" == \"chromium\" ]]","action":"omarchy-default-browser chromium"},
"setup.default.browser.chrome": {"icon":"󰊯","label":"Chrome","checked":"[[ \"$(omarchy-default-browser)\" == \"chrome\" ]]","action":"omarchy-default-browser chrome"},
Expand Down Expand Up @@ -251,7 +251,7 @@
"install.ai.hermes": {"icon":"","iconFont":"omarchy","label":"Hermes Desktop","disabled":"omarchy-pkg-present hermes-desktop","action":"omarchy-launch-floating-terminal-with-presentation omarchy-install-ai-hermes"},
"install.ai.lm-studio": {"icon":"","iconFont":"omarchy","label":"LM Studio","disabled":"omarchy-pkg-present lmstudio-bin","action":"omarchy-install-app 'LM Studio' lmstudio-bin"},
"install.ai.ollama": {"icon":"","iconFont":"omarchy","label":"Ollama","disabled":"omarchy-cmd-present ollama","action":"if omarchy-cmd-present nvidia-smi; then ollama_pkg=ollama-cuda; elif omarchy-cmd-present rocminfo; then ollama_pkg=ollama-rocm; else ollama_pkg=ollama; fi; omarchy-install-app Ollama \"$ollama_pkg\""},
"install.ai.openclaw": {"icon":"","iconFont":"omarchy","label":"OpenClaw","disabled":"omarchy-pkg-present openclaw","action":"omarchy-launch-floating-terminal-with-presentation omarchy-install-ai-openclaw"},
"install.ai.openclaw": {"icon":"","iconFont":"omarchy","label":"OpenClaw","disabled":"omarchy-openclaw-present","action":"omarchy-launch-floating-terminal-with-presentation omarchy-install-ai-openclaw"},
"install.ai.perplexity": {"icon":"","iconFont":"omarchy","label":"Perplexity","disabled":"omarchy-pkg-present perplexity","action":"omarchy-install-and-launch Perplexity perplexity perplexity"},
"install.ai.t3-code": {"icon":"","iconFont":"omarchy","label":"T3 Code","disabled":"omarchy-pkg-present t3code-bin","action":"omarchy-launch-floating-terminal-with-presentation omarchy-install-ai-t3-code"},
"install.gaming.steam": {"icon":"","label":"Steam","disabled":"omarchy-pkg-present steam","action":"omarchy-launch-floating-terminal-with-presentation omarchy-install-gaming-steam"},
Expand Down
4 changes: 2 additions & 2 deletions install/user/mise.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
mise settings set upgrade.auto_prune false

omarchy-mise-install codex
omarchy-mise-install claude
omarchy-mise-install-bun claude
omarchy-mise-install crush
omarchy-mise-install antigravity-cli agy
omarchy-mise-install gh
omarchy-mise-install copilot
omarchy-mise-install opencode
omarchy-mise-install npm:playwright playwright
omarchy-mise-install pi
omarchy-mise-install-bun pi
omarchy-mise-install github:can1357/oh-my-pi omp
omarchy-mise-install grok
# Cursor's own installer links the same path, so a re-provision keeps it.
Expand Down
37 changes: 37 additions & 0 deletions migrations/1789200000.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
echo "Stop mise wrappers from rewriting global config on every run"

# Wrappers used to call `mise use -g` before every exec. That mutates global
# mise state and races when a caller times out mid-install (#11886).
# omarchy-mise-install now pins once at install time and writes an exec-only
# wrapper; rewrite any still-mutating wrappers through it.

bin_dir="$HOME/.local/bin"
[[ -d $bin_dir ]] || exit 0

for wrapper in "$bin_dir"/*; do
[[ -f $wrapper && ! -L $wrapper && -r $wrapper ]] || continue

# ~/.local/bin also holds real binaries; skip anything that is not a short
# shell wrapper. Prefer portable size checks over GNU stat -c.
size=$(wc -c <"$wrapper" | tr -d ' ')
(( size <= 1024 )) || continue

contents=$(<"$wrapper")

# Only rewrite wrappers that still mutate global config on each run.
grep -q '^mise use -g' <<<"$contents" || continue

package=$(sed -n -E \
-e 's/^mise use -g --quiet "([^"]+)"( \|\| exit 1)?$/\1/p' \
-e 's/^mise use -g "([^"]+)"( \|\| exit 1)?$/\1/p' \
<<<"$contents" | head -n1)
bin=$(sed -n -E \
-e 's/^exec mise x ".*" -- "([^"]+)" "\$@"$/\1/p' \
-e 's/^exec mise exec ".*" -- "([^"]+)" "\$@"$/\1/p' \
-e 's/^exec "([^"]+)" "\$@"$/\1/p' \
<<<"$contents" | head -n1)

[[ -n $package && -n $bin ]] || continue

omarchy-mise-install "$package" "${wrapper##*/}" "$bin"
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved
done
Loading