fix: merge auth methods from multiple plugins for the same provider #6260
+319
−23
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.
Fixes auth method conflicts when multiple plugins register for the same provider.
Problem
fromEntries()inprovider/auth.tsoverwrites duplicate provider keys (last plugin wins).find()in CLIauth.tsreturns only the first matching pluginGoogleOAuthPlugin = AntigravityCLIOAuthPlugin) get loaded twiceSolution
Plugin loader (
plugin/index.ts): Track called functions to skip aliased exports; store package name in_sourcefieldAuth aggregation (
provider/auth.ts): ReplacefromEntries()with merge loop that accumulates methods from all pluginsCLI auth (
cli/cmd/auth.ts): Aggregate methods from all matching plugins instead of using.find()Labeling: Non-native plugins show source in label (e.g., "Google API key (websearch-cited)"), except for generic "Manually enter API Key" which is the same as native fallback
Before
{ "google": [{ "type": "api", "label": "Google API key" }] }After
{ "google": [ { "type": "oauth", "label": "OAuth with Google (Antigravity) (antigravity)" }, { "type": "api", "label": "Manually enter API Key" }, { "type": "api", "label": "Google API key (websearch-cited)" } ] }Test Cases