Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .cursor/rules/development.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ alwaysApply: true

- `cargo build --all-features` - build the project
- `target/debug/mise` - run the built binary
- `mise run test:e2e -- [test_filename]...` - run e2e tests
- `mise run test:e2e [test_filename]...` - run e2e tests
- `mise run test:unit` - run unit tests
- `mise run lint` - run linting
- `mise run lint-fix` - run linting and fix issues

Don't run e2e tests by trying to execute them directly, always use `mise run test:e2e -- [test_filename]...`
Don't run e2e tests by trying to execute them directly, always use `mise run test:e2e [test_filename]...`
2 changes: 1 addition & 1 deletion .cursor/rules/testing.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ alwaysApply: false

Testing and linting commands should be run via `mise run`.

- `mise run test:e2e -- [test_filename]...` executes an e2e test
- `mise run test:e2e [test_filename]...` executes an e2e test
- `mise run test:unit` executes the unit tests
- `mise run lint` runs the linting commands
- `mise run lint-fix` runs the linting commands and fixes the issues
Expand Down
26 changes: 13 additions & 13 deletions docs/dev-tools/backends/github.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ Specifies the pattern to match against release asset names. This is useful when

### Platform-specific Asset Patterns

You can specify different asset patterns for different platforms:
For different asset patterns per platform:

```toml
[tools."github:cli/cli"]
version = "latest"
platforms_linux_x64_asset_pattern = "gh_*_linux_x64.tar.gz"
platforms_macos_arm64_asset_pattern = "gh_*_macOS_arm64.tar.gz"

[tools."github:cli/cli".platforms]
linux-x64 = { asset_pattern = "gh_*_linux_x64.tar.gz" }
macos-arm64 = { asset_pattern = "gh_*_macOS_arm64.tar.gz" }
```

### `checksum`
Expand All @@ -62,13 +64,13 @@ checksum = "sha256:a1b2c3d4e5f6789..."

### Platform-specific Checksums

You can specify different checksums for different platforms:

```toml
[tools."github:cli/cli"]
version = "latest"
platforms_linux_x64_checksum = "sha256:a1b2c3d4e5f6789..."
platforms_macos_arm64_checksum = "sha256:b2c3d4e5f6789..."

[tools."github:cli/cli".platforms]
linux-x64 = { asset_pattern = "gh_*_linux_x64.tar.gz", checksum = "sha256:a1b2c3d4e5f6789..." }
macos-arm64 = { asset_pattern = "gh_*_macOS_arm64.tar.gz", checksum = "sha256:b2c3d4e5f6789..." }
```

### `size`
Expand All @@ -91,14 +93,12 @@ Number of directory components to strip when extracting archives:

### `bin_path`

Specify the directory containing binaries within the extracted archive:
Specify the directory containing binaries within the extracted archive, or where to place the downloaded file. This supports templating with `{name}`, `{version}`, `{os}`, `{arch}`, and `{ext}`:

```toml
[tools]
"github:cli/cli" = {
version = "latest",
bin_path = "bin"
}
[tools."github:cli/cli"]
version = "latest"
bin_path = "{name}-{version}/bin" # expands to cli-1.0.0/bin
```

**Binary path lookup order:**
Expand Down
29 changes: 17 additions & 12 deletions docs/dev-tools/backends/gitlab.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ asset_pattern = "gitlab-runner-linux-x64"

### Platform-specific Asset Patterns

You can specify different asset patterns for different platforms:
For different asset patterns per platform:

```toml
[tools."gitlab:gitlab-org/gitlab-runner"]
version = "latest"
platforms_linux_x64_asset_pattern = "gitlab-runner-linux-x64"
platforms_macos_arm64_asset_pattern = "gitlab-runner-macos-arm64"

[tools."gitlab:gitlab-org/gitlab-runner".platforms]
linux-x64 = { asset_pattern = "gitlab-runner-linux-x64" }
macos-arm64 = { asset_pattern = "gitlab-runner-macos-arm64" }
```

### `checksum`
Expand All @@ -63,13 +65,13 @@ checksum = "sha256:a1b2c3d4e5f6789..."

### Platform-specific Checksums

You can specify different checksums for different platforms:

```toml
[tools."gitlab:gitlab-org/gitlab-runner"]
version = "latest"
platforms_linux_x64_checksum = "sha256:a1b2c3d4e5f6789..."
platforms_macos_arm64_checksum = "sha256:b2c3d4e5f6789..."

[tools."gitlab:gitlab-org/gitlab-runner".platforms]
linux-x64 = { asset_pattern = "gitlab-runner-linux-x64", checksum = "sha256:a1b2c3d4e5f6789..." }
macos-arm64 = { asset_pattern = "gitlab-runner-macos-arm64", checksum = "sha256:b2c3d4e5f6789..." }
```

### `size`
Expand All @@ -88,8 +90,10 @@ You can specify different sizes for different platforms:
```toml
[tools."gitlab:gitlab-org/gitlab-runner"]
version = "latest"
platforms_linux_x64_size = "12345678"
platforms_macos_arm64_size = "9876543"

[tools."gitlab:gitlab-org/gitlab-runner".platforms]
linux-x64 = { size = "12345678" }
macos-arm64 = { size = "9876543" }
```

### `strip_components`
Expand All @@ -103,11 +107,12 @@ Number of directory components to strip when extracting archives:

### `bin_path`

Specify the directory containing binaries within the extracted archive:
Specify the directory containing binaries within the extracted archive, or where to place the downloaded file. This supports templating with `{name}`, `{version}`, `{os}`, `{arch}`, and `{ext}`:

```toml
[tools]
"gitlab:gitlab-org/gitlab-runner" = { version = "latest", bin_path = "bin" }
[tools."gitlab:gitlab-org/gitlab-runner"]
version = "latest"
bin_path = "{name}-{version}/bin" # expands to gitlab-runner-1.0.0/bin
```

**Binary path lookup order:**
Expand Down
41 changes: 27 additions & 14 deletions docs/dev-tools/backends/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@ Specifies the HTTP URL to download the tool from:

### Platform-specific URLs

You can specify different URLs for different platforms:
For tools that need different downloads per platform, use the table format:

```toml
[tools."http:my-tool"]
version = "1.0.0"
platforms_macos_x64_url = "https://example.com/releases/my-tool-v1.0.0-macos-x64.tar.gz"
platforms_macos_arm64_url = "https://example.com/releases/my-tool-v1.0.0-macos-arm64.tar.gz"
platforms_linux_x64_url = "https://example.com/releases/my-tool-v1.0.0-linux-x64.tar.gz"

[tools."http:my-tool".platforms]
macos-x64 = { url = "https://example.com/releases/my-tool-v1.0.0-macos-x64.tar.gz" }
macos-arm64 = { url = "https://example.com/releases/my-tool-v1.0.0-macos-arm64.tar.gz" }
linux-x64 = { url = "https://example.com/releases/my-tool-v1.0.0-linux-x64.tar.gz" }
```

> **Note:** You can use either `macos` or `darwin`, and `x64` or `amd64` for platform keys. `macos` and `x64` are preferred in documentation and examples, but all variants are accepted.
Expand All @@ -66,17 +68,14 @@ checksum = "sha256:a1b2c3d4e5f6789..."

### Platform-specific Checksums

You can specify different checksums for different platforms:

```toml
[tools."http:my-tool"]
version = "1.0.0"
platforms_macos_x64_url = "https://example.com/releases/my-tool-v1.0.0-macos-x64.tar.gz"
platforms_macos_x64_checksum = "sha256:a1b2c3d4e5f6789..."
platforms_macos_arm64_url = "https://example.com/releases/my-tool-v1.0.0-macos-arm64.tar.gz"
platforms_macos_arm64_checksum = "sha256:b2c3d4e5f6789..."
platforms_linux_x64_url = "https://example.com/releases/my-tool-v1.0.0-linux-x64.tar.gz"
platforms_linux_x64_checksum = "sha256:a1b2c3d4e5f6789..."

[tools."http:my-tool".platforms]
macos-x64 = { url = "https://example.com/releases/my-tool-v1.0.0-macos-x64.tar.gz", checksum = "sha256:a1b2c3d4e5f6789..." }
macos-arm64 = { url = "https://example.com/releases/my-tool-v1.0.0-macos-arm64.tar.gz", checksum = "sha256:b2c3d4e5f6789..." }
linux-x64 = { url = "https://example.com/releases/my-tool-v1.0.0-linux-x64.tar.gz", checksum = "sha256:c3d4e5f6789..." }
```

### `size`
Expand All @@ -90,6 +89,20 @@ url = "https://example.com/releases/my-tool-v1.0.0.tar.gz"
size = "12345678"
```

### Platform-specific Size

You can specify different sizes for different platforms:

```toml
[tools."http:my-tool"]
version = "1.0.0"

[tools."http:my-tool".platforms]
macos-x64 = { url = "https://example.com/releases/my-tool-v1.0.0-macos-x64.tar.gz", size = "12345678" }
macos-arm64 = { url = "https://example.com/releases/my-tool-v1.0.0-macos-arm64.tar.gz", size = "9876543" }
linux-x64 = { url = "https://example.com/releases/my-tool-v1.0.0-linux-x64.tar.gz", size = "11111111" }
```

### `strip_components`

Number of directory components to strip when extracting archives:
Expand All @@ -103,13 +116,13 @@ strip_components = 1

### `bin_path`

Specify the directory containing binaries within the extracted archive, or where to place the downloaded file:
Specify the directory containing binaries within the extracted archive, or where to place the downloaded file. This supports templating with `{name}`, `{version}`, `{os}`, `{arch}`, and `{ext}`:

```toml
[tools."http:my-tool"]
version = "1.0.0"
url = "https://example.com/releases/my-tool-v1.0.0.tar.gz"
bin_path = "bin"
bin_path = "{name}-{version}/bin" # expands to my-tool-1.0.0/bin
```

**Binary path lookup order:**
Expand Down
83 changes: 48 additions & 35 deletions docs/dev-tools/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,54 @@ mise supports nested configuration that cascades from broad to specific settings

Each level can override or extend the previous ones, giving you fine-grained control over tool versions across different contexts.

## Tool Options

Tool options allow you to customize how tools are installed and configured. They support nested configurations for better organization, particularly useful for platform-specific settings.

### Table Format (Recommended)

The cleanest way to specify nested options is using TOML tables:

```toml
[tools."http:my-tool"]
version = "1.0.0"

[tools."http:my-tool".platforms]
macos-x64 = { url = "https://example.com/my-tool-macos-x64.tar.gz", checksum = "sha256:abc123" }
linux-x64 = { url = "https://example.com/my-tool-linux-x64.tar.gz", checksum = "sha256:def456" }
```

### Dotted Notation

You can also use dotted notation for simpler nested configurations:

```toml
[tools."http:my-tool"]
version = "1.0.0"
platforms.macos-x64.url = "https://example.com/my-tool-macos-x64.tar.gz"
platforms.linux-x64.url = "https://example.com/my-tool-linux-x64.tar.gz"
simple_option = "value"
```

### Generic Nested Support

Any backend can use nested options for organizing complex configurations:

```toml
[tools."custom:my-backend"]
version = "1.0.0"

[tools."custom:my-backend".database]
host = "localhost"
port = 5432

[tools."custom:my-backend".cache.redis]
host = "redis.example.com"
port = 6379
```

Internally, nested options are flattened to dot notation (e.g., `platforms.macos-x64.url`, `database.host`, `cache.redis.port`) for backend access.

### Caching and Performance

mise uses intelligent caching to minimize overhead:
Expand Down Expand Up @@ -208,38 +256,3 @@ alias mx="mise x --"

Similarly, `mise run` can be used to [execute tasks](/tasks/) which will also activate the mise
environment with all of your tools.

## Tool Options

mise plugins may accept configuration in the form of tool options specified in `mise.toml`:

```toml
[tools]
# send arbitrary options to the plugin, passed as:
# MISE_TOOL_OPTS__FOO=bar
mytool = { version = '3.10', foo = 'bar' }
```

All tools can accept a `postinstall` option which is a shell command to run after the tool is installed:

```toml
[tools]
node = { version = '20', postinstall = 'corepack enable' }
```

It's yet not possible to specify this via the CLI in `mise use`. As a workaround, you can use [mise config set](/cli/config/set.html):

```shell
mise config set tools.node.version 20
mise config set tools.node.postinstall 'corepack enable'
mise install
```

### `install_env`

`install_env` is a special option that can be used to set environment variables during tool installation:

```toml
[tools]
teleport-ent = { version = "11.3.11", install_env = { TELEPORT_ENT_ARCH = "amd64" } }
```
28 changes: 25 additions & 3 deletions e2e/backend/test_http
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,15 @@ assert_contains "mise x -- hello-world" "hello world"
# Test HTTP backend with platform-specific URLs
cat <<EOF >mise.toml
[tools."http:hello-platform"]
platform_darwin_arm64_url = "https://mise.jdx.dev/test-fixtures/hello-world-1.0.0.tar.gz"
platform_darwin_amd64_url = "https://mise.jdx.dev/test-fixtures/hello-world-1.0.0.tar.gz"
platform_linux_amd64_url = "https://mise.jdx.dev/test-fixtures/hello-world-1.0.0.tar.gz"
version = "1.0.0"
bin_path = "bin"
postinstall = "chmod +x \$MISE_TOOL_INSTALL_PATH/bin/hello-world"
strip_components = 1

[tools."http:hello-platform".platforms]
darwin-arm64 = { url = "https://mise.jdx.dev/test-fixtures/hello-world-1.0.0.tar.gz" }
darwin-amd64 = { url = "https://mise.jdx.dev/test-fixtures/hello-world-1.0.0.tar.gz" }
linux-amd64 = { url = "https://mise.jdx.dev/test-fixtures/hello-world-1.0.0.tar.gz" }
EOF

mise install
Expand Down Expand Up @@ -104,3 +106,23 @@ assert_contains "cat mise.lock" 'version = "1.0.0"'
assert_contains "cat mise.lock" 'backend = "http:hello-lock"'
assert_contains "cat mise.lock" '[tools."http:hello-lock".checksums]'
assert_contains "cat mise.lock" '"hello-world-1.0.0.tar.gz" = "blake3:71f774faa03daf1a58cc3339f8c73e6557348c8e0a2f3fb8148cc26e26bad83f"'

# Test HTTP backend with URL templating
cat <<EOF >mise.toml
[tools]
"http:hello-world" = { version = "1.0.0", url = "https://mise.jdx.dev/test-fixtures/{name}-{version}.tar.gz", bin_path = "hello-world-1.0.0/bin", postinstall = "chmod +x \$MISE_TOOL_INSTALL_PATH/hello-world-1.0.0/bin/hello-world" }
EOF

mise uninstall --all && mise install
mise env
assert_contains "mise x -- hello-world" "hello world"

# Test HTTP backend with templated bin_path
cat <<EOF >mise.toml
[tools]
"http:hello-world" = { version = "1.0.0", url = "https://mise.jdx.dev/test-fixtures/hello-world-1.0.0.tar.gz", bin_path = "{name}-{version}/bin", postinstall = "chmod +x \$MISE_TOOL_INSTALL_PATH/hello-world-1.0.0/bin/hello-world" }
EOF

mise uninstall --all && mise install
mise env
assert_contains "mise x -- hello-world" "hello world"
10 changes: 10 additions & 0 deletions schema/mise.json
Original file line number Diff line number Diff line change
Expand Up @@ -1422,6 +1422,16 @@
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "object",
"additionalProperties": true
}
]
}
Expand Down
Loading
Loading