Skip to content

Expose mise shims in zshenv - #568

Open
shunk031 wants to merge 1 commit into
mainfrom
fix/zshenv-mise-shims
Open

Expose mise shims in zshenv#568
shunk031 wants to merge 1 commit into
mainfrom
fix/zshenv-mise-shims

Conversation

@shunk031

@shunk031 shunk031 commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Why

Remote and non-interactive Zsh sessions read .zshenv but do not source .zshrc, so commands that depend on mise shims can fail before the interactive shell configuration runs. Sourcing .zshrc is too broad for these contexts because it can load prompt and plugin setup.

What Changed

  • Add a minimal home/dot_config/exact_shell/mise.zsh startup helper that prepends ~/.local/bin and ~/.local/share/mise/shims only when the standalone mise binary exists.
  • Source the helper from home/dot_zshenv after ~/.zshenv_private, then clean up helper variables.
  • Cover non-interactive Zsh startup behavior in tests/install/common/mise.bats, including absent mise, shim exposure, duplicate prevention, private env ordering, and helper variable cleanup.

Interactive Zsh activation in dot_zprofile and plugin/prompt setup remain unchanged.

Validation

Inspect the diff for whitespace errors.

git diff --check

Parse the updated Zsh startup files.

zsh -n home/dot_zshenv home/dot_config/exact_shell/mise.zsh

Parse existing Bash mise startup files.

bash -n install/common/mise.sh home/dot_config/exact_shell/mise.bash

Run shellcheck through mise for the Bash startup files.

mise exec -- shellcheck install/common/mise.sh home/dot_config/exact_shell/mise.bash

Smoke-test a minimal non-interactive Zsh environment with fake mise and chezmoi shim executables.

_tmp_home="$(mktemp -d)"
trap 'rm -rf "${_tmp_home}"' EXIT
mkdir -p "${_tmp_home}/.config/shell" "${_tmp_home}/.local/bin" "${_tmp_home}/.local/share/mise/shims"
cp home/dot_zshenv "${_tmp_home}/.zshenv"
cp home/dot_config/exact_shell/mise.zsh "${_tmp_home}/.config/shell/mise.zsh"
cat > "${_tmp_home}/.local/bin/mise" <<'MISE_STUB'
#!/usr/bin/env sh
echo fake-mise
MISE_STUB
cat > "${_tmp_home}/.local/share/mise/shims/chezmoi" <<'CHEZMOI_STUB'
#!/usr/bin/env sh
echo fake-chezmoi
CHEZMOI_STUB
chmod +x "${_tmp_home}/.local/bin/mise" "${_tmp_home}/.local/share/mise/shims/chezmoi"
HOME="${_tmp_home}" ZDOTDIR="${_tmp_home}" zsh -c 'command -v mise; command -v chezmoi; test -z "${ZSH_VERSION:-}" || true'

Bats tests were not run locally per repository policy; GitHub Actions should validate them.

Co-Authored-By: Claude <noreply@anthropic.com>
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.

1 participant