MCPcopy Create free account
hub / github.com/amrkmn/x / updateExtensions

Function updateExtensions

scripts/task.ts:124–157  ·  view source on GitHub ↗
(
    command: 'check' | 'static' | 'full',
    args: string[]
)

Source from the content-addressed store, hash-verified

122 }
123}
124
125async function updateExtensions(
126 command: 'check' | 'static' | 'full',
127 args: string[]
128): Promise<void> {
129 const quick = command === 'check';
130 const useCache = command === 'full' && !args.includes('--no-cache');
131
132 if (useCache) {
133 await restoreStaticCache();
134 } else {
135 logger.info(
136 'cache',
137 quick ? 'cache disabled mode="quick"' : 'cache disabled mode="command"'
138 );
139 }
140
141 const data = await loadExtensionsData();
142 const pruned = !quick ? await pruneRemovedRepos(data) : 0;
143
144 const updates = await findExtensionUpdates(data, { quick });
145
146 if (updates.length === 0) {
147 await persistQuickUpdates(false);
148 // Persist removed sources in the cache even without repo updates, so
149 // the next restore doesn't resurrect files for deleted extensions.json
150 // entries (e.g. a deprecated repo removed after a cache was saved).
151 if (pruned > 0 && useCache) await saveStaticCache();
152 return;
153 }
154
155 if (quick) {
156 await handleQuickUpdates(data, updates);
157 return;
158 }
159
160 const { changed, failures } = await materializeExtensions(data, updates);

Callers 2

task.tsFile · 0.85
runTaskFunction · 0.85

Calls 9

loadExtensionsDataFunction · 0.90
findExtensionUpdatesFunction · 0.90
materializeExtensionsFunction · 0.90
restoreStaticCacheFunction · 0.85
persistQuickUpdatesFunction · 0.85
handleQuickUpdatesFunction · 0.85
finalizeFullUpdateFunction · 0.85
infoMethod · 0.80

Tested by

no test coverage detected