Skip to content

fix(rewrite): route direct biome invocations to rtk biome instead of rtk lint - #2378

Closed
feliperugai wants to merge 3 commits into
rtk-ai:developfrom
feliperugai:fix/rewrite-biome-routing
Closed

feliperugai wants to merge 3 commits into
rtk-ai:developfrom
feliperugai:fix/rewrite-biome-routing

Conversation

@feliperugai

Copy link
Copy Markdown

Summary

  • biome check x / npx biome check x were rewritten to rtk lint check x — the ESLint adapter. The rewrite strips the biome token, so rtk lint falls back to ESLint; in Biome-only projects the subprocess dies in ~0.2s and rtk prints a misleading [warn] Linter process terminated abnormally (possibly out of memory).
  • Direct invocations (biome, npx biome, pnpm exec biome, pnpm dlx biome, npm exec biome, npm x biome, pnpx biome) now rewrite to rtk biome, which runs the Biome CLI through the built-in src/filters/biome.toml filter.
  • Script-runner forms (npm run biome, pnpm run biome) fall through to the generic npm/pnpm rules (rtk npm run biome / rtk pnpm run biome), preserving package.json script semantics — same philosophy as fix(rewrite): route npm lint scripts through rtk npm (biome-safe) #1491.

Refs #1489 (same root cause, npm run lint symptom). Complements #1491, which routes npm/npx lint scripts but explicitly left direct biome invocations out of scope — this PR covers that gap.

Repro (before)

$ rtk rewrite "npx biome check src/x.ts"
rtk lint check src/x.ts        # ESLint adapter — wrong tool

After

$ rtk rewrite "npx biome check src/x.ts"
rtk biome check src/x.ts       # Biome TOML filter
$ rtk rewrite "npm run biome"
rtk npm run biome              # script semantics preserved
$ rtk rewrite "npx eslint src/"
rtk lint src/                  # eslint/lint routing unchanged

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test — 2154 passed
  • Manual testing: rtk <command> output inspected
    • cargo run -- rewrite "npx biome check src/x.ts" → rtk biome check src/x.ts
    • cargo run -- rewrite "biome check --write ." → rtk biome check --write .
    • cargo run -- rewrite "npm run biome" → rtk npm run biome
    • cargo run -- rewrite "npx eslint src/" → rtk lint src/ (unchanged)
    • E2E on a real Biome project: rtk biome check src/.../review.service.ts → biome: ok
  • New unit tests: test_classify_biome, test_rewrite_biome, test_rewrite_biome_check_keeps_args, test_rewrite_biome_script_runner_goes_to_package_manager

…rtk lint

The lint rewrite rule stripped the biome token, so 'biome check x' and 'npx biome check x' became 'rtk lint check x' — the ESLint adapter. In Biome-only projects ESLint is absent and rtk printed a misleading 'Linter process terminated abnormally (possibly out of memory)' warning.

Direct invocations (biome, npx biome, pnpm exec/dlx biome, npm exec/x biome, pnpx biome) now rewrite to rtk biome, which executes the Biome CLI through the built-in biome TOML filter. Script-runner forms (npm run biome, pnpm run biome) fall through to the generic npm/pnpm rules, preserving package.json script semantics.

Refs rtk-ai#1489, complements PR rtk-ai#1491 which explicitly left direct biome invocations out of scope.
@CLAassistant

CLAassistant commented Jun 10, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@blackfyre

Copy link
Copy Markdown

I'm also interested in the resolution of this specific issue

Comment thread src/discover/registry.rs
Comment thread src/discover/rules.rs
@feliperugai
feliperugai requested a review from blackfyre August 7, 2026 00:00

@blackfyre blackfyre left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

@KuSh

KuSh commented Sep 26, 2026

Copy link
Copy Markdown
Collaborator

Closing this in favour of #3150, which fixes the same Biome routing, has an end-to-end test and green CI, and builds on current develop (this branch predates the pipeline_safety field on rules). If you prefer npm run biome to stay a package script, or rtk biome as the destination, please raise it on #3150 or reply here.

@KuSh KuSh closed this Sep 26, 2026
@KuSh KuSh added the duplicate This issue or pull request already exists label Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants