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

Function installSelectedPlugins

src/commands/plugin/DiscoverPlugins.tsx:228–277  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

226
227 // Install selected plugins
228 const installSelectedPlugins = async () => {
229 if (selectedForInstall.size === 0) return;
230 const pluginsToInstall = availablePlugins.filter(p_1 => selectedForInstall.has(p_1.pluginId));
231 setInstallingPlugins(new Set(pluginsToInstall.map(p_2 => p_2.pluginId)));
232 let successCount_0 = 0;
233 let failureCount = 0;
234 const newFailedPlugins: Array<{
235 name: string;
236 reason: string;
237 }> = [];
238 for (const plugin_0 of pluginsToInstall) {
239 const result = await installPluginFromMarketplace({
240 pluginId: plugin_0.pluginId,
241 entry: plugin_0.entry,
242 marketplaceName: plugin_0.marketplaceName,
243 scope: 'user'
244 });
245 if (result.success) {
246 successCount_0++;
247 } else {
248 failureCount++;
249 newFailedPlugins.push({
250 name: plugin_0.entry.name,
251 reason: result.error
252 });
253 }
254 }
255 setInstallingPlugins(new Set());
256 setSelectedForInstall(new Set());
257 clearAllCaches();
258
259 // Handle installation results
260 if (failureCount === 0) {
261 const message = `✓ Installed ${successCount_0} ${plural(successCount_0, 'plugin')}. ` + `Run /reload-plugins to activate.`;
262 setResult(message);
263 } else if (successCount_0 === 0) {
264 setError(`Failed to install: ${formatFailureDetails(newFailedPlugins, true)}`);
265 } else {
266 const message_0 = `✓ Installed ${successCount_0} of ${successCount_0 + failureCount} plugins. ` + `Failed: ${formatFailureDetails(newFailedPlugins, false)}. ` + `Run /reload-plugins to activate successfully installed plugins.`;
267 setResult(message_0);
268 }
269 if (successCount_0 > 0) {
270 if (onInstallComplete) {
271 await onInstallComplete();
272 }
273 }
274 setParentViewState({
275 type: 'menu'
276 });
277 };
278
279 // Install single plugin from details view
280 const handleSinglePluginInstall = async (plugin_1: InstallablePlugin, scope: 'user' | 'project' | 'local' = 'user') => {

Callers 2

DiscoverPluginsFunction · 0.70
checkAndInstallFunction · 0.50

Calls 6

clearAllCachesFunction · 0.85
pluralFunction · 0.85
formatFailureDetailsFunction · 0.85
hasMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected