MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / mergePluginSettings

Function mergePluginSettings

src/utils/plugins/pluginLoader.ts:3253–3278  ·  view source on GitHub ↗

* Merge settings from all enabled plugins into a single record. * Later plugins override earlier ones for the same key. * Only allowlisted keys are included (filtering happens at load time).

(
  plugins: LoadedPlugin[],
)

Source from the content-addressed store, hash-verified

3251 * Only allowlisted keys are included (filtering happens at load time).
3252 */
3253function mergePluginSettings(
3254 plugins: LoadedPlugin[],
3255): Record<string, unknown> | undefined {
3256 let merged: Record<string, unknown> | undefined
3257
3258 for (const plugin of plugins) {
3259 if (!plugin.settings) {
3260 continue
3261 }
3262
3263 if (!merged) {
3264 merged = {}
3265 }
3266
3267 for (const [key, value] of Object.entries(plugin.settings)) {
3268 if (key in merged) {
3269 logForDebugging(
3270 `Plugin "${plugin.name}" overrides setting "${key}" (previously set by another plugin)`,
3271 )
3272 }
3273 merged[key] = value
3274 }
3275 }
3276
3277 return merged
3278}
3279
3280/**
3281 * Store merged plugin settings in the synchronous cache.

Callers 1

cachePluginSettingsFunction · 0.85

Calls 2

entriesMethod · 0.80
logForDebuggingFunction · 0.50

Tested by

no test coverage detected