Repository navigation
registry: packages, first name and aliases per source - #217
Conversation
Each source lists the packages it covers (ecosystem:name) and plugin.ForPackage finds a package's sources; the list prints them with each source's first name and aliases, for the contract switch to source ids. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: adssib <[email protected]>
|
Claude finished @adssib's task in 1m 14s —— View job ✅ Ready to merge. This PR adds metadata to the registry and to the list ( Rules
Package mapping (I read all of them): each one matches the provider's official package. These are BugsNone found. Verified
Non-blocking (optional)
|
| func ForPackage(pkg string) []SourceInfo { | ||
| var out []SourceInfo | ||
| for _, s := range Sources() { | ||
| if slices.Contains(s.Source.Packages, pkg) { |
There was a problem hiding this comment.
Non-blocking: this is an exact string match, but lockfiles don't always write a PyPI name the way the registration does. PEP 503 treats Datadog_API_Client, datadog.api.client and datadog-api-client as the same name, so ForPackage("pypi:datadog_api_client") from a poetry.lock or requirements.txt would find nothing. Two ways to fix it:
- normalize PyPI names on both sides (lowercase, and collapse runs of
-,_and.into-), or - have
check()accept only the normalized form and say in the doc comment that callers must normalize.
npm names are already lowercase, so npm doesn't need this.
Stacked on #216
Part of #171 (prepares for patch-it-dev/patch-it#58)
What this changes
The registry exposes per source what the contract change (patch-it#58) and the client need, without adopting the contract yet:
plugin.Source.Packages: the published packages a source covers,ecosystem:name(pypi:stripe,npm:@vercel/sdk), checked byRegisterProvider(plugin.Ecosystems()).plugin.ForPackage("pypi:stripe")finds a package's sources, so a lockfile maps to sources without a table.SourceInfo.Aliases(); the list (plugins.json, schema updated) prints each source'spackages,first_name(the old slug, which fingerprints keep hashing) andaliases, next toid,alias,kind,layer, category.No event changes; goldens untouched.
Calls I made (please check)
Checks
make checkpasses (tidy, build, gofmt, vet, import allowlist, net/http guard,go test -race, noTODO(new-plugin), leak guard);make contractagainst patch-it'smainfixtures passes (11 files).Related PRs
apps/plugins-repo.md)v0.3.0(see "What the next bump changes" in the combined PR); the contract change this stack prepares for: patch-it-dev/patch-it#58 (adopted in a separate PR after it merges)🤖 Generated with Claude Code