<!-- @generated by usage-cli from usage spec -->
# `mise run`

- **Usage:** `mise run [FLAGS]`
- **Aliases:** `r`
- **Source code:** [`src/cli/run.rs`](https://github.com/jdx/mise/blob/main/src/cli/run.rs)

Run task(s)

This command will run a task, or multiple tasks in parallel.
Tasks may have dependencies on other tasks or on source files.
If source is configured on a task, it will only run if the source
files have changed.

Tasks can be defined in mise.toml or as standalone scripts.
In mise.toml, tasks take this form:

```
[tasks.build]
run = "npm run build"
sources = ["src/**/*.ts"]
outputs = ["dist/**/*.js"]
```

Alternatively, tasks can be defined as standalone scripts.
These must be located in `mise-tasks`, `.mise-tasks`, `.mise/tasks`, `mise/tasks` or
`.config/mise/tasks`.
The name of the script will be the name of the tasks.

```
$ cat .mise/tasks/build<<EOF
#!/usr/bin/env bash
npm run build
EOF
$ mise run build
```

## Flags
- **`--affected`** — Run matching tasks only for projects affected by Git changes
- **`--affected-base <REV>`** — Git base revision for --affected
  Defaults to MISE_AFFECTED_BASE, CI metadata, or HEAD~1
- **`--affected-explain`** — Explain why projects and tasks were selected by --affected
- **`--affected-head <REV>`** — Git head revision for --affected
  Defaults to MISE_AFFECTED_HEAD, CI metadata, or HEAD
- **`--affected-json`** — Output affected projects and tasks as JSON without running tasks
- **`--all`** — Open the interactive selector with all tasks from the entire monorepo
- **`-c --continue-on-error`** — Continue running tasks even if one fails
- **`-C --cd <CD>`** — Change to this directory before executing the command
- **`-f --force`** — Force the tasks to run even if outputs are up to date
- **`-j --jobs <JOBS>`** — Number of tasks to run in parallel
  Values below 1 are treated as 1
  [default: 4]
  Configure with `jobs` config or `MISE_JOBS` env var

  **Environment Variable:** `MISE_JOBS`
- **`-n --dry-run`** — Don't actually run the task(s), just print them in order of execution
- **`-o --output <OUTPUT>`** — Change how tasks information is output when running tasks

  - `prefix` - Print stdout/stderr by line, prefixed with the task's label
  - `interleave` - Print directly to stdout/stderr instead of by line
  - `replacing` - Stdout is replaced each time, stderr is printed as is
  - `timed` - Only show stdout lines if they are displayed for more than 1 second
  - `keep-order` - Print stdout/stderr by line, prefixed with the task's label, but keep the order of the output
  - `quiet` - Don't show extra output
  - `silent` - Don't show any output including stdout and stderr from the task except for errors

  **Environment Variable:** `MISE_TASK_OUTPUT`
- **`-q --quiet`** — Don't show extra output

  **Environment Variable:** `MISE_QUIET`
- **`-r --raw`** — Read/write directly to stdin/stdout/stderr instead of by line
  Redactions are not applied with this option
  Configure with `raw` config or `MISE_RAW` env var
- **`-s --shell <SHELL>`** — Shell to use to run toml tasks

  Defaults to `sh -c -o errexit -o pipefail` on unix, and `cmd /c` on Windows
  Can also be set with the setting `MISE_UNIX_DEFAULT_INLINE_SHELL_ARGS` or `MISE_WINDOWS_DEFAULT_INLINE_SHELL_ARGS`
  Or it can be overridden with the `shell` property on a task.
- **`-S --silent`** — Don't show any output except for errors

  **Environment Variable:** `MISE_SILENT`
- **`-t --tool… <TOOL@VERSION>`** — Tool(s) to run in addition to what is in mise.toml files e.g.: node@20 python@3.10
- **`--allow-env… <VAR>`** — Allow specific env var through (implies --deny-env for everything else)
  Supports wildcards, e.g. --allow-env='MYAPP_*'
- **`--allow-net… <HOST>`** — Allow network to specific host (implies --deny-net for everything else)
- **`--allow-read… <PATH>`** — Allow reads from specific path (implies --deny-read for everything else)
- **`--allow-write… <PATH>`** — Allow writes to specific path (implies --deny-write for everything else)
- **`--deny-all`** — Block reads, writes, network, and env vars
- **`--deny-env`** — Block env var inheritance (only PATH, HOME, USER, SHELL, TERM, LANG pass through)
- **`--deny-net`** — Block all network access
- **`--deny-read`** — Block filesystem reads (system libs and tool dirs still accessible)
- **`--deny-write`** — Block all filesystem writes
- **`--fresh-env`** — Bypass the environment cache and recompute the environment
- **`--no-cache`** — Do not use cache on remote tasks

  **Environment Variable:** `MISE_TASK_REMOTE_NO_CACHE`
- **`--no-deps`** — Skip automatic dependency preparation
- **`--no-timings`** — Hides elapsed time after each task completes

  Default to always hide with `MISE_TASK_TIMINGS=0`
- **`--skip-deps`** — Run only the specified tasks skipping all dependencies

  **Environment Variable:** `MISE_TASK_SKIP_DEPENDS`
- **`--skip-tools`** — Skip installing tools before running tasks

  Can also be set persistently with the `task.run_auto_install` setting
  or `MISE_TASK_RUN_AUTO_INSTALL=false` env var
- **`--task-cache <TASK_CACHE>`** — Set task output cache access for this run

  - `read-write` - Read cached results and write new results
  - `read-only` - Read cached results without writing new results
  - `write-only` - Write new results without reading cached results
  - `off` - Disable task output caching
  - `local-only` - Read and write only the local cache; currently equivalent to `read-write`

  **Choices:** `read-write`, `read-only`, `write-only`, `off`, `local-only`

  **Default:** `read-write`

  **Environment Variable:** `MISE_TASK_CACHE`
- **`--task-cache-explain`** — Explain the inputs that produced each task's output cache key
- **`--task-cache-explain-json`** — Output cache-key input details as JSON Lines without running tasks
- **`--task-cache-stats`** — Report task output cache hits, restored bytes, and time saved
- **`--timeout <TIMEOUT>`** — Timeout for the task to complete
  e.g.: 30s, 5m

Examples:

```
# Runs the "lint" tasks. This needs to either be defined in mise.toml
# or as a standalone script. See the project README for more information.
$ mise run lint

# Forces the "build" tasks to run even if its sources are up-to-date.
$ mise run --force build

# Run "test" with stdin/stdout/stderr all connected to the current terminal.
# This forces `--jobs=1` to prevent interleaving of output.
$ mise run --raw test

# Runs the "lint", "test", and "check" tasks in parallel.
$ mise run lint ::: test ::: check

# Execute multiple tasks each with their own arguments.
$ mise run cmd1 arg1 arg2 ::: cmd2 arg1 arg2
```
