MCPcopy Create free account
hub / github.com/Noumena-Network/code / findPluginInSettings

Function findPluginInSettings

src/services/plugins/pluginOperations.ts:181–202  ·  view source on GitHub ↗

* Search all editable settings scopes for a plugin ID matching the given input. * * If `plugin` contains `@`, it's treated as a full pluginId and returned if * found in any scope. If `plugin` is a bare name, searches for any key * starting with `{plugin}@` in any scope. * * Returns the most sp

(plugin: string)

Source from the content-addressed store, hash-verified

179 * Precedence: local > project > user (most specific wins).
180 */
181function findPluginInSettings(plugin: string): {
182 pluginId: string
183 scope: InstallableScope
184} | null {
185 const hasMarketplace = plugin.includes('@')
186 // Most specific first — first match wins
187 const searchOrder: InstallableScope[] = ['local', 'project', 'user']
188
189 for (const scope of searchOrder) {
190 const enabledPlugins = getSettingsForSource(
191 scopeToSettingSource(scope),
192 )?.enabledPlugins
193 if (!enabledPlugins) continue
194
195 for (const key of Object.keys(enabledPlugins)) {
196 if (hasMarketplace ? key === plugin : key.startsWith(`${plugin}@`)) {
197 return { pluginId: key, scope }
198 }
199 }
200 }
201 return null
202}
203
204/**
205 * Helper function to find a plugin from loaded plugins

Callers 1

setPluginEnabledOpFunction · 0.85

Calls 3

getSettingsForSourceFunction · 0.85
scopeToSettingSourceFunction · 0.85
keysMethod · 0.80

Tested by

no test coverage detected