Add globalConfigSourceRegistry to match middleware pattern#206
Merged
Conversation
Add a global ConfigSourceRegistry singleton that resolveConfig() auto-includes, matching the existing globalMiddlewareRegistry and globalAuthMiddlewareRegistry patterns. This eliminates the need to manually pass plugin config sources to every resolveConfig()/loadConfig() call. Changes: - New ConfigSourceRegistry class with register/unregister/getSources/clear - resolveConfig() auto-includes globalConfigSourceRegistry sources - B2CPluginManager.applyMiddleware() registers config sources globally - Simplified BaseCommand: removed getPluginSources() and pluginSources properties - Simplified 6 loadConfig() callsites across CLI commands - Deprecated PluginSources type in cli/config.ts - VS Code extension: removed resolveConfigWithPlugins() wrapper - Fixes MCP server bug where plugin config sources were silently dropped
…istries) Add B2C_SKIP_PLUGIN_HOOKS env var guard to all three collectPlugin* methods in BaseCommand to prevent real plugins (keychain, password-store, etc.) from running during tests. Add mocha root hooks to CLI, MCP, and SDK packages that set this env var and clear global registries before each test. This fixes a pre-existing test isolation issue where locally installed plugins could pollute test state, made visible by the globalConfigSourceRegistry addition (plugin config sources accumulated O(N^2) across N tests).
patricksullivansf
approved these changes
Feb 25, 2026
Contributor
patricksullivansf
left a comment
There was a problem hiding this comment.
LGTM. As it makes config registry global, but ability to call loadConfig/resolveConfig multiple times and get fresh results remains (needed for long running MCP).
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
globalConfigSourceRegistrysingleton thatresolveConfig()auto-includes, matching the existingglobalMiddlewareRegistryandglobalAuthMiddlewareRegistrypatternsloadConfig()callers no longer need to passgetPluginSources()B2CPluginManager.applyMiddleware()now registers config sources globally alongside HTTP and auth middlewaremcp.ts:277callsloadConfig()without plugin sources)resolveConfigWithPlugins()wrapperTest isolation
B2C_SKIP_PLUGIN_HOOKSenv var guard to allcollectPlugin*methods inBaseCommand— prevents real plugins (keychain, password-store, etc.) from running during testsTest plan