Summary
mvn jackknife:index -Dclass=com.fasterxml.jackson.databind.ObjectMapper — find a class in ~/.m2/repository without shell commands or permission prompts.
Motivation
When Claude needs to understand a class that isn't a project dependency, the current workflow is find, jar tf, jar xf, javap — every one prompts the user for permission. This eliminates that entire workflow.
Design
Algorithm
- Check existing manifests — if found, print location, done
- Derive search root from class package:
com.fasterxml maps to ~/.m2/repository/com/fasterxml/
- Walk from that root, collecting all
*.jar files
- Group by
groupId:artifactId, keep only latest version of each (see version sorting below)
- Sort by longest match of groupId+artifactId path to class package
- Walk the sorted list, open zip directory, check for the
.class entry
- First hit: index that jar, print result
Version sorting
Use numeric component comparison (adapted from Harminie Version.java). Split version string on non-numeric characters, compare int arrays component by component. Correctly sorts 2.9.1 < 2.14.0 < 2.15.3.
Search root optimization
The first two segments of the package name (com.fasterxml) map to the repo directory (com/fasterxml/). Start the walk there. This eliminates 90%+ of ~/.m2 without scanning.
Examples
mvn jackknife:index -Dclass=com.fasterxml.jackson.databind.ObjectMapper
mvn jackknife:index -Dclass=org.apache.commons.lang3.StringUtils
Acceptance Criteria
Summary
mvn jackknife:index -Dclass=com.fasterxml.jackson.databind.ObjectMapper— find a class in~/.m2/repositorywithout shell commands or permission prompts.Motivation
When Claude needs to understand a class that isn't a project dependency, the current workflow is
find,jar tf,jar xf,javap— every one prompts the user for permission. This eliminates that entire workflow.Design
Algorithm
com.fasterxmlmaps to~/.m2/repository/com/fasterxml/*.jarfilesgroupId:artifactId, keep only latest version of each (see version sorting below).classentryVersion sorting
Use numeric component comparison (adapted from Harminie Version.java). Split version string on non-numeric characters, compare int arrays component by component. Correctly sorts
2.9.1<2.14.0<2.15.3.Search root optimization
The first two segments of the package name (
com.fasterxml) map to the repo directory (com/fasterxml/). Start the walk there. This eliminates 90%+ of~/.m2without scanning.Examples
Acceptance Criteria
~/.m2without prior index