Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ All notable changes to rtk (Rust Token Killer) will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Features

* **gradle**: Add `rtk gradle` command for filtered Gradle output (85-99% token savings)
- Task-type auto-detection: COMPILE, TEST, DETEKT, HEALTH, PROTO, DEPS, GENERIC
- Global noise filters: daemon startup, task status, config cache, deprecation, downloads, build scan, etc.
- COMPILE filter: kapt/KSP noise removal, path normalization (absolute → relative)
- TEST filter: passing test removal, stack trace truncation (keep exception + assertion + user frames)
- DETEKT filter: violation grouping by rule (>3 same rule → grouped format)
- HEALTH filter: passthrough (already concise)
- PROTO filter: proto error extraction
- DEPS filter: dependency tree depth truncation (keep depth 0-1)
- Multi-task batch: per-task section splitting and filtering
- Configurable via `[gradle]` section in config.toml: `user_packages`, `extra_drop_patterns`
- Hook integration: `./gradlew` and `gradle` commands auto-rewrite to `rtk gradle`

## [0.29.0](https://github.com/rtk-ai/rtk/compare/v0.28.2...v0.29.0) (2026-03-12)


Expand Down
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ rtk gain --history | grep proxy
| pytest_cmd.rs | Pytest test runner | State machine text parser (90%+ reduction) |
| mypy_cmd.rs | Mypy type checker | Group by file/error code (80% reduction) |
| pip_cmd.rs | pip/uv package manager | JSON parsing, auto-detect uv (70-85% reduction) |
| gradle/ | Gradle commands | Task-type detection, global noise filters, compile/test/detekt/health/proto/deps/batch (85-99% reduction) |
| go_cmd.rs | Go commands | NDJSON for test, text for build/vet (80-90% reduction) |
| golangci_cmd.rs | golangci-lint | JSON parsing, group by rule (85% reduction) |
| tee.rs | Full output recovery | Save raw output to file on failure, print hint for LLM re-read |
Expand Down
11 changes: 11 additions & 0 deletions src/discover/rules.rs
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this PR should be near the bottom of the stack so the code we're adding becomes usable.

Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ pub const PATTERNS: &[&str] = &[
r"^ruff\s+(check|format)",
r"^(python\s+-m\s+)?pytest(\s|$)",
r"^(pip3?|uv\s+pip)\s+(list|outdated|install)",
// Gradle
r"^(\./)?gradlew?\s+",
// Go tooling
r"^go\s+(test|build|vet)",
r"^golangci-lint(\s|$)",
Expand Down Expand Up @@ -315,6 +317,15 @@ pub const RULES: &[RtkRule] = &[
subcmd_savings: &[("list", 75.0), ("outdated", 80.0)],
subcmd_status: &[],
},
// Gradle
RtkRule {
rtk_cmd: "rtk gradle",
rewrite_prefixes: &["./gradlew", "gradlew", "gradle"],
category: "Build",
savings_pct: 90.0,
subcmd_savings: &[],
subcmd_status: &[],
},
// Go tooling
RtkRule {
rtk_cmd: "rtk go",
Expand Down
4 changes: 2 additions & 2 deletions src/gradle/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ lazy_static! {
// Downloads + progress bars
Regex::new(r"^(Download |Downloading )").unwrap(),
Regex::new(r"^\s*\[[\s<=\->]+\]\s+\d+%").unwrap(),
// Build scan + develocity URLs
Regex::new(r"^(Publishing build scan|https://develocity\.|Upload .* build scan|Waiting for build scan)").unwrap(),
// Build scan + develocity URLs (both private develocity.* and public scans.gradle.com)
Regex::new(r"^(Publishing build scan|https://(develocity\.|scans\.gradle\.com)|Upload .* build scan|Waiting for build scan)").unwrap(),
// VFS (all VFS> lines and Virtual file system lines)
Regex::new(r"^(VFS>|Virtual file system )").unwrap(),
// Evaluation
Expand Down
5 changes: 1 addition & 4 deletions tests/fixtures/gradle/compile_failure_raw.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ VFS> > Stat: Executed stat() x 0. getUnixMode() x 0
VFS> > FileHasher: Hashed 0 files (0 bytes)
Received 12 file system events since last build while watching 1 locations
Virtual file system retained information about 125611 files, 17699 directories and 769 missing files since last build

[33mThis task referenced 450 projects. Using the focus plugin can help bring this number down.
Learn more about how you can focus by running `./focus help` from the repo root or by visiting https://example.com/focus[0m
> Task :protos:protos-core-versioning:checkKotlinGradlePluginConfigurationErrors SKIPPED
> Task :protos:protos-core-currency:checkKotlinGradlePluginConfigurationErrors SKIPPED
> Task :events:checkKotlinGradlePluginConfigurationErrors SKIPPED
Expand Down Expand Up @@ -70,6 +67,6 @@ Received 1024 file system events during the current build while watching 1 locat
Virtual file system retains information about 125611 files, 17699 directories and 769 missing files until next build

Publishing build scan...
https://develocity.example.com/s/abc123xyz
https://scans.gradle.com/s/abc123xyz

Configuration cache entry stored.
2 changes: 1 addition & 1 deletion tests/fixtures/gradle/compile_success_raw.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ VFS> > FileHasher: Hashed 28944 files (390031618 bytes)
VFS> > DirectorySnapshotter: Snapshot 7069 directory hierarchies (visited 27458 directories, 175521 files and 0 failed files)

Publishing build scan...
https://develocity.example.com/s/fagmceoq32cxc
https://scans.gradle.com/s/fagmceoq32cxc

Configuration cache entry stored.
2 changes: 1 addition & 1 deletion tests/fixtures/gradle/deps_raw.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ Received 747 file system events during the current build while watching 1 locati
Virtual file system retains information about 160976 files, 24516 directories and 3917 missing files until next build

Publishing build scan...
https://develocity.example.com/s/sosb6c6chrio6
https://scans.gradle.com/s/sosb6c6chrio6

Configuration cache entry stored.
2 changes: 1 addition & 1 deletion tests/fixtures/gradle/detekt_success_raw.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Calculating task graph as no cached configuration is available for tasks: :app-p
Loading baseline from /Users/developer/backend/app-payments/detekt-baseline.xml
Comparing against baseline...
Publishing build scan...
https://develocity.example.com/s/abc123xyz
https://scans.gradle.com/s/abc123xyz
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
For more on this, please refer to https://docs.gradle.org/8.5/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/gradle/generic_noise_raw.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ VFS> > FileHasher: Hashed 1021 files (14411852 bytes)
VFS> > DirectorySnapshotter: Snapshot 21 directory hierarchies (visited 92 directories, 1320 files and 0 failed files)

Publishing build scan...
https://develocity.example.com/s/iyn5qieotkino
https://scans.gradle.com/s/iyn5qieotkino

Configuration cache entry stored.
5 changes: 1 addition & 4 deletions tests/fixtures/gradle/test_failure_raw.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ VFS> Statistics since last build:
VFS> > Stat: Executed stat() x 0. getUnixMode() x 0
Received 18 file system events since last build while watching 1 locations
Virtual file system retained information about 125611 files, 17699 directories and 769 missing files since last build

[33mThis task referenced 606 projects. Using the focus plugin can help bring this number down.
Learn more about how you can focus by running `./focus help` from the repo root or by visiting https://example.com/focus[0m
> Task :protos:protos-core-versioning:checkKotlinGradlePluginConfigurationErrors SKIPPED
> Task :protos:protos-core-currency:checkKotlinGradlePluginConfigurationErrors SKIPPED
> Task :core:core-extensions:compileKotlin FROM-CACHE
Expand Down Expand Up @@ -114,6 +111,6 @@ Received 68536 file system events during the current build while watching 1 loca
Virtual file system retains information about 158297 files, 24428 directories and 1255 missing files until next build

Publishing build scan...
https://develocity.example.com/s/hlnkde4iznd6m
https://scans.gradle.com/s/hlnkde4iznd6m

Configuration cache entry stored.
5 changes: 1 addition & 4 deletions tests/fixtures/gradle/test_success_raw.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ VFS> > Stat: Executed stat() x 0. getUnixMode() x 0
VFS> > FileHasher: Hashed 0 files (0 bytes)
Received 18 file system events since last build while watching 1 locations
Virtual file system retained information about 125611 files, 17699 directories and 769 missing files since last build

[33mThis task referenced 606 projects. Using the focus plugin can help bring this number down.
Learn more about how you can focus by running `./focus help` from the repo root or by visiting https://example.com/focus[0m
> Task :protos:protos-core-versioning:checkKotlinGradlePluginConfigurationErrors SKIPPED
> Task :protos:protos-core-currency:checkKotlinGradlePluginConfigurationErrors SKIPPED
> Task :events:checkKotlinGradlePluginConfigurationErrors SKIPPED
Expand Down Expand Up @@ -64,6 +61,6 @@ VFS> > Stat: Executed stat() x 97. getUnixMode() x 3952
VFS> > FileHasher: Hashed 91953 files (900658944 bytes)

Publishing build scan...
https://develocity.example.com/s/hlnkde4iznd6m
https://scans.gradle.com/s/hlnkde4iznd6m

Configuration cache entry stored.