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

Function setMarketplaceAutoUpdate

src/utils/plugins/marketplaceManager.ts:2587–2639  ·  view source on GitHub ↗
(
  name: string,
  autoUpdate: boolean,
)

Source from the content-addressed store, hash-verified

2585 * @throws If marketplace not found
2586 */
2587export async function setMarketplaceAutoUpdate(
2588 name: string,
2589 autoUpdate: boolean,
2590): Promise<void> {
2591 const config = await loadKnownMarketplacesConfig()
2592 const entry = config[name]
2593
2594 if (!entry) {
2595 throw new Error(
2596 `Marketplace '${name}' not found. Available marketplaces: ${Object.keys(config).join(', ')}`,
2597 )
2598 }
2599
2600 // Seed-managed marketplaces always have autoUpdate: false (read-only, git-pull
2601 // would fail). Toggle appears to work but registerSeedMarketplaces overwrites
2602 // it on next startup. Error with guidance instead of silent revert.
2603 const seedDir = seedDirFor(entry.installLocation)
2604 if (seedDir) {
2605 throw new Error(
2606 `Marketplace '${name}' is seed-managed (${seedDir}) and ` +
2607 `auto-update is always disabled for seed content. ` +
2608 `To update: ask your admin to update the seed.`,
2609 )
2610 }
2611
2612 // Only update if the value is actually changing
2613 if (entry.autoUpdate === autoUpdate) {
2614 return
2615 }
2616
2617 config[name] = {
2618 ...entry,
2619 autoUpdate,
2620 }
2621 await saveKnownMarketplacesConfig(config)
2622
2623 // Also update intent in settings if declared there — write to the SAME
2624 // source that declared it to avoid creating duplicates at wrong scope
2625 const declaringSource = getMarketplaceDeclaringSource(name)
2626 if (declaringSource) {
2627 const declared =
2628 getSettingsForSource(declaringSource)?.extraKnownMarketplaces?.[name]
2629 if (declared) {
2630 saveMarketplaceToSettings(
2631 name,
2632 { source: declared.source, autoUpdate },
2633 declaringSource,
2634 )
2635 }
2636 }
2637
2638 logForDebugging(`Set autoUpdate=${autoUpdate} for marketplace: ${name}`)
2639}
2640
2641export const _test = {
2642 redactUrlCredentials,

Callers 1

handleToggleAutoUpdateFunction · 0.85

Calls 8

seedDirForFunction · 0.85
getSettingsForSourceFunction · 0.85
logForDebuggingFunction · 0.85
keysMethod · 0.80

Tested by

no test coverage detected