mise icon indicating copy to clipboard operation
mise copied to clipboard

`mise up` does not update tools to latest

Open travbale opened this issue 2 years ago • 5 comments

Describe the bug

When using mise up I am getting mise All tools are up to date when I have what I consider to be out of date tools. For instance I intentional set my .mise.toml to use an older version of yamllint (One minor version behind latest) and attempted to use mise up to bump it to latest as if I had ran mise use --pin yamllint@latest.

To Reproduce

mkdir test
cd test
mise use --pin jq
mise use [email protected]
mise up

Expected behavior

I expected yamllint to bump to the latest version (1.33.0) as if I had ran mise use --pin yamllint@latest.

mise doctor output

mise version:
  2024.1.7 macos-arm64 (292e4ac 2024-01-05)

build:
  Target: aarch64-apple-darwin
  Features: DEFAULT, NATIVE_TLS, OPENSSL
  Built: Fri, 5 Jan 2024 19:07:41 +0000
  Rust Version: rustc 1.75.0 (82e1608df 2023-12-21)
  Profile: release

shell:
  /bin/zsh
  zsh 5.9 (x86_64-apple-darwin22.0)

mise data directory:
  /Users/travbale/.local/share/mise

mise environment variables:
  MISE_SHELL=zsh

settings:
  {
    "experimental": false,
    "color": true,
    "always_keep_download": false,
    "always_keep_install": false,
    "legacy_version_file": true,
    "legacy_version_file_disable_tools": [],
    "plugin_autoupdate_last_check_duration": "7d",
    "trusted_config_paths": [],
    "log_level": "info",
    "trace": false,
    "debug": false,
    "verbose": false,
    "quiet": false,
    "asdf_compat": false,
    "jobs": 4,
    "shorthands_file": null,
    "disable_default_shorthands": false,
    "disable_tools": [],
    "raw": false,
    "yes": false,
    "task_output": null,
    "not_found_auto_install": true,
    "ci": false,
    "env_file": null,
    "cd": null
  }

config files:
  /Users/travbale/Development/test/.mise.toml

plugins:
  bun             (core)
  deno            (core)
  go              (core)
  golangci-lint   https://github.com/hypnoglow/asdf-golangci-lint.git#e968b13
  java            (core)
  jq              https://github.com/lsanwick/asdf-jq.git#addae51
  node            (core)
  python          (core)
  ruby            (core)
  yamllint        https://github.com/ericcornelissen/asdf-yamllint.git#4e0a8a0

toolset:
  [email protected], [email protected]

No problems found

travbale avatar Jan 06 '24 20:01 travbale

that's not a bug, mise up updates to the latest in the range you've specified. For what you're doing you can just do mise use --pin yamllint@latest

jdx avatar Jan 06 '24 23:01 jdx

that said, there is the downside of that where you don't have --interactive and can't upgrade all of them at once. I also suspect you won't be the only user to attempt this so I'm ok with having more than 1 way to do things.

This probably shouldn't be default behavior though. I'm thinking maybe something like mise up --latest.

jdx avatar Jan 06 '24 23:01 jdx

I figured it might be something like that. I was looking for something like pre-commit's command that updates all hooks to the latest version. I think mise up --latest would work nicely. Also great tool by the way I've been enjoying it.

travbale avatar Jan 07 '24 02:01 travbale

I'd be open to a PR for this but I think it will be a bit tricky to write. It will probably need to respect the existing specificity for the previous version, e.g.:

[tools]
node = '20'
python = '3.11.0'

should become:

[tools]
node = '22'
python = '3.12.1'

I don't think existing code does this anywhere so that would need to be written. There are edge cases like how go and erlang use "1.9" but "1.9.1" and probably a lot more where semver isn't followed or uses strange conventions. We could start with basic semver though.

jdx avatar Jan 18 '24 18:01 jdx

I'm currently using this script to update all plugins to their latest version, and also pin the version in the global configuration file:

#!/bin/bash

plugins=$( mise ls -g --no-header | cut -d\  -f1 )

mise plugins update || exit 1

# set plugins to 'latest' so 'mise upgrade' will use newer versions
for plugin in $plugins; do
  mise use -g "$plugin@latest" >/dev/null
done

mise upgrade --interactive || exit 1

# set plugins to their actual versions
for plugin in $plugins; do
  mise use -g --pin "$plugin@latest"
done

mise prune

Maybe mise upgrade --latest could just act as if plugins were already set to latest? That would take care of simple use cases at least.

toupeira avatar Apr 28 '24 15:04 toupeira