MCPcopy Create free account
hub / github.com/cortexkit/magic-context / getPluginCacheInfo

Function getPluginCacheInfo

packages/cli/src/lib/diagnostics-opencode.ts:220–237  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

218}
219
220function getPluginCacheInfo(): { path: string; cached?: string; latest?: string } {
221 const [path = ""] = getOpenCodePluginCacheRoots();
222 let cached: string | undefined;
223 for (const installedPkgPath of getOpenCodePluginPackageJsonPaths()) {
224 try {
225 if (existsSync(installedPkgPath)) {
226 const pkg = JSON.parse(readFileSync(installedPkgPath, "utf-8")) as {
227 version?: unknown;
228 };
229 cached = typeof pkg.version === "string" ? pkg.version : undefined;
230 if (cached) break;
231 }
232 } catch {
233 cached = undefined;
234 }
235 }
236 return { path, cached, latest: getSelfVersion() };
237}
238
239function getStorageDir(): string {
240 const dataHome = process.env.XDG_DATA_HOME || join(homedir(), ".local", "share");

Callers 1

collectDiagnosticsFunction · 0.85

Calls 3

getSelfVersionFunction · 0.70

Tested by

no test coverage detected