ツールの状態をあちこちのコマンドで確認するのが面倒

特定のツールについて「どのバックエンドから入っているか」「インストール済みのバージョンは何か」「どの設定ファイルで解決されているか」を知りたいときがある。従来は【mise】mise registryでツール名とバックエンドの対応を確認する【mise】mise lsでインストール済みツールの一覧を確認する などを使い分ける必要があった。

mise toolを使うと、1つのツールについての情報がまとめて確認できる。

mise tool <ツール名>の基本

$ mise tool jq
Backend:            aqua:jqlang/jq
Description:        Command-line JSON processor
Installed Versions: 1.7.1 1.8.0
Active Version:     1.7.1
Requested Version:  1.7.1
Config Source:      /path/to/project/mise.toml
Tool Options:       [none]
Security:           checksum (sha256), github_attestations

バックエンド、説明文、インストール済みバージョン一覧、実際に使われるバージョン、mise.tomlでのリクエスト内容、その設定がどのファイルに書かれているか、セキュリティ関連の対応状況までが1画面で確認できる。

Active Versionは未インストールでも値が入る

Active Versionという名前から「実際にインストールされて使える状態のバージョン」を連想しやすいが、実際にはmise.tomlの記述から解決されたバージョンをそのまま表示するだけで、インストール済みかどうかとは関係ない。

$ cat mise.toml
[tools]
jq = "1.7.1"

$ mise tool jq
Backend:            aqua:jqlang/jq
Description:        Command-line JSON processor
Installed Versions:
Active Version:     1.7.1
Requested Version:  1.7.1
...

jqをまだ一度もmise installしていない状態でも、Installed Versionsは空欄のままActive Versionには1.7.1が表示される。実際に使えるかどうかはInstalled Versionsが空でないかで判断する。

個別の項目だけを取り出すフラグ

各項目名に対応するフラグを付けると、その値だけを出力する。スクリプトから特定の情報だけを取り出したい場合に使う。

$ mise tool jq --backend
aqua:jqlang/jq

$ mise tool jq --installed
1.7.1 1.8.0

$ mise tool jq --requested
1.7.1

$ mise tool jq --config-source
/path/to/project/mise.toml

$ mise tool jq --description
Command-line JSON processor

$ mise tool jq --tool-options
[none]

–jsonでより詳細な情報を確認する

--jsonを付けると、通常表示には出てこないtool_optionsの内訳(osdependsinstall_envlazylazy_bins)や、securityの詳細(チェックサムのアルゴリズム、GitHub Attestationsの検証対象ワークフロー)まで確認できる。

$ mise tool jq --json
{
  "backend": "aqua:jqlang/jq",
  "description": "Command-line JSON processor",
  "installed_versions": ["1.7.1", "1.8.0"],
  "requested_versions": ["1.7.1"],
  "active_versions": ["1.7.1"],
  "config_source": {
    "type": "mise.toml",
    "path": "/path/to/project/mise.toml"
  },
  "tool_options": {
    "os": null,
    "depends": null,
    "install_env": {},
    "lazy": null,
    "lazy_bins": []
  },
  "security": [
    { "type": "checksum", "algorithm": "sha256" },
    {
      "type": "github_attestations",
      "signer_workflow": "jqlang/jq/.github/workflows/ci.yml"
    }
  ]
}

存在しないツール名を指定するとフィルタ候補が提示される

レジストリに存在しないツール名を指定すると、エラーとともに似た名前の候補が提示される。

$ mise tool notarealtool123
mise ERROR notarealtool123 not found in mise tool registry

Did you mean?
  notation
  aqua:sachaos/note

【mise】mise searchでレジストリのツールをキーワード検索する で紹介したfuzzy検索と同じ、文字を順番通りに含む名前を候補にする仕組みが使われている。