(projectRoot: string)
| 139 | * schema, or a file SQLite refuses as not a database, says no. |
| 140 | */ |
| 141 | export function isInitialized(projectRoot: string): boolean { |
| 142 | const codegraphDir = getCodeGraphDir(projectRoot); |
| 143 | if (!fs.existsSync(codegraphDir) || !fs.statSync(codegraphDir).isDirectory()) { |
| 144 | return false; |
| 145 | } |
| 146 | // Must have codegraph.db, not just .codegraph folder |
| 147 | const dbPath = path.join(codegraphDir, 'codegraph.db'); |
| 148 | let st: fs.Stats; |
| 149 | try { |
| 150 | st = fs.statSync(dbPath); |
| 151 | } catch { |
| 152 | return false; |
| 153 | } |
| 154 | return hasCodeGraphSchema(dbPath, st); |
| 155 | } |
| 156 | |
| 157 | /** |
| 158 | * `codegraph.db` exists at `projectRoot` but does not carry the schema, and |
no test coverage detected