Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
42ae0a2
feat(mvn): add Maven filter module with Surefire/Failsafe XML enrichment
mariuszs Apr 16, 2026
384eb6c
feat(mvnd): add Maven Daemon support as rtk mvnd subcommand
mariuszs Apr 17, 2026
049d040
feat(mvn): route verify through test parser with failsafe XML enrichment
mariuszs Apr 17, 2026
83373c8
refactor(mvn): extract run_simple_goal + per-goal subcmd_savings
mariuszs Apr 17, 2026
fefdf3a
feat(mvn): add clean filter — one-line summary with deleted paths
mariuszs Apr 17, 2026
fa5e23f
feat(mvn): collapse Reactor Summary + dedup javac errors
mariuszs Apr 17, 2026
63ed416
refactor(mvn): tighten filter_mvn_compile allocations per review
mariuszs Apr 17, 2026
d81c814
feat(mvn): close compile-filter gaps found via rtk-ai/rtk#1241 fixtures
mariuszs Apr 17, 2026
f4afd77
feat(mvn): broaden resources-plugin noise pattern to catch encoding a…
mariuszs Apr 17, 2026
19b5d78
fix(mvn): mvn test must surface compile errors instead of hiding them
mariuszs Apr 17, 2026
ca0be14
feat(mvn): strip artifactregistry-maven-wagon + GCP auth noise
mariuszs Apr 17, 2026
11a5b00
feat(mvn): strip enforcer/githook/compiler plugin boilerplate
mariuszs Apr 17, 2026
192d8ec
test(mvn): compact bloated fixtures and rename PR-numbered ones
mariuszs Apr 18, 2026
e333eba
fix(mvn): close reactor + degraded-failure gaps from Codex adversaria…
mariuszs Apr 18, 2026
4ac2ae7
test(mvn): anonymize + compact reactor fixtures
mariuszs Apr 18, 2026
e43e8ef
fix(mvn): deduplicate failures block when XML enrichment present
mariuszs Apr 18, 2026
1b851a1
feat(mvn): unify stdout failure format with XML enrichment path
mariuszs Apr 18, 2026
ae80997
feat(mvn): add parse_goals for multi-goal detection
mariuszs May 29, 2026
cd73c5e
feat(mvn): add chain_runs_tests enrichment gate
mariuszs May 29, 2026
a73f443
feat(mvn): add marker-based segment splitter
mariuszs May 29, 2026
d39f41a
feat(mvn): add multi-goal segment filter (success path)
mariuszs May 29, 2026
8cbb765
test(mvn): multi-goal compile-failure snapshot
mariuszs May 29, 2026
cec37fa
feat(mvn): add run_multi_goal with -q strip and XML enrichment
mariuszs May 29, 2026
8982446
feat(mvn): route all goals via dispatch, enable multi-goal filtering
mariuszs May 29, 2026
d99bcf5
refactor(mvn): drop orphaned run_compile wrapper
mariuszs May 29, 2026
0f95a68
fix(mvn): classify_marker handles short plugin goal-prefix form
mariuszs May 29, 2026
1587bd4
test(mvn): multi-goal verify-failure (multi-module) snapshot
mariuszs May 29, 2026
4a864e2
fix(mvn): dedupe BUILD line in multi-goal output
mariuszs May 29, 2026
716a93f
docs(mvn): document multi-goal filtering
mariuszs May 29, 2026
1eb4e79
docs(mvn): fix stale run_other references after cutover
mariuszs May 29, 2026
c800291
refactor(jvm): merge java module into jvm
mariuszs May 29, 2026
a72254a
docs(jvm): correct mvn routing description (dispatch/route_goal)
mariuszs May 29, 2026
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
1 change: 1 addition & 0 deletions .claude/rules/search-strategy.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ src/
│ ├── js/ ← npm, pnpm, vitest, lint, tsc, next, prettier, playwright, prisma
│ ├── python/ ← ruff, pytest, mypy, pip
│ ├── go/ ← go, golangci-lint
│ ├── jvm/ ← mvn/mvnw/mvnd, gradlew (test, compile, checkstyle, dependency:tree)
│ ├── dotnet/ ← dotnet, binlog, trx, format_report
│ ├── cloud/ ← aws, container (docker/kubectl), curl, wget, psql
│ ├── system/ ← ls, tree, read, grep, find, wc, env, json, log, deps, summary, format, local_llm
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Features

* **mvn:** add Maven (Java) filter module — test, compile, checkstyle:check, dependency:tree ([#1089](https://github.com/rtk-ai/rtk/pull/1089))
* **mvn:** enrich `mvn test` / `verify` / `integration-test` output with structured failure details read from `target/surefire-reports/TEST-*.xml` and `target/failsafe-reports/*.xml`. Stack traces are segmented on `Caused by:` with framework frames collapsed; the root-cause segment is always preserved.
* **mvn:** autodetect application package from `pom.xml` `<groupId>` (with `<parent>/<groupId>` fallback) for framework-frame classification.
* **mvn:** red-flag heuristic — `no tests run` with no fresh XML reports emits a diagnostic pointing at surefire misconfiguration.
* **mvn:** signal-aware multi-goal filtering — filters every goal in a chain (`clean test-compile checkstyle:check`, `clean verify`, `clean install`) instead of only the first; always preserves BUILD SUCCESS/FAILURE, `[ERROR]`s, test counts, and checkstyle violations; auto-drops `-q`; enriches test failures from surefire/failsafe XML when the chain includes test-running goals.

### Bug Fixes

* **git:** remove `-u` short alias from `--ultra-compact` to fix `git push -u` upstream tracking ([#1086](https://github.com/rtk-ai/rtk/issues/1086))
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ For the full architecture, component details, and module development patterns, s

Module responsibilities are documented in each folder's `README.md` and each file's `//!` doc header. Browse `src/cmds/*/` to discover available filters.

Supported ecosystems: git/gh/gt, cargo, go/golangci-lint, npm/pnpm/npx, ruff/pytest/pip/mypy, rspec/rubocop/rake, dotnet, playwright/vitest/jest, docker/kubectl/aws.
Supported ecosystems: git/gh/gt, cargo, go/golangci-lint, npm/pnpm/npx, ruff/pytest/pip/mypy, rspec/rubocop/rake, dotnet, mvn/mvnw, playwright/vitest/jest, docker/kubectl/aws.

### Proxy Mode

Expand Down
47 changes: 47 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ libc = "0.2"
toml = "0.8"

[dev-dependencies]
filetime = "0.2"
insta = "1"

[profile.release]
opt-level = 3
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ rtk filters and compresses command outputs before they reach your LLM context. S
| `git log` | 5x | 2,500 | 500 | -80% |
| `git add/commit/push` | 8x | 1,600 | 120 | -92% |
| `cargo test` / `npm test` | 5x | 25,000 | 2,500 | -90% |
| `mvn test` | 3x | 30,000 | 300 | -99% |
| `ruff check` | 3x | 3,000 | 600 | -80% |
| `pytest` | 4x | 8,000 | 800 | -90% |
| `go test` | 3x | 6,000 | 600 | -90% |
Expand Down Expand Up @@ -181,6 +182,12 @@ rtk go test # Go tests (NDJSON, -90%)
rtk cargo test # Cargo tests (-90%)
rtk rake test # Ruby minitest (-90%)
rtk rspec # RSpec tests (JSON, -60%+)
rtk mvn test # Maven tests (-99%)
rtk mvn verify # Maven verify — surefire + failsafe XML enrichment
rtk mvn clean # Maven clean — one-line summary (-95%)
rtk mvn clean test-compile checkstyle:check # Multi-goal: per-goal filter, BUILD signal always preserved
rtk mvn clean verify # Multi-goal: XML enrichment applies; -q auto-dropped
rtk mvnd test # Maven Daemon tests (same filter, same savings)
rtk err <cmd> # Filter errors only from any command
rtk test <cmd> # Generic test wrapper - failures only (-90%)
```
Expand All @@ -197,6 +204,8 @@ rtk cargo clippy # Cargo clippy (-80%)
rtk ruff check # Python linting (JSON, -80%)
rtk golangci-lint run # Go linting (JSON, -85%)
rtk rubocop # Ruby linting (JSON, -60%+)
rtk mvn build # Maven build (-90%)
rtk mvn dependency:tree # Maven dependency tree (-60%+)
```

### Package Managers
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing/TECHNICAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ Start here, then drill down into each README for file-level details.
| [`core/`](../src/core/README.md) | Shared infrastructure | Tracking DB schema, config system, tee recovery, TOML filter engine, utility functions |
| [`hooks/`](../src/hooks/README.md) | Hook system | Installation flow (`rtk init`), integrity verification, rewrite command, trust model |
| [`analytics/`](../src/analytics/README.md) | Token savings analytics | `rtk gain` dashboard, Claude Code economics, ccusage parsing |
| [`cmds/`](../src/cmds/README.md) | **Command filters (9 ecosystems)** | Common filter pattern, cross-command routing, token savings table, **links to each ecosystem** |
| [`cmds/`](../src/cmds/README.md) | **Command filters (10 ecosystems)** | Common filter pattern, cross-command routing, token savings table, **links to each ecosystem** |
| [`discover/`](../src/discover/README.md) | History analysis + rewrite registry | Rewrite patterns, session providers, compound command splitting |
| [`learn/`](../src/learn/README.md) | CLI correction detection | Error classification, correction pair detection, rule generation |
| [`parser/`](../src/parser/README.md) | Parser infrastructure | Canonical types (TestResult, LintResult, etc.), 3-tier format modes, migration guide |
Expand Down
1 change: 1 addition & 0 deletions src/cmds/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Each subdirectory has its own README with file descriptions, parsing strategies,
- **[`js/`](js/README.md)** — npm, pnpm, vitest, lint, tsc, next, prettier, playwright, prisma — Package manager auto-detection, lint routing, cross-deps with python
- **[`python/`](python/README.md)** — ruff, pytest, mypy, pip — JSON check vs text format, state machine parsing, uv auto-detection
- **[`go/`](go/README.md)** — go test/build/vet, golangci-lint — NDJSON streaming, Go sub-enum pattern
- **[`jvm/`](jvm/README.md)** — mvn/mvnw/mvnd, gradlew — State-machine test parser, Surefire/Failsafe XML enrichment, checkstyle compaction, dependency:tree collapsing
- **[`dotnet/`](dotnet/README.md)** — dotnet, binlog, trx, format_report — DotnetCommands sub-enum, internal helper modules
- **[`cloud/`](cloud/README.md)** — aws, docker/kubectl, curl, wget, psql — Docker/Kubectl sub-enums, JSON forced output
- **[`system/`](system/README.md)** — ls, tree, read, grep, find, wc, env, json, log, deps, summary, format, smart — format_cmd routing, filter levels, language detection
Expand Down
63 changes: 63 additions & 0 deletions src/cmds/jvm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# JVM Ecosystem (Maven, Gradle)

> Part of [`src/cmds/`](../README.md) — see also [docs/contributing/TECHNICAL.md](../../../docs/contributing/TECHNICAL.md)

## Specifics

- **mvn_cmd.rs** handles Maven (`mvn`), Maven Wrapper (`mvnw`), and Maven Daemon (`mvnd`) commands
- `rtk mvn`: auto-detects `mvnw` wrapper in project root; falls back to system `mvn`
- `rtk mvnd`: always invokes the Maven Daemon (`mvnd`) — the wrapper is bypassed because `mvnd` is a separate long-lived JVM daemon; metrics are tracked as `mvnd <goal>` in `rtk gain` so mvn/mvnd savings stay separate
- `mvn test` uses a state-machine parser (Preamble → Testing → Summary → Done) for 97-99%+ savings on real-world output
- `mvn verify` shares the same state-machine filter as `test`; surefire + failsafe `T E S T S` blocks accumulate into one combined summary. This is the canonical goal that produces `target/failsafe-reports/` (integration tests), so XML enrichment surfaces both unit- and integration-test failures
- `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)
- `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
- `mvn dependency:tree` strips "omitted for duplicate" lines, "version managed from" annotations, and collapses deep transitive branches
- `mvn clean` collapses to one line `mvn clean: deleted <path> (time)`; multi-module builds report `deleted N targets` (goal chains like `mvn clean verify` are handled by the multi-goal filter below)
- **Single-goal routing** (`dispatch` → `route_goal`): `test`, `verify`, `clean`, compile-likes, `checkstyle`/`checkstyle:check`, and `dependency:tree` each route to their dedicated filter; any other goal (e.g. `package`, `install`, `deploy`, `spring-boot:run`) streams via unfiltered `cmd.status()` passthrough — safe for long-running goals
- **Multi-goal chains** (≥2 goals, e.g. `mvn clean test-compile checkstyle:check`, `mvn clean verify`, `mvn clean install`): a signal-aware filter splits output by Maven plugin boundary markers, runs each segment group through its matching single-goal filter, and always preserves the BUILD signal — all `[ERROR]` lines, `BUILD SUCCESS`/`BUILD FAILURE` + `Total time`, per-module test counts, checkstyle violation counts, and (on failure) the Reactor Summary failing module. `-q`/`--quiet` is automatically stripped in multi-goal mode so rtk receives full output and does the compression itself. When the chain includes `test`/`verify`/`install`, surefire/failsafe XML enrichment applies exactly as for single-goal `verify`.
- **0 goals** (e.g. `mvn -version`, `mvn --help`): unfiltered passthrough
- **gradlew_cmd.rs** handles Gradle Wrapper (`gradlew`) command output

## Output enrichment from Surefire/Failsafe XML reports

When `mvn test` (or verify/integration-test) reports failures, rtk reads
`target/surefire-reports/TEST-*.xml` and `target/failsafe-reports/*.xml`
**after** the build finishes and appends a structured Failures section
with:

- Full stack trace per failure, with framework frames collapsed and the
root-cause segment preserved (up to 50 lines per trace).
- Captured stdout + stderr from failing tests only, capped at 2000 chars
per test and 10000 chars total.
- File counters in the footer: `(reports: N surefire, M failsafe, K stale files skipped)`.

### Application-package detection

rtk classifies stack frames as *application* vs *framework* by comparing
frame class names against the Java `groupId` from `pom.xml`:

1. `<project>/<groupId>` from the pom.xml in the current working directory.
2. Fallback: `<project>/<parent>/<groupId>`.
3. Otherwise: no filtering — full stack traces are preserved.

### Time-gated report reads

Stale XML reports from previous runs are skipped: only files with
`mtime >= started_at` (captured just before `mvn` executes) are parsed.

### Red-flag heuristic for "0 tests"

If the summary says `no tests run` but surefire reports are empty or
absent, rtk emits a diagnostic instead of the silent summary:

```
mvn test: 0 tests executed — surefire detected no tests. Check pom.xml (surefire plugin configuration) or run: rtk proxy mvn test
```

### Bypass

For the rare cases where you need the full raw Maven output:

```bash
rtk proxy mvn test
```
Loading