<!-- @generated by usage-cli from usage spec -->
# `mise generate tool-stub`

- **Usage**: `mise generate tool-stub [FLAGS] <OUTPUT>`
- **Effect**: modifies state
- **Source code**: [`src/cli/generate/tool_stub.rs`](https://github.com/jdx/mise/blob/main/src/cli/generate/tool_stub.rs)

Generate a tool stub for HTTP-based tools

This command generates tool stubs that can automatically download and execute
tools from HTTP URLs. It can detect checksums, file sizes, and binary paths
automatically by downloading and analyzing the tool.

When generating stubs with platform-specific URLs, the command will append new
platforms to existing stub files rather than overwriting them. This allows you
to incrementally build cross-platform tool stubs.

## Arguments

### `<OUTPUT>`

Output file path for the tool stub

## Flags

### `-b --bin <BIN>`

Binary path within the extracted archive

If not specified and the archive is downloaded, will auto-detect the most likely binary

### `--bootstrap`

Wrap stub in a bootstrap script that installs mise if not already present

When enabled, generates a bash script that:
1. Checks if mise is installed at the expected path
2. If not, downloads and installs mise using the embedded installer
3. Executes the tool stub using mise

### `--bootstrap-version <BOOTSTRAP_VERSION>`

Specify mise version for the bootstrap script

By default, uses the latest version from the install script.
Use this to pin to a specific version (e.g., "2025.1.0").

### `--checksum-algorithm <CHECKSUM_ALGORITHM>`

Checksum algorithm to use when downloading artifacts

Accepts `blake3` or `sha256` and defaults to `blake3`. Cannot be used with `--lock` or `--skip-download` because those modes do not calculate checksums.

**Choices:**

- `blake3`
- `sha256`

**Default:** `blake3`

### `--fetch`

Fetch checksums and sizes for an existing tool stub file

This reads an existing stub file and fills in any missing checksum/size fields by downloading the files. URLs must already be present in the stub.

### `--http <HTTP>`

HTTP backend type to use

**Default:** `http`

### `--lock`

Resolve and embed lockfile data (exact version + platform URLs/checksums) into an existing stub file for reproducible installs without runtime API calls

### `--platform-bin… <PLATFORM_BIN>`

Platform-specific binary paths in the format platform:path

Examples: --platform-bin windows-x64:tool.exe --platform-bin linux-x64:bin/tool

### `--platform-url… <PLATFORM_URL>`

Platform-specific URLs in the format platform:url or just url (auto-detect platform)

When the output file already exists, new platforms will be appended to the existing platforms table. Existing platform URLs will be updated if specified again.

If only a URL is provided (without platform:), the platform will be automatically detected from the URL filename.

Examples: --platform-url linux-x64:https://... --platform-url <https://nodejs.org/dist/v22.17.1/node-v22.17.1-darwin-arm64.tar.gz>

### `--skip-download`

Skip downloading for checksum and binary path detection (faster but less informative)

### `-u --url <URL>`

URL for downloading the tool

Example: <https://github.com/owner/repo/releases/download/v2.0.0/tool-linux-x64.tar.gz>

### `--version <VERSION>`

Version of the tool

**Default:** `latest`

Examples:

```
Generate a tool stub for a single URL:
$ mise generate tool-stub ./bin/gh --url "https://github.com/cli/cli/releases/download/v2.96.0/gh_2.96.0_linux_amd64.tar.gz"

Generate a tool stub with platform-specific URLs:
$ mise generate tool-stub ./bin/rg \
    --platform-url linux-x64:https://github.com/BurntSushi/ripgrep/releases/download/14.0.3/ripgrep-14.0.3-x86_64-unknown-linux-musl.tar.gz \
    --platform-url darwin-arm64:https://github.com/BurntSushi/ripgrep/releases/download/14.0.3/ripgrep-14.0.3-aarch64-apple-darwin.tar.gz

Append additional platforms to an existing stub:
$ mise generate tool-stub ./bin/rg \
    --platform-url linux-x64:https://example.com/rg-linux.tar.gz
$ mise generate tool-stub ./bin/rg \
    --platform-url darwin-arm64:https://example.com/rg-darwin.tar.gz
# The stub now contains both platforms

Use auto-detection for platform from URL:
$ mise generate tool-stub ./bin/node \
    --platform-url https://nodejs.org/dist/v22.17.1/node-v22.17.1-darwin-arm64.tar.gz
# Platform 'macos-arm64' will be auto-detected from the URL

Generate with platform-specific binary paths:
$ mise generate tool-stub ./bin/tool \
    --platform-url linux-x64:https://example.com/tool-linux.tar.gz \
    --platform-url windows-x64:https://example.com/tool-windows.zip \
    --platform-bin windows-x64:tool.exe

Generate without downloading (faster):
$ mise generate tool-stub ./bin/tool --url "https://example.com/tool.tar.gz" --skip-download

Fetch checksums for an existing stub:
$ mise generate tool-stub ./bin/jq --fetch
# This will read the existing stub and download files to fill in any missing checksums/sizes

Generate a bootstrap stub that installs mise if needed:
$ mise generate tool-stub ./bin/tool --url "https://example.com/tool.tar.gz" --bootstrap
# The stub will check for mise and install it automatically before running the tool

Generate a bootstrap stub with a pinned mise version:
$ mise generate tool-stub ./bin/tool --url "https://example.com/tool.tar.gz" --bootstrap --bootstrap-version 2025.1.0

Lock an existing tool stub with pinned version and platform URLs/checksums:
$ mise generate tool-stub ./bin/node --lock

Bump the version in a locked stub:
$ mise generate tool-stub ./bin/node --lock --version 22
# Resolves the latest node 22.x, pins it, and updates platform URLs/checksums
```
