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

Function getSelfVersion

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

Source from the content-addressed store, hash-verified

201// ── Version + path helpers ──────────────────────────────────────────
202
203function getSelfVersion(): string {
204 // createRequire resolves relative to this module. In source layout this file
205 // lives at src/cli/diagnostics.ts; in bundled layout at dist/cli.js.
206 const require = createRequire(import.meta.url);
207 for (const relPath of ["../../package.json", "../package.json"]) {
208 try {
209 const pkg = require(relPath) as { version?: unknown };
210 if (typeof pkg.version === "string" && pkg.version.length > 0) {
211 return pkg.version;
212 }
213 } catch {
214 // Try next path.
215 }
216 }
217 return "unknown";
218}
219
220function getPluginCacheInfo(): { path: string; cached?: string; latest?: string } {
221 const [path = ""] = getOpenCodePluginCacheRoots();

Callers 2

getPluginCacheInfoFunction · 0.70
collectDiagnosticsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected