MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / readPackageVersion

Function readPackageVersion

src/mcp/version.ts:26–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24export const CodeGraphPackageJsonPath = path.join(__dirname, '..', '..', 'package.json');
25
26function readPackageVersion(): string {
27 try {
28 const raw = fs.readFileSync(CodeGraphPackageJsonPath, 'utf8');
29 const parsed = JSON.parse(raw);
30 if (typeof parsed?.version === 'string' && parsed.version.length > 0) {
31 return parsed.version;
32 }
33 } catch {
34 // Fall through to sentinel.
35 }
36 return '0.0.0-unknown';
37}
38
39export const CodeGraphPackageVersion = readPackageVersion();
40

Callers 1

version.tsFile · 0.70

Calls 1

parseMethod · 0.80

Tested by

no test coverage detected