diff --git a/bin/omarchy-default-agent b/bin/omarchy-default-agent index cee381040f62..ee4cb7f7234c 100755 --- a/bin/omarchy-default-agent +++ b/bin/omarchy-default-agent @@ -76,6 +76,11 @@ agent_package=${agent_package:-$agent} # from a table-valued key. The bracketed package is only for the user's config. agent_tool=${agent_tool:-$agent_package} +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 @@ -89,18 +94,25 @@ if [[ -n ${agent_installer:-} ]]; then agent_present() { "$agent_installer" --check; } agent_install() { "$agent_installer" --now; } else - # omarchy-mise-install's wrappers run `mise use` and `mise x`, current ones on - # lines of their own and older ones after an inline variable; either way - # running one installs the tool it wraps. A symlink is the user's own install. - mise_wrapper() { - [[ ! -L $1 ]] && head -c 4096 "$1" | grep -qaE 'mise (use|x) ' - } - # 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" + # Match generated wrappers by their complete contents. A user's wrapper + # may also run mise, and their own launcher should stay in control. + local package_arg bin_arg + printf -v package_arg '%q' "$agent_package" + printf -v bin_arg '%q' "$agent" + cmp -s "$wrapper" <(printf '#!/bin/bash\n# omarchy:mise-managed=true\nexec mise x "%s" -- "%s" "$@"\n' "$agent_package" "$agent") || + cmp -s "$wrapper" <(printf '#!/bin/bash\n# omarchy:mise-managed=true\nexec mise x %s -- %s "$@"\n' "$package_arg" "$bin_arg") || + cmp -s "$wrapper" <(printf '#!/bin/bash\nexport MISE_MINIMUM_RELEASE_AGE=0\nmise use -g --quiet "%s" || exit 1\nexec mise x "%s" -- "%s" "$@"\n' "$agent_package" "$agent_package" "$agent") || + cmp -s "$wrapper" <(printf '#!/bin/bash\nexec mise x "%s" -- "%s" "$@"\n' "$agent_package" "$agent") || + cmp -s "$wrapper" <(printf '#!/bin/bash\nexec mise x %s -- %s "$@"\n' "$package_arg" "$bin_arg") + } user_install() { - [[ -x $HOME/.local/bin/$agent ]] && ! mise_wrapper "$HOME/.local/bin/$agent" + [[ -f $HOME/.local/bin/$agent && -x $HOME/.local/bin/$agent ]] && + { [[ -L $HOME/.local/bin/$agent ]] || ! managed_wrapper; } } agent_present() { user_install || mise where "$agent_tool" &>/dev/null; } # Omarchy declares the default agents as mise tools, so installing one is diff --git a/bin/omarchy-hw-cpu-sse4_2 b/bin/omarchy-hw-cpu-sse4_2 new file mode 100755 index 000000000000..50fc94c8fc2c --- /dev/null +++ b/bin/omarchy-hw-cpu-sse4_2 @@ -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 ]] && omarchy-cmd-present lscpu; then + flags=$(lscpu 2>/dev/null | awk -F: '/^Flags:/{print $2; exit}') +fi + +cpu_has_bun_x64_flags "$flags" diff --git a/bin/omarchy-mise-install b/bin/omarchy-mise-install index 356c3324bf6a..8d5e43441ac9 100755 --- a/bin/omarchy-mise-install +++ b/bin/omarchy-mise-install @@ -44,15 +44,11 @@ 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. +# Historical migrations use this to write optional launchers offline. rm -f "$HOME/.local/bin/$command" cat >"$HOME/.local/bin/$command" < 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 omarchy-cmd-present openclaw; then + exit 0 +fi + +exit 1 diff --git a/bin/omarchy-remove-preinstalls b/bin/omarchy-remove-preinstalls index f733f34f5752..7bdb9dfadeff 100755 --- a/bin/omarchy-remove-preinstalls +++ b/bin/omarchy-remove-preinstalls @@ -22,20 +22,26 @@ if gum confirm --affirmative "$(omarchy-i18n common.yes)" --negative "$(omarchy- # Preserve a user-managed Kimi launcher at the same path. if [[ -f ~/.local/bin/kimi && ! -L ~/.local/bin/kimi ]] && - grep -Eq '^mise use -g .*"npm:@moonshot-ai/kimi-code"' ~/.local/bin/kimi; then + { grep -Eq '^mise use -g .*"npm:@moonshot-ai/kimi-code"' ~/.local/bin/kimi || + { grep -qx "# omarchy:mise-managed=true" ~/.local/bin/kimi && + grep -Eq '^exec mise x "npm:@moonshot-ai/kimi-code" -- "kimi" "\$@"$' ~/.local/bin/kimi; }; }; then rm -f ~/.local/bin/kimi fi # 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"' ~/.local/bin/cursor-agent || + { grep -qx "# omarchy:mise-managed=true" ~/.local/bin/cursor-agent && + grep -Eq '^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 .*"(muse"|http:muse\[)' ~/.local/bin/muse; then + { grep -Eq '^mise use -g .*"(muse"|http:muse\[)' ~/.local/bin/muse || + { grep -qx "# omarchy:mise-managed=true" ~/.local/bin/muse && + grep -Eq '^exec mise x "(muse|http:muse\[[^"]+\])" -- "muse" "\$@"$' ~/.local/bin/muse; }; }; then rm -f ~/.local/bin/muse fi diff --git a/bin/omarchy-update-mise b/bin/omarchy-update-mise index 1e4fd4ec1d07..2efe280b9e6e 100755 --- a/bin/omarchy-update-mise +++ b/bin/omarchy-update-mise @@ -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 fi diff --git a/default/bash/aliases b/default/bash/aliases index 315dd230c5d5..8e64c3288874 100644 --- a/default/bash/aliases +++ b/default/bash/aliases @@ -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 diff --git a/default/omarchy/omarchy-menu.jsonc b/default/omarchy/omarchy-menu.jsonc index 4bb2a4e23fe6..445bcd7cb678 100644 --- a/default/omarchy/omarchy-menu.jsonc +++ b/default/omarchy/omarchy-menu.jsonc @@ -41,7 +41,7 @@ "agent.harness": {"icon":"󰆍","label":"Harness","title":"Default Harness"}, "agent.harness.amp": {"icon":"","iconFont":"omarchy","label":"Amp","checked":"[[ \"$(omarchy-default-agent)\" == \"amp\" ]]","action":"omarchy-default-agent amp"}, "agent.harness.agy": {"icon":"","iconFont":"omarchy","label":"Antigravity","checked":"[[ \"$(omarchy-default-agent)\" == \"agy\" ]]","action":"omarchy-default-agent agy"}, - "agent.harness.claude": {"icon":"","iconFont":"omarchy","label":"Claude","checked":"[[ \"$(omarchy-default-agent)\" == \"claude\" ]]","action":"omarchy-default-agent claude"}, + "agent.harness.claude": {"icon":"","iconFont":"omarchy","label":"Claude","when":"omarchy-hw-cpu-sse4_2","checked":"[[ \"$(omarchy-default-agent)\" == \"claude\" ]]","action":"omarchy-default-agent claude"}, "agent.harness.codex": {"icon":"","iconFont":"omarchy","label":"Codex","checked":"[[ \"$(omarchy-default-agent)\" == \"codex\" ]]","action":"omarchy-default-agent codex"}, "agent.harness.commandcode": {"icon":"","iconFont":"omarchy","label":"Command Code","checked":"[[ \"$(omarchy-default-agent)\" == \"commandcode\" ]]","action":"omarchy-default-agent commandcode"}, "agent.harness.copilot": {"icon":"","label":"Copilot","checked":"[[ \"$(omarchy-default-agent)\" == \"copilot\" ]]","action":"omarchy-default-agent copilot"}, @@ -61,7 +61,7 @@ "agent.harness.openclaw": {"icon":"","iconFont":"omarchy","label":"OpenClaw","checked":"[[ \"$(omarchy-default-agent)\" == \"openclaw\" ]]","action":"omarchy-default-agent openclaw"}, "agent.harness.opencode": {"icon":"","iconFont":"omarchy","label":"OpenCode","checked":"[[ \"$(omarchy-default-agent)\" == \"opencode\" ]]","action":"omarchy-default-agent opencode"}, "agent.harness.ori": {"icon":"","iconFont":"omarchy","label":"Ori","checked":"[[ \"$(omarchy-default-agent)\" == \"ori\" ]]","action":"omarchy-default-agent ori"}, - "agent.harness.pi": {"icon":"","iconFont":"omarchy","label":"Pi","checked":"[[ \"$(omarchy-default-agent)\" == \"pi\" ]]","action":"omarchy-default-agent pi"}, + "agent.harness.pi": {"icon":"","iconFont":"omarchy","label":"Pi","when":"omarchy-hw-cpu-sse4_2","checked":"[[ \"$(omarchy-default-agent)\" == \"pi\" ]]","action":"omarchy-default-agent pi"}, "agent.harness.qwen": {"icon":"","iconFont":"omarchy","label":"Qwen Code","checked":"[[ \"$(omarchy-default-agent)\" == \"qwen\" ]]","action":"omarchy-default-agent qwen"}, "agent.instructions": {"icon":"󰈙","label":"Instructions","action":"omarchy-agent-instructions --edit"}, @@ -334,7 +334,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":"[[ -f \"$HOME/.local/share/t3code/T3-Code.AppImage\" ]]","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"}, diff --git a/docs/update-process.md b/docs/update-process.md index 73650bb85d2c..84badd0da03f 100644 --- a/docs/update-process.md +++ b/docs/update-process.md @@ -302,7 +302,7 @@ scripts. | `omarchy-update-user-notify` | Hidden compatibility wrapper for `omarchy-migrate-notify`. | **Temporary.** Keep only for old callers. | | `omarchy-update-available` | Update checker for the shell widget. The update itself clears the widget instead of rechecking. | **Keep.** Could eventually be renamed `omarchy-update-check`, but current name matches widget semantics. | | `omarchy-update-aur-pkgs` | Updates AUR packages with `yay -Sua` if foreign packages exist and AUR is reachable. | **Question.** Omarchy is package-backed now, but users may still install AUR packages. Keep for now. | -| `omarchy-update-mise` | Runs `MISE_MINIMUM_RELEASE_AGE=0 mise up` for mise-managed tools — the override of mise's release-age cooldown is the point. | **Keep.** Mise-managed tools are intentionally part of the blessed update path. | +| `omarchy-update-mise` | Runs `mise up` for mise-managed tools and honors the configured release-age cooldown. | **Keep.** Mise-managed tools are intentionally part of the blessed update path. | | `omarchy-update-orphan-pkgs` | Lists orphans and prompts before removal unless passed `-y`, as the update pipeline does; standalone noninteractive mode only reports. | **Keep for now.** Automates cleanup during updates and supports standalone review. | | `omarchy-update-analyze-logs` | Scans `/tmp/omarchy-update.log` for known failure patterns, currently initramfs generation. | **Keep/expand.** Useful safety net; should grow only for high-signal checks. | | `omarchy-update-boot` | Hidden helper that runs the platform's `update-verify` lifecycle operation through `omarchy-lifecycle-dispatch`, with `sudo` only when the platform implements it. | **Keep internal/hidden.** Keeps platform boot checks out of the pipeline and stubbable in tests. | diff --git a/etc/mise/conf.d/omarchy-tools.toml b/etc/mise/conf.d/omarchy-tools.toml index b784d7198a91..5be6192bd98a 100644 --- a/etc/mise/conf.d/omarchy-tools.toml +++ b/etc/mise/conf.d/omarchy-tools.toml @@ -9,34 +9,34 @@ system_shims_dir = "~/.local/share/mise/shims" # Backend options go inside a tool's table, never in a "tool[...]" key: mise drops bracket options from a # key whose value is a table, so a tool declared that way installs without them. [tools] -amp = { version = "latest", lazy = true, auto_update = "4h", lazy_bins = ["amp"], minimum_release_age = "0s" } -antigravity-cli = { version = "latest", lazy = true, auto_update = "4h", minimum_release_age = "0s" } -basecamp = { version = "latest", lazy = true, minimum_release_age = "0s" } -claude = { version = "latest", lazy = true, auto_update = "4h", minimum_release_age = "0s" } -codex = { version = "latest", lazy = true, auto_update = "4h", minimum_release_age = "0s" } -copilot = { version = "latest", lazy = true, auto_update = "4h", minimum_release_age = "0s" } -crush = { version = "latest", lazy = true, auto_update = "4h", minimum_release_age = "0s" } -cursor-agent = { version = "latest", lazy = true, auto_update = "4h", minimum_release_age = "0s" } -gh = { version = "latest", lazy = true, minimum_release_age = "0s" } -ghui = { version = "latest", lazy = true, minimum_release_age = "0s" } -grok = { version = "latest", lazy = true, auto_update = "4h", minimum_release_age = "0s" } -hey-cli = { version = "latest", lazy = true, minimum_release_age = "0s" } -"http:devin" = { version = "latest", lazy = true, auto_update = "4h", lazy_bins = ["devin"], minimum_release_age = "0s", platforms_linux_x64_url = "https://static.devin.ai/cli/{{ version }}/devin-{{ version }}-x86_64-unknown-linux.tar.gz", platforms_linux_arm64_url = "https://static.devin.ai/cli/{{ version }}/devin-{{ version }}-aarch64-unknown-linux.tar.gz", bin_path = "bin", version_list_url = "https://static.devin.ai/cli/current/manifest.json", version_json_path = ".version" } -"http:kiro-cli" = { version = "latest", lazy = true, auto_update = "4h", lazy_bins = ["kiro-cli"], minimum_release_age = "0s", platforms_linux_x64_url = "https://prod.download.cli.kiro.dev/stable/{{version}}/kirocli-x86_64-linux.tar.gz", platforms_linux_arm64_url = "https://prod.download.cli.kiro.dev/stable/{{version}}/kirocli-aarch64-linux.tar.gz", version_list_url = "https://prod.download.cli.kiro.dev/stable/latest/manifest.json", version_json_path = ".version" } -hunk = { version = "latest", lazy = true, minimum_release_age = "0s" } -muse = { version = "latest", lazy = true, auto_update = "4h", minimum_release_age = "0s" } -node = { version = "latest", lazy = true, minimum_release_age = "0s" } -"npm:@deepseek-ai/dsh" = { version = "latest", lazy = true, auto_update = "4h", lazy_bins = ["dsh"], minimum_release_age = "0s" } -"npm:@kilocode/cli" = { version = "latest", lazy = true, auto_update = "4h", lazy_bins = ["kilo"], minimum_release_age = "0s" } -"npm:@minimax-ai/code" = { version = "latest", lazy = true, auto_update = "4h", lazy_bins = ["mcode"], minimum_release_age = "0s", allow_builds = "better-sqlite3" } -"npm:@moonshot-ai/kimi-code" = { version = "latest", lazy = true, auto_update = "4h", lazy_bins = ["kimi"], minimum_release_age = "0s" } -"npm:cf" = { version = "latest", lazy = true, lazy_bins = ["cf"], minimum_release_age = "0s" } -"npm:command-code" = { version = "latest", lazy = true, auto_update = "4h", lazy_bins = ["commandcode"], minimum_release_age = "0s" } -"npm:freebuff" = { version = "latest", lazy = true, auto_update = "4h", lazy_bins = ["freebuff"], minimum_release_age = "0s" } -oh-my-pi = { version = "latest", lazy = true, auto_update = "4h", minimum_release_age = "0s" } -opencode = { version = "latest", lazy = true, auto_update = "4h", minimum_release_age = "0s" } -ori = { version = "latest", lazy = true, minimum_release_age = "0s" } -pi = { version = "latest", lazy = true, auto_update = "4h", minimum_release_age = "0s" } -playwright = { version = "latest", lazy = true, minimum_release_age = "0s" } -qwen = { version = "latest", lazy = true, auto_update = "4h", minimum_release_age = "0s" } -uv = { version = "latest", lazy = true, minimum_release_age = "0s" } +amp = { version = "latest", lazy = true, auto_update = "4h", lazy_bins = ["amp"] } +antigravity-cli = { version = "latest", lazy = true, auto_update = "4h" } +basecamp = { version = "latest", lazy = true } +claude = { version = "latest", lazy = true, auto_update = "4h" } +codex = { version = "latest", lazy = true, auto_update = "4h" } +copilot = { version = "latest", lazy = true, auto_update = "4h" } +crush = { version = "latest", lazy = true, auto_update = "4h" } +cursor-agent = { version = "latest", lazy = true, auto_update = "4h" } +gh = { version = "latest", lazy = true } +ghui = { version = "latest", lazy = true } +grok = { version = "latest", lazy = true, auto_update = "4h" } +hey-cli = { version = "latest", lazy = true } +"http:devin" = { version = "latest", lazy = true, auto_update = "4h", lazy_bins = ["devin"], platforms_linux_x64_url = "https://static.devin.ai/cli/{{ version }}/devin-{{ version }}-x86_64-unknown-linux.tar.gz", platforms_linux_arm64_url = "https://static.devin.ai/cli/{{ version }}/devin-{{ version }}-aarch64-unknown-linux.tar.gz", bin_path = "bin", version_list_url = "https://static.devin.ai/cli/current/manifest.json", version_json_path = ".version" } +"http:kiro-cli" = { version = "latest", lazy = true, auto_update = "4h", lazy_bins = ["kiro-cli"], platforms_linux_x64_url = "https://prod.download.cli.kiro.dev/stable/{{version}}/kirocli-x86_64-linux.tar.gz", platforms_linux_arm64_url = "https://prod.download.cli.kiro.dev/stable/{{version}}/kirocli-aarch64-linux.tar.gz", version_list_url = "https://prod.download.cli.kiro.dev/stable/latest/manifest.json", version_json_path = ".version" } +hunk = { version = "latest", lazy = true } +muse = { version = "latest", lazy = true, auto_update = "4h" } +node = { version = "latest", lazy = true } +"npm:@deepseek-ai/dsh" = { version = "latest", lazy = true, auto_update = "4h", lazy_bins = ["dsh"] } +"npm:@kilocode/cli" = { version = "latest", lazy = true, auto_update = "4h", lazy_bins = ["kilo"] } +"npm:@minimax-ai/code" = { version = "latest", lazy = true, auto_update = "4h", lazy_bins = ["mcode"], allow_builds = "better-sqlite3" } +"npm:@moonshot-ai/kimi-code" = { version = "latest", lazy = true, auto_update = "4h", lazy_bins = ["kimi"] } +"npm:cf" = { version = "latest", lazy = true, lazy_bins = ["cf"] } +"npm:command-code" = { version = "latest", lazy = true, auto_update = "4h", lazy_bins = ["commandcode"] } +"npm:freebuff" = { version = "latest", lazy = true, auto_update = "4h", lazy_bins = ["freebuff"] } +oh-my-pi = { version = "latest", lazy = true, auto_update = "4h" } +opencode = { version = "latest", lazy = true, auto_update = "4h" } +ori = { version = "latest", lazy = true } +pi = { version = "latest", lazy = true, auto_update = "4h" } +playwright = { version = "latest", lazy = true } +qwen = { version = "latest", lazy = true, auto_update = "4h" } +uv = { version = "latest", lazy = true } diff --git a/migrations/1791382872.sh b/migrations/1791382872.sh index 48955be93993..b0e63c95e360 100644 --- a/migrations/1791382872.sh +++ b/migrations/1791382872.sh @@ -4,6 +4,8 @@ legacy_wrapper_template() { local form=$1 package=$2 bin=$3 case $form in + read-only) + printf '#!/bin/bash\n# omarchy:mise-managed=true\nexec mise x "%s" -- "%s" "$@"\n' "$package" "$bin" ;; quiet) printf '#!/bin/bash\nexport MISE_MINIMUM_RELEASE_AGE=0\nmise use -g --quiet "%s" || exit 1\nexec mise x "%s" -- "%s" "$@"\n' "$package" "$package" "$bin" ;; cooldown-export) @@ -25,7 +27,7 @@ legacy_wrapper() { # Match complete shipped templates, including the binary name and final # newline. Matching only the mise lines would discard user customizations. - for form in quiet cooldown-export bail-on-failure mise-exec bare-exec; do + for form in read-only quiet cooldown-export bail-on-failure mise-exec bare-exec; do if cmp -s "$wrapper" <(legacy_wrapper_template "$form" "$package" "$command"); then return 0 fi diff --git a/test/shell.d/default-agent-test.sh b/test/shell.d/default-agent-test.sh index 57b877f82cf9..9585a555d539 100644 --- a/test/shell.d/default-agent-test.sh +++ b/test/shell.d/default-agent-test.sh @@ -178,7 +178,7 @@ assert_lazy_stub() { "$test_home/.local/bin/$command" --version mapfile -t mise_calls <"$mise_history" - [[ ${mise_calls[0]} == "use -g --quiet $package" && ${mise_calls[1]} == "x $package -- $command --version" ]] || + [[ ${#mise_calls[@]} == 1 && ${mise_calls[0]} == "x $package -- $command --version" ]] || fail "$command lazy stub preserves its mise package" } @@ -197,21 +197,22 @@ lazy_config="$ROOT/etc/mise/conf.d/omarchy-tools.toml" grep -Fx 'locked_scopes = ["project", "global"]' "$lazy_config" >/dev/null || fail "system tools remain installable when the user enables locked mode" for tool in "$agy_package" "$grok_package" "$omp_package" "$crush_package" "$cursor_agent_package" "$muse_package"; do - grep -Eq "^$tool = \\{ version = \"latest\", lazy = true, auto_update = \"4h\", minimum_release_age = \"0s\" \\}$" "$lazy_config" || + grep -Eq "^$tool = \\{ version = \"latest\", lazy = true, auto_update = \"4h\" \\}$" "$lazy_config" || fail "user setup declares $tool as a self-updating native lazy tool" done for tool in "$ori_package" basecamp; do - grep -Eq "^$tool = \\{ version = \"latest\", lazy = true, minimum_release_age = \"0s\" \\}$" "$lazy_config" || + grep -Eq "^$tool = \\{ version = \"latest\", lazy = true \\}$" "$lazy_config" || fail "user setup declares $tool as a native lazy tool" done -for tool in codex claude copilot opencode pi "\"$kimi_package\""; do - grep -Eq "^$tool = \\{ version = \"latest\", lazy = true, auto_update = \"4h\", " "$lazy_config" || +for tool in codex claude copilot opencode pi; do + grep -Eq "^$tool = \\{ version = \"latest\", lazy = true, auto_update = \"4h\" \\}$" "$lazy_config" || fail "user setup declares $tool as a self-updating native lazy tool" done -grep -Eq "^$qwen_package = \\{ version = \"latest\", lazy = true, auto_update = \"4h\", minimum_release_age = \"0s\" \\}$" "$lazy_config" || +grep -Eq "^$qwen_package = \\{ version = \"latest\", lazy = true, auto_update = \"4h\" \\}$" "$lazy_config" || fail "user setup declares Qwen Code as a self-updating native lazy tool" # A tool without registry bin metadata names the commands mise shims for it. declare -A declared_bins=( + ["\"$kimi_package\""]='"kimi"' [$amp_package]='"amp"' ["\"$dsh_package\""]='"dsh"' ["\"$freebuff_package\""]='"freebuff"' @@ -219,7 +220,7 @@ declare -A declared_bins=( ["\"$commandcode_package\""]='"commandcode"' ) for tool in "${!declared_bins[@]}"; do - grep -Fx "$tool = { version = \"latest\", lazy = true, auto_update = \"4h\", lazy_bins = [${declared_bins[$tool]}], minimum_release_age = \"0s\" }" "$lazy_config" >/dev/null || + grep -Fx "$tool = { version = \"latest\", lazy = true, auto_update = \"4h\", lazy_bins = [${declared_bins[$tool]}] }" "$lazy_config" >/dev/null || fail "user setup declares $tool as a self-updating native lazy tool with its commands" done # mise drops bracket options from a table-valued key, so a tool with backend @@ -233,7 +234,7 @@ declare -A declared_option_bins=( for agent in "${!declared_option_bins[@]}"; do tool_var="${agent}_tool" package_var="${agent}_package" - declaration=$(grep -F "\"${!tool_var}\" = { version = \"latest\", lazy = true, auto_update = \"4h\", lazy_bins = [${declared_option_bins[$agent]}], minimum_release_age = \"0s\", " "$lazy_config") || + declaration=$(grep -F "\"${!tool_var}\" = { version = \"latest\", lazy = true, auto_update = \"4h\", lazy_bins = [${declared_option_bins[$agent]}], " "$lazy_config") || fail "user setup declares ${!tool_var} as a self-updating native lazy tool with its commands" options=${!package_var#*[} IFS=, read -ra options <<<"${options%]}" @@ -244,10 +245,13 @@ for agent in "${!declared_option_bins[@]}"; do done [[ $(grep -c 'auto_update = "4h"' "$lazy_config") == 21 ]] || fail "only the agent CLIs update themselves" for tool in node uv; do - grep -Eq "^$tool = \\{ version = \"latest\", lazy = true, minimum_release_age = \"0s\" \\}$" "$lazy_config" || + grep -Eq "^$tool = \\{ version = \"latest\", lazy = true \\}$" "$lazy_config" || fail "user setup declares $tool as a native lazy tool" done [[ $(grep -c 'lazy = true' "$lazy_config") == 31 ]] || fail "user setup declares every default mise tool as lazy" +if grep -q "minimum_release_age" "$lazy_config"; then + fail "system mise tools honor the configured release age" +fi grep -Fx "reshim --system" "$mise_history" >/dev/null || fail "user setup builds the system lazy bootstrap shims" pass "user setup configures system lazy tools from registry shorthands" : >"$stub_log" @@ -283,6 +287,41 @@ omarchy-remove-preinstalls >/dev/null rm "$test_home/.local/bin/muse" pass "Remove Preinstalls keeps a user-managed Muse install" +# Bun's x86 build needs both flags; ARM uses a different build. +cpuinfo_dir="$test_tmp/cpuinfo" +mkdir -p "$cpuinfo_dir" +printf 'flags : sse4_1\n' >"$cpuinfo_dir/core2duo" +printf 'flags : sse4_1 sse4_2\n' >"$cpuinfo_dir/sse4_2-only" +printf 'flags : sse4_1 sse4_2 popcnt\n' >"$cpuinfo_dir/haswell" +printf 'Features : fp asimd\n' >"$cpuinfo_dir/aarch64" +for cpu in core2duo sse4_2-only haswell aarch64; do + compatible=false + OMARCHY_ARCH='' OMARCHY_CPUINFO="$cpuinfo_dir/$cpu" "$ROOT/bin/omarchy-hw-cpu-sse4_2" && compatible=true + case $cpu in + core2duo | sse4_2-only) [[ $compatible == "false" ]] || fail "$cpu cannot run Bun's x86 build" ;; + *) [[ $compatible == "true" ]] || fail "$cpu can run its Bun build" ;; + esac +done +OMARCHY_ARCH=aarch64 OMARCHY_CPUINFO="$cpuinfo_dir/core2duo" "$ROOT/bin/omarchy-hw-cpu-sse4_2" || + fail "the architecture override takes precedence over x86 cpuinfo" +pass "Bun CPU detection requires SSE4.2 and POPCNT only on x86" + +for agent in claude pi; do + : >"$mise_history" + : >"$terminal_log" + if OMARCHY_ARCH=x86_64 OMARCHY_CPUINFO="$cpuinfo_dir/core2duo" omarchy-default-agent "$agent" >"$test_tmp/cpu-skip" 2>&1; then + fail "default agent refuses $agent on an incompatible CPU" + fi + grep -q 'SSE4.2' "$test_tmp/cpu-skip" || fail "default agent explains why $agent cannot run" + [[ ! -s $mise_history && ! -s $terminal_log && ! -f $agent_file ]] || + fail "an incompatible $agent is not installed, launched or selected" +done +OMARCHY_ARCH=x86_64 OMARCHY_CPUINFO="$cpuinfo_dir/haswell" OMARCHY_TEST_AGENT_INSTALLED=true \ + OMARCHY_MISE_CONFIG_PATH="$ROOT/etc/mise/conf.d/omarchy-tools.toml" omarchy-default-agent claude >/dev/null +[[ $(<"$agent_file") == "claude" ]] || fail "a compatible CPU can select Claude" +grep -Fx 'install claude' "$mise_history" >/dev/null || fail "a compatible CPU installs the declared Claude tool" +rm "$agent_file" +pass "agent selection checks CPU support before installation" [[ -z $(omarchy-default-agent) ]] || fail "default agent is unset until one is chosen" pass "default agent is unset until one is chosen" @@ -376,6 +415,36 @@ SH chmod +x "$mock_bin/omarchy-agent" hash -r +# A managed wrapper is not evidence that its package is installed. +"$ROOT/bin/omarchy-mise-install" codex +for wrapper in generated legacy; do + if [[ $wrapper == "legacy" ]]; then + printf '#!/bin/bash\nexec mise x "codex" -- "codex" "$@"\n' >"$test_home/.local/bin/codex" + fi + : >"$mise_history" + : >"$terminal_log" + omarchy-default-agent codex + grep -Fx 'where codex' "$mise_history" >/dev/null || fail "$wrapper wrappers probe their mise package" + mapfile -d '' -t terminal_args <"$terminal_log" + [[ ${terminal_args[*]} == "omarchy-default-agent --install codex" && ! -f $agent_file ]] || + fail "$wrapper wrappers install a missing package before selecting it" +done +printf '#!/bin/bash\nexec mise x "custom-codex" -- "custom-agent" "$@"\n' >"$test_home/.local/bin/codex" +: >"$mise_history" +omarchy-default-agent codex +[[ ! -s $mise_history ]] || fail "a foreign two-line launcher must not trigger mise installation" +printf '#!/bin/bash\nexec mise x "codex" -- "codex" "$@"\n' >"$test_home/.local/bin/codex" +: >"$mise_history" +omarchy-default-agent --install codex >/dev/null +grep -Fx 'use -g codex' "$mise_history" >/dev/null || fail "managed selection restores an undeclared package pin" +[[ $(<"$agent_file") == "codex" ]] || fail "a successful installation selects the managed agent" +: >"$mise_history" +OMARCHY_MISE_CONFIG_PATH="$ROOT/etc/mise/conf.d/omarchy-tools.toml" omarchy-default-agent --install codex >/dev/null +grep -Fx 'install codex' "$mise_history" >/dev/null || fail "a declared managed agent uses the system declaration" +grep -q '^use ' "$mise_history" && fail "a declared managed agent leaves the user's pin alone" +rm "$test_home/.local/bin/codex" "$agent_file" +pass "managed wrappers restore missing packages without taking over foreign launchers" + declare -A expected_agents=( [pi]="pi" [omp]="omp" diff --git a/test/shell.d/menu-test.sh b/test/shell.d/menu-test.sh index 3a73db494ca8..f64a65fcd8bf 100644 --- a/test/shell.d/menu-test.sh +++ b/test/shell.d/menu-test.sh @@ -153,6 +153,9 @@ assertDeepEqual( const defaultItems = menu.parseMenuJsonc(defaultMenuJsonc) const defaultById = Object.fromEntries(defaultItems.map(item => [item.id, item])) +for (const id of ['claude', 'pi']) { + assertEqual(defaultById[`agent.harness.${id}`].when, 'omarchy-hw-cpu-sse4_2', 'menu checks CPU support for ' + id) +} // Needs the real menu: app rows sort after all menu items, and only at that // item count does the order tiebreak alone bury an installed app. diff --git a/test/shell.d/mise-install-test.sh b/test/shell.d/mise-install-test.sh index 951db41d1685..272ea5d8b77d 100644 --- a/test/shell.d/mise-install-test.sh +++ b/test/shell.d/mise-install-test.sh @@ -11,8 +11,8 @@ home="$tmpdir/home" stub_bin="$tmpdir/bin" mkdir -p "$home" "$stub_bin" -# Stands in for the real mise so a generated wrapper can be run and asked what -# arguments it passed on. +# Stands in for the real mise so install and the generated wrapper can be run +# and asked what arguments they passed on. cat >"$stub_bin/mise" <<'SH' #!/bin/bash @@ -21,41 +21,56 @@ for arg in "$@"; do printf '\t%s' "$arg" >>"$OMARCHY_MISE_TEST_LOG" done printf '\n' >>"$OMARCHY_MISE_TEST_LOG" +[[ ${OMARCHY_MISE_TEST_OFFLINE:-0} != 1 ]] SH chmod +x "$stub_bin/mise" install_wrapper() { - HOME="$home" "$ROOT/bin/omarchy-mise-install" "$@" + HOME="$home" PATH="$stub_bin:$PATH" OMARCHY_MISE_TEST_LOG="$1" \ + "$ROOT/bin/omarchy-mise-install" "${@:2}" } # The ordinary case still works, and every call site in install/user/mise.sh -# passes names of this shape. -install_wrapper npm:playwright playwright >/dev/null +# passes names of this shape. Wrapper creation also has to work offline. +install_log="$tmpdir/install-normal.log" +: >"$install_log" +OMARCHY_MISE_TEST_OFFLINE=1 install_wrapper "$install_log" npm:playwright playwright >/dev/null || + fail "writing an optional wrapper does not need a package download" [[ -x $home/.local/bin/playwright ]] || fail "a normal install writes an executable wrapper" +[[ ! -s $install_log ]] || fail "creating the wrapper does not call mise" "$(cat "$install_log")" + +run_log="$tmpdir/run-normal.log" +: >"$run_log" +OMARCHY_MISE_TEST_LOG="$run_log" PATH="$stub_bin:$PATH" "$home/.local/bin/playwright" >/dev/null +grep -Fqx $'mise\tx\tnpm:playwright\t--\tplaywright' "$run_log" || + fail "the wrapper only execs the package" "$(cat "$run_log")" +if grep -q $'\tuse\t' "$run_log"; then + fail "the wrapper must not call mise use" "$(cat "$run_log")" +fi -log="$tmpdir/normal.log" -: >"$log" -OMARCHY_MISE_TEST_LOG="$log" PATH="$stub_bin:$PATH" "$home/.local/bin/playwright" >/dev/null -grep -Fqx $'mise\tuse\t-g\t--quiet\tnpm:playwright' "$log" || - fail "the wrapper asks mise for the package it was given" "$(cat "$log")" - -pass "a normal install writes a wrapper that names its package" +pass "a normal install writes an exec-only wrapper that names its package" # A package name is data. Quoted with %q it reaches mise as one argument # instead of being read as shell source when the wrapper runs. -install_wrapper 'npm:pkg$(touch '"$tmpdir"'/PWNED)end' hostile >/dev/null +install_log="$tmpdir/install-hostile.log" +: >"$install_log" +install_wrapper "$install_log" 'npm:pkg$(touch '"$tmpdir"'/PWNED)end' hostile >/dev/null -log="$tmpdir/hostile.log" -: >"$log" -OMARCHY_MISE_TEST_LOG="$log" PATH="$stub_bin:$PATH" "$home/.local/bin/hostile" >/dev/null +run_log="$tmpdir/run-hostile.log" +: >"$run_log" +OMARCHY_MISE_TEST_LOG="$run_log" PATH="$stub_bin:$PATH" "$home/.local/bin/hostile" >/dev/null [[ -e $tmpdir/PWNED ]] && fail "a package name with shell characters does not run when the wrapper does" \ "wrapper: $(cat "$home/.local/bin/hostile")" -grep -Fqx $'mise\tuse\t-g\t--quiet\tnpm:pkg$(touch '"$tmpdir"'/PWNED)end' "$log" || - fail "the package reaches mise whole" "$(cat "$log")" +grep -Fq $'mise\tx\tnpm:pkg$(touch ' "$run_log" || + fail "the package reaches mise whole" "$(cat "$run_log")" +grep -Fq $'\t--\thostile' "$run_log" || + fail "the bin reaches mise whole" "$(cat "$run_log")" +grep -Fq 'PWNED' "$run_log" || + fail "the hostile package name is preserved in the mise argv" "$(cat "$run_log")" pass "a package name with shell characters reaches mise as one argument" @@ -75,7 +90,7 @@ for (( i = 0; i < ${#refused[@]}; i += 2 )); do label=${refused[i]} name=${refused[i + 1]} - if install_wrapper somepkg "$name" >/dev/null 2>"$tmpdir/err"; then + if install_wrapper "$tmpdir/refused.log" somepkg "$name" >/dev/null 2>"$tmpdir/err"; then fail "a command name with $label is refused" fi grep -Fq 'is not usable as a command name' "$tmpdir/err" || @@ -88,10 +103,19 @@ pass "command names that are not plain file names are refused" # escaped path on its way to failing. victim="$tmpdir/victim" printf 'keep me\n' >"$victim" -if install_wrapper somepkg "../../../..$victim" >/dev/null 2>&1; then +if install_wrapper "$tmpdir/escape.log" somepkg "../../../..$victim" >/dev/null 2>&1; then fail "an escaping command name is refused" fi [[ -f $victim ]] || fail "an escaping command name removes nothing outside ~/.local/bin" pass "an escaping command name removes nothing outside ~/.local/bin" + +update_log="$tmpdir/update.log" +if HOME="$home" PATH="$stub_bin:$ROOT/bin:$PATH" OMARCHY_MISE_TEST_LOG="$update_log" OMARCHY_MISE_TEST_OFFLINE=1 \ + "$ROOT/bin/omarchy-update-mise" >"$tmpdir/update-failure" 2>&1; then + fail "mise update failures propagate" +fi +HOME="$home" PATH="$stub_bin:$ROOT/bin:$PATH" OMARCHY_MISE_TEST_LOG="$update_log" \ + "$ROOT/bin/omarchy-update-mise" >/dev/null || fail "successful mise updates succeed" +pass "mise updates propagate the tool's exit status" diff --git a/test/shell.d/openclaw-cli-test.sh b/test/shell.d/openclaw-cli-test.sh index 53e21dea5937..f7fd36e44313 100755 --- a/test/shell.d/openclaw-cli-test.sh +++ b/test/shell.d/openclaw-cli-test.sh @@ -180,6 +180,7 @@ for script in bin/omarchy-install-openclaw-cli; do "$ROOT/$script" >"$mock_bin/${script##*/}" done chmod +x "$mock_bin/omarchy-install-openclaw-cli" +ln -s "$ROOT/bin/omarchy-cmd-present" "$mock_bin/omarchy-cmd-present" new_home() { test_home="$test_tmp/$1" @@ -209,6 +210,13 @@ run_update() { "$@" >"$test_tmp/output" 2>&1 } +new_home absent +run "$ROOT/bin/omarchy-openclaw-present" && fail "an absent OpenClaw does not count as installed" +mkdir -p "$test_home/.config/systemd/user" +touch "$test_home/.config/systemd/user/openclaw-gateway.service" +run "$ROOT/bin/omarchy-openclaw-present" && fail "a gateway unit without its CLI does not hide installation" +pass "a leftover gateway unit does not count as an installed OpenClaw" + new_home usage run omarchy-install-openclaw-cli && fail "no mode is a usage error" [[ ! -s $events ]] || fail "no mode installs nothing" "$(cat "$events")" @@ -276,7 +284,9 @@ pass "a runtime that does not run fails the install" new_home foreign printf '#!/bin/bash\necho mine\n' >"$command" chmod +x "$command" +run "$ROOT/bin/omarchy-openclaw-present" || fail "a user-installed CLI on PATH disables the installation entry" run omarchy-install-openclaw-cli --now && fail "a command that is the user's is not replaced" +[[ ! -s $events ]] || fail "a user-installed CLI is rejected before installing another package" "$(cat "$events")" grep -q "Move it aside" "$test_tmp/output" || fail "a command that is the user's is named" "$(cat "$test_tmp/output")" [[ ! -L $command ]] && grep -q mine "$command" || fail "a command that is the user's is kept" run omarchy-install-openclaw-cli --check && fail "--check calls the runtime installed while the command is somebody else's"