jdx / mise

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

Mise use defaults to installing globally if a .mise.toml doesn't already exist #2256

Open BoltsJ opened 4 weeks ago

BoltsJ commented 4 weeks ago

Describe the bug If a project doesn't already have a .mise.toml, running mise use to add a package will add it to the global configuration

To Reproduce Steps to reproduce the behavior.

b@toolbox ~> mkdir myproj
b@toolbox ~> cd myproj/
b@toolbox ~/myproj> mise use yarn@latest
mise yarn@4.2.2 ✓ installed
mise ~/.config/mise/config.toml tools: yarn@4.2.2
b@toolbox ~/myproj> nvim ~/.config/mise/config.toml # remove the entry from the global config
b@toolbox ~/myproj> touch .mise.toml
b@toolbox ~/myproj> mise use yarn@latest
mise ~/myproj/.mise.toml tools: yarn@4.2.2
b@toolbox ~/myproj> 

Expected behavior Mise should create and use a local .mise.toml unless the --global / -g flag is specified.

mise doctor output

b@toolbox ~/myproj> mise doctor 
version: 2024.6.1 linux-x64 (6a3f377 2024-06-03)
activated: yes
shims_on_path: no

build_info: 
  Target: x86_64-unknown-linux-gnu
  Features: DEFAULT, NATIVE_TLS, OPENSSL
  Built: Mon, 3 Jun 2024 22:26:16 +0000
  Rust Version: rustc 1.78.0 (9b00956e5 2024-04-29)
  Profile: release

shell: 
  fish
  fish, version 3.7.0

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

config_files: 
  ~/.config/mise/config.toml
  ~/myproj/.mise.toml

backends: 
  cargo
  core
  go
  npm
  pipx
  spm
  ubi

plugins: 
  bun      (core)
  deno     (core)
  erlang   (core)
  fd       https://gitlab.com/wt0f/asdf-fd.git#17d56e0
  fzf      https://github.com/kompiro/asdf-fzf.git#d19eb67
  go       (core)
  java     (core)
  neovim   https://github.com/richin13/asdf-neovim.git#d6118ad
  node     (core)
  pipx     https://github.com/yozachar/asdf-pipx.git#31db618
  python   (core)
  ripgrep  https://gitlab.com/wt0f/asdf-ripgrep.git#e836665
  ruby     (core)
  tokei    https://github.com/gasuketsu/asdf-tokei.git#d127410
  usage    https://github.com/jdx/mise-usage.git#fe3888a
  yarn     https://github.com/mise-plugins/asdf-yarn.git#74ea3b9

toolset: 
  yarn@4.2.2      
  fd@10.1.0       
  fzf@0.52.1      
  neovim@0.10.0   
  node@20.14.0    
  pipx@1.6.0      
  ripgrep@14.1.0  
  usage@0.3.0     

env_vars: 
  MISE_SHELL=fish

settings: 
  activate_aggressive = false
  all_compile = false
  always_keep_download = false
  always_keep_install = false
  asdf_compat = false
  cargo_binstall = true
  color = true
  disable_default_shorthands = false
  disable_tools = []
  experimental = false
  go_default_packages_file = "~/.default-go-packages"
  go_download_mirror = "https://dl.google.com/go"
  go_repo = "https://github.com/golang/go"
  go_set_gopath = false
  go_set_goroot = true
  go_skip_checksum = false
  http_timeout = 30
  jobs = 4
  legacy_version_file = true
  legacy_version_file_disable_tools = []
  node_compile = false
  not_found_auto_install = true
  paranoid = false
  plugin_autoupdate_last_check_duration = "7d"
  python_default_packages_file = "/var/home/b/.default-python-packages"
  python_pyenv_repo = "https://github.com/pyenv/pyenv.git"
  raw = false
  trusted_config_paths = []
  quiet = false
  verbose = false
  yes = false
  ci = false
  debug = false
  trace = false
  log_level = "info"
  python_venv_auto_create = false

  [status]
  missing_tools = "if_other_versions_installed"
  show_env = false
  show_tools = false

No warnings found
No problems found

Additional context Add any other context about the problem here. Consider running mise with --debug or --trace for extra debug info.

jdx commented 4 weeks ago

Probably happening because it's recursing to find a .config directory. We should skip it if it's in the home directory in this case I think.