feat(cli): add Maven ecosystem resolver#17
Merged
Conversation
18 tasks
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
amondnet
added a commit
that referenced
this pull request
Apr 8, 2026
Move track to completed/, mark status as review. PR #17 ready for review.
Contributor
There was a problem hiding this comment.
0 issues found across 3 files (changes from recent commits).
Requires human review: This is a new feature implementation adding a Maven ecosystem resolver. It contains non-trivial logic including API interactions and regex-based XML parsing that requires human review.
Contributor
There was a problem hiding this comment.
No issues found across 8 files
Requires human review: New feature adding a non-trivial ecosystem resolver. While isolated, it includes complex logic like regex-based XML parsing and external API integration that requires human review.
Architecture diagram
sequenceDiagram
participant CLI as CLI Core
participant Index as Resolver Index
participant Maven as NEW: MavenResolver
participant SearchAPI as Maven Central Search API
participant MavenRepo as Maven Central Repository (repo1)
Note over CLI, MavenRepo: maven:groupId:artifactId Resolution Flow
CLI->>Index: CHANGED: getResolver('maven')
Index-->>CLI: MavenResolver instance
CLI->>Maven: NEW: resolve(name, version)
Maven->>Maven: Parse "groupId:artifactId"
rect rgb(240, 240, 240)
Note right of Maven: Version Resolution
alt version is 'latest'
Maven->>SearchAPI: GET /solrsearch?q=g:G+AND+a:A
alt Search API Success
SearchAPI-->>Maven: Latest version + scmUrl
else Search API Failure
Maven->>MavenRepo: NEW: GET /.../maven-metadata.xml
MavenRepo-->>Maven: XML with <release> tag
end
else explicit version provided
Maven->>SearchAPI: GET /solrsearch?q=...&v=V (Try for scmUrl)
SearchAPI-->>Maven: Version metadata
end
end
rect rgb(240, 240, 240)
Note right of Maven: Repository Mapping (Priority Flow)
alt scmUrl found in Search API docs
Maven->>Maven: parseRepoUrl(scmUrl)
else scmUrl missing or invalid
Maven->>MavenRepo: NEW: GET /.../{artifactId}-{version}.pom
MavenRepo-->>Maven: POM XML content
Maven->>Maven: NEW: extractRepoFromPom() (Regex <scm> or <url>)
end
end
alt GitHub URL Resolved
Maven-->>CLI: ResolveResult { repo, ref: "v{v}", resolvedVersion: "{v}" }
else No GitHub URL found
Maven-->>CLI: Throw Error (Suggest 'owner/repo' format)
end
Add spec and plan for Maven ecosystem resolver implementation. Refs #15
Implement MavenResolver class following existing resolver patterns. Primary: Maven Central Search API for version resolution. Fallback: POM XML download for GitHub repo extraction. Supports groupId:artifactId format (e.g. maven:com.google.guava:guava). Refs #15
Add 'maven' to SupportedEcosystem type and resolvers record.
getResolver('maven') now returns a MavenResolver instance.
Refs #15
Fix regexp/match-any and e18e/prefer-static-regex lint violations. Mark all implementation tasks complete in plan. Refs #15
- FR-5: Check Search API scmUrl field before falling back to POM XML - FR-4/AC-3: When Search API is unavailable, fall back to maven-metadata.xml for version resolution + POM for repo extraction - Explicit versions skip Search API for version resolution on failure Refs #15
- Use default core (not GAV) for scmUrl lookup so scm.url field is actually returned by Maven Central Search API - Add 5 missing test cases: explicit version scmUrl, <latest> only metadata, malformed metadata, trailing colon, non-GitHub SCM fallback Refs #15
Move track to completed/, mark status as review. PR #17 ready for review.
2e27cb3 to
8db055e
Compare
This was referenced Apr 8, 2026
Merged
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MavenResolverclass implementingEcosystemResolverinterfacemaven:groupId:artifactIdspec format (e.g.maven:com.google.guava:guava)getResolver('maven')now worksRefs #15
Test plan
bun --cwd packages/cli test test/resolvers/maven.test.ts— 10 tests passbun --cwd packages/cli test test/resolvers/— all 54 resolver tests passbun run --cwd packages/cli lint— cleanSummary by cubic
Adds a Maven resolver to the CLI so
maven:groupId:artifactIdspecs resolve to GitHub repos, addressing #15. It uses Maven Central for versioning and prefers Search APIscm.url, with fallbacks tomaven-metadata.xmland the POM.MavenResolverimplementingEcosystemResolverformaven:groupId:artifactId(e.g.,maven:com.google.guava:guava) and explicit versions; registered sogetResolver('maven')works.scm.url(default core query), then POM (<scm><url>then<url>) normalized viaparseRepoUrl().latestviamaven-metadata.xmlor uses explicit version directly, then falls back to POM for repo extraction. Returnsrefasv{version}with{version}fallback.Written for commit 078e47e. Summary will update on new commits.
Verification Checklist
bun --cwd packages/cli test test/resolvers/maven.test.ts— 18 tests passbun --cwd packages/cli test test/resolvers/index.test.ts— 5 tests passbun --cwd packages/cli test test/resolvers/— all 62 resolver tests passbun run --cwd packages/cli lint— clean