Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ digest = "0.10.7"
dotenvy = "0.15"
duct = "0.13"
homedir = "0.3"
expr-lang = "0.3"
eyre = "0.6"
filetime = "0.2"
flate2 = "1"
Expand Down
4 changes: 2 additions & 2 deletions docs/dev-tools/backends/forgejo.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,12 @@ Use `rename_exe` for archives where the binary inside has a different name than

### `bin_path`

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}`:
Specify the directory containing binaries within the extracted archive, or where to place the downloaded file. This supports Tera templating with variables like `{{ version }}`, `{{ os }}`, `{{ arch }}`, and arch aliases (`{{ darwin_os }}`, `{{ amd64_arch }}`, `{{ x86_64_arch }}`, `{{ gnu_arch }}`):

```toml
[tools."forgejo:user/repo"]
version = "latest"
bin_path = "{name}-{version}/bin" # expands to tool-1.0.0/bin
bin_path = "tool-{{ version }}/bin" # expands to tool-1.0.0/bin
```

**Binary path lookup order:**
Expand Down
4 changes: 2 additions & 2 deletions docs/dev-tools/backends/github.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,12 @@ Use `rename_exe` for archives where the binary inside has a different name than

### `bin_path`

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}`:
Specify the directory containing binaries within the extracted archive, or where to place the downloaded file. This supports Tera templating with variables like `{{ version }}`, `{{ os }}`, `{{ arch }}`, and arch aliases (`{{ darwin_os }}`, `{{ amd64_arch }}`, `{{ x86_64_arch }}`, `{{ gnu_arch }}`):

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

**Binary path lookup order:**
Expand Down
4 changes: 2 additions & 2 deletions docs/dev-tools/backends/gitlab.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,12 @@ Use `rename_exe` for archives where the binary inside has a different name than

### `bin_path`

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}`:
Specify the directory containing binaries within the extracted archive, or where to place the downloaded file. This supports Tera templating with variables like `{{ version }}`, `{{ os }}`, `{{ arch }}`, and arch aliases (`{{ darwin_os }}`, `{{ amd64_arch }}`, `{{ x86_64_arch }}`, `{{ gnu_arch }}`):

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

**Binary path lookup order:**
Expand Down
2 changes: 1 addition & 1 deletion docs/dev-tools/backends/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ Rename the downloaded binary to a specific name. This is useful when downloading
```toml
[tools."http:docker-compose"]
version = "2.29.1"
url = "https://github.com/docker/compose/releases/download/v{version}/docker-compose-linux-x86_64"
url = "https://github.com/docker/compose/releases/download/v{{ version }}/docker-compose-linux-x86_64"
bin = "docker-compose" # Rename from docker-compose-linux-x86_64 to docker-compose
```

Expand Down
18 changes: 9 additions & 9 deletions docs/dev-tools/backends/s3.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ go in `[tools]` in `mise.toml`.

### `url` (Required)

Specifies the S3 URL to download the tool from. The URL supports templating with `{version}`:
Specifies the S3 URL to download the tool from. The URL supports templating with `{{ version }}`:

```toml
[tools]
"s3:my-tool" = { version = "1.0.0", url = "s3://my-bucket/tools/my-tool-v{version}.tar.gz" }
"s3:my-tool" = { version = "1.0.0", url = "s3://my-bucket/tools/my-tool-v{{ version }}.tar.gz" }
```

### `endpoint`
Expand All @@ -61,7 +61,7 @@ Specify a custom S3-compatible endpoint for services like MinIO, DigitalOcean Sp
```toml
[tools."s3:my-tool"]
version = "1.0.0"
url = "s3://my-bucket/tools/my-tool-v{version}.tar.gz"
url = "s3://my-bucket/tools/my-tool-v{{ version }}.tar.gz"
endpoint = "http://minio.internal:9000"
```

Expand All @@ -72,7 +72,7 @@ Specify the AWS region for the S3 bucket:
```toml
[tools."s3:my-tool"]
version = "1.0.0"
url = "s3://my-bucket/tools/my-tool-v{version}.tar.gz"
url = "s3://my-bucket/tools/my-tool-v{{ version }}.tar.gz"
region = "us-west-2"
```

Expand Down Expand Up @@ -111,7 +111,7 @@ Specify the directory containing binaries within the extracted archive:
[tools."s3:my-tool"]
version = "1.0.0"
url = "s3://my-bucket/tools/my-tool-v1.0.0.tar.gz"
bin_path = "my-tool-{version}/bin"
bin_path = "my-tool-{{ version }}/bin"
```

### `format`
Expand All @@ -136,7 +136,7 @@ Fetch available versions from a JSON manifest file stored in S3:
```toml
[tools."s3:my-tool"]
version = "latest"
url = "s3://my-bucket/tools/my-tool-v{version}.tar.gz"
url = "s3://my-bucket/tools/my-tool-v{{ version }}.tar.gz"
version_list_url = "s3://my-bucket/tools/versions.json"
```

Expand All @@ -159,7 +159,7 @@ Extract versions from JSON responses using a jq-like path expression:
```toml
[tools."s3:my-tool"]
version = "latest"
url = "s3://my-bucket/tools/my-tool-v{version}.tar.gz"
url = "s3://my-bucket/tools/my-tool-v{{ version }}.tar.gz"
version_list_url = "s3://my-bucket/tools/releases.json"
version_json_path = ".[].version"
```
Expand All @@ -171,7 +171,7 @@ Discover versions by listing objects in the S3 bucket:
```toml
[tools."s3:my-tool"]
version = "latest"
url = "s3://my-bucket/tools/my-tool-v{version}.tar.gz"
url = "s3://my-bucket/tools/my-tool-v{{ version }}.tar.gz"
version_prefix = "tools/my-tool-v"
version_regex = "my-tool-v([0-9.]+)"
```
Expand All @@ -186,7 +186,7 @@ Here's a complete example using MinIO as an S3-compatible backend:
```toml
[tools."s3:my-internal-tool"]
version = "latest"
url = "s3://tools-bucket/releases/my-tool-{version}.tar.gz"
url = "s3://tools-bucket/releases/my-tool-{{ version }}.tar.gz"
endpoint = "http://minio.internal:9000"
region = "us-east-1"
version_list_url = "s3://tools-bucket/releases/versions.json"
Expand Down
63 changes: 38 additions & 25 deletions registry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -782,20 +782,20 @@ bin = "claude"
version_list_url = "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/latest"

[tools.claude.backends.options.platforms.macos-arm64]
url = "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/{version}/darwin-arm64/claude"
url = "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/{{ version }}/darwin-arm64/claude"

[tools.claude.backends.options.platforms.macos-x64]
url = "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/{version}/darwin-x64/claude"
url = "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/{{ version }}/darwin-x64/claude"

[tools.claude.backends.options.platforms.linux-arm64]
url = "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/{version}/linux-arm64/claude"
url = "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/{{ version }}/linux-arm64/claude"

[tools.claude.backends.options.platforms.linux-x64]
url = "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/{version}/linux-x64/claude"
url = "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/{{ version }}/linux-x64/claude"

[tools.claude.backends.options.platforms.windows-x64]
bin = "claude.exe"
url = "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/{version}/win32-x64/claude.exe"
url = "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/{{ version }}/win32-x64/claude.exe"

[[tools.claude.backends]]
full = "npm:@anthropic-ai/claude-code"
Expand Down Expand Up @@ -1154,9 +1154,22 @@ description = "Command-line tools for Dapr"
test = ["dapr --version", "CLI version: {{version}}"]

[tools.dart]
backends = ["asdf:mise-plugins/mise-dart", "vfox:mise-plugins/vfox-dart"]
description = "An approachable, portable, and productive language for high-quality apps on any platform"

[[tools.dart.backends]]
full = "http:dart"

[tools.dart.backends.options]
url = "https://storage.googleapis.com/dart-archive/channels/stable/release/{{ version }}/sdk/dartsdk-{{ os() }}-{{ arch() }}-release.zip"
version_list_url = "https://storage.googleapis.com/storage/v1/b/dart-archive/o?prefix=channels/stable/release/&delimiter=/"
version_regex = "channels/stable/release/(\\d+\\.\\d+\\.\\d+)/"

[[tools.dart.backends]]
full = "asdf:mise-plugins/mise-dart"

[[tools.dart.backends]]
full = "vfox:mise-plugins/vfox-dart"

[tools.dasel]
backends = ["aqua:TomWright/dasel", "asdf:asdf-community/asdf-dasel"]
description = "Select, put and delete data from JSON, TOML, YAML, XML and CSV files with a single tool. Supports conversion between formats and can be used as a Go package"
Expand Down Expand Up @@ -1316,19 +1329,19 @@ os = ["linux", "macos", "windows"]
full = "github:domeengine/dome"

[tools.dome.backends.options.platforms.macos-x64]
asset_pattern = "dome-v{version}-macosx-all.zip"
asset_pattern = "dome-v{{ version }}-macosx-all.zip"
bin_path = "dome-macosx-all"

[tools.dome.backends.options.platforms.macos-arm64]
asset_pattern = "dome-v{version}-macosx-all.zip"
asset_pattern = "dome-v{{ version }}-macosx-all.zip"
bin_path = "dome-macosx-all"

[tools.dome.backends.options.platforms.linux-x64]
asset_pattern = "dome-v{version}-linux-x64.zip"
asset_pattern = "dome-v{{ version }}-linux-x64.zip"
bin_path = "dome-linux-x64"

[tools.dome.backends.options.platforms.windows-x64]
asset_pattern = "dome-v{version}-windows-x64.zip"
asset_pattern = "dome-v{{ version }}-windows-x64.zip"
bin_path = "dome-windows-x64"

[[tools.dome.backends]]
Expand Down Expand Up @@ -1611,16 +1624,16 @@ version_json_path = ".releases[?channel=stable].version"
version_list_url = "https://storage.googleapis.com/flutter_infra_release/releases/releases_linux.json"

[tools.flutter.backends.options.platforms.macos-x64]
url = "https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_{version}-stable.zip"
url = "https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_{{ version }}-stable.zip"

[tools.flutter.backends.options.platforms.macos-arm64]
url = "https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_arm64_{version}-stable.zip"
url = "https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_arm64_{{ version }}-stable.zip"

[tools.flutter.backends.options.platforms.linux-x64]
url = "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_{version}-stable.tar.xz"
url = "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_{{ version }}-stable.tar.xz"

[tools.flutter.backends.options.platforms.windows-x64]
url = "https://storage.googleapis.com/flutter_infra_release/releases/stable/windows/flutter_windows_{version}-stable.zip"
url = "https://storage.googleapis.com/flutter_infra_release/releases/stable/windows/flutter_windows_{{ version }}-stable.zip"

[[tools.flutter.backends]]
full = "asdf:mise-plugins/mise-flutter"
Expand Down Expand Up @@ -1661,20 +1674,20 @@ test = ["flyway --version", "{{version}}"]
full = "github:flyway/flyway[version_prefix=flyway-]"

[tools.flyway.backends.options.platforms.macos-arm64]
asset_pattern = "flyway-commandline-{version}-macosx-arm64.tar.gz"
bin_path = "flyway-{version}"
asset_pattern = "flyway-commandline-{{ version }}-macosx-arm64.tar.gz"
bin_path = "flyway-{{ version }}"

[tools.flyway.backends.options.platforms.macos-x64]
asset_pattern = "flyway-commandline-{version}-macosx-x64.tar.gz"
bin_path = "flyway-{version}"
asset_pattern = "flyway-commandline-{{ version }}-macosx-x64.tar.gz"
bin_path = "flyway-{{ version }}"

[tools.flyway.backends.options.platforms.linux-x64]
asset_pattern = "flyway-commandline-{version}-linux-x64.tar.gz"
bin_path = "flyway-{version}"
asset_pattern = "flyway-commandline-{{ version }}-linux-x64.tar.gz"
bin_path = "flyway-{{ version }}"

[tools.flyway.backends.options.platforms.windows-x64]
asset_pattern = "flyway-commandline-{version}-windows-x64.zip"
bin_path = "flyway-{version}"
asset_pattern = "flyway-commandline-{{ version }}-windows-x64.zip"
bin_path = "flyway-{{ version }}"

[[tools.flyway.backends]]
full = "asdf:mise-plugins/mise-flyway"
Expand Down Expand Up @@ -4949,13 +4962,13 @@ description = "Executables, uberjar, and library to beautifully format Clojure a
full = "github:kkinnear/zprint[bin=zprint]"

[tools.zprint.backends.options.platforms.macos-arm64]
asset_pattern = "zprintma-{version}"
asset_pattern = "zprintma-{{ version }}"

[tools.zprint.backends.options.platforms.macos-x64]
asset_pattern = "zprintm-{version}"
asset_pattern = "zprintm-{{ version }}"

[tools.zprint.backends.options.platforms.linux-x64]
asset_pattern = "zprintl-{version}"
asset_pattern = "zprintl-{{ version }}"

[[tools.zprint.backends]]
full = "asdf:mise-plugins/mise-zprint"
26 changes: 17 additions & 9 deletions src/backend/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1217,15 +1217,23 @@ fn template_string_for_target(template: &str, tv: &ToolVersion, target: &Platfor
_ => arch,
};

template
.replace("{version}", version)
.replace("{os}", os)
.replace("{arch}", arch)
// Common aliases
.replace("{darwin_os}", darwin_os)
.replace("{amd64_arch}", amd64_arch)
.replace("{x86_64_arch}", x86_64_arch)
.replace("{gnu_arch}", gnu_arch)
// Use Tera rendering for templates
let mut ctx = crate::tera::BASE_CONTEXT.clone();
ctx.insert("version", version);
ctx.insert("os", os);
ctx.insert("arch", arch);
ctx.insert("darwin_os", darwin_os);
ctx.insert("amd64_arch", amd64_arch);
ctx.insert("x86_64_arch", x86_64_arch);
ctx.insert("gnu_arch", gnu_arch);

match crate::tera::get_tera(None).render_str(template, &ctx) {
Ok(rendered) => rendered,
Err(e) => {
warn!("Failed to render template '{}': {}", template, e);
template.to_string()
}
}
}

#[cfg(test)]
Expand Down
3 changes: 2 additions & 1 deletion src/backend/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,9 @@ impl HttpBackend {

let regex = opts.get("version_regex").map(|s| s.as_str());
let json_path = opts.get("version_json_path").map(|s| s.as_str());
let version_expr = opts.get("version_expr").map(|s| s.as_str());

version_list::fetch_versions(&url, regex, json_path).await
version_list::fetch_versions(&url, regex, json_path, version_expr).await
Comment thread
cursor[bot] marked this conversation as resolved.
}
}

Expand Down
8 changes: 7 additions & 1 deletion src/backend/s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,14 @@ impl S3Backend {
let content = file::read_to_string(&tmp_path)?;
let regex = Self::get_opt(opts, "version_regex");
let json_path = Self::get_opt(opts, "version_json_path");
let version_expr = Self::get_opt(opts, "version_expr");

version_list::parse_version_list(&content, regex.as_deref(), json_path.as_deref())
version_list::parse_version_list(
&content,
regex.as_deref(),
json_path.as_deref(),
version_expr.as_deref(),
)
}

/// Fetch versions by listing S3 objects
Expand Down
14 changes: 12 additions & 2 deletions src/backend/static_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,18 @@ pub fn list_available_platforms_with_key(opts: &ToolVersionOptions, key_type: &s
}

pub fn template_string(template: &str, tv: &ToolVersion) -> String {
let version = &tv.version;
template.replace("{version}", version)
// Use Tera rendering for templates
// Supports {{ version }}, {{ os() }}, {{ arch() }}, etc.
let mut ctx = crate::tera::BASE_CONTEXT.clone();
ctx.insert("version", &tv.version);

match crate::tera::get_tera(None).render_str(template, &ctx) {
Ok(rendered) => rendered,
Err(e) => {
warn!("Failed to render template '{}': {}", template, e);
template.to_string()
}
}
Comment thread
cursor[bot] marked this conversation as resolved.
}

pub fn get_filename_from_url(url_str: &str) -> String {
Expand Down
Loading
Loading