Summary
In RTK 0.37.2, the mvn handler exists and works (rtk discover confirms it as existing for mvn compile), but rtk hook check returns "No rewrite for: ..." for every mvn/mvnw/./mvnw invocation. Net result: typing mvn test in Claude Code's Bash tool runs unfiltered, even though the maven TOML filter shipped via #338 / #147 / PRs #349/#351/#386.
Reproduction
Environment: rtk 0.37.2 (Linux WSL2), Claude Code session with hook installed via rtk init -g.
$ rtk --version
rtk 0.37.2
$ rtk hook check "mvn test"
No rewrite for: mvn test
$ rtk hook check "mvnw test"
No rewrite for: mvnw test
$ rtk hook check "./mvnw test"
No rewrite for: ./mvnw test
# But the handler itself works:
$ rtk mvn --help
usage: mvn [options] [<goal(s)>] [<phase(s)>]
...
$ rtk discover | grep -i mvn
mvn compile 21 rtk mvn existing ~2.6K tokens
Impact
In a Spring Boot / Maven project running 30 days of rtk discover analysis:
mvnw 109 ./mvnw -q -pl . -Dtest=DocumentGenerat..
mvn 59 mvn -B -q -ntp test -Dtest='TrialToPai..
mvn test 50 mvn test -Dtest=DocumentBrandingAssemb..
mvnw test 27 ./mvnw test -Dtest=CacheStampedeFanOut..
mvnw checkstyle:check 25 MAVEN_OPTS="-Xmx1g" ./mvnw checkstyle:..
≈ 270 invocations × significant verbose output per mvn test (Surefire stack traces, [INFO] noise) = large token bleed despite the TOML filter being a fix-away from working.
Proposed approach (not prescribing)
Add mvn and mvnw (and the common ./mvnw invocation) to the hook routing whitelist (per the hook_lookup() design described in #361 / PR #156). Conservative subcommand inclusion:
mvn test, mvn compile, mvn package, mvn clean, mvn install, mvn verify, mvn checkstyle:check
- Same for
mvnw and ./mvnw invocations
- Skip non-maven
mvn- prefixed binaries if any exist (none common)
For mvn test Surefire output specifically, PR #288 (mentioned in #338 follow-up) covers the state-machine parser — independent of this routing fix.
Related
Environment
- rtk: 0.37.2 (binary from
~/.local/bin/rtk, build-id c7c6664f)
- Hook:
~/.claude/settings.json PreToolUse Bash matcher → rtk hook claude
- Claude Code with autorun-style usage; Maven project (Spring Boot 3.x, kitehub-subscription / kitehub-branding modules)
Summary
In RTK 0.37.2, the
mvnhandler exists and works (rtk discoverconfirms it asexistingformvn compile), butrtk hook checkreturns "No rewrite for: ..." for everymvn/mvnw/./mvnwinvocation. Net result: typingmvn testin Claude Code's Bash tool runs unfiltered, even though the maven TOML filter shipped via #338 / #147 / PRs #349/#351/#386.Reproduction
Environment: rtk 0.37.2 (Linux WSL2), Claude Code session with hook installed via
rtk init -g.Impact
In a Spring Boot / Maven project running 30 days of
rtk discoveranalysis:≈ 270 invocations × significant verbose output per
mvn test(Surefire stack traces,[INFO]noise) = large token bleed despite the TOML filter being a fix-away from working.Proposed approach (not prescribing)
Add
mvnandmvnw(and the common./mvnwinvocation) to the hook routing whitelist (per thehook_lookup()design described in #361 / PR #156). Conservative subcommand inclusion:mvn test,mvn compile,mvn package,mvn clean,mvn install,mvn verify,mvn checkstyle:checkmvnwand./mvnwinvocationsmvn-prefixed binaries if any exist (none common)For
mvn testSurefire output specifically, PR #288 (mentioned in #338 follow-up) covers the state-machine parser — independent of this routing fix.Related
hook_lookup()whitelist — this issue may be subsumed if Hook Engine + Chained Command Rewriting (PR #131 Part 1) #156 lands and includes mvn)git ls-files/git rm/git tag— same shape of issue, different command family)Environment
~/.local/bin/rtk, build-idc7c6664f)~/.claude/settings.jsonPreToolUse Bash matcher →rtk hook claude