feat(js): add Bun runtime support (bun test, run, bunx)#1374
feat(js): add Bun runtime support (bun test, run, bunx)#1374HenriqueSchroeder wants to merge 16 commits intortk-ai:developfrom
Conversation
📊 Automated PR Analysis
SummaryAdds comprehensive Bun runtime support to RTK, including filters for bun test, bun install, bun build, bun run, and bunx commands. Implements intelligent routing for bunx to specialized filters (tsc, eslint, prisma) and includes snapshot tests, token savings assertions, and clap routing tests. Review Checklist
Analyzed automatically by wshm · This is an automated analysis, not a human review. |
607535b to
18e6b1e
Compare
| if trimmed.starts_with("Resolving") | ||
| || trimmed.starts_with("Downloading") | ||
| || trimmed.starts_with("Extracting") | ||
| { |
There was a problem hiding this comment.
Could you test bun in non English environment? Something like LC_ALL=de_DE.UTF-8 to see if bun has i18n output.
If that's the case, we should run it with env("LC_ALL", "C") to ensure consistent output whatever user's config
| rtk_cmd: "rtk tsc", | ||
| rewrite_prefixes: &[ | ||
| "bun x tsc", | ||
| "bunx tsc", |
There was a problem hiding this comment.
Missing bun tsc and bun run tsc
Same goes for other commands
| }, | ||
| /// Passthrough: runs any unsupported bun subcommand directly | ||
| #[command(external_subcommand)] | ||
| Other(Vec<OsString>), |
There was a problem hiding this comment.
the rewrite should take care of most cases but you should special case bun x in case a tool directly call it
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Bun prints (pass)/(fail) when stdout is piped (RTK's case) but the initial filter only matched TTY ✓/✗ markers. Rewrote filter_bun_test to: - handle both TTY and piped formats - buffer lines preceding a fail marker (Bun emits error context before the marker) and flush them on match - skip the trailing "N tests failed:" summary (duplicates already captured failures) Replaced synthetic fixtures with real bun test output and added bun_test_real.txt to guard the >=60% token savings target under real-world conditions. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- README.md: added rtk bun test (Test Runners), rtk bun build + rtk bunx (Build & Lint), rtk bun install + rtk bun run (Package Managers) - docs/guide/what-rtk-covers.md: added bun test/install/build/run/bunx rows to the JavaScript / TypeScript table Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…, prettier, next, playwright
… duplication in route_bunx
23184d4 to
d6493bb
Compare
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Summary
Adds Bun runtime support to RTK with filters for
bun test,bun run,bun install,bun build, andbunx.What's new
bun testfilter: strips passing tests, keeps failures with error context, compact summary. Handles both TTY (✓/✗) and piped ((pass)/(fail)) formats. Buffers lines preceding a fail marker since Bun prints error context before the marker, then flushes them on match.bun installfilter: strips progress bars, keeps summary.bun buildfilter: compact build output.bun run <script>filter: passes through script output with error-focused filtering.bunxpassthrough with intelligent routing (tsc, eslint, prisma → specialized filters).bunx tsc,bunx eslint, etc. get rewritten to specialized RTK filters.Token savings
All filters verified
>= 60%savings against realbun testoutput (seetests/fixtures/bun_test_real.txt, 140 lines of real bun output with 79 pass / 2 fail).Tests
bun_test_real.txt)bun test/run/install/buildsubcommands andbunxTest plan
cargo test— 1372 tests pass locallycargo clippy --all-targets— no new warnings inbun_cmd.rscargo fmt --all --check— cleanrtk bun testin a Bun project verifies end-to-end filteringNotes
Branch is based on an older point in history (pre-0.37.0). Merge conflicts with current
develop(notablysrc/discover/rules.rswhere Bun entries need to be combined with the expandednpx/pnpm execpatterns, andsrc/main.rsPrismaCommands derive) are expected and will need resolution before merge.🤖 Generated with Claude Code