From f1f75ee11b16508b5e6d09a1222f28833777ca0e Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 25 May 2026 16:49:18 +0200 Subject: [PATCH] Switch from npm to mise for the lazy-loaded tools --- bin/omarchy | 2 +- ...archy-npm-install => omarchy-mise-install} | 7 +- bin/omarchy-npm-run | 76 ------------------- bin/omarchy-refresh-applications | 6 +- bin/omarchy-remove-preinstalls | 5 +- bin/omarchy-update-mise | 9 +++ bin/omarchy-update-perform | 1 + install/packaging/all.sh | 2 +- install/packaging/mise.sh | 8 ++ install/packaging/npm.sh | 8 -- migrations/1778516505.sh | 3 - .../1779454304_npm_wrapper_update_support.sh | 3 - migrations/1779715013.sh | 5 ++ 13 files changed, 35 insertions(+), 100 deletions(-) rename bin/{omarchy-npm-install => omarchy-mise-install} (56%) delete mode 100755 bin/omarchy-npm-run create mode 100755 bin/omarchy-update-mise create mode 100644 install/packaging/mise.sh delete mode 100644 install/packaging/npm.sh delete mode 100644 migrations/1778516505.sh delete mode 100644 migrations/1779454304_npm_wrapper_update_support.sh create mode 100644 migrations/1779715013.sh diff --git a/bin/omarchy b/bin/omarchy index da6e8760..c54fc84c 100755 --- a/bin/omarchy +++ b/bin/omarchy @@ -56,7 +56,7 @@ GROUP_DESCRIPTIONS[migrate]="Migration runner" GROUP_DESCRIPTIONS[monitor]="Monitor status helpers" GROUP_DESCRIPTIONS[network]="Network status helpers" GROUP_DESCRIPTIONS[notification]="Notification helpers" -GROUP_DESCRIPTIONS[npm]="NPM package wrappers" +GROUP_DESCRIPTIONS[mise]="Mise tool wrappers" GROUP_DESCRIPTIONS[osd]="On-screen display status helpers" GROUP_DESCRIPTIONS[pkg]="Package management helpers" GROUP_DESCRIPTIONS[plugin]="Omarchy shell plugin and bar widget management" diff --git a/bin/omarchy-npm-install b/bin/omarchy-mise-install similarity index 56% rename from bin/omarchy-npm-install rename to bin/omarchy-mise-install index 5c5f7b5b..bf98dd9f 100755 --- a/bin/omarchy-npm-install +++ b/bin/omarchy-mise-install @@ -1,10 +1,10 @@ #!/bin/bash -# omarchy:summary=Install a small pnpm dlx wrapper for a given npm package. +# omarchy:summary=Install a small mise-backed wrapper for a given tool. # omarchy:args= [command-name [bin-name]] if [[ -z $1 ]]; then - echo "Usage: omarchy-npm-install [command-name [bin-name]]" + echo "Usage: omarchy-mise-install [command-name [bin-name]]" exit 1 fi @@ -16,7 +16,8 @@ mkdir -p "$HOME/.local/bin" cat >"$HOME/.local/bin/$command" < [args...] -# omarchy:hidden=true - -if (($# < 3)); then - echo "Usage: omarchy-npm-run [args...]" - exit 1 -fi - -package=$1 -command=$2 -bin=$3 -shift 3 - -package_spec=$package -state_dir="${XDG_STATE_HOME:-$HOME/.local/state}/omarchy/npm-wrappers" -version_file="$state_dir/$command.version" -pin_ttl=7200 -uses_pinned_version=0 - -if [[ -s $version_file ]]; then - now=$(date +%s) - pinned_at=$(stat -c %Y "$version_file" 2>/dev/null || printf '0\n') - - if ((now - pinned_at < pin_ttl)); then - pinned_version=$(<"$version_file") - package_spec="$package@$pinned_version" - uses_pinned_version=1 - else - rm -f "$version_file" - fi -fi - -if ! node_root=$(mise where node@latest 2>/dev/null); then - mise use -g node@latest >/dev/null - node_root=$(mise where node@latest) -fi - -export PATH="$node_root/bin:$PATH" - -if omarchy-cmd-missing pnpm; then - echo "Installing pnpm for $package..." - omarchy-pkg-add pnpm - hash -r -fi - -# pnpm reads npm_config_* env vars for CLI configuration. -export npm_config_minimum_release_age=$pin_ttl -export npm_config_dlx_cache_max_age=$pin_ttl - -if (( uses_pinned_version )); then - export npm_config_minimum_release_age=0 -fi - -if (($# == 1)) && [[ $1 == "update" ]]; then - export npm_config_minimum_release_age=0 - export npm_config_dlx_cache_max_age=0 - - if ! latest_version=$(env -u npm_config_minimum_release_age -u npm_config_dlx_cache_max_age pnpm view "$package@latest" version); then - echo "Could not resolve latest npm version for $package" >&2 - exit 1 - fi - - mkdir -p "$state_dir" - printf '%s\n' "$latest_version" >"$version_file" - package_spec="$package@$latest_version" - - pnpm dlx --package "$package_spec" true - - echo "Updated $command to $latest_version" - exit 0 -fi - -exec pnpm dlx --package "$package_spec" "$bin" "$@" diff --git a/bin/omarchy-refresh-applications b/bin/omarchy-refresh-applications index 0c894c34..b95bb9e0 100755 --- a/bin/omarchy-refresh-applications +++ b/bin/omarchy-refresh-applications @@ -1,6 +1,6 @@ #!/bin/bash -# omarchy:summary=Ensure all default .desktop, web apps, TUIs, and npm wrappers are installed. +# omarchy:summary=Ensure all default .desktop, web apps, TUIs, and mise wrappers are installed. mkdir -p ~/.local/share/icons/hicolor/48x48/apps/ cp "$OMARCHY_PATH"/applications/icons/*.png ~/.local/share/icons/hicolor/48x48/apps/ @@ -14,10 +14,10 @@ if omarchy-cmd-present alacritty; then cp "$OMARCHY_PATH/default/alacritty/Alacritty.desktop" ~/.local/share/applications/ fi -# Refresh the webapps, TUIs, and npm wrappers +# Refresh the webapps, TUIs, and mise wrappers bash "$OMARCHY_PATH/install/packaging/icons.sh" bash "$OMARCHY_PATH/install/packaging/webapps.sh" bash "$OMARCHY_PATH/install/packaging/tuis.sh" -bash "$OMARCHY_PATH/install/packaging/npm.sh" +bash "$OMARCHY_PATH/install/packaging/mise.sh" update-desktop-database ~/.local/share/applications diff --git a/bin/omarchy-remove-preinstalls b/bin/omarchy-remove-preinstalls index fd25c2f4..7e6ee5b4 100755 --- a/bin/omarchy-remove-preinstalls +++ b/bin/omarchy-remove-preinstalls @@ -12,9 +12,10 @@ if gum confirm "Are you sure you want to remove all preinstalled web apps, TUI w cp "$OMARCHY_PATH/default/hypr/plain-bindings.lua" ~/.config/hypr/bindings.lua hyprctl reload - # Remove npm stubs + # Remove mise stubs rm -f ~/.local/bin/codex ~/.local/bin/gemini ~/.local/bin/copilot \ - ~/.local/bin/opencode ~/.local/bin/playwright-cli ~/.local/bin/pi + ~/.local/bin/opencode ~/.local/bin/playwright ~/.local/bin/playwright-cli ~/.local/bin/pi \ + ~/.local/bin/ghui ~/.local/bin/hunk omarchy-pkg-drop \ aether \ diff --git a/bin/omarchy-update-mise b/bin/omarchy-update-mise new file mode 100755 index 00000000..8252e68b --- /dev/null +++ b/bin/omarchy-update-mise @@ -0,0 +1,9 @@ +#!/bin/bash + +# omarchy:summary=Update mise-managed tools + +if omarchy-cmd-present mise; then + echo -e "\e[32m\nUpdate mise tools\e[0m" + mise up + echo +fi diff --git a/bin/omarchy-update-perform b/bin/omarchy-update-perform index 14d85e18..8958acba 100755 --- a/bin/omarchy-update-perform +++ b/bin/omarchy-update-perform @@ -14,6 +14,7 @@ omarchy-update-available-reset omarchy-update-system-pkgs omarchy-migrate omarchy-update-aur-pkgs +omarchy-update-mise omarchy-update-orphan-pkgs omarchy-hook post-update diff --git a/install/packaging/all.sh b/install/packaging/all.sh index cb377033..5c32107e 100644 --- a/install/packaging/all.sh +++ b/install/packaging/all.sh @@ -4,7 +4,7 @@ run_logged $OMARCHY_INSTALL/packaging/nvim.sh run_logged $OMARCHY_INSTALL/packaging/icons.sh run_logged $OMARCHY_INSTALL/packaging/webapps.sh run_logged $OMARCHY_INSTALL/packaging/tuis.sh -run_logged $OMARCHY_INSTALL/packaging/npm.sh +run_logged $OMARCHY_INSTALL/packaging/mise.sh run_logged $OMARCHY_INSTALL/packaging/asus-rog.sh run_logged $OMARCHY_INSTALL/packaging/framework16.sh run_logged $OMARCHY_INSTALL/packaging/dell-xps-touchpad-haptics.sh diff --git a/install/packaging/mise.sh b/install/packaging/mise.sh new file mode 100644 index 00000000..8a714634 --- /dev/null +++ b/install/packaging/mise.sh @@ -0,0 +1,8 @@ +omarchy-mise-install codex +omarchy-mise-install gemini +omarchy-mise-install copilot +omarchy-mise-install opencode +omarchy-mise-install npm:playwright playwright +omarchy-mise-install pi +omarchy-mise-install npm:@kitlangton/ghui ghui +omarchy-mise-install aqua:modem-dev/hunk hunk diff --git a/install/packaging/npm.sh b/install/packaging/npm.sh deleted file mode 100644 index 65478fbd..00000000 --- a/install/packaging/npm.sh +++ /dev/null @@ -1,8 +0,0 @@ -omarchy-npm-install @openai/codex codex -omarchy-npm-install @google/gemini-cli gemini -omarchy-npm-install @github/copilot copilot -omarchy-npm-install opencode-ai opencode -omarchy-npm-install playwright playwright-cli playwright -omarchy-npm-install @earendil-works/pi-coding-agent pi -omarchy-npm-install @kitlangton/ghui ghui -omarchy-npm-install hunkdiff hunk diff --git a/migrations/1778516505.sh b/migrations/1778516505.sh deleted file mode 100644 index b0c94023..00000000 --- a/migrations/1778516505.sh +++ /dev/null @@ -1,3 +0,0 @@ -echo "Install npm package wrappers using pnpm with 5-day security lag" - -source "$OMARCHY_PATH/install/packaging/npm.sh" diff --git a/migrations/1779454304_npm_wrapper_update_support.sh b/migrations/1779454304_npm_wrapper_update_support.sh deleted file mode 100644 index 87ff9743..00000000 --- a/migrations/1779454304_npm_wrapper_update_support.sh +++ /dev/null @@ -1,3 +0,0 @@ -echo "Refresh npm wrappers with update support" - -source "$OMARCHY_PATH/install/packaging/npm.sh" diff --git a/migrations/1779715013.sh b/migrations/1779715013.sh new file mode 100644 index 00000000..619b0f8e --- /dev/null +++ b/migrations/1779715013.sh @@ -0,0 +1,5 @@ +echo "Install mise package wrappers" + +rm -f "$HOME/.local/bin/playwright-cli" + +source "$OMARCHY_PATH/install/packaging/mise.sh"