feat(discover): rewrite bunx prisma → rtk prisma#2005
Open
YOMXXX wants to merge 1 commit into
Open
Conversation
Bun is now the primary JS runtime on a growing share of Prisma projects. `bunx prisma <sub>` is semantically equivalent to `npx prisma <sub>` — same CLI, same output format, same subcommands — but the hook didn't recognise it, so 45+ monthly invocations per reporter were flowing through the Bash hook completely unfiltered. Add `bunx` to the existing Prisma `RtkRule`: - Regex pattern: insert `|bunx` into the runner alternation so `bunx prisma …` classifies as `Supported(rtk prisma)`. - `rewrite_prefixes`: add `"bunx prisma"` so the rewrite path produces `rtk prisma …` and main.rs's filter dispatch picks up the existing `src/cmds/js/prisma_cmd.rs` handler unchanged. No new output-filtering logic is needed — the entire Bun-Prisma stack goes through the same code path as npx/pnpm/npm; only the rewrite recognition was missing. Tests: - Extend `test_classify_prisma` and `test_rewrite_prisma` with `bunx prisma` so the same per-runner invariant fence guards bun. - Add `test_rewrite_bunx_prisma_subcommands` covering the six surface shapes the reporter calls out (`migrate dev`, `migrate dev --name …`, `migrate deploy`, `migrate status`, `generate`, `db seed`, `studio`). Pins the regex against a future tweak that silently drops one shape. cargo fmt / clippy --all-targets / test --bin rtk: 1910 passed, 0 warnings. Fixes rtk-ai#1401
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bun is the primary JS runtime on a growing share of Prisma projects. `bunx prisma ` is semantically equivalent to `npx prisma ` — same CLI, same output format, same subcommands — but the hook didn't recognise it, so the reporter's 45 monthly `bunx prisma` invocations (#1401) were flowing through the Bash hook completely unfiltered.
Fix
One `RtkRule` change in `src/discover/rules.rs`:
```diff
rtk_cmd: "rtk prisma",
rewrite_prefixes: &[
```
No new output-filtering logic — the entire Bun-Prisma stack goes through the same `src/cmds/js/prisma_cmd.rs` handler as npx/pnpm/npm; only the rewrite recognition was missing.
Behaviour
`npx prisma` / `pnpm prisma` / `pnpm dlx prisma` continue to work exactly as before — same rule, just one more alternation branch.
Scope notes
Test plan
Fixes #1401