Repository navigation
Resolve mise wrappers to @latest on each run #10168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
calledtoconstruct
wants to merge
4
commits into
omacom:quattro
Choose a base branch
from
calledtoconstruct:fix/mise-wrapper-latest
base: quattro
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
3d19a8d
Resolve mise wrappers to @latest on each run
calledtoconstruct 2aa4691
Append @latest after a backend spec's options too
omarchybot edee693
Look for a version only after a spec's options
omarchybot 6ec7122
Merge quattro, and give the Kimi wrapper @latest like the others
omarchybot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| echo "Refresh mise wrappers so they resolve @latest on each run" | ||
|
|
||
| # omarchy-mise-install now writes `mise use -g --quiet "<tool>@latest"` so a | ||
| # wrapper cannot stay pinned on a stale installed version. Wrappers already on | ||
| # disk still call the bare tool name (e.g. claude@latest is the target form). | ||
| # Rewrite the exact --quiet template through omarchy-mise-install. | ||
|
|
||
| stale_quiet_template() { | ||
| printf '#!/bin/bash\nexport MISE_MINIMUM_RELEASE_AGE=0\nmise use -g --quiet "%s" || exit 1\nexec mise x "%s" -- "%s" "$@"' "$1" "$1" "$2" | ||
| } | ||
|
|
||
| bin_dir="$HOME/.local/bin" | ||
|
|
||
| [[ -d $bin_dir ]] || exit 0 | ||
|
|
||
| for wrapper in "$bin_dir"/*; do | ||
| [[ -f $wrapper && ! -L $wrapper && -r $wrapper ]] || continue | ||
| (($(stat -c%s "$wrapper") <= 1024)) || continue | ||
|
|
||
| contents=$(<"$wrapper") | ||
| package=$(sed -n 's/^mise use -g --quiet "\(.*\)" || exit 1$/\1/p' <<<"$contents") | ||
| bin=$(sed -n 's/^exec mise x ".*" -- "\(.*\)" "\$@"$/\1/p' <<<"$contents") | ||
|
|
||
| [[ -n $package && -n $bin ]] || continue | ||
| [[ $package == *@latest ]] && continue | ||
| [[ $contents == "$(stale_quiet_template "$package" "$bin")" ]] || continue | ||
|
|
||
| omarchy-mise-install "$package" "${wrapper##*/}" "$bin" | ||
| done | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh" | ||
|
|
||
| test_dir=$(mktemp -d) | ||
| trap 'rm -rf "$test_dir"' EXIT | ||
|
|
||
| home="$test_dir/home" | ||
| mkdir -p "$home/.local/bin" | ||
|
|
||
| HOME="$home" PATH="$ROOT/bin:$PATH" "$ROOT/bin/omarchy-mise-install" claude | ||
| wrapper="$home/.local/bin/claude" | ||
|
|
||
| grep -qF 'mise use -g --quiet "claude@latest" || exit 1' "$wrapper" || | ||
| fail "mise wrapper pins the tool at @latest" "$(cat "$wrapper")" | ||
| grep -qF 'exec mise x "claude@latest" -- "claude" "$@"' "$wrapper" || | ||
| fail "mise wrapper executes the @latest spec" "$(cat "$wrapper")" | ||
| pass "mise wrapper refreshes to @latest on each run" | ||
|
|
||
| HOME="$home" PATH="$ROOT/bin:$PATH" "$ROOT/bin/omarchy-mise-install" "npm:@kitlangton/ghui" ghui | ||
| grep -qF 'mise use -g --quiet "npm:@kitlangton/ghui@latest" || exit 1' "$home/.local/bin/ghui" || | ||
| fail "mise wrapper appends @latest after a scoped npm package" "$(cat "$home/.local/bin/ghui")" | ||
| pass "mise wrapper appends @latest after a scoped npm package" | ||
|
|
||
| HOME="$home" PATH="$ROOT/bin:$PATH" "$ROOT/bin/omarchy-mise-install" "claude@1.2.3" claude-pinned | ||
| grep -qF 'mise use -g --quiet "claude@1.2.3" || exit 1' "$home/.local/bin/claude-pinned" || | ||
| fail "mise wrapper leaves an already-versioned spec alone" "$(cat "$home/.local/bin/claude-pinned")" | ||
| if grep -q 'claude@1.2.3@latest' "$home/.local/bin/claude-pinned"; then | ||
| fail "mise wrapper does not append @latest onto a pinned version" | ||
| fi | ||
| pass "mise wrapper leaves an already-versioned spec alone" | ||
|
|
||
| HOME="$home" PATH="$ROOT/bin:$PATH" "$ROOT/bin/omarchy-mise-install" "claude@latest" claude-latest | ||
| grep -qF 'mise use -g --quiet "claude@latest" || exit 1' "$home/.local/bin/claude-latest" || | ||
| fail "mise wrapper does not double @latest" "$(cat "$home/.local/bin/claude-latest")" | ||
| pass "mise wrapper does not double @latest" | ||
|
|
||
| HOME="$home" PATH="$ROOT/bin:$PATH" "$ROOT/bin/omarchy-mise-install" \ | ||
| "http:muse[url=https://example.test/muse.sh,bin=muse]" muse | ||
| grep -qF 'mise use -g --quiet "http:muse[url=https://example.test/muse.sh,bin=muse]@latest" || exit 1' "$home/.local/bin/muse" || | ||
| fail "mise wrapper appends @latest after a backend spec's options" "$(cat "$home/.local/bin/muse")" | ||
|
|
||
| HOME="$home" PATH="$ROOT/bin:$PATH" "$ROOT/bin/omarchy-mise-install" \ | ||
| "http:tool[url=https://example.test/@releases/tool.sh]" tool | ||
| grep -qF 'mise use -g --quiet "http:tool[url=https://example.test/@releases/tool.sh]@latest" || exit 1' "$home/.local/bin/tool" || | ||
| fail "mise wrapper does not read an @ inside the options as a version" "$(cat "$home/.local/bin/tool")" | ||
|
|
||
| HOME="$home" PATH="$ROOT/bin:$PATH" "$ROOT/bin/omarchy-mise-install" \ | ||
| "http:tool[url=https://example.test/@releases/tool.sh]@1.2.3" tool-pinned | ||
| grep -qF 'mise use -g --quiet "http:tool[url=https://example.test/@releases/tool.sh]@1.2.3" || exit 1' "$home/.local/bin/tool-pinned" || | ||
| fail "mise wrapper leaves a version after the options alone" "$(cat "$home/.local/bin/tool-pinned")" | ||
| pass "mise wrapper appends @latest after a backend spec's options" | ||
|
|
||
| migration="$ROOT/migrations/1789093830.sh" | ||
| [[ -f $migration ]] || fail "a migration rewrites existing mise wrappers onto @latest" | ||
| pass "a migration rewrites existing mise wrappers onto @latest" | ||
|
|
||
| bin_dir="$home/.local/bin" | ||
| cat >"$bin_dir/codex" <<'EOF' | ||
| #!/bin/bash | ||
| export MISE_MINIMUM_RELEASE_AGE=0 | ||
| mise use -g --quiet "codex" || exit 1 | ||
| exec mise x "codex" -- "codex" "$@" | ||
| EOF | ||
| chmod +x "$bin_dir/codex" | ||
|
|
||
| cat >"$bin_dir/muse" <<'EOF' | ||
| #!/bin/bash | ||
| export MISE_MINIMUM_RELEASE_AGE=0 | ||
| mise use -g --quiet "http:muse[url=https://example.test/muse.sh,bin=muse]" || exit 1 | ||
| exec mise x "http:muse[url=https://example.test/muse.sh,bin=muse]" -- "muse" "$@" | ||
| EOF | ||
| chmod +x "$bin_dir/muse" | ||
|
|
||
| HOME="$home" PATH="$ROOT/bin:$PATH" bash -euo pipefail "$migration" >/dev/null | ||
|
|
||
| grep -qF 'mise use -g --quiet "codex@latest" || exit 1' "$bin_dir/codex" || | ||
| fail "migration rewrites a quiet wrapper onto @latest" "$(cat "$bin_dir/codex")" | ||
| grep -qF 'exec mise x "http:muse[url=https://example.test/muse.sh,bin=muse]@latest" -- "muse" "$@"' "$bin_dir/muse" || | ||
| fail "migration rewrites a wrapper whose spec carries options" "$(cat "$bin_dir/muse")" | ||
| pass "migration rewrites a quiet wrapper onto @latest" | ||
|
|
||
| before=$(cat "$bin_dir/codex") | ||
| HOME="$home" PATH="$ROOT/bin:$PATH" bash -euo pipefail "$migration" >/dev/null | ||
| [[ $(cat "$bin_dir/codex") == "$before" ]] || fail "latest-wrapper migration is idempotent" | ||
| pass "latest-wrapper migration is idempotent" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.