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

Function loadDist

scripts/agent-eval/probe-allocation.mjs:54–70  ·  view source on GitHub ↗

Load the built dist — the probe measures the shipping allocator, not src.

()

Source from the content-addressed store, hash-verified

52
53/** Load the built dist — the probe measures the shipping allocator, not src. */
54async function loadDist() {
55 const distIndex = join(REPO_ROOT, 'dist/index.js');
56 if (!existsSync(distIndex)) {
57 console.error('dist/ not built — run `npm run build` first.');
58 process.exit(2);
59 }
60 const idx = await import(pathToFileURL(distIndex).href);
61 const tools = await import(pathToFileURL(join(REPO_ROOT, 'dist/mcp/tools.js')).href);
62 // esModuleInterop: dynamic import of CJS yields { default: module.exports, ...named }
63 const CodeGraph = idx.default?.default ?? idx.default ?? idx.CodeGraph;
64 const ToolHandler = tools.ToolHandler ?? tools.default?.ToolHandler;
65 if (typeof CodeGraph?.openSync !== 'function' || typeof ToolHandler !== 'function') {
66 console.error('could not resolve CodeGraph/ToolHandler from dist/');
67 process.exit(2);
68 }
69 return { CodeGraph, ToolHandler };
70}
71
72/** `internal/gen/**` → /^internal\/gen\/.*$/ . Supports `**`, `*` and literals. */
73function globToRegExp(glob) {

Callers 1

mainFunction · 0.85

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected