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