目录
jdx

fix(task): auto-install tools from mise.toml for file tasks (#8030)

Summary

  • When running file tasks (scripts in .mise-tasks/), tools defined in mise.toml were not auto-installed before execution because t.cf(config) returns None for file tasks
  • Adds a fallback that uses the task’s config_root to discover and install tools from the project’s config hierarchy, matching what the execution-time toolset build already does
  • Refactors collect_tools_from_config_file to delegate to a new collect_tools_from_dir method for reuse

Closes https://github.com/jdx/mise/discussions/8014

Test plan

  • mise run build compiles successfully
  • mise run lint-fix passes all linting
  • mise run test:unit — all 446 tests pass
  • Manual test: create a file task in .mise-tasks/ that uses a tool declared only in mise.toml, verify mise run auto-installs the tool before execution

🤖 Generated with Claude Code


[!NOTE] Medium Risk Changes task tool resolution behavior by expanding when project config hierarchy is consulted, which could affect tool selection/precedence for some task setups; covered by a new E2E regression test.

Overview Fixes task_run_auto_install for file tasks (scripts in mise-tasks/) by falling back to the task’s config_root to load the project config hierarchy when t.cf(config) is None, ensuring tools in mise.toml are discovered and installed before execution.

Refactors tool discovery by extracting shared logic into collect_tools_from_dir, and adds an E2E test (e2e/tasks/test_task_file_auto_install) that runs a file task requiring tiny and asserts it gets auto-installed.

Written by Cursor Bugbot for commit 7fce78f07cb5e4d98dca8392ab7804789c343a88. This will update automatically on new commits. Configure here.


Co-authored-by: Claude Opus 4.6 noreply@anthropic.com

10小时前5713次提交

mise
mise-en-place

Crates.io GitHub GitHub Workflow Status Discord

The front-end to your dev env

Getting StartedDocumentationDev ToolsEnvironmentsTasks


What is it?

Demo

The following demo shows how to install and use mise to manage multiple versions of node on the same system. Note that calling which node gives us a real path to node, not a shim.

It also shows that you can use mise to install and many other tools such as jq, terraform, or go.

demo

See demo transcript.

Quickstart

Install mise

See Getting started for more options.

$ curl https://mise.run | sh
$ ~/.local/bin/mise --version
              _                                        __
   ____ ___  (_)_______        ___  ____        ____  / /___ _________
  / __ `__ \/ / ___/ _ \______/ _ \/ __ \______/ __ \/ / __ `/ ___/ _ \
 / / / / / / (__  )  __/_____/  __/ / / /_____/ /_/ / / /_/ / /__/  __/
/_/ /_/ /_/_/____/\___/      \___/_/ /_/     / .___/_/\__,_/\___/\___/
                                            /_/                 by @jdx
2026.2.5 macos-arm64 (2026-02-05)

Hook mise into your shell (pick the right one for your shell):

# note this assumes mise is located at ~/.local/bin/mise
# which is what https://mise.run does by default
echo 'eval "$(~/.local/bin/mise activate bash)"' >> ~/.bashrc
echo 'eval "$(~/.local/bin/mise activate zsh)"' >> ~/.zshrc
echo '~/.local/bin/mise activate fish | source' >> ~/.config/fish/config.fish
echo '~/.local/bin/mise activate pwsh | Out-String | Invoke-Expression' >> ~/.config/powershell/Microsoft.PowerShell_profile.ps1

Execute commands with specific tools

$ mise exec node@24 -- node -v
mise node@24.x.x ✓ installed
v24.x.x

Install tools

$ mise use --global node@24 go@1
$ node -v
v24.x.x
$ go version
go version go1.x.x macos/arm64

See dev tools for more examples.

Manage environment variables

# mise.toml
[env]
SOME_VAR = "foo"
$ mise set SOME_VAR=bar
$ echo $SOME_VAR
bar

Note that mise can also load .env files.

Run tasks

# mise.toml
[tasks.build]
description = "build the project"
run = "echo building..."
$ mise run build
building...

See tasks for more information.

Example mise project

Here is a combined example to give you an idea of how you can use mise to manage your a project’s tools, environment, and tasks.

# mise.toml
[tools]
terraform = "1"
aws-cli = "2"

[env]
TF_WORKSPACE = "development"
AWS_REGION = "us-west-2"
AWS_PROFILE = "dev"

[tasks.plan]
description = "Run terraform plan with configured workspace"
run = """
terraform init
terraform workspace select $TF_WORKSPACE
terraform plan
"""

[tasks.validate]
description = "Validate AWS credentials and terraform config"
run = """
aws sts get-caller-identity
terraform validate
"""

[tasks.deploy]
description = "Deploy infrastructure after validation"
depends = ["validate", "plan"]
run = "terraform apply -auto-approve"

Run it with:

mise install # install tools specified in mise.toml
mise run deploy

Find more examples in the mise cookbook.

Full Documentation

See mise.jdx.dev

GitHub Issues & Discussions

Due to the volume of issue submissions mise received, using GitHub Issues became unsustainable for the project. Instead, mise uses GitHub Discussions which provide a more community-centric platform for communication and require less management on the part of the maintainers.

Please note the following discussion categories, which match how issues are often used:

Special Thanks

We’re grateful for Cloudflare’s support through Project Alexandria.

Contributors

Contributors

邀请码