Skip to content

feat: support os/arch compound syntax in tool os filtering#9088

Merged
jdx merged 1 commit intojdx:mainfrom
RobertDeRose:feat/os-arch-filter
Apr 15, 2026
Merged

feat: support os/arch compound syntax in tool os filtering#9088
jdx merged 1 commit intojdx:mainfrom
RobertDeRose:feat/os-arch-filter

Conversation

@RobertDeRose
Copy link
Copy Markdown
Contributor

Allow entries in the os field to specify both OS and architecture using a slash separator (e.g., "macos/arm64", "linux/x64").

When an entry contains /, both the OS and architecture must match the current platform. Plain OS entries (e.g., "linux") continue to match any architecture on that OS.

OS aliases (darwin -> macos) and arch aliases (aarch64 -> arm64, x86_64/amd64 -> x64) are normalized automatically.

Example: os = ["linux", "macos/arm64"] installs on all Linux machines and on Apple Silicon Macs, but skips Intel Macs.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for filtering tools based on specific OS and architecture combinations using an os/arch syntax. The changes include updated documentation, a new end-to-end test suite, and logic within the toolset to normalize OS and architecture aliases (e.g., mapping 'darwin' to 'macos' and 'x86_64' to 'x64'). A review comment suggests documenting the 'win' alias for Windows to ensure the documentation remains consistent with the implementation.

Comment thread docs/dev-tools/index.md Outdated
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 14, 2026

Greptile Summary

This PR adds os/arch compound syntax to the os field for tool filtering, allowing entries like "macos/arm64" or "linux/x64" to target specific platform+architecture combinations. It also adds OS name aliases (darwinmacos, winwindows) and arch aliases (aarch64arm64, x86_64/amd64x64) normalized against the already-canonical values in cli::version::OS and cli::version::ARCH.

Confidence Score: 5/5

Safe to merge; implementation is correct and well-tested with only a minor test-reliability concern.

No P0 or P1 findings. The normalization logic is consistent with the existing cli::version::ARCH/OS definitions, unit tests cover all alias branches, and the e2e test covers the main scenarios. The single P2 comment is about a potentially fragile assert_fail_contains assertion that depends on the asdf plugin cache state, not a logic bug in the feature itself.

e2e/tools/test_os_arch_filter line 12 — the assert_fail_contains assertion may be fragile depending on shared plugin cache state.

Important Files Changed

Filename Overview
src/toolset/tool_request.rs Core implementation: replaces direct string containment check with normalized OS/arch matching; normalize_os and normalize_arch helpers correctly map user aliases to the canonical forms already used by cli::version::OS/ARCH.
e2e/tools/test_os_arch_filter New e2e test covering non-matching OS/arch, plain-OS match, exact OS/arch match, mixed list, and darwin alias — correct logic but the first assertion relies on the tiny asdf plugin not being pre-installed, which could be fragile in shared test environments.
docs/dev-tools/index.md Documents os/arch syntax, supported aliases, and behaviour; accurate and matches the implementation.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["is_os_supported()"] --> B{os field set?}
    B -- No --> Z["delegate to ba().is_os_supported()"]
    B -- Yes --> C["for each entry in os_list"]
    C --> D{entry contains '/'}
    D -- Yes --> E["split into os_part / arch_part"]
    E --> F["normalize_os(os_part) == current_os"]
    F -- match --> G["normalize_arch(arch_part) == current_arch"]
    G -- match --> H["matched = true"]
    D -- No --> I["normalize_os(entry) == current_os"]
    I -- match --> H
    G -- no match --> C
    F -- no match --> C
    I -- no match --> C
    H --> J{matched?}
    J -- Yes --> Z
    J -- No --> K["return false (skip tool)"]
Loading

Reviews (3): Last reviewed commit: "feat: support os/arch compound syntax in..." | Re-trigger Greptile

Comment thread e2e/tools/test_os_arch_filter
Comment thread src/toolset/tool_request.rs Outdated
Allow entries in the `os` field to specify both OS and architecture
using a slash separator (e.g., `"macos/arm64"`, `"linux/x64"`).

When an entry contains `/`, both the OS and architecture must match
the current platform. Plain OS entries (e.g., `"linux"`) continue
to match any architecture on that OS.

OS aliases (`darwin` -> `macos`) and arch aliases (`aarch64` -> `arm64`,
`x86_64`/`amd64` -> `x64`) are normalized automatically.

Example: `os = ["linux", "macos/arm64"]` installs on all Linux
machines and on Apple Silicon Macs, but skips Intel Macs.
@jdx jdx merged commit d0b0c92 into jdx:main Apr 15, 2026
35 checks passed
@RobertDeRose RobertDeRose deleted the feat/os-arch-filter branch April 15, 2026 04:10
mise-en-dev added a commit that referenced this pull request Apr 15, 2026
### 🚀 Features

- **(npm)** use --min-release-age for npm 11.10.0+ supply chain
protection by @webkaz in [#9072](#9072)
- **(registry)** add openfga by @mnm364 in
[#9084](#9084)
- **(task)** allow to set confirmation default by @roele in
[#9089](#9089)
- support os/arch compound syntax in tool os filtering by @RobertDeRose
in [#9088](#9088)

### 🐛 Bug Fixes

- **(activate)** export __MISE_EXE and resolve bare ARGV0 to absolute
path by @fru1tworld in [#9081](#9081)
- **(install)** support aliased installs sharing a backend by @jdx in
[#9093](#9093)
- **(shim)** use which_no_shims when resolving mise binary in reshim and
doctor by @kevinswiber in [#9071](#9071)
- filter empty segments in colon-separated env var parsing by @baby-joel
in [#9076](#9076)

### 📚 Documentation

- fix wrong file reference to forgejo backend implemenation by @roele in
[#9090](#9090)
- fix cli token command for token resolution by @roele in
[#9077](#9077)

### 📦 Registry

- add trzsz-go
([aqua:trzsz/trzsz-go](https://github.com/trzsz/trzsz-go)) by
@ZeroAurora in [#9083](#9083)
- add copilot
([aqua:github/copilot-cli](https://github.com/github/copilot-cli)) by
@risu729 in [#9082](#9082)

### Chore

- add AGENTS.md symlink by @jdx in
[#9094](#9094)

### New Contributors

- @kevinswiber made their first contribution in
[#9071](#9071)
- @webkaz made their first contribution in
[#9072](#9072)
- @RobertDeRose made their first contribution in
[#9088](#9088)

## 📦 Aqua Registry Updates

#### New Packages (7)

-
[`IBM-Cloud/ibm-cloud-cli-release`](https://github.com/IBM-Cloud/ibm-cloud-cli-release)
- [`max-sixty/worktrunk`](https://github.com/max-sixty/worktrunk)
- [`micelio.dev/hif`](https://github.com/micelio.dev/hif)
- [`pgplex/pgschema`](https://github.com/pgplex/pgschema)
-
[`rose-pine/rose-pine-bloom`](https://github.com/rose-pine/rose-pine-bloom)
- [`santosr2/TerraTidy`](https://github.com/santosr2/TerraTidy)
- [`trzsz/trzsz-go`](https://github.com/trzsz/trzsz-go)

#### Updated Packages (3)

- [`mvdan/sh`](https://github.com/mvdan/sh)
- [`rvben/rumdl`](https://github.com/rvben/rumdl)
- [`temporalio/temporal`](https://github.com/temporalio/temporal)
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Apr 16, 2026
## [2026.4.14](https://github.com/jdx/mise/compare/v2026.4.13..v2026.4.14) - 2026-04-15

### Chore

- bump sigstore-verification by @jdx in [#9128](jdx/mise#9128)

## [2026.4.13](https://github.com/jdx/mise/compare/v2026.4.12..v2026.4.13) - 2026-04-15

### 🐛 Bug Fixes

- **(go)** honor install_before for module versions by @mariusvniekerk in [#9097](jdx/mise#9097)
- **(vfox-plugin)** support Git URL with commit hash for mise.toml by @Oyami-Srk in [#9099](jdx/mise#9099)
- `MISE_FETCH_REMOTE_VERSIONS_CACHE` not respected by @mcncl in [#9096](jdx/mise#9096)

### 📦️ Dependency Updates

- unblock cargo-deny advisories check by @jdx in [#9112](jdx/mise#9112)

### New Contributors

- @mariusvniekerk made their first contribution in [#9097](jdx/mise#9097)
- @mcncl made their first contribution in [#9096](jdx/mise#9096)
- @Oyami-Srk made their first contribution in [#9099](jdx/mise#9099)

## [2026.4.12](https://github.com/jdx/mise/compare/v2026.4.11..v2026.4.12) - 2026-04-15

### 🚀 Features

- **(npm)** use --min-release-age for npm 11.10.0+ supply chain protection by @webkaz in [#9072](jdx/mise#9072)
- **(registry)** add openfga by @mnm364 in [#9084](jdx/mise#9084)
- **(task)** allow to set confirmation default by @roele in [#9089](jdx/mise#9089)
- support os/arch compound syntax in tool os filtering by @RobertDeRose in [#9088](jdx/mise#9088)

### 🐛 Bug Fixes

- **(activate)** export __MISE_EXE and resolve bare ARGV0 to absolute path by @fru1tworld in [#9081](jdx/mise#9081)
- **(install)** support aliased installs sharing a backend by @jdx in [#9093](jdx/mise#9093)
- **(shim)** use which_no_shims when resolving mise binary in reshim and doctor by @kevinswiber in [#9071](jdx/mise#9071)
- filter empty segments in colon-separated env var parsing by @baby-joel in [#9076](jdx/mise#9076)

### 📚 Documentation

- fix wrong file reference to forgejo backend implemenation by @roele in [#9090](jdx/mise#9090)
- fix cli token command for token resolution by @roele in [#9077](jdx/mise#9077)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants