feat: Phase 5+ P1 providers + shared core provider helpers#5
Merged
Conversation
…eesound/jamendo resilience, polyhaven mediaType, changeset/README)
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
Implements the Phase 5+ P1 provider backlog from
docs/provider-roadmap.mdand centralizes the per-provider helper duplication into@refkit/core.New provider satellites (6 packages, ~7 provider ids)
@refkit/provider-rijksmuseum@refkit/provider-polyhaven@refkit/provider-freesound@refkit/provider-jamendo@refkit/provider-europeana@refkit/provider-internet-archiveShared core helpers (
packages/core/src/provider-helpers.ts)New exports consumed by every provider, removing duplicated copies (
setIfStringalone had been copy-pasted into 11 providers):setIfString,setIfBoolean,setIfStringList,setIfInt/setIfPositiveInt/setIfNonNegativeInt/setIfNumber(with an opt-inclampmode to preserve providers'Math.minclamping)first(array-field helper)mapCcDeedUrl(CC deed URL →LicenseId+ version) andmapRightsUrl(CC deeds + faithful rightsstatements.org mapping)isLikelyImageUrl,imageMediaType,IMAGE_EXTAll 11 existing providers + the 5 new ones that had inline copies were retrofitted to import these (poly-haven has nothing centralizable; poetrydb is path-based with no query setters).
Faithful license normalization
Continues refkit's moat (honest per-item license). Notably, rightsstatements.org statements are mapped faithfully per token, not collapsed to
unknown:InC*) →proprietary(we know it's copyrighted → denied, not needs-review)NoC-US→PD+jurisdiction: 'US'(jurisdiction-scoped; gated byevaluateUsewhen the caller supplies a jurisdiction)NoC-NC→proprietary(non-commercial)NoC-OKLR/NoC-CR/CNE/UND/NKC) →unknownA source not annotating a license still correctly yields
unknown→needs-review(e.g. Internet Archive, where ~93% of items carry nolicenseurl) — that's the faithful output, not a defect.Testing
pnpm -r typecheck— clean across all 22 packagespnpm test:run— 37 test files / 250 tests, all passingProcess
Built via subagent-driven development (implementer + spec/quality review per unit), then an adversarial multi-agent review of the full branch diff (14 findings confirmed, 6 refuted). The confirmed fixes are in
471e5c0:licenseurl/titleto scalar + harden core mappers against non-string input (was: one array-valued doc could throw and sink the whole batch)mapRightsUrlso a found rightsstatements URI is mapped faithfully (was: matcher found it but CC-only mapper dropped it tounknown)imageMediaTypeinstead of an inline ternaryIntended behavior changes (not bugs — noted for reviewers)
providerOptionsand empty arrays are now dropped rather than emitted as empty query params (key=).creativecommons.orghost (a CC path on another host →unknown).…/licenses/by/deed now maps toCC-BY(no version) instead ofunknown.Changesets
Included:
@refkit/coreminor (new exports), 6 new providers minor,@refkit/mcpminor (zero-config server now registers the new providers), 11 existing providers patch (internal refactor).🤖 Generated with Claude Code