MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / updatePlugin

Function updatePlugin

source code/utils/plugins/pluginAutoupdate.ts:110–140  ·  view source on GitHub ↗

* Update a single plugin's installations. * Returns the plugin ID if any installation was updated, null otherwise.

(
  pluginId: string,
  installations: Array<{ scope: PluginScope; projectPath?: string }>,
)

Source from the content-addressed store, hash-verified

108 * Returns the plugin ID if any installation was updated, null otherwise.
109 */
110async function updatePlugin(
111 pluginId: string,
112 installations: Array<{ scope: PluginScope; projectPath?: string }>,
113): Promise<string | null> {
114 let wasUpdated = false
115
116 for (const { scope } of installations) {
117 try {
118 const result = await updatePluginOp(pluginId, scope)
119
120 if (result.success && !result.alreadyUpToDate) {
121 wasUpdated = true
122 logForDebugging(
123 `Plugin autoupdate: updated ${pluginId} from ${result.oldVersion} to ${result.newVersion}`,
124 )
125 } else if (!result.alreadyUpToDate) {
126 logForDebugging(
127 `Plugin autoupdate: failed to update ${pluginId}: ${result.message}`,
128 { level: 'warn' },
129 )
130 }
131 } catch (error) {
132 logForDebugging(
133 `Plugin autoupdate: error updating ${pluginId}: ${errorMessage(error)}`,
134 { level: 'warn' },
135 )
136 }
137 }
138
139 return wasUpdated ? pluginId : null
140}
141
142/**
143 * Update all project-relevant installed plugins from the given marketplaces.

Callers 1

Calls 3

updatePluginOpFunction · 0.85
logForDebuggingFunction · 0.85
errorMessageFunction · 0.50

Tested by

no test coverage detected