Add swift package-registry search subcommand#10125
Draft
plemarquand wants to merge 3 commits into
Draft
Conversation
Implements the SwiftPM client side of the registry search pitch (https://forums.swift.org/t/pitch-package-registry-search/86320). - Extends GET /availability to discover advertised capabilities. The `available` AvailabilityStatus case now carries a Set<String> of capability keys parsed from the response body; an empty body still signals availability (backwards compatible). - `withAvailabilityCheck` gains a `requiring:` parameter that throws `RegistryError.capabilityNotSupported` when a registry does not advertise a required capability. All existing call sites are unaffected. - Adds `RegistryClient.search(query:limit:offset:registry:...)` hitting GET /search; 404 maps to `capabilityNotSupported`, other errors to a new `searchFailed` case. - New `swift package-registry search` subcommand iterates default and scoped registries (or `--registry <url>`), runs searches in parallel, and aggregates with round-robin interleaving. All registries unsupported -> error; some unsupported -> warning naming them (suppressed by `--json`). Per-result `registry` annotation appears only when multiple registries contribute.
Contributor
Author
|
@swift-ci test |
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.
Motivation:
Implements the SwiftPM client side of the registry search pitch https://forums.swift.org/t/pitch-package-registry-search/86320, swiftlang/swift-evolution#3309.
Modifications:
availableAvailabilityStatus case now carries a Set of capability keys parsed from the response body; an empty body still signals availability (backwards compatible).withAvailabilityCheckgains arequiring:parameter that throwsRegistryError.capabilityNotSupportedwhen a registry does not advertise a required capability. All existing call sites are unaffected.RegistryClient.search(query:limit:offset:registry:...)hitting GET /search; 404 maps tocapabilityNotSupported, other errors to a newsearchFailedcase.swift package-registry searchsubcommand iterates default and scoped registries (or--registry <url>), runs searches in parallel across all the registries the user has configured, and aggregates with round-robin interleaving. All registries unsupported -> error; some unsupported -> warning naming them (suppressed by--json). Per-resultregistryannotation appears only when multiple registries contribute.Result:
The
swift package-registry searchcommand allows for users and tools to query their configured registries for packages that match their search criteria.