Skip to main content

Overview

RTK provides comprehensive support for the modern JavaScript/TypeScript ecosystem. Achieve 70-94% token savings through:
  • JSON parsing: Structured output from linters and compilers
  • Error grouping: Group by file, rule, or error code
  • Failures only: Show only failing tests and checks
  • Package manager detection: Auto-detects pnpm/npm/yarn/npx

Supported Tools

ESLint

Linting with rule grouping (84% savings)

TypeScript

Compiler errors grouped by file (83% savings)

Next.js

Build/dev with route metrics (87% savings)

Prettier

Format checking (70% savings)

Vitest

Test failures only (99.5% savings)

Playwright

E2E test results (94% savings)

Prisma

Schema operations (88% savings)

rtk lint

ESLint and other linters with rule-based grouping.

Usage

rtk lint [linter] [options]

Supported Linters

  • eslint (default)
  • biome
  • oxc (experimental)

Examples

$ eslint .
/path/to/project/src/components/Button.tsx
  12:15  error  'React' must be in scope when using JSX  react/react-in-jsx-scope
  18:23  error  Missing semicolon                        semi
  24:5   warning  Unexpected console statement           no-console

/path/to/project/src/utils/helpers.ts
  8:10   error  'foo' is assigned a value but never used  @typescript-eslint/no-unused-vars
  15:3   error  Missing semicolon                          semi

 5 problems (4 errors, 1 warning)
# 12+ lines, ~500 tokens

Features

  • Rule grouping: Group violations by rule ID
  • Severity levels: Separate errors and warnings
  • File locations: Show file:line for each violation
  • Exit code preservation: Safe for CI/CD

Implementation

From src/lint_cmd.rs:
// Forces JSON output
cmd.arg("-f").arg("json");

// Parses EslintResult JSON array
let results: Vec<EslintResult> = serde_json::from_str(&stdout)?;

// Groups by rule_id
let mut by_rule: HashMap<String, Vec<(String, usize)>> = HashMap::new();
for result in results {
    for msg in result.messages {
        by_rule.entry(msg.rule_id)
            .or_default()
            .push((result.file_path, msg.line));
    }
}

rtk tsc

TypeScript compiler errors grouped by file.

Usage

rtk tsc [options]

Examples

$ tsc
src/components/Button.tsx(12,15): error TS2322: Type 'string' is not assignable to type 'number'.
src/components/Button.tsx(18,23): error TS2304: Cannot find name 'React'.
src/utils/helpers.ts(8,10): error TS6133: 'foo' is declared but its value is never read.
src/utils/helpers.ts(15,3): error TS1005: ';' expected.
src/api/client.ts(42,5): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
# 5+ lines, ~300 tokens

Features

  • File grouping: Group errors by file
  • Error codes: Show TypeScript error codes (TS2322, etc.)
  • Line numbers: Compact format TScode:line
  • Context preservation: Keep error messages

Implementation

From src/tsc_cmd.rs:
// Regex pattern for tsc output
static ref TSC_ERROR: Regex = Regex::new(
    r"^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+(TS\d+):\s+(.+)$"
).unwrap();

// Groups by file
let mut errors: Vec<TsError> = Vec::new();
for line in output.lines() {
    if let Some(caps) = TSC_ERROR.captures(line) {
        errors.push(TsError {
            file: caps[1].to_string(),
            line: caps[2].parse()?,
            code: caps[5].to_string(),
            message: caps[6].to_string(),
        });
    }
}

rtk next

Next.js build and dev with route metrics.

Usage

rtk next <command> [options]

Commands

  • build: Production build
  • dev: Development server
  • start: Start production server

Examples

$ next build
 Creating an optimized production build
 Compiled successfully
 Linting and checking validity of types
 Collecting page data
 Generating static pages (12/12)
 Collecting build traces
 Finalizing page optimization

Route (app)                              Size     First Load JS
 Λ /                                    142 B          87.3 kB
 Λ /about                               156 B          87.4 kB
 Λ /blog/[slug]                         234 B          87.5 kB
 Λ /api/users                           0 B            87.2 kB
+ First Load JS shared by all            87.1 kB
 chunks/framework-abc123.js              45.2 kB
 chunks/main-def456.js                   31.8 kB
 other shared chunks (total)            10.1 kB
# 20+ lines, ~800 tokens

Features

  • Route summary: Show all routes with sizes
  • Build metrics: Total bundle size
  • Error highlighting: Preserve build errors
  • Dev mode: Compact startup messages

rtk prettier

Format checking with files-only output.

Usage

rtk prettier [options]

Examples

$ prettier --check .
Checking formatting...
src/components/Button.tsx
src/utils/helpers.ts
src/api/client.ts
All matched files use Prettier code style!
# 5+ lines, ~200 tokens

Features

  • Pass/fail summary: Single line if all formatted
  • File list: Show only files needing changes
  • Write mode: Compact confirmation on format

rtk vitest

Vitest test runner showing failures only.

Usage

rtk vitest [command] [options]

Examples

See Testing Commands for detailed examples.

Token Savings

99.5% savings on passing tests, 90% savings on failures.

rtk playwright

Playwright E2E tests with failure grouping.

Usage

rtk playwright test [options]

Examples

$ playwright test

Running 24 tests using 4 workers
  24 passed (1.2s)

To open last HTML report run:
  npx playwright show-report
# 10+ lines, ~150 tokens (all passing)

Features

  • Failures only: Skip passing tests
  • Suite grouping: Group by test file
  • Error messages: Preserve failure details
  • Tee recovery: Full output saved to file

rtk prisma

Prisma CLI without ASCII art.

Usage

rtk prisma <command> [options]

Supported Commands

  • generate: Generate Prisma Client
  • migrate dev: Create and apply migration
  • db push: Push schema changes
  • studio: Open Prisma Studio (passthrough)

Examples

$ prisma generate

██████╗ ██████╗ ██╗██████╗ ███╗   ██╗ ██████╗
██╔══██╗██╔══██╗██║██╔════╝████╗ ██║██╔══██╗
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "mydb"

Generating Prisma Client...
 Generated Prisma Client (4.8.1) to ./node_modules/@prisma/client in 823ms
# 15+ lines, ~500 tokens

Features

  • No ASCII art: Strips Prisma logo
  • Essential info: Schema path, datasource, timing
  • Migration summaries: Compact migration output
  • Error preservation: Full error messages on failure

Package Manager Detection

All JavaScript tools auto-detect package manager:
// From src/utils.rs
pub fn package_manager_exec(tool: &str) -> Command {
    if has_pnpm_lock() {
        Command::new("pnpm").arg("exec").arg(tool)
    } else if has_yarn_lock() {
        Command::new("yarn").arg("exec").arg(tool)
    } else {
        Command::new("npx").arg(tool)
    }
}

Detection Order

  1. pnpm: Check for pnpm-lock.yaml
  2. yarn: Check for yarn.lock
  3. npm: Default to npx

Exit Code Preservation

All commands preserve exit codes for CI/CD:
rtk lint || exit 1
rtk tsc || exit 1
rtk vitest run || exit 1
rtk playwright test || exit 1

Token Savings Summary

CommandStandard TokensRTK TokensSavings
eslint (5 errors)50080-84%
tsc (5 errors)30050-83%
next build800100-87%
prettier --check (all pass)20060-70%
vitest run (24 pass)3,00010-99.5%
playwright test (2 fail, 22 pass)1,50090-94%
prisma generate50060-88%

Next Steps

Python

Python development tools

Go

Go development tools