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

Function buildProject

__tests__/explore-named-file-valve.test.ts:38–47  ·  view source on GitHub ↗
(files: Record<string, string>)

Source from the content-addressed store, hash-verified

36interface Project { dir: string; cg: CodeGraph }
37
38async function buildProject(files: Record<string, string>): Promise<Project> {
39 const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'codegraph-named-valve-'));
40 for (const [rel, body] of Object.entries(files)) {
41 fs.mkdirSync(path.dirname(path.join(dir, rel)), { recursive: true });
42 fs.writeFileSync(path.join(dir, rel), body);
43 }
44 const cg = CodeGraph.initSync(dir);
45 await cg.indexAll();
46 return { dir, cg };
47}
48
49function destroyProject(p?: Project): void {
50 if (!p) return;

Calls 3

initSyncMethod · 0.80
joinMethod · 0.45
indexAllMethod · 0.45

Tested by

no test coverage detected