MCPcopy
hub / github.com/colbymchenry/codegraph / loadCodeGraph

Function loadCodeGraph

src/bin/codegraph.ts:42–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

40
41// Lazy-load heavy modules (CodeGraph, runInstaller) to keep CLI startup fast.
42async function loadCodeGraph(): Promise<typeof import('../index')> {
43 try {
44 return await import('../index');
45 } catch (err) {
46 const msg = err instanceof Error ? err.message : String(err);
47 console.error(`\x1b[31m${getGlyphs().err}\x1b[0m Failed to load CodeGraph modules.`);
48 console.error(`\n Node: ${process.version} Platform: ${process.platform} ${process.arch}`);
49 console.error(`\n Error: ${msg}`);
50 console.error('\n Try reinstalling with: npm install -g @colbymchenry/codegraph\n');
51 process.exit(1);
52 }
53}
54
55// Dynamic import helper — tsc compiles import() to require() in CJS mode,
56// which fails for ESM-only packages. This bypasses the transformation.

Callers 1

mainFunction · 0.70

Calls 2

getGlyphsFunction · 0.90
errorMethod · 0.80

Tested by

no test coverage detected