Skip to content

feat(js): add Bun runtime support (bun test, run, bunx)#1374

Open
HenriqueSchroeder wants to merge 3 commits intortk-ai:developfrom
HenriqueSchroeder:feat/bun-support
Open

feat(js): add Bun runtime support (bun test, run, bunx)#1374
HenriqueSchroeder wants to merge 3 commits intortk-ai:developfrom
HenriqueSchroeder:feat/bun-support

Conversation

@HenriqueSchroeder
Copy link
Copy Markdown

Summary

Adds Bun runtime support to RTK with filters for bun test, bun run, bun install, bun build, and bunx.

What's new

  • bun test filter: 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 install filter: strips progress bars, keeps summary.
  • bun build filter: compact build output.
  • bun run <script> filter: passes through script output with error-focused filtering.
  • bunx passthrough with intelligent routing (tsc, eslint, prisma → specialized filters).
  • Discovery rules so bunx tsc, bunx eslint, etc. get rewritten to specialized RTK filters.

Token savings

All filters verified >= 60% savings against real bun test output (see tests/fixtures/bun_test_real.txt, 140 lines of real bun output with 79 pass / 2 fail).

Tests

  • Snapshot tests for all filter variants
  • Token savings assertions with real fixtures (bun_test_real.txt)
  • Clap routing tests for bun test/run/install/build subcommands and bunx

Test plan

  • cargo test — 1372 tests pass locally
  • cargo clippy --all-targets — no new warnings in bun_cmd.rs
  • cargo fmt --all --check — clean
  • Manual: rtk bun test in a Bun project verifies end-to-end filtering

Notes

Branch is based on an older point in history (pre-0.37.0). Merge conflicts with current develop (notably src/discover/rules.rs where Bun entries need to be combined with the expanded npx/pnpm exec patterns, and src/main.rs PrismaCommands derive) are expected and will need resolution before merge.

🤖 Generated with Claude Code

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 17, 2026

CLA assistant check
All committers have signed the CLA.

@pszymkowiak pszymkowiak added effort-large Plusieurs jours, nouveau module enhancement New feature or request labels Apr 17, 2026
@pszymkowiak
Copy link
Copy Markdown
Collaborator

[w] wshm · Automated triage by AI

📊 Automated PR Analysis

Type feature
🟡 Risk medium

Summary

Adds 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

  • Tests present
  • Breaking change
  • Docs updated

Analyzed automatically by wshm · This is an automated analysis, not a human review.

HenriqueSchroeder and others added 2 commits April 17, 2026 18:04
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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) <noreply@anthropic.com>
- 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) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort-large Plusieurs jours, nouveau module enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants