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