Skip to content
Open
Changes from all 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
29 changes: 20 additions & 9 deletions shell/lib/mise.sh
Original file line number Diff line number Diff line change
Expand Up @@ -289,18 +289,24 @@ wait_for_gh_rate_limit() {
# Prints the path to a tool from either PATH or in the
# mise environment.
find_tool() {
local toolName="$1"
local toolName="$1" toolPath
# Deliberately not using command_exists here because we want to
# print the path.
if ! command -v "$toolName" 2>/dev/null; then
local misePath
misePath="$(find_mise)"
if [[ -z $misePath ]]; then
error "mise not found (find_tool)"
return 1
fi
"$misePath" which "$toolName" 2>/dev/null
toolPath="$(command -v "$toolName" 2>/dev/null)"
# Skip mise shims: they resolve versions from the current directory's config,
# which doesn't declare devbase tools. Callers fall through to `mise exec`.
if [[ -n $toolPath ]] && [[ $toolPath != "$(mise_shim_dir)"/* ]]; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This line decides the scope of the fix: a shim falls through to mise exec, anything else runs as-is. So a real binary still beats devbase's pin. A repo carrying golangci-lint = "2.13.2" in customMiseTools, or a Homebrew install, produces a non-shim path here and runs instead of the pinned 2.9.0, with no error.

Right for a repo's own tools (your uv row), wrong for devbase-pinned ones, and find_tool can't tell them apart. Not for this PR, but DT-5560's acceptance criteria ask for exactly this, so a scope note and a follow-up would help.

echo "$toolPath"
return 0
fi

local misePath
misePath="$(find_mise)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

find_mise returns 1 when mise is absent, so under set -e this assignment aborts before line 306 ever runs, making the mise not found (find_tool) error unreachable.

Pre-existing, but it matters a bit more now: this block used to run only when command -v missed, and now it also runs on every mise shim hit. The version proposed on the ticket had || true here.

Suggested change
misePath="$(find_mise)"
misePath="$(find_mise)" || true

if [[ -z $misePath ]]; then
error "mise not found (find_tool)"
return 1
fi
"$misePath" which "$toolName" 2>/dev/null
}

# mise_exec_tool(toolName[, args...])
Expand Down Expand Up @@ -373,6 +379,11 @@ asdf_shim_dir() {
echo "${ASDF_DIR:-$HOME/.asdf}/shims"
}

# Where mise keeps its shims.
mise_shim_dir() {
echo "${MISE_SHIMS_DIR:-${MISE_DATA_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/mise}/shims}"
}

asdf_shim_path() {
local binName="$1"
echo "$(asdf_shim_dir)/$binName"
Expand Down