MCPcopy Index your code
hub / github.com/codeaashu/claude-code / findPluginInSettings

Function findPluginInSettings

src/services/plugins/pluginOperations.ts:180–201  ·  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

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