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

Method openSync

src/index.ts:416–436  ·  view source on GitHub ↗

* Open synchronously (without sync)

(projectRoot: string)

Source from the content-addressed store, hash-verified

414 * Open synchronously (without sync)
415 */
416 static openSync(projectRoot: string): CodeGraph {
417 const resolvedRoot = path.resolve(projectRoot);
418
419 // Check if initialized
420 if (!isInitialized(resolvedRoot)) {
421 throw new Error(`CodeGraph not initialized in ${resolvedRoot}. Run init() first.`);
422 }
423
424 // Validate directory structure
425 const validation = validateDirectory(resolvedRoot);
426 if (!validation.valid) {
427 throw new Error(`Invalid CodeGraph directory: ${validation.errors.join(', ')}`);
428 }
429
430 // Open database
431 const dbPath = getDatabasePath(resolvedRoot);
432 const db = DatabaseConnection.open(dbPath);
433 const queries = new QueryBuilder(db.getDb());
434
435 return new CodeGraph(db, queries, resolvedRoot);
436 }
437
438 /**
439 * Check if a directory has been initialized as a CodeGraph project

Callers 15

readFileInChunksFunction · 0.80
spawnDetachedDaemonFunction · 0.80
getCodeGraphMethod · 0.80
retryInitializeSyncMethod · 0.80
query-worker.tsFile · 0.80
mainFunction · 0.80
probe-sweep.mjsFile · 0.80
probe-trace.mjsFile · 0.80
probe-explore.mjsFile · 0.80
runCaseFunction · 0.80
runExploreFunction · 0.80

Calls 7

isInitializedFunction · 0.90
validateDirectoryFunction · 0.90
getDatabasePathFunction · 0.90
getDbMethod · 0.80
resolveMethod · 0.65
joinMethod · 0.45
openMethod · 0.45

Tested by 2

graphCountsFunction · 0.64
runFunction · 0.64