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

Method initSync

src/index.ts:274–291  ·  view source on GitHub ↗

* Initialize synchronously (without indexing)

(projectRoot: string)

Source from the content-addressed store, hash-verified

272 * Initialize synchronously (without indexing)
273 */
274 static initSync(projectRoot: string): CodeGraph {
275 const resolvedRoot = path.resolve(projectRoot);
276
277 // Check if already initialized
278 if (isInitialized(resolvedRoot)) {
279 throw new Error(`CodeGraph already initialized in ${resolvedRoot}`);
280 }
281
282 // Create directory structure
283 createDirectory(resolvedRoot);
284
285 // Initialize database
286 const dbPath = getDatabasePath(resolvedRoot);
287 const db = DatabaseConnection.initialize(dbPath);
288 const queries = new QueryBuilder(db.getDb());
289
290 return new CodeGraph(db, queries, resolvedRoot);
291 }
292
293 /**
294 * Open an existing CodeGraph project

Calls 6

isInitializedFunction · 0.90
createDirectoryFunction · 0.90
getDatabasePathFunction · 0.90
resolveMethod · 0.80
getDbMethod · 0.80
initializeMethod · 0.45

Tested by 2

indexFunction · 0.64
setupFunction · 0.64