Skip to content

feat(js): add bun and bunx to command rewrite rules#1340

Open
niklasmarderx wants to merge 1 commit intortk-ai:developfrom
niklasmarderx:fix/bun-command-support
Open

feat(js): add bun and bunx to command rewrite rules#1340
niklasmarderx wants to merge 1 commit intortk-ai:developfrom
niklasmarderx:fix/bun-command-support

Conversation

@niklasmarderx
Copy link
Copy Markdown
Contributor

Fixes #1316

Bun projects use bun test, bunx tsc, and bunx vitest in place of the npm/pnpm/npx equivalents. None of these were matched by the rewrite registry, so they passed through unfiltered.

Three changes:

rules.rs — extend two existing patterns:

  • tsc: ^(npx|pnpm|bunx)?tsc so bunx tsc --noEmitrtk tsc --noEmit
  • vitest: add bunx prefix variant and a dedicated ^bun test alternative so bun test src/rtk vitest src/

utils.rs — teach detect_package_manager() to recognise bun.lockb / bun.lock and return "bun", then route package_manager_exec() to bunx when the lockfile says bun. This matches the pattern already in place for pnpm / yarn.

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test — 1228 passed, 0 failed (4 new tests)
  • New tests: test_rewrite_bunx_tsc, test_rewrite_bun_test, test_rewrite_bun_test_with_path, test_rewrite_bunx_vitest

Adds bun/bunx as recognized package manager prefixes for three
command types discovered in the wild (rtk-ai#1316):

- `bunx tsc` now rewrites to `rtk tsc`
- `bun test` / `bunx vitest` rewrite to `rtk vitest`
- `detect_package_manager()` returns "bun" when bun.lockb or bun.lock
  is present, so `package_manager_exec()` uses `bunx` as fallback

Tests added for each new rewrite path.
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.

1 participant