MCPcopy
hub / github.com/codeaashu/claude-code / installPluginsAndApplyMcpInBackground

Function installPluginsAndApplyMcpInBackground

src/cli/print.ts:1704–1729  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1702
1703 // NOTE: Nested function required - needs closure access to applyMcpServerChanges and updateSdkMcp
1704 async function installPluginsAndApplyMcpInBackground(): Promise<void> {
1705 try {
1706 // Join point for user settings (fired at runHeadless entry) and managed
1707 // settings (fired in main.tsx preAction). downloadUserSettings() caches
1708 // its promise so this awaits the same in-flight request.
1709 await Promise.all([
1710 feature('DOWNLOAD_USER_SETTINGS') &&
1711 (isEnvTruthy(process.env.CLAUDE_CODE_REMOTE) || getIsRemoteMode())
1712 ? withDiagnosticsTiming('headless_user_settings_download', () =>
1713 downloadUserSettings(),
1714 )
1715 : Promise.resolve(),
1716 withDiagnosticsTiming('headless_managed_settings_wait', () =>
1717 waitForRemoteManagedSettingsToLoad(),
1718 ),
1719 ])
1720
1721 const pluginsInstalled = await installPluginsForHeadless()
1722
1723 if (pluginsInstalled) {
1724 await applyPluginMcpDiff()
1725 }
1726 } catch (error) {
1727 logError(error)
1728 }
1729 }
1730
1731 // Background plugin installation for all headless users
1732 // Installs marketplaces from extraKnownMarketplaces and missing enabled plugins

Callers 1

runHeadlessStreamingFunction · 0.85

Calls 10

featureFunction · 0.85
isEnvTruthyFunction · 0.85
getIsRemoteModeFunction · 0.85
withDiagnosticsTimingFunction · 0.85
downloadUserSettingsFunction · 0.85
applyPluginMcpDiffFunction · 0.85
logErrorFunction · 0.50
resolveMethod · 0.45

Tested by

no test coverage detected