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