* Initialize synchronously (without indexing)
(projectRoot: string)
| 272 | * Initialize synchronously (without indexing) |
| 273 | */ |
| 274 | static initSync(projectRoot: string): CodeGraph { |
| 275 | const resolvedRoot = path.resolve(projectRoot); |
| 276 | |
| 277 | // Check if already initialized |
| 278 | if (isInitialized(resolvedRoot)) { |
| 279 | throw new Error(`CodeGraph already initialized in ${resolvedRoot}`); |
| 280 | } |
| 281 | |
| 282 | // Create directory structure |
| 283 | createDirectory(resolvedRoot); |
| 284 | |
| 285 | // Initialize database |
| 286 | const dbPath = getDatabasePath(resolvedRoot); |
| 287 | const db = DatabaseConnection.initialize(dbPath); |
| 288 | const queries = new QueryBuilder(db.getDb()); |
| 289 | |
| 290 | return new CodeGraph(db, queries, resolvedRoot); |
| 291 | } |
| 292 | |
| 293 | /** |
| 294 | * Open an existing CodeGraph project |