* Initialize synchronously (without indexing)
(projectRoot: string)
| 307 | * Initialize synchronously (without indexing) |
| 308 | */ |
| 309 | static initSync(projectRoot: string): CodeGraph { |
| 310 | const resolvedRoot = path.resolve(projectRoot); |
| 311 | |
| 312 | // Check if already initialized |
| 313 | if (isInitialized(resolvedRoot)) { |
| 314 | throw new Error(`CodeGraph already initialized in ${resolvedRoot}`); |
| 315 | } |
| 316 | |
| 317 | // Create directory structure |
| 318 | createDirectory(resolvedRoot); |
| 319 | |
| 320 | // Initialize database |
| 321 | const dbPath = getDatabasePath(resolvedRoot); |
| 322 | const db = DatabaseConnection.initialize(dbPath); |
| 323 | const queries = new QueryBuilder(db.getDb()); |
| 324 | |
| 325 | return new CodeGraph(db, queries, resolvedRoot); |
| 326 | } |
| 327 | |
| 328 | /** |
| 329 | * Open an existing CodeGraph project |