* Initialize synchronously (without indexing)
(projectRoot: string)
| 343 | * Initialize synchronously (without indexing) |
| 344 | */ |
| 345 | static initSync(projectRoot: string): CodeGraph { |
| 346 | const resolvedRoot = path.resolve(projectRoot); |
| 347 | |
| 348 | // Check if already initialized |
| 349 | if (isInitialized(resolvedRoot)) { |
| 350 | throw new Error(`CodeGraph already initialized in ${resolvedRoot}`); |
| 351 | } |
| 352 | |
| 353 | // Create directory structure |
| 354 | createDirectory(resolvedRoot); |
| 355 | |
| 356 | // Initialize database |
| 357 | const dbPath = getDatabasePath(resolvedRoot); |
| 358 | const db = DatabaseConnection.initialize(dbPath); |
| 359 | const queries = new QueryBuilder(db.getDb()); |
| 360 | |
| 361 | return new CodeGraph(db, queries, resolvedRoot); |
| 362 | } |
| 363 | |
| 364 | /** |
| 365 | * Open an existing CodeGraph project |