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

Function updatePluginsForMarketplaces

src/utils/plugins/pluginAutoupdate.ts:161–200  ·  view source on GitHub ↗
(
  marketplaceNames: Set<string>,
)

Source from the content-addressed store, hash-verified

159 * @returns plugin IDs that were actually updated (not already up-to-date)
160 */
161export async function updatePluginsForMarketplaces(
162 marketplaceNames: Set<string>,
163): Promise<string[]> {
164 const installedPlugins = loadInstalledPluginsFromDisk()
165 const pluginIds = Object.keys(installedPlugins.plugins)
166
167 if (pluginIds.length === 0) {
168 return []
169 }
170
171 const results = await Promise.allSettled(
172 pluginIds.map(async pluginId => {
173 const { marketplace } = parsePluginIdentifier(pluginId)
174 if (!marketplace || !marketplaceNames.has(marketplace.toLowerCase())) {
175 return null
176 }
177
178 const allInstallations = installedPlugins.plugins[pluginId]
179 if (!allInstallations || allInstallations.length === 0) {
180 return null
181 }
182
183 const relevantInstallations = allInstallations.filter(
184 isInstallationRelevantToCurrentProject,
185 )
186 if (relevantInstallations.length === 0) {
187 return null
188 }
189
190 return updatePlugin(pluginId, relevantInstallations)
191 }),
192 )
193
194 return results
195 .filter(
196 (r): r is PromiseFulfilledResult<string> =>
197 r.status === 'fulfilled' && r.value !== null,
198 )
199 .map(r => r.value)
200}
201
202/**
203 * Update plugins from marketplaces that have autoUpdate enabled.

Callers 2

updatePluginsFunction · 0.85
applyChangesFunction · 0.85

Calls 5

parsePluginIdentifierFunction · 0.85
updatePluginFunction · 0.85
keysMethod · 0.80
hasMethod · 0.45

Tested by

no test coverage detected