MCPcopy Create free account
hub / github.com/codeaashu/claude-code / handleSave

Function handleSave

src/commands/plugin/ManagePlugins.tsx:1678–1713  ·  view source on GitHub ↗
(config: UserConfigValues)

Source from the content-addressed store, hash-verified

1676 if (viewState === 'configuring' && configNeeded && selectedPlugin) {
1677 const pluginId_12 = `${selectedPlugin.plugin.name}@${selectedPlugin.marketplace}`;
1678 async function handleSave(config: UserConfigValues) {
1679 if (!configNeeded || !selectedPlugin) return;
1680 try {
1681 // Find MCPB path again
1682 const mcpServersSpec_1 = selectedPlugin.plugin.manifest.mcpServers;
1683 let mcpbPath_0: string | null = null;
1684 if (typeof mcpServersSpec_1 === 'string' && isMcpbSource(mcpServersSpec_1)) {
1685 mcpbPath_0 = mcpServersSpec_1;
1686 } else if (Array.isArray(mcpServersSpec_1)) {
1687 for (const spec_1 of mcpServersSpec_1) {
1688 if (typeof spec_1 === 'string' && isMcpbSource(spec_1)) {
1689 mcpbPath_0 = spec_1;
1690 break;
1691 }
1692 }
1693 }
1694 if (!mcpbPath_0) {
1695 setProcessError('No MCPB file found');
1696 setViewState('plugin-details');
1697 return;
1698 }
1699
1700 // Reload with provided config
1701 await loadMcpbFile(mcpbPath_0, selectedPlugin.plugin.path, pluginId_12, undefined, config);
1702
1703 // Success - go back to details
1704 setProcessError(null);
1705 setConfigNeeded(null);
1706 setViewState('plugin-details');
1707 setResult('Configuration saved. Run /reload-plugins for changes to take effect.');
1708 } catch (err_4) {
1709 const errorMsg_0 = errorMessage(err_4);
1710 setProcessError(`Failed to save configuration: ${errorMsg_0}`);
1711 setViewState('plugin-details');
1712 }
1713 }
1714 function handleCancel() {
1715 setConfigNeeded(null);
1716 setViewState('plugin-details');

Callers 1

AgentEditorFunction · 0.50

Calls 3

isMcpbSourceFunction · 0.85
loadMcpbFileFunction · 0.85
errorMessageFunction · 0.50

Tested by

no test coverage detected