Skip to content

Hook doesn't auto-route mvn / mvnw despite handler existing #1537

@VictorAurelius

Description

@VictorAurelius

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingeffort-smallQuelques heures, 1 fichierfilter-qualityFilter produces incorrect/truncated signalgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions