jdx / mise

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

bug: ls-remote doesn't support `@sub-X` style versions #2494

Closed janslow closed 1 month ago

janslow commented 1 month ago

Hey, thanks for the work you've done on this project!

Describe the bug

When using mise ls-remote with an tool@sub-X:base argument, it returns every version for that tool, instead of the version that matches.

To Reproduce

$ mise ls-remote node@20.17.0
20.17.0
$ mise ls-remote node@20.16.0
20.16.0
$ mise ls-remote node@sub-0.1:20.17.0
0.1.14
0.1.15
0.1.16
0.1.17
0.1.18
0.1.19
0.1.20
0.1.21
0.1.22
0.1.23
# ...
22.4.0
22.4.1
22.5.0
22.5.1
22.6.0
22.7.0

Expected behavior

node@sub-0.1:20.17.0 resolves to node@20.16.0, so the output should be the same 20.16.0

$ mise ls-remote node@sub-0.1:20.17.0
20.16.0

Similarly, if no such version exists (e.g., node@sub-0.0.1:20.17.0), mise should exit with status code 0, but no output (same as querying a non-existent version, e.g., mise ls-remote node@20.4983.324234)

mise doctor output

version: 2024.8.12 macos-arm64 (2024-08-20)
activated: yes
shims_on_path: yes

build_info: 
  Target: aarch64-apple-darwin
  Features: DEFAULT, NATIVE_TLS
  Built: Tue, 20 Aug 2024 22:15:12 +0000
  Rust Version: rustc 1.80.1 (3f5fd8dd4 2024-08-06) (Homebrew)
  Profile: release

shell: 
  /opt/homebrew/bin/fish
  fish, version 3.7.1

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

config_files: 
  <!-- REDACTED -->

backends: 
  cargo
  core
  go
  npm
  pipx
  spm
  ubi
  vfox

plugins: 
  deno       https://github.com/asdf-community/asdf-deno#fec2a08
  terraform  https://github.com/asdf-community/asdf-hashicorp.git#f1602b6
  tflint     https://github.com/skyzyx/asdf-tflint.git#37e7eb9
  usage      https://github.com/jdx/mise-usage.git#fe3888a
  yarn       https://github.com/mise-plugins/asdf-yarn.git#74ea3b9
  yq         https://github.com/sudermanjr/asdf-yq.git#772992f

toolset: 
  <!-- REDACTED -->

env_vars: 
  MISE_SHELL=fish

settings: 
  activate_aggressive = false
  all_compile = false
  always_keep_download = false
  always_keep_install = false
  asdf = true
  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 = []
  libgit2 = true
  node_compile = false
  not_found_auto_install = true
  paranoid = false
  plugin_autoupdate_last_check_duration = "7d"
  python_default_packages_file = "~/.default-python-packages"
  python_pyenv_repo = "https://github.com/pyenv/pyenv.git"
  raw = false
  trusted_config_paths = []
  quiet = false
  verbose = false
  vfox = 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

1 warning found:

1. plugin deno overrides a core plugin

No problems found

Additional context

The reason this is a problem is because I want to pre-install a selection of recent versions on our CI runners (without needing to manually specify the versions), to improve my users' build speeds.

I was intending to run mise install node@latest node@sub-0.0.1:latest node@sub-0.1:latest, but this fails if there's no such version (e.g., if latest is 20.0.0, then sub-0.1:latest doesn't exist).

Therefore, I was hoping to use mise ls-remote to filter out the non-existent versions first.