#!/usr/bin/env zsh
# shellcheck disable=SC1071
set -eu

# Verify that the first precmd after `mise activate zsh` still runs hook-env.
# This protects the startup path where zsh may mutate PATH during shell
# initialization before the first prompt is rendered.

eval "$(mise activate zsh --status)"

if [[ ${__MISE_ZSH_PRECMD_RUN:-unset} != "0" ]]; then
	echo "expected __MISE_ZSH_PRECMD_RUN=0 after activation"
	exit 1
fi

_mise_hook_precmd >/dev/null 2>&1

if [[ ${__MISE_ZSH_PRECMD_RUN:-unset} != "1" ]]; then
	echo "expected first precmd after activation to run hook-env"
	exit 1
fi
