Skip to content

fix(bun): create bunx alongside bun.exe on Windows install#9732

Merged
jdx merged 1 commit into
jdx:mainfrom
JamBalaya56562:windows-bunx-shim
May 9, 2026
Merged

fix(bun): create bunx alongside bun.exe on Windows install#9732
jdx merged 1 commit into
jdx:mainfrom
JamBalaya56562:windows-bunx-shim

Conversation

@JamBalaya56562

@JamBalaya56562 JamBalaya56562 commented May 9, 2026

Copy link
Copy Markdown
Contributor

Summary

mise install bun on Windows extracts bun.exe from the upstream
bun-windows-x64.zip release but does not create a bunx entry, so
bunx <pkg> is broken under mise-managed bun on Windows. The unix
releases include a bunx symlink pointing at bun, and the upstream
PowerShell installer mirrors that on Windows by calling
bun completions (oven-sh/bun:src/cli/install_completions_command.zig,
installBunxSymlinkWindows). The mise core bun plugin had no
equivalent, so package.json scripts, Playwright webServer.command,
mise tasks, etc. that invoke bunx all failed.

Reproduction (before this PR)

$ mise install bun@1.3.13
$ ls (mise where bun)/bin/
bun.exe              # bunx is missing
$ bunx --version
# command not found

What changed

  • src/plugins/core/bun.rs: after extracting the Windows zip, create
    a bunx entry next to bun.exe. Try a hardlink bunx.exe -> bun.exe
    first (matches upstream — bun inspects argv[0] and switches to bunx
    mode the same way the unix symlink does), and fall back to a
    bunx.cmd shim using the literal upstream uses
    (@%~dp0bun.exe x %*) for filesystems where hardlinks fail.
  • mise's reshim picks the new entry up automatically because both
    .exe and .cmd are in the default windows_executable_extensions,
    so a bunx.exe shim lands in ~/AppData/Local/mise/shims/
    with no further plumbing.
  • e2e-win/bun.Tests.ps1: assert that the bun bin dir contains a
    bunx entry after install and that mise x bun -- bunx --version
    returns the expected version.

Test plan

  • Manual mise install bun@1.3.13 --force on Windows 11
    produces a working bunx (verified end-to-end via the mise
    shim — bunx --version returns 1.3.13).
  • cargo +stable-x86_64-pc-windows-msvc check -p mise clean
    (no new warnings).
  • cargo fmt --all -- --check clean.
  • CI passes on the Windows runner (the new bun.Tests.ps1).
  • Linux / macOS install path unchanged — existing bunx
    symlink intact (no regression; the new code is gated behind
    #[cfg(windows)]).

References

@greptile-apps

greptile-apps Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes the missing bunx on Windows after mise install bun by mirroring the step the upstream bun PowerShell installer performs: creating a bunx.exe hardlink (matching bun's argv[0] dispatch) or falling back to a quoted bunx.cmd shim for filesystems that don't support hardlinks.

  • src/plugins/core/bun.rs: Adds install_bunx_windows, called immediately after the zip is extracted on Windows. Attempts a hardlink first; on failure logs a debug message and writes a single-line bunx.cmd with the path properly quoted to handle spaces in the install directory (improvement over upstream's unquoted form).
  • e2e-win/bun.Tests.ps1: New Pester test that asserts bun.exe and at least one bunx entry exist after install and that mise x bun@1.3.13 -- bunx --version returns the installed version.

Confidence Score: 5/5

Safe to merge — the change is narrowly scoped to Windows install post-processing and is compile-time gated so it cannot regress Unix behaviour.

The new install_bunx_windows function handles both the happy path (hardlink) and a well-known fallback (cmd shim) with correct path quoting, idempotent cleanup, and informative debug logging. The Unix symlink path is completely untouched. Previous thread concerns (quoting, remove_all semantics) have been addressed in this revision.

No files require special attention.

Important Files Changed

Filename Overview
src/plugins/core/bun.rs Adds install_bunx_windows to create a bunx.exe hardlink (preferred) or bunx.cmd shim fallback after Windows zip extraction; correctly gated behind #[cfg(windows)] with no impact on Unix paths.
e2e-win/bun.Tests.ps1 New Pester test that verifies bun.exe and a bunx entry (either .exe or .cmd) are present after install, and that bunx --version returns the expected version string via mise x.

Reviews (3): Last reviewed commit: "fix(bun): create bunx alongside bun.exe ..." | Re-trigger Greptile

Comment thread src/plugins/core/bun.rs Outdated
Comment thread e2e-win/bun.Tests.ps1

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

Copy link
Copy Markdown
Contributor

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 adds Windows-specific support for the Bun plugin to ensure bunx is available after installation, either via a hard link or a .cmd shim, and includes a new E2E test. The review feedback recommends using the internal file module for safer file cleanup and notes that the Bun version used in the tests is likely invalid and should be updated.

Comment thread src/plugins/core/bun.rs Outdated
Comment thread e2e-win/bun.Tests.ps1
Comment thread src/plugins/core/bun.rs Outdated
The upstream `bun-windows-*.zip` release ships `bun.exe` only — the
`bunx` symlink that exists in the unix releases is created post-install
by the bun PowerShell installer (which calls `bun completions`, see
oven-sh/bun:src/cli/install_completions_command.zig
`installBunxSymlinkWindows`).

`mise install bun` skipped that step on Windows, leaving `bunx`
unavailable: scripts that invoke `bunx <pkg>` (npm package.json
scripts, Playwright `webServer.command`, mise tasks, etc.) all break
under mise-managed bun on Windows. This patch mirrors the upstream
shim-creation step:

* Try a hardlink `bunx.exe -> bun.exe` first (matches upstream);
  bun inspects argv[0] and switches to bunx mode, so this is
  functionally identical to the unix symlink.
* Fall back to a `bunx.cmd` shim with the same literal upstream
  uses (`@%~dp0bun.exe x %*`) for filesystems where hardlinks fail.

mise's reshim picks up the new entry automatically because `.exe`
and `.cmd` are both in the default `windows_executable_extensions`.
@JamBalaya56562 JamBalaya56562 marked this pull request as ready for review May 9, 2026 02:17
@jdx jdx merged commit 2aa4b6f into jdx:main May 9, 2026
35 checks passed
@JamBalaya56562 JamBalaya56562 deleted the windows-bunx-shim branch May 9, 2026 12:35
mise-en-dev added a commit that referenced this pull request May 10, 2026
### 🚀 Features

- add --inactive option to outdated and upgrade commands for inactive
tools by @roele in [#9640](#9640)

### 🐛 Bug Fixes

- **(aqua)** resolve bin paths for prefixed v tags by @risu729 in
[#9759](#9759)
- **(bun)** create bunx alongside bun.exe on Windows install by
@JamBalaya56562 in [#9732](#9732)
- **(dotnet)** use shared prerelease tool option by @risu729 in
[#9720](#9720)
- **(node)** use matching node in npm shim by @jdx in
[#9749](#9749)
- **(task)** resolve bash deterministically on Windows to avoid WSL
launcher by @JamBalaya56562 in
[#9750](#9750)

### 📚 Documentation

- **(secrets)** clarify age strict mode default by @risu729 in
[#9737](#9737)
- **(tasks)** add bash shebang to conditional-dependencies example by
@JamBalaya56562 in [#9747](#9747)
- update backend tool option docs by @risu729 in
[#9738](#9738)

### 📦 Registry

- remove tools with zero users by @jdx in
[#9725](#9725)
- add scalafmt
([github:scalameta/scalafmt](https://github.com/scalameta/scalafmt)) by
@pokir in [#9757](#9757)
- remove flarectl by @risu729 in
[#9756](#9756)

### Chore

- **(release)** strip pre-existing sponsor block before appending
canonical one by @jdx in [#9745](#9745)

### New Contributors

- @pokir made their first contribution in
[#9757](#9757)
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