Skip to content

feat(install): add bun as a package manager#1005

Merged
graphite-app[bot] merged 1 commit intomainfrom
bun-pm
Mar 27, 2026
Merged

feat(install): add bun as a package manager#1005
graphite-app[bot] merged 1 commit intomainfrom
bun-pm

Conversation

@fengmk2
Copy link
Copy Markdown
Member

@fengmk2 fengmk2 commented Mar 18, 2026

Summary

Add bun as the 4th supported package manager alongside pnpm, npm, and yarn. Bun is added only as a package manager and runtime support is not planned.

Closes #557

Changes

Rust Core

  • Add Bun variant to PackageManagerType enum
  • Detect bun via packageManager field, bun.lock, bun.lockb, bunfig.toml
  • Download platform-specific native binary from @oven/bun-{os}-{arch} npm packages (including musl variants)
  • Add native binary shim support (non-Node.js wrappers for sh/cmd/ps1)
  • Add PackageManagerType::Bun arms to all 30 command files with correct flag mappings
  • Add bun to interactive package manager selection menu

Command Mappings

  • bun install with --frozen-lockfile, --production, --ignore-scripts, --lockfile-only, --omit optional, --filter
  • bun add with --dev, --peer, --optional, --exact, --global
  • bun remove, bun update (with --latest, --interactive, --recursive, --production)
  • bun outdated (with --filter, --recursive, --production, --omit optional)
  • bun why (with --depth), bun x (with --package), bun audit (with --audit-level)
  • bun pm pack (with --filename, --gzip-level), bun pm ls, bun pm cache, bun pm whoami
  • bun info for package view, bun publish for publishing
  • Unsupported commands (deprecate, fund, owner, ping, search, token) fall back to npm silently

Global CLI & NAPI

  • Add "bun" to PACKAGE_MANAGER_TOOLS in shim dispatch
  • Add "bun" => PackageManagerType::Bun in NAPI binding

TypeScript

  • Add bun to PackageManager type and selection prompt
  • Add --package-manager flag to vp create for easier testing
  • Handle bun in monorepo templates (uses package.json workspaces, not pnpm-workspace.yaml)
  • Bun catalog support: write catalog entries to root package.json with catalog: references in both dependencies and overrides
  • Migration: bun uses overrides with catalog: references (not raw versions)
  • Use bun x instead of bunx for DLX commands (better cross-platform compatibility)

Snap Tests & Output Sanitizer

  • 10 bun command snap tests (add, remove, update, outdated, why, dlx, list, publish, view, cache)
  • 1 bun monorepo creation snap test (new-vite-monorepo-bun) verifying catalog support
  • Filter unstable bun output: Resolving dependencies, Resolved, downloaded and extracted, Resolving..., Saved lockfile, (vX.Y.Z available)

RFCs

  • Update all 11 package-manager RFCs with bun command mapping tables

Ecosystem CI

  • Add bun-vite-template (React + Mantine) test case

Test plan

  • cargo test -p vite_install — 455 tests pass (18 new bun tests)
  • cargo test -p vite_global_cli — 311 tests pass
  • pnpm -F vite-plus snap-test-global bun — all 10 bun snap tests pass
  • pnpm -F vite-plus snap-test-global new-vite-monorepo-bun — catalog test passes
  • pnpm -F vite-plus snap-test-global new-vite-monorepo — existing pnpm test unaffected
  • Ecosystem CI clone verified locally for bun-vite-template
  • Windows native cmd shim tested (no command echo)
  • musl Linux binary detection tested

🤖 Generated with Claude Code

Copy link
Copy Markdown
Member Author

fengmk2 commented Mar 18, 2026


How to use the Graphite Merge Queue

Add the label auto-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@fengmk2 fengmk2 mentioned this pull request Mar 18, 2026
5 tasks
@fengmk2 fengmk2 self-assigned this Mar 18, 2026
@fengmk2 fengmk2 force-pushed the trampoline-exe-for-shims branch from 45e4691 to bc38b7a Compare March 18, 2026 01:50
@fengmk2 fengmk2 force-pushed the trampoline-exe-for-shims branch 2 times, most recently from 810d51c to efc5c42 Compare March 18, 2026 02:28
@fengmk2 fengmk2 force-pushed the trampoline-exe-for-shims branch from efc5c42 to d143fc6 Compare March 18, 2026 03:51
@fengmk2 fengmk2 force-pushed the trampoline-exe-for-shims branch from d143fc6 to 9db93c2 Compare March 18, 2026 04:01
@fengmk2 fengmk2 force-pushed the bun-pm branch 2 times, most recently from 183be48 to f551a2a Compare March 18, 2026 06:05
@fengmk2 fengmk2 force-pushed the trampoline-exe-for-shims branch from 9db93c2 to cc73dcc Compare March 18, 2026 06:05
@fengmk2 fengmk2 force-pushed the trampoline-exe-for-shims branch 2 times, most recently from 000f043 to 00ae674 Compare March 18, 2026 06:15
@fengmk2 fengmk2 force-pushed the bun-pm branch 2 times, most recently from a38d005 to c16f4d5 Compare March 18, 2026 06:49
@fengmk2 fengmk2 force-pushed the trampoline-exe-for-shims branch from 00ae674 to 5fb8073 Compare March 18, 2026 06:49
@fengmk2 fengmk2 force-pushed the bun-pm branch 2 times, most recently from ffb13dd to 3659cb9 Compare March 18, 2026 07:18
@fengmk2 fengmk2 force-pushed the trampoline-exe-for-shims branch 2 times, most recently from cfccc29 to d64cba8 Compare March 18, 2026 07:42
@fengmk2 fengmk2 force-pushed the bun-pm branch 3 times, most recently from f5c94ee to 2430298 Compare March 18, 2026 11:38
@fengmk2 fengmk2 force-pushed the trampoline-exe-for-shims branch from df57cf4 to 5534094 Compare March 18, 2026 11:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds Bun as a 4th supported package manager across Vite+ (Rust core, NAPI/binding, TypeScript CLI), updating command mappings/RFCs and adding snapshot coverage to validate behavior.

Changes:

  • Introduces PackageManagerType::Bun with detection (packageManager field + bun lock/config files) and Bun binary download/shim support.
  • Adds Bun support across CLI commands (install/add/remove/update/outdated/pm subcommands/etc.) plus TypeScript prompts/migration/template handling.
  • Updates RFC documentation and adds global snap-tests for Bun flows.

Reviewed changes

Copilot reviewed 82 out of 82 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
rfcs/why-package-command.md Documents vp why mappings and Bun behavior/limitations.
rfcs/update-package-command.md Documents vp update mappings including Bun flags.
rfcs/pm-command-group.md Documents vp pm subcommands and Bun delegation rules.
rfcs/pack-command.md Clarifies vp pm pack behavior for Bun (bun pm pack).
rfcs/outdated-package-command.md Documents vp outdated mappings including Bun support/limits.
rfcs/link-unlink-package-commands.md Documents vp link/unlink mappings including Bun.
rfcs/install-command.md Documents vp install mappings including Bun flags.
rfcs/exec-command.md Updates vp exec RFC to reference Bun equivalences.
rfcs/dlx-command.md Updates vp dlx RFC to include Bun (bun x) mapping.
rfcs/dedupe-package-command.md Notes Bun lacks dedupe; documents fallback expectations.
rfcs/add-remove-package-commands.md Documents add/remove mappings including Bun and limitations.
packages/tools/src/utils.ts Stabilizes bun CLI output in snapshot normalization.
packages/cli/src/utils/prompts.ts Adds Bun to interactive package manager selection.
packages/cli/src/types/package.ts Extends PackageManager type with bun.
packages/cli/src/migration/migrator.ts Treats Bun like npm for overrides; excludes Bun from catalog usage.
packages/cli/src/migration/bin.ts Forces reinstall with --force for npm and bun.
packages/cli/src/create/templates/monorepo.ts Treats Bun like npm workspace layout (workspaces field).
packages/cli/src/create/command.ts Uses bun x as runner; fixes npx -- passthrough condition.
packages/cli/snap-tests-global/command-why-bun/steps.json Adds Bun snap-test steps for vp why.
packages/cli/snap-tests-global/command-why-bun/snap.txt Expected output snapshot for Bun vp why.
packages/cli/snap-tests-global/command-why-bun/package.json Bun-based fixture project for vp why.
packages/cli/snap-tests-global/command-view-bun/steps.json Adds Bun snap-test steps for vp pm view.
packages/cli/snap-tests-global/command-view-bun/snap.txt Expected output snapshot for Bun vp pm view.
packages/cli/snap-tests-global/command-view-bun/package.json Bun-based fixture project for vp pm view.
packages/cli/snap-tests-global/command-update-bun/steps.json Adds Bun snap-test steps for vp update.
packages/cli/snap-tests-global/command-update-bun/snap.txt Expected output snapshot for Bun vp update.
packages/cli/snap-tests-global/command-update-bun/package.json Bun-based fixture project for vp update.
packages/cli/snap-tests-global/command-remove-bun/steps.json Adds Bun snap-test steps for vp remove.
packages/cli/snap-tests-global/command-remove-bun/snap.txt Expected output snapshot for Bun vp remove.
packages/cli/snap-tests-global/command-remove-bun/package.json Bun-based fixture project for vp remove.
packages/cli/snap-tests-global/command-publish-bun/steps.json Adds Bun snap-test steps for vp pm publish.
packages/cli/snap-tests-global/command-publish-bun/snap.txt Expected output snapshot for Bun vp pm publish.
packages/cli/snap-tests-global/command-publish-bun/package.json Bun-based fixture project for vp pm publish.
packages/cli/snap-tests-global/command-outdated-bun/steps.json Adds Bun snap-test steps for vp outdated.
packages/cli/snap-tests-global/command-outdated-bun/snap.txt Expected output snapshot for Bun vp outdated.
packages/cli/snap-tests-global/command-outdated-bun/package.json Bun-based fixture project for vp outdated.
packages/cli/snap-tests-global/command-list-bun/steps.json Adds Bun snap-test steps for vp pm list.
packages/cli/snap-tests-global/command-list-bun/snap.txt Expected output snapshot for Bun vp pm list.
packages/cli/snap-tests-global/command-list-bun/package.json Bun-based fixture project for vp pm list.
packages/cli/snap-tests-global/command-dlx-bun/steps.json Adds Bun snap-test steps for vp dlx.
packages/cli/snap-tests-global/command-dlx-bun/snap.txt Expected output snapshot for Bun vp dlx.
packages/cli/snap-tests-global/command-dlx-bun/package.json Bun-based fixture project for vp dlx.
packages/cli/snap-tests-global/command-cache-bun/steps.json Adds Bun snap-test steps for vp pm cache.
packages/cli/snap-tests-global/command-cache-bun/snap.txt Expected output snapshot for Bun vp pm cache.
packages/cli/snap-tests-global/command-cache-bun/package.json Bun-based fixture project for vp pm cache.
packages/cli/snap-tests-global/command-add-bun/steps.json Adds Bun snap-test steps for vp add.
packages/cli/snap-tests-global/command-add-bun/snap.txt Expected output snapshot for Bun vp add.
packages/cli/snap-tests-global/command-add-bun/package.json Bun-based fixture project for vp add.
packages/cli/binding/src/package_manager.rs Maps "bun" to PackageManagerType::Bun in NAPI binding.
crates/vite_install/src/shim.rs Adds native binary shim generation for bun (and similar).
crates/vite_install/src/package_manager.rs Adds Bun detection, platform package selection, and bun binary download flow.
crates/vite_install/src/commands/why.rs Adds Bun why resolution with supported/unsupported flags behavior.
crates/vite_install/src/commands/whoami.rs Adds Bun whoami mapping (bun pm whoami).
crates/vite_install/src/commands/view.rs Uses bun info when PM is Bun; otherwise npm view.
crates/vite_install/src/commands/update.rs Adds Bun update argument mapping.
crates/vite_install/src/commands/unlink.rs Adds Bun unlink mapping with recursive warning.
crates/vite_install/src/commands/token.rs Documents Bun fallback behavior (comment).
crates/vite_install/src/commands/search.rs Documents Bun fallback behavior (comment).
crates/vite_install/src/commands/run.rs Allows run to use bun binary for Bun PM.
crates/vite_install/src/commands/remove.rs Adds Bun remove mapping and unsupported flag warnings.
crates/vite_install/src/commands/rebuild.rs Disables rebuild for Bun with warning.
crates/vite_install/src/commands/publish.rs Adds Bun publish mapping + unsupported flag warnings.
crates/vite_install/src/commands/prune.rs Disables prune for Bun with warning.
crates/vite_install/src/commands/ping.rs Documents Bun fallback behavior (comment).
crates/vite_install/src/commands/pack.rs Adds Bun pack mapping to bun pm pack with option translations.
crates/vite_install/src/commands/owner.rs Documents Bun fallback behavior (comment).
crates/vite_install/src/commands/outdated.rs Adds Bun outdated mapping + unsupported option warnings.
crates/vite_install/src/commands/logout.rs Uses npm logout when PM is Bun.
crates/vite_install/src/commands/login.rs Uses npm login when PM is Bun.
crates/vite_install/src/commands/list.rs Adds Bun list mapping to bun pm ls with warnings for unsupported flags.
crates/vite_install/src/commands/link.rs Adds Bun link mapping (bun link).
crates/vite_install/src/commands/install.rs Adds Bun install argument mapping + standardizes warnings via output::warn.
crates/vite_install/src/commands/fund.rs Warns and falls back to npm fund for Bun.
crates/vite_install/src/commands/dlx.rs Adds Bun dlx runner (bun x).
crates/vite_install/src/commands/dist_tag.rs Warns and falls back to npm dist-tag for Bun.
crates/vite_install/src/commands/deprecate.rs Warns and falls back to npm deprecate for Bun.
crates/vite_install/src/commands/dedupe.rs Warns and falls back to bun install for Bun dedupe.
crates/vite_install/src/commands/config.rs Warns and falls back to npm config for Bun.
crates/vite_install/src/commands/cache.rs Adds Bun cache mapping via bun pm cache / rm.
crates/vite_install/src/commands/audit.rs Adds Bun audit mapping + behavior for unsupported flags.
crates/vite_install/src/commands/add.rs Adds Bun add mapping + unsupported flag warnings.
crates/vite_global_cli/src/shim/dispatch.rs Includes bun in package-manager tool list for project-context resolution.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fengmk2 fengmk2 changed the title feat(install): add bun as a package manager (#557) feat(install): add bun as a package manager Mar 25, 2026
fengmk2 added a commit that referenced this pull request Mar 26, 2026
Some installation methods (e.g. mise) don't add `bunx` exe to PATH on
Windows. Using `bun x` (subcommand) instead of `bunx` (separate binary)
is more reliable across platforms and calls fewer binaries.

Closes #1005
@fengmk2 fengmk2 force-pushed the bun-pm branch 2 times, most recently from d16ee75 to 46a68bb Compare March 26, 2026 06:23
@fengmk2 fengmk2 marked this pull request as ready for review March 27, 2026 02:01
@fengmk2 fengmk2 requested review from branchseer and cpojer March 27, 2026 02:01
Copy link
Copy Markdown
Member

@cpojer cpojer left a comment

Choose a reason for hiding this comment

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

Awesome!!

Copy link
Copy Markdown
Member Author

fengmk2 commented Mar 27, 2026

Need to add an e2e test for bun + vp lint type-aware https://github.com/voidzero-dev/vite-plus/actions/runs/23598882817/job/68723764147

@fengmk2
Copy link
Copy Markdown
Member Author

fengmk2 commented Mar 27, 2026

Manual Testing Plan

Prerequisites

mkdir /tmp/test-bun-vp && cd /tmp/test-bun-vp
echo '{"name":"test-bun","version":"1.0.0","packageManager":"bun@1.3.11"}' > package.json

1. Detection & Install

  • 1.1 vp install — detects bun from packageManager field, runs bun install
  • 1.2 vp install --frozen-lockfile — runs bun install --frozen-lockfile
  • 1.3 vp install --production — runs bun install --production
  • 1.4 vp install --ignore-scripts — runs bun install --ignore-scripts
  • 1.5 vp install --lockfile-only — runs bun install --lockfile-only
  • 1.6 vp install --force — runs bun install --force

2. Add & Remove

  • 2.1 vp add lodash — runs bun add lodash, adds to dependencies
  • 2.2 vp add -D typescript — runs bun add --dev typescript
  • 2.3 vp add -O sharp — runs bun add --optional sharp
  • 2.4 vp add --save-peer react — runs bun add --peer react
  • 2.5 vp add -E lodash — runs bun add --exact lodash
  • 2.6 vp remove lodash — runs bun remove lodash

3. Update & Outdated

  • 3.1 vp update — runs bun update
  • 3.2 vp update --latest — runs bun update --latest
  • 3.3 vp update --interactive — runs bun update --interactive (interactive TUI)
  • 3.4 vp outdated — runs bun outdated

4. DLX (Execute package)

  • 4.1 vp dlx cowsay hello — runs bun x cowsay hello (not bunx)
  • 4.2 vp dlx cowsay@1.6.0 hello — runs bun x cowsay@1.6.0 hello

5. Why & Audit

  • 5.1 vp why lodash — runs bun why lodash
  • 5.2 vp why lodash --depth 1 — runs bun why lodash --depth 1
  • 5.3 vp pm audit — runs bun audit (not bun pm audit)
  • 5.4 vp pm audit --audit-level high — runs bun audit --audit-level high

6. PM Subcommands

  • 6.1 vp pm list — runs bun pm ls
  • 6.2 vp pm view lodash — runs bun info lodash (not npm view)
  • 6.3 vp pm publish --dry-run — runs bun publish --dry-run
  • 6.4 vp pm pack — runs bun pm pack
  • 6.5 vp pm whoami — runs bun pm whoami
  • 6.6 vp pm cache dir — runs bun pm cache

7. Commands Delegating to npm

  • 7.1 vp pm login — falls back to npm login (no warning)
  • 7.2 vp pm logout — falls back to npm logout (no warning)
  • 7.3 vp pm owner ls lodash — falls back to npm owner ls lodash (no warning)

8. Monorepo with Catalog (vp create)

cd /tmp && rm -rf test-bun-monorepo
vp create vite:monorepo --no-interactive --package-manager bun
  • 8.1 Root package.json has "catalog" field with vite/vitest/vite-plus entries
  • 8.2 Root package.json has "overrides" with "catalog:" references
  • 8.3 Root package.json has "workspaces" array (not pnpm-workspace.yaml)
  • 8.4 Root package.json has "packageManager": "bun@..."
  • 8.5 No pnpm-workspace.yaml or .yarnrc.yml files
  • 8.6 Sub-package uses "catalog:" for vite and vite-plus

9. Detection from Files (no packageManager field)

cd /tmp && mkdir test-bun-detect && cd test-bun-detect
echo '{"name":"test"}' > package.json
  • 9.1 Create bun.lockvp install detects bun
  • 9.2 Create bun.lockb (remove bun.lock) → vp install detects bun
  • 9.3 Create bunfig.toml (remove bun.lockb) → vp install detects bun

10. Invalid Input

  • 10.1 vp create vite:monorepo --no-interactive --package-manager invalid → error: "Invalid package manager"

@fengmk2 fengmk2 force-pushed the bun-pm branch 2 times, most recently from 4572e20 to 3a85b2b Compare March 27, 2026 06:37
@graphite-app
Copy link
Copy Markdown

graphite-app bot commented Mar 27, 2026

Merge activity

  • Mar 27, 11:44 AM UTC: fengmk2 added this pull request to the Graphite merge queue.
  • Mar 27, 12:00 PM UTC: The Graphite merge queue couldn't merge this PR because it was not satisfying all requirements (Failed CI: 'done', 'CLI E2E test (namespace-profile-linux-x64-default, x86_64-unknown-linux-gnu)', 'CLI E2E test (namespace-profile-mac-default, aarch64-apple-darwin)', 'CLI E2E test (Linux x64 musl)').
  • Mar 27, 12:16 PM UTC: fengmk2 added this pull request to the Graphite merge queue.
  • Mar 27, 12:17 PM UTC: Merged by the Graphite merge queue.

graphite-app bot pushed a commit that referenced this pull request Mar 27, 2026
## Summary

Add bun as the 4th supported package manager alongside pnpm, npm, and yarn. Bun is added only as a package manager and runtime support is not planned.

Closes #557

## Changes

### Rust Core

- Add `Bun` variant to `PackageManagerType` enum
- Detect bun via `packageManager` field, `bun.lock`, `bun.lockb`, `bunfig.toml`
- Download platform-specific native binary from `@oven/bun-{os}-{arch}` npm packages (including musl variants)
- Add native binary shim support (non-Node.js wrappers for sh/cmd/ps1)
- Add `PackageManagerType::Bun` arms to all 30 command files with correct flag mappings
- Add bun to interactive package manager selection menu

### Command Mappings

- `bun install` with `--frozen-lockfile`, `--production`, `--ignore-scripts`, `--lockfile-only`, `--omit optional`, `--filter`
- `bun add` with `--dev`, `--peer`, `--optional`, `--exact`, `--global`
- `bun remove`, `bun update` (with `--latest`, `--interactive`, `--recursive`, `--production`)
- `bun outdated` (with `--filter`, `--recursive`, `--production`, `--omit optional`)
- `bun why` (with `--depth`), `bun x` (with `--package`), `bun audit` (with `--audit-level`)
- `bun pm pack` (with `--filename`, `--gzip-level`), `bun pm ls`, `bun pm cache`, `bun pm whoami`
- `bun info` for package view, `bun publish` for publishing
- Unsupported commands (deprecate, fund, owner, ping, search, token) fall back to npm silently

### Global CLI & NAPI

- Add `"bun"` to `PACKAGE_MANAGER_TOOLS` in shim dispatch
- Add `"bun" => PackageManagerType::Bun` in NAPI binding

### TypeScript

- Add `bun` to `PackageManager` type and selection prompt
- Add `--package-manager` flag to `vp create` for easier testing
- Handle bun in monorepo templates (uses `package.json` workspaces, not pnpm-workspace.yaml)
- Bun catalog support: write catalog entries to root `package.json` with `catalog:` references in both dependencies and overrides
- Migration: bun uses `overrides` with `catalog:` references (not raw versions)
- Use `bun x` instead of `bunx` for DLX commands (better cross-platform compatibility)

### Snap Tests & Output Sanitizer

- 10 bun command snap tests (add, remove, update, outdated, why, dlx, list, publish, view, cache)
- 1 bun monorepo creation snap test (`new-vite-monorepo-bun`) verifying catalog support
- Filter unstable bun output: `Resolving dependencies`, `Resolved, downloaded and extracted`, `Resolving...`, `Saved lockfile`, `(vX.Y.Z available)`

### RFCs

- Update all 11 package-manager RFCs with bun command mapping tables

### Ecosystem CI

- Add `bun-vite-template` (React + Mantine) test case

## Test plan

- [x] `cargo test -p vite_install` — 455 tests pass (18 new bun tests)
- [x] `cargo test -p vite_global_cli` — 311 tests pass
- [x] `pnpm -F vite-plus snap-test-global bun` — all 10 bun snap tests pass
- [x] `pnpm -F vite-plus snap-test-global new-vite-monorepo-bun` — catalog test passes
- [x] `pnpm -F vite-plus snap-test-global new-vite-monorepo` — existing pnpm test unaffected
- [x] Ecosystem CI clone verified locally for `bun-vite-template`
- [x] Windows native cmd shim tested (no command echo)
- [x] musl Linux binary detection tested

🤖 Generated with [Claude Code](https://claude.com/claude-code)
graphite-app bot pushed a commit that referenced this pull request Mar 27, 2026
## Summary

Add bun as the 4th supported package manager alongside pnpm, npm, and yarn. Bun is added only as a package manager and runtime support is not planned.

Closes #557

## Changes

### Rust Core

- Add `Bun` variant to `PackageManagerType` enum
- Detect bun via `packageManager` field, `bun.lock`, `bun.lockb`, `bunfig.toml`
- Download platform-specific native binary from `@oven/bun-{os}-{arch}` npm packages (including musl variants)
- Add native binary shim support (non-Node.js wrappers for sh/cmd/ps1)
- Add `PackageManagerType::Bun` arms to all 30 command files with correct flag mappings
- Add bun to interactive package manager selection menu

### Command Mappings

- `bun install` with `--frozen-lockfile`, `--production`, `--ignore-scripts`, `--lockfile-only`, `--omit optional`, `--filter`
- `bun add` with `--dev`, `--peer`, `--optional`, `--exact`, `--global`
- `bun remove`, `bun update` (with `--latest`, `--interactive`, `--recursive`, `--production`)
- `bun outdated` (with `--filter`, `--recursive`, `--production`, `--omit optional`)
- `bun why` (with `--depth`), `bun x` (with `--package`), `bun audit` (with `--audit-level`)
- `bun pm pack` (with `--filename`, `--gzip-level`), `bun pm ls`, `bun pm cache`, `bun pm whoami`
- `bun info` for package view, `bun publish` for publishing
- Unsupported commands (deprecate, fund, owner, ping, search, token) fall back to npm silently

### Global CLI & NAPI

- Add `"bun"` to `PACKAGE_MANAGER_TOOLS` in shim dispatch
- Add `"bun" => PackageManagerType::Bun` in NAPI binding

### TypeScript

- Add `bun` to `PackageManager` type and selection prompt
- Add `--package-manager` flag to `vp create` for easier testing
- Handle bun in monorepo templates (uses `package.json` workspaces, not pnpm-workspace.yaml)
- Bun catalog support: write catalog entries to root `package.json` with `catalog:` references in both dependencies and overrides
- Migration: bun uses `overrides` with `catalog:` references (not raw versions)
- Use `bun x` instead of `bunx` for DLX commands (better cross-platform compatibility)

### Snap Tests & Output Sanitizer

- 10 bun command snap tests (add, remove, update, outdated, why, dlx, list, publish, view, cache)
- 1 bun monorepo creation snap test (`new-vite-monorepo-bun`) verifying catalog support
- Filter unstable bun output: `Resolving dependencies`, `Resolved, downloaded and extracted`, `Resolving...`, `Saved lockfile`, `(vX.Y.Z available)`

### RFCs

- Update all 11 package-manager RFCs with bun command mapping tables

### Ecosystem CI

- Add `bun-vite-template` (React + Mantine) test case

## Test plan

- [x] `cargo test -p vite_install` — 455 tests pass (18 new bun tests)
- [x] `cargo test -p vite_global_cli` — 311 tests pass
- [x] `pnpm -F vite-plus snap-test-global bun` — all 10 bun snap tests pass
- [x] `pnpm -F vite-plus snap-test-global new-vite-monorepo-bun` — catalog test passes
- [x] `pnpm -F vite-plus snap-test-global new-vite-monorepo` — existing pnpm test unaffected
- [x] Ecosystem CI clone verified locally for `bun-vite-template`
- [x] Windows native cmd shim tested (no command echo)
- [x] musl Linux binary detection tested

🤖 Generated with [Claude Code](https://claude.com/claude-code)
## Summary

Add bun as the 4th supported package manager alongside pnpm, npm, and yarn. Bun is added only as a package manager and runtime support is not planned.

Closes #557

## Changes

### Rust Core

- Add `Bun` variant to `PackageManagerType` enum
- Detect bun via `packageManager` field, `bun.lock`, `bun.lockb`, `bunfig.toml`
- Download platform-specific native binary from `@oven/bun-{os}-{arch}` npm packages (including musl variants)
- Add native binary shim support (non-Node.js wrappers for sh/cmd/ps1)
- Add `PackageManagerType::Bun` arms to all 30 command files with correct flag mappings
- Add bun to interactive package manager selection menu

### Command Mappings

- `bun install` with `--frozen-lockfile`, `--production`, `--ignore-scripts`, `--lockfile-only`, `--omit optional`, `--filter`
- `bun add` with `--dev`, `--peer`, `--optional`, `--exact`, `--global`
- `bun remove`, `bun update` (with `--latest`, `--interactive`, `--recursive`, `--production`)
- `bun outdated` (with `--filter`, `--recursive`, `--production`, `--omit optional`)
- `bun why` (with `--depth`), `bun x` (with `--package`), `bun audit` (with `--audit-level`)
- `bun pm pack` (with `--filename`, `--gzip-level`), `bun pm ls`, `bun pm cache`, `bun pm whoami`
- `bun info` for package view, `bun publish` for publishing
- Unsupported commands (deprecate, fund, owner, ping, search, token) fall back to npm silently

### Global CLI & NAPI

- Add `"bun"` to `PACKAGE_MANAGER_TOOLS` in shim dispatch
- Add `"bun" => PackageManagerType::Bun` in NAPI binding

### TypeScript

- Add `bun` to `PackageManager` type and selection prompt
- Add `--package-manager` flag to `vp create` for easier testing
- Handle bun in monorepo templates (uses `package.json` workspaces, not pnpm-workspace.yaml)
- Bun catalog support: write catalog entries to root `package.json` with `catalog:` references in both dependencies and overrides
- Migration: bun uses `overrides` with `catalog:` references (not raw versions)
- Use `bun x` instead of `bunx` for DLX commands (better cross-platform compatibility)

### Snap Tests & Output Sanitizer

- 10 bun command snap tests (add, remove, update, outdated, why, dlx, list, publish, view, cache)
- 1 bun monorepo creation snap test (`new-vite-monorepo-bun`) verifying catalog support
- Filter unstable bun output: `Resolving dependencies`, `Resolved, downloaded and extracted`, `Resolving...`, `Saved lockfile`, `(vX.Y.Z available)`

### RFCs

- Update all 11 package-manager RFCs with bun command mapping tables

### Ecosystem CI

- Add `bun-vite-template` (React + Mantine) test case

## Test plan

- [x] `cargo test -p vite_install` — 455 tests pass (18 new bun tests)
- [x] `cargo test -p vite_global_cli` — 311 tests pass
- [x] `pnpm -F vite-plus snap-test-global bun` — all 10 bun snap tests pass
- [x] `pnpm -F vite-plus snap-test-global new-vite-monorepo-bun` — catalog test passes
- [x] `pnpm -F vite-plus snap-test-global new-vite-monorepo` — existing pnpm test unaffected
- [x] Ecosystem CI clone verified locally for `bun-vite-template`
- [x] Windows native cmd shim tested (no command echo)
- [x] musl Linux binary detection tested

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@graphite-app graphite-app bot merged commit 37c0432 into main Mar 27, 2026
54 checks passed
@graphite-app graphite-app bot deleted the bun-pm branch March 27, 2026 12:17
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.

feat: support bun (vite install)

4 participants