covtrim
v0.2.0
Published
Token-efficient coverage report compressor for LLM/agent consumption. Reads lcov, outputs compact TSV.
Readme
covtrim
Token-efficient coverage report compressor for LLM/agent consumption. Reads the standard lcov format and outputs a compact TSV summary — the same information in roughly half the tokens.
Install
npm install -g covtrim
# or from GitHub Packages (scoped registry to avoid dependency fetch failures)
npm config set @yanqd0:registry https://npm.pkg.github.com && npm install -g @yanqd0/covtrim
# or run without installing
npx covtrim <args>Usage
covtrim <lcovFile> # compress lcov → TSV summary sorted by uncovered lines
covtrim <lcovFile> --tokens # include token-quantification stats (stderr, off by default)
covtrim node [args] # run Node tests (auto-detected framework) → TSV
covtrim node --framework vitest # pick the test framework explicitly
covtrim rust [args] # run Rust tests via cargo llvm-cov → TSV
covtrim python [args] # run Python tests via pytest-cov → TSV
covtrim deno [args] # run Deno tests with coverage → TSV
covtrim --version # print version
covtrim --help # show help⚠️
covtrim node|rust|python|denoruns the project's test/coverage commands, which executes that project's code. Only run them on repositories you trust; covtrim prints the commands it will run to stderr first.
Why
- LLMs read coverage tables poorly: they mix hundreds of
test ... oklog lines with the actual table, and general-purpose token optimizers (e.g. RTK) treat the table itself as noise and drop it. - Coverage tools emit structured output (
cargo llvm-cov --json/--lcov,pytest --cov-report=lcov) but have no LLM-friendly layer on top. covtrimfills exactly that gap: a thin, format-agnostic layer that turns lcov into an actionable digest.
Planned features
- ✅ lcov parser (
SF/LF/LHfile-level counts) — implemented in 0.1.0 - ✅ Compact TSV summary sorted by uncovered lines — implemented in 0.1.0
--diff: baseline regression detection (improved / regressed / newly-uncovered)--fail-under <N>: CI gate with exit code--summary: one-line digest for LLM context ("12 modules, 3 below 90%, needs X")- Adapters: ✅
covtrim node(vitest / jest / c8 / mocha+nyc / bun / node:test) — 0.2.0; ✅covtrim rust(cargo llvm-cov); ✅covtrim python(pytest-cov); ✅covtrim deno(built-in coverage)
Status
Active development — see the CHANGELOG for the latest release.
