feat(cli): add ecosystem resolvers for npm, pypi, pub#13
Merged
Conversation
Introduce a resolver layer that maps ecosystem package names to GitHub repositories by fetching package metadata APIs. When a registry lookup misses for an ecosystem-prefixed spec (e.g. `npm:lodash`), the CLI now falls back to the appropriate resolver. - Add EcosystemResolver interface and getResolver factory - Add parseRepoUrl utility for normalizing GitHub URLs - Implement NpmResolver (registry.npmjs.org + dist-tags) - Implement PypiResolver (pypi.org JSON API + project_urls) - Implement PubResolver (pub.dev API + pubspec.repository) - Wire resolver fallback into the `add` command - Add comprehensive unit tests with mocked fetch Closes #6
Verify registry-hit specs bypass the resolver path and that unsupported ecosystems return null from getResolver.
- FR-4: Add semver range resolution to npm resolver (e.g. ^15 → 15.2.3) using the `semver` package for maxSatisfying range matching - FR-5: Add fallbackRefs to ResolveResult — resolvers now provide alternate git refs (v1.0.0 → 1.0.0 or vice versa) - NFR-3: Mark sources/npm.ts NpmSource as @deprecated in favor of the npm resolver + github source combination - Fix parseRepoUrl to preserve dots in repo names (e.g. next.js)
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
0 issues found across 3 files (changes from recent commits).
Requires human review: Significant feature addition adding a new resolver layer, external API integrations, and a new production dependency (semver), requiring human review of the logic and architecture.
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
npm:lodash), the CLI falls back to the appropriate resolver^15→ latest 15.x.x)v{version}then{version})Changes
packages/cli/src/resolvers/— new resolver module with interface, factory, and 3 implementationspackages/cli/src/index.ts— wire resolver fallback intoaddcommandpackages/cli/src/sources/npm.ts— mark as@deprecatedREADME.md— document ecosystem resolversTest plan
bun run --cwd packages/cli test— all 146 tests passbun run --cwd packages/cli lint— no errorsbun run --cwd packages/cli build— tsc compiles cleanlynpm:lodashresolves tolodash/lodash(mocked)pub:riverpodresolves torrousselGit/riverpod(mocked)npm:next@^15resolves to latest 15.x.x (mocked)Closes #6
Summary by cubic
Adds ecosystem resolvers for
npm,pypi, andpubso specs likenpm:lodashauto-map to GitHub when the registry misses inask docs add. Adds npm semver range support, git ref fallbacks, and docs on resolver architecture; deprecates the oldnpmtarball source. Implements #6.New Features
npm,pypi,pub;addfalls back on registry miss for ecosystem-prefixed specs and delegates to the GitHub source.^15,~3.22) resolve viasemverand dist-tags to the best match.fallbackRefs(tryv{version}then{version}).CLAUDE.mddocument resolver architecture and gotchas.Migration
source: 'npm'is deprecated; usenpm:<name>orowner/repo.Written for commit cc6bd0d. Summary will update on new commits.