138
* manifest-bearing candidate is found.
139
*/
140
>
async function resolveMarketplaceCacheRoot(plugin: string, marketplace: string, userHome: URI, fileService: IFileService): Promise<URI | undefined> {
claudeNativePluginScan.ts
141
>
const base = URI.joinPath(userHome, '.claude', 'plugins', 'cache', marketplace, plugin);
142
>
if (await hasManifest(base, fileService)) {
143
return base;
144
}
146
>
try {
147
>
stat = await fileService.resolve(base);
148
>
} catch {
149
return undefined;
150
}
152
return undefined;
153
}
155
>
for (const child of stat.children) {
156
>
if (!child.isDirectory || !(await hasManifest(child.resource, fileService))) {
157
continue;
158
}
160
>
// Newest install wins; the dir name breaks ties deterministically when
161
>
// mtimes collide or are missing. Compare numerically (`{ numeric: true }`)
162
>
// so version dirs order naturally — `0.0.10` after `0.0.9`, not before.
163
>
if (!best || mtime > best.mtime || (mtime === best.mtime && child.name.localeCompare(best.name, undefined, { numeric: true }) > 0)) {
164
>
best = { uri: child.resource, mtime, name: child.name };
165
>
}
166
>
}
167
>
return best?.uri;
168
>
}
169
170
/**