refactor!: use abstract provider classes - #36
Merged
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 32 files
Architecture diagram
sequenceDiagram
participant Caller as Caller (CLI/Extension/AI)
participant Registry as Registry
participant Base as Provider (abstract)
participant Concrete as Concrete Provider (e.g., Brave)
participant Error as Error Handler
Note over Caller,Registry: NEW: Registration via class constructors
Concrete->>Registry: register(ProviderClass) (static providerName, defaultBaseURL)
Registry-->>Concrete: stored
Note over Caller,Base: NEW: Capability-aware creation
Caller->>Registry: createSearchProvider(name, config)
Registry->>Registry: lookup ProviderClass
Registry->>Concrete: new ProviderClass(config)
Concrete->>Base: super(config, ProviderClass)
Base->>Base: validate baseURL (http/https) - throws InvalidProviderUrlError if not
Base-->>Concrete: initialized
Registry->>Registry: isSearchProvider(provider) check
alt provider lacks search()
Registry->>Error: SearchNotSupportedError
Error-->>Caller: error handled in command (exit 1)
else provider supports search
Registry-->>Caller: SearchProvider instance
Caller->>Concrete: search(query, options)
Concrete-->>Caller: SearchResult[]
end
Note over Caller,Registry: NEW: Read capability via createReadProvider
Caller->>Registry: createReadProvider(name, config)
Registry->>Concrete: new ProviderClass(config)
Registry->>Registry: isReadProvider(provider) check
alt provider lacks read()
Registry->>Error: ReadNotSupportedError
Error-->>Caller: thrown from readUrl()
else provider supports read
Registry-->>Caller: ReadProvider instance
Caller->>Concrete: read(url, options)
Concrete-->>Caller: ReadResult
end
Note over Caller,Registry: Availability probe (resolve.ts)
Caller->>Registry: create(name)
Registry->>Concrete: new ProviderClass(config)
Caller->>Concrete: isAvailable()? (only if isAvailabilityProvider)
Concrete-->>Caller: boolean (reachable)
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 5 files (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: Breaks public API: register and create signatures changed, custom provider integrations require update without compatibility shim. Needs human review to confirm migration approach.
Re-trigger cubic
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.
I want provider integrations to be normal classes here, not factory-shaped objects. Registry now takes constructors for abstract
Provider, while search, read and reachability stay separate capabilities so read-only provider doesn't need fakesearch(). This is breaking for custom registrations, no compatibility shim.