fix: harden error handling and shell-agnostic mise activation

- Guard x-path call to prevent PATH clobber when missing
- Make husky init.sh use shell-agnostic mise activate --shims
- Add fail-fast to Tier 2 install steps in dfm install all
- Check brew update exit status before reporting success
- Always run mise install during reset_nvim (handles bootstrap)
- Use double-bracket conditional in cleanup script
This commit is contained in:
2026-03-18 11:17:31 +02:00
parent 63977f81db
commit 9df2996a5d
4 changed files with 15 additions and 10 deletions

View File

@@ -20,8 +20,10 @@
# Bootstrap: ensure local/bin is on PATH so x-path is available # Bootstrap: ensure local/bin is on PATH so x-path is available
PATH="$DOTFILES/local/bin:$PATH" PATH="$DOTFILES/local/bin:$PATH"
# Use x-path to deduplicate PATH entries # Use x-path to deduplicate PATH entries (only if x-path is available)
PATH="$(x-path prepend "$XDG_BIN_HOME" "$DOTFILES/local/bin" "/opt/homebrew/bin" "/usr/local/bin")" if command -v x-path &> /dev/null; then
PATH="$(x-path prepend "$XDG_BIN_HOME" "$DOTFILES/local/bin" "/opt/homebrew/bin" "/usr/local/bin")"
fi
export PATH export PATH
if ! command -v msg &> /dev/null; then if ! command -v msg &> /dev/null; then

View File

@@ -1,2 +1,2 @@
#!/usr/bin/env bash #!/usr/bin/env bash
eval "$(mise activate bash --shims)" eval "$(mise activate --shims)"

View File

@@ -105,9 +105,9 @@ section_install()
$0 install fonts $0 install fonts
# Tier 2: Runtimes and CLI tools via mise, then remaining installers # Tier 2: Runtimes and CLI tools via mise, then remaining installers
$0 install mise $0 install mise || exit 1
$0 install composer $0 install composer || exit 1
$0 install python-libs $0 install python-libs || exit 1
# Tier 3: Tool-dependent installers # Tier 3: Tool-dependent installers
$0 install cheat-databases $0 install cheat-databases
@@ -268,8 +268,11 @@ section_brew()
;; ;;
update) update)
brew update && brew outdated && brew upgrade && brew cleanup if brew update && brew outdated && brew upgrade && brew cleanup; then
msgr yay "Done!" msgr yay "Done!"
else
msgr err "brew update failed"
fi
;; ;;
updatebundle) updatebundle)
@@ -548,7 +551,7 @@ section_dotfiles()
msgr ok "Deleted old nvim files (share, state and cache + config)" msgr ok "Deleted old nvim files (share, state and cache + config)"
ln -s "$DOTFILES/config/nvim" ~/.config/nvim ln -s "$DOTFILES/config/nvim" ~/.config/nvim
msgr ok "Linked nvim and astronvim" msgr ok "Linked nvim and astronvim"
x-have mise && $0 install mise $0 install mise
msgr ok "Installed packages" msgr ok "Installed packages"
msgr run_done "nvim reset!" msgr run_done "nvim reset!"
;; ;;

View File

@@ -5,7 +5,7 @@ set -euo pipefail
# because nvim's Mason installs some of the same tool names. # because nvim's Mason installs some of the same tool names.
# #
# Ensure DOTFILES is set even when script is invoked directly # Ensure DOTFILES is set even when script is invoked directly
if [ -z "${DOTFILES:-}" ]; then if [[ -z "${DOTFILES:-}" ]]; then
DOTFILES="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" DOTFILES="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
export DOTFILES export DOTFILES
fi fi