jdx / mise

dev tools, env vars, task runner
https://mise.jdx.dev
MIT License
10.46k stars 303 forks source link

Hooks are not executed #3321

Open noirbizarre opened 3 days ago

noirbizarre commented 3 days ago

Describe the bug I defined some hooks and they are not executed

To Reproduce Add this to ~/.config/mise/config.toml:

[hooks]
enter = 'echo "ENTER"'
leave = 'echo "LEAVE"'
cd = 'echo "CD"'
preinstall = 'echo "PREINSTALL"'
postinstall = 'echo "POSTINSTALL"'

Enter a mise-managed directory and nothing happens

Expected behavior I see hooks echos

mise doctor output

version: 2024.11.37 linux-x64 (7ac5ab3 2024-11-30)
activated: yes
shims_on_path: no

build_info:
  Target: x86_64-unknown-linux-gnu
  Features: DEFAULT, NATIVE_TLS, OPENSSL
  Built: Sat, 30 Nov 2024 01:03:00 +0000
  Rust Version: rustc 1.82.0 (f6e511eec 2024-10-15)
  Profile: release

shell:
  /bin/zsh
  zsh 5.9 (x86_64-pc-linux-gnu)

dirs:
  cache: ~/.cache/mise
  config: ~/.config/mise
  data: ~/.local/share/mise
  shims: ~/.local/share/mise/shims
  state: ~/.local/state/mise

config_files:
  ~/.config/mise/config.toml
  ~/Workspaces/commitizen/mise.toml
  ~/Workspaces/commitizen/emotional/mise.toml
  ~/Workspaces/commitizen/emotional/.mise.toml

backends:
  aqua
  asdf
  cargo
  core
  gem
  go
  npm
  pipx
  spm
  ubi
  vfox

plugins:
  goreleaser    https://github.com/kforsthoevel/asdf-goreleaser.git#078fdba
  helm          https://github.com/Antiarchitect/asdf-helm.git#085651c
  jq            https://github.com/mise-plugins/asdf-jq.git#6d86d19
  kubectl       https://github.com/asdf-community/asdf-kubectl.git#2fb3b57
  pdm           https://github.com/1oglop1/asdf-pdm#0223762
  saml2aws      https://github.com/elementalvoid/asdf-saml2aws.git#5223233
  shellcheck    https://github.com/luizm/asdf-shellcheck.git#66200ff
  shfmt         https://github.com/luizm/asdf-shfmt.git#a42c5ff
  telepresence  https://github.com/pirackr/asdf-telepresence.git#c9eeab4
  terraform     https://github.com/asdf-community/asdf-hashicorp.git#22eb1c4
  tiny          https://github.com/mise-plugins/mise-tiny.git#c532b14

toolset:
  core:python@3.11.9
  ubi:jdx/usage@1.3.3

env_vars:
  MISE_ENV_FILE=.env
  MISE_PYTHON_DEFAULT_PACKAGES_FILE=~/.config/mise/tools.pip
  MISE_SHELL=zsh

settings:
  disable_hints         ["python_multi"]                                                                                                                                                                                                  ~/.config/mise/config.toml
  experimental          true                                                                                                                                                                                                              ~/.config/mise/config.toml
  legacy_version_file   true                                                                                                                                                                                                              ~/.config/mise/config.toml
  trusted_config_paths  ["REDACTED"] ~/.config/mise/config.toml
  verbose               false                                                                                                                                                                                                             ~/.config/mise/config.toml

No problems found
syhol commented 3 days ago

~/.mise/config.toml is not the user-wide config location but can still be detected as long as you mise trust the file. Normally ~/.config/mise/config.toml is used for user-wide config. However, looking at the "config_files" in your mise doctor it seems that ~/.mise/config.toml is not one of the trusted config files.

I couldn't recreate your issue on fish or zsh.

noirbizarre commented 2 days ago

Sorry, it was a typo. I fixed it. Configuration file is ~/.config/mise/config.toml. Everything else is properly applied, but not the hooks.

syhol commented 1 day ago

OK, that I can reproduce.