Skip to content
Open
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
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,26 @@ 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]

### Added
- `rtk gradlew`: Android Gradle wrapper with streaming compact output for build,
test, connected (instrumented) tests, and lint. Token savings: 70–85% depending
on task type. Verbose flags (`--stacktrace`, `--info`, `--debug`) bypass filtering.
Windows support via `gradlew.bat`.
- `rtk gradlew clean/installDebug/uninstallDebug/check`: Additional Gradle task
support — clean, install/uninstall to device, and full check all use the build
filter for consistent noise reduction.
- `rtk gradlew dependencies`: Dependency tree filter showing only top-level
dependencies per configuration (~60% token savings).
- Gradle fallback: When `./gradlew` wrapper is not present, rtk automatically
falls back to system `gradle` command.
- Progress spinner: Long-running Gradle builds show a real-time spinner on stderr
with elapsed time and current task name. Zero stdout contamination — only
appears in interactive terminals.
- Hook rewrites `./gradlew` and bare `gradle` commands to `rtk gradlew`.
- CLI accepts `rtk ./gradlew` and `rtk gradle` as aliases for `rtk gradlew`.

## [0.28.2](https://github.com/rtk-ai/rtk/compare/v0.28.1...v0.28.2) (2026-03-10)


Expand All @@ -29,7 +49,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* TOML Part 1 — filter DSL engine + 14 built-in filters ([#349](https://github.com/rtk-ai/rtk/issues/349)) ([adda253](https://github.com/rtk-ai/rtk/commit/adda2537be1fe69625ac280f15e8c8067d08c711))
* TOML Part 2 — user-global config, shadow warning, rtk init templates, 4 new built-in filters ([#351](https://github.com/rtk-ai/rtk/issues/351)) ([926e6a0](https://github.com/rtk-ai/rtk/commit/926e6a0dd4512c4cbb0f5ac133e60cb6134a3174))
* TOML Part 3 — 15 additional built-in filters (ping, rsync, dotnet, swift, shellcheck, hadolint, poetry, composer, brew, df, ps, systemctl, yamllint, markdownlint, uv) ([#386](https://github.com/rtk-ai/rtk/issues/386)) ([b71a8d2](https://github.com/rtk-ai/rtk/commit/b71a8d24e2dbd3ff9bb423c849638bfa23830c0b))

## [0.27.2](https://github.com/rtk-ai/rtk/compare/v0.27.1...v0.27.2) (2026-03-06)


Expand Down
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ rtk gain --history | grep proxy
| pip_cmd.rs | pip/uv package manager | JSON parsing, auto-detect uv (70-85% 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) |
| gradlew_cmd.rs | Android Gradle wrapper | Status+errors only for build/clean/install/check (70%+), failures for tests (85%+), grouped violations for lint (75%+), top-level deps for dependencies (60%+); streams live with progress spinner; gradle fallback |
| tee.rs | Full output recovery | Save raw output to file on failure, print hint for LLM re-read |
| utils.rs | Shared utilities | Package manager detection, common formatting |
| discover/ | Claude Code history analysis | Scan JSONL sessions, classify commands, report missed savings |
Expand Down
37 changes: 37 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ hostname = "0.4"
toml = "0.8"

[dev-dependencies]
insta = "1.40"

[profile.release]
opt-level = 3
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,25 @@ rtk discover --all --since 7 # All projects, last 7 days
-v, --verbose # Increase verbosity (-v, -vv, -vvv)
```

### Gradle
```bash
# Build
rtk gradlew assembleDebug # Status + errors only, streams live (75% reduction)
rtk gradlew bundleRelease # Same filter for bundle tasks
rtk gradlew clean # Strips task noise (70% reduction)
rtk gradlew installDebug # Install to device (75% reduction)
rtk gradlew uninstallDebug # Uninstall from device (75% reduction)
rtk gradlew check # Full check (test + lint) (70% reduction)

# Tests
rtk gradlew testDebugUnitTest # Unit tests — failures only (85% reduction)
rtk gradlew connectedDebugAndroidTest # Instrumented tests — failures + device summary (80% reduction)

# Analysis
rtk gradlew lint # Violations grouped by file (75% reduction)
rtk gradlew dependencies # Top-level deps only (60% reduction)
```

## Examples

**Directory listing:**
Expand Down Expand Up @@ -300,6 +319,7 @@ After install, **restart Claude Code**.
| `pip list/install` | `rtk pip ...` |
| `go test/build/vet` | `rtk go ...` |
| `golangci-lint` | `rtk golangci-lint` |
| `./gradlew`/`gradle` | `rtk gradlew ...` |
| `docker ps/images/logs` | `rtk docker ...` |
| `kubectl get/logs` | `rtk kubectl ...` |
| `curl` | `rtk curl` |
Expand Down
92 changes: 92 additions & 0 deletions src/discover/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1641,6 +1641,98 @@ mod tests {
);
}

// --- Gradle ---

#[test]
fn test_classify_gradlew() {
assert!(matches!(
classify_command("./gradlew assembleDebug"),
Classification::Supported {
rtk_equivalent: "rtk gradlew",
..
}
));
}

#[test]
fn test_classify_gradlew_no_dot_slash() {
assert!(matches!(
classify_command("gradlew build"),
Classification::Supported {
rtk_equivalent: "rtk gradlew",
..
}
));
}

#[test]
fn test_classify_gradlew_bat() {
assert!(matches!(
classify_command("gradlew.bat clean"),
Classification::Supported {
rtk_equivalent: "rtk gradlew",
..
}
));
}

#[test]
fn test_classify_gradle() {
assert!(matches!(
classify_command("gradle build"),
Classification::Supported {
rtk_equivalent: "rtk gradlew",
..
}
));
}

#[test]
fn test_rewrite_gradlew() {
assert_eq!(
rewrite_command("./gradlew assembleDebug", &[]),
Some("rtk gradlew assembleDebug".into())
);
}

#[test]
fn test_rewrite_gradlew_no_dot_slash() {
assert_eq!(
rewrite_command("gradlew build", &[]),
Some("rtk gradlew build".into())
);
}

#[test]
fn test_rewrite_gradlew_bat() {
assert_eq!(
rewrite_command("gradlew.bat clean", &[]),
Some("rtk gradlew clean".into())
);
}

#[test]
fn test_rewrite_gradle() {
assert_eq!(
rewrite_command("gradle build", &[]),
Some("rtk gradlew build".into())
);
}

#[test]
fn test_rewrite_gradlew_test_savings() {
// Verify test subcommand gets higher savings via classify
assert_eq!(
classify_command("./gradlew test"),
Classification::Supported {
rtk_equivalent: "rtk gradlew",
category: "Build",
estimated_savings_pct: 85.0,
status: RtkStatus::Existing,
}
);
}

// --- Compound operator edge cases ---

#[test]
Expand Down
11 changes: 11 additions & 0 deletions src/discover/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ pub const PATTERNS: &[&str] = &[
// Go tooling
r"^go\s+(test|build|vet)",
r"^golangci-lint(\s|$)",
// Gradle
r"^(?:\./gradlew|gradlew\.bat|gradlew|gradle)(?:\s+(test|build|clean|assemble\w*|install\w*|check|lint\w*|dependencies))?(\s|$)",
// AWS CLI
r"^aws\s+",
// PostgreSQL
Expand Down Expand Up @@ -299,6 +301,15 @@ pub const RULES: &[RtkRule] = &[
subcmd_savings: &[],
subcmd_status: &[],
},
// Gradle
RtkRule {
rtk_cmd: "rtk gradlew",
rewrite_prefixes: &["./gradlew", "gradlew.bat", "gradlew", "gradle"],
category: "Build",
savings_pct: 70.0,
subcmd_savings: &[("test", 85.0)],
subcmd_status: &[],
},
// AWS CLI
RtkRule {
rtk_cmd: "rtk aws",
Expand Down
Loading