MCPcopy Index your code
hub / github.com/colbymchenry/codegraph / initSync

Method initSync

src/index.ts:266–283  ·  view source on GitHub ↗

* Initialize synchronously (without indexing)

(projectRoot: string)

Source from the content-addressed store, hash-verified

264 * Initialize synchronously (without indexing)
265 */
266 static initSync(projectRoot: string): CodeGraph {
267 const resolvedRoot = path.resolve(projectRoot);
268
269 // Check if already initialized
270 if (isInitialized(resolvedRoot)) {
271 throw new Error(`CodeGraph already initialized in ${resolvedRoot}`);
272 }
273
274 // Create directory structure
275 createDirectory(resolvedRoot);
276
277 // Initialize database
278 const dbPath = getDatabasePath(resolvedRoot);
279 const db = DatabaseConnection.initialize(dbPath);
280 const queries = new QueryBuilder(db.getDb());
281
282 return new CodeGraph(db, queries, resolvedRoot);
283 }
284
285 /**
286 * 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