Skip to content

fish: switch mise from shims to PATH activation#19

Merged
tyvsmith merged 1 commit into
mainfrom
mise-path-activation
Jul 22, 2026
Merged

fish: switch mise from shims to PATH activation#19
tyvsmith merged 1 commit into
mainfrom
mise-path-activation

Conversation

@tyvsmith

Copy link
Copy Markdown
Owner

Why

Shims mode only generates shims at mise reshim time, so binaries added afterward (cargo install, npm i -g) were invisible — cargo-audit, sync_dis_boi existed in ~/.cargo/bin but weren't on PATH. This is inherent to shims mode; mise's own docs recommend PATH activation for interactive shells.

What

  • zz_01_paths.fish.tmpl: mise activate --shims fishmise activate fish. A fish_prompt hook now runs mise hook-env, putting real tool bin dirs (incl. ~/.cargo/bin) on PATH.
  • __cached_source.fish: cache key now includes the subcommand (mise-activate-fish.fish instead of mise.fish). Without this, the old cached shims line would keep winning after the config change — args weren't part of the cache key. Old-scheme cache files are cleaned up on cold start, so the switch takes effect on the first shell after chezmoi apply, no manual cache clearing.
  • zz_03_interactive.fish / __auto_venv.fish: comment updates only — auto-venv stays (it covers plain-.venv repos; mise's uv_venv_auto only ever applies to mise-managed python, which is intentionally not a global tool).

Verification

Ran a sandboxed fish (XDG_CONFIG_HOME pointing at a copy of the live config with the new files, clean env) through startup, repeated fish_prompt events, and cd into/out of a project pinned to bun = "1.3.10":

  • Overrides dir stays first: ~/.local/share/overrides/bin was $PATH[1] at startup, after repeated prompt hooks, and after version-switching cd in both directions — hook-env respects PATH entries added after activation.
  • ~/.cargo/bin on PATH; cargo-audit (no shim, previously invisible) resolves.
  • Shims dir no longer on PATH; node/bun resolve to real install dirs.
  • Version switching works: pinned project → bun 1.3.10, leaving → 1.3.11 (latest).
  • Non-interactive fish -c still resolves cargo binaries (activation runs one env pass at source time).
  • Warm startup 20ms (baseline ~24ms — no regression).

Final PATH shape:

~/.local/share/overrides/bin      ← still first
~/.local/share/mise/installs/bun/latest/bin
~/.local/share/mise/installs/node/latest/bin
~/.cargo/bin
~/.local/share/mise/installs/go/1.26.1/bin
~/.local/share/mise/installs/java/latest/bin
/usr/local/bin ...

🤖 Generated with Claude Code

Shims are only generated at `mise reshim` time, so anything added to a
tool's bin dir afterward (`cargo install`, `npm i -g`) was invisible
until a manual reshim — cargo-audit et al. silently missing from PATH.

Plain `mise activate` runs `mise hook-env` from a fish_prompt hook,
putting the real bin dirs (incl. ~/.cargo/bin) on PATH, so new binaries
appear immediately. hook-env respects entries added after activation,
so ~/.local/share/overrides/bin keeps first position (verified across
startup, repeated prompts, and version-switching cd).

__cached_source now keys the cache on tool + subcommand, not just tool:
the old mise.fish cache (shims line) would otherwise keep winning after
this change, since args weren't part of the cache key. Old-scheme cache
files are cleaned on cold start.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 22, 2026 01:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Fish shell initialization to use mise “PATH activation” instead of shims, ensuring dynamically-added tool bins (e.g., ~/.cargo/bin from cargo install, global npm bins) remain visible on PATH without requiring mise reshim. It also hardens the Fish startup caching helper so cached activation output correctly invalidates when arguments change.

Changes:

  • Switch Fish mise initialization from mise activate --shims fish to mise activate fish in zz_01_paths.fish.tmpl.
  • Update __cached_source cache keying to include subcommands/args and add cold-start cleanup for old cache naming schemes.
  • Comment-only clarifications around auto-venv behavior and rationale (__auto_venv.fish, zz_03_interactive.fish).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
dot_config/fish/conf.d/zz_01_paths.fish.tmpl Moves mise init to PATH activation mode to keep real tool bin dirs on PATH.
dot_config/fish/functions/__cached_source.fish Makes cache filenames include args so changes to activation flags/subcommands invalidate cache; cleans legacy cache files.
dot_config/fish/conf.d/zz_03_interactive.fish Updates explanatory comments for __auto_venv ownership/intent (no behavior change).
dot_config/fish/functions/__auto_venv.fish Updates comments to match the intended division of responsibilities vs mise-managed python.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tyvsmith
tyvsmith merged commit d6fdea3 into main Jul 22, 2026
2 checks passed
@tyvsmith
tyvsmith deleted the mise-path-activation branch July 22, 2026 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants