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

Function updatePlugin

src/utils/plugins/pluginAutoupdate.ts:108–138  ·  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

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