Skip to content

Commit 80da844

Browse files
committed
feat(mvn): add Maven (Java) filter module — test, compile, checkstyle:check, dependency:tree
Adds `rtk mvn` with four filters: - `mvn test` — state machine parser (Preamble → Testing → Summary → Done) that accumulates counts across T E S T S sections for multi-module builds and surefire+failsafe (`mvn verify`). - `mvn compile` — line filter routed also from `process-classes` / `test-compile` via a shared `COMPILE_LIKE_GOALS` tuple table. - `mvn checkstyle:check` — compact violation rewrite with Help-boilerplate strip. - `mvn dependency:tree` — boilerplate/duplicate strip, transitive collapse. Auto-detects `./mvnw` wrapper; falls back to system `mvn`. Other goals (e.g. `spring-boot:run`, `install`) stream through unchanged for safety with metrics-only tracking. Discover rules rewrite bare `mvn`/`mvnw` invocations to `rtk mvn`. Replaces the previous TOML filter `src/filters/mvn-build.toml`. 38 unit tests + 14 real-output fixtures covering pass/fail/multi-module cases; verify-fixture savings ≥ 90%.
1 parent 9e96caa commit 80da844

25 files changed

Lines changed: 3683 additions & 53 deletions

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Features
11+
12+
* **mvn:** add Maven (Java) filter module — test, compile, checkstyle:check, dependency:tree ([#1089](https://github.com/rtk-ai/rtk/pull/1089))
13+
1014
### Bug Fixes
1115

1216
* **git:** remove `-u` short alias from `--ultra-compact` to fix `git push -u` upstream tracking ([#1086](https://github.com/rtk-ai/rtk/issues/1086))

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ rtk filters and compresses command outputs before they reach your LLM context. S
4747
| `git log` | 5x | 2,500 | 500 | -80% |
4848
| `git add/commit/push` | 8x | 1,600 | 120 | -92% |
4949
| `cargo test` / `npm test` | 5x | 25,000 | 2,500 | -90% |
50+
| `mvn test` | 3x | 30,000 | 300 | -99% |
5051
| `ruff check` | 3x | 3,000 | 600 | -80% |
5152
| `pytest` | 4x | 8,000 | 800 | -90% |
5253
| `go test` | 3x | 6,000 | 600 | -90% |
@@ -179,6 +180,7 @@ rtk go test # Go tests (NDJSON, -90%)
179180
rtk cargo test # Cargo tests (-90%)
180181
rtk rake test # Ruby minitest (-90%)
181182
rtk rspec # RSpec tests (JSON, -60%+)
183+
rtk mvn test # Maven tests (-99%)
182184
rtk err <cmd> # Filter errors only from any command
183185
rtk test <cmd> # Generic test wrapper - failures only (-90%)
184186
```
@@ -195,6 +197,8 @@ rtk cargo clippy # Cargo clippy (-80%)
195197
rtk ruff check # Python linting (JSON, -80%)
196198
rtk golangci-lint run # Go linting (JSON, -85%)
197199
rtk rubocop # Ruby linting (JSON, -60%+)
200+
rtk mvn build # Maven build (-90%)
201+
rtk mvn dependency:tree # Maven dependency tree (-60%+)
198202
```
199203

200204
### Package Managers

src/cmds/java/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Java Ecosystem
2+
3+
> Part of [`src/cmds/`](../README.md) — see also [docs/contributing/TECHNICAL.md](../../../docs/contributing/TECHNICAL.md)
4+
5+
## Specifics
6+
7+
- **mvn_cmd.rs** handles Maven (`mvn`) and Maven Wrapper (`mvnw`) commands
8+
- Auto-detects `mvnw` wrapper in project root; falls back to system `mvn`
9+
- `mvn test` uses a state-machine parser (Preamble → Testing → Summary → Done) for 97-99%+ savings on real-world output
10+
- `mvn compile` uses line filtering to strip `[INFO]` noise, download progress, JVM/native-access warnings, and plugin chatter (jOOQ codegen, Liquibase, npm/React builds, typescript-generator). Also routes `process-classes` and `test-compile` through the same filter (same noise profile)
11+
- `mvn checkstyle:check` (aliased as `checkstyle`) compacts violation lines to `path:line:col [Rule] message`, strips mvn startup noise and Help-link boilerplate, keeps `N Checkstyle violations` summary and BUILD SUCCESS/FAILURE
12+
- `mvn dependency:tree` strips "omitted for duplicate" lines, "version managed from" annotations, and collapses deep transitive branches
13+
- Unknown goals stream via `cmd.status()` passthrough (safe for long-running goals like `spring-boot:run`); rare lifecycle phases (`package`, `install`, `verify`, `clean`, `deploy`) also passthrough — filtered only when the output shape matches compile
14+
- Routing via Clap sub-enum with `#[command(external_subcommand)] Other` for unknown goals; compile-like and checkstyle goals received as `Other` are auto-re-dispatched by `route_goal` to the right filter

src/cmds/java/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
automod::dir!(pub "src/cmds/java");

0 commit comments

Comments
 (0)