* Initialize synchronously (without indexing)
(projectRoot: string)
| 442 | * Initialize synchronously (without indexing) |
| 443 | */ |
| 444 | static initSync(projectRoot: string): CodeGraph { |
| 445 | const resolvedRoot = path.resolve(projectRoot); |
| 446 | |
| 447 | // Check if already initialized |
| 448 | if (isInitialized(resolvedRoot)) { |
| 449 | throw new Error(`CodeGraph already initialized in ${resolvedRoot}`); |
| 450 | } |
| 451 | |
| 452 | // Create directory structure |
| 453 | createDirectory(resolvedRoot); |
| 454 | |
| 455 | // Initialize database |
| 456 | const dbPath = getDatabasePath(resolvedRoot); |
| 457 | const db = DatabaseConnection.initialize(dbPath); |
| 458 | const queries = new QueryBuilder(db.getDb()); |
| 459 | |
| 460 | return new CodeGraph(db, queries, resolvedRoot); |
| 461 | } |
| 462 | |
| 463 | /** |
| 464 | * Open an existing CodeGraph project |