(projectRoot, sessionPath)
| 250 | } |
| 251 | |
| 252 | export function getSessionDbPath(projectRoot, sessionPath) { |
| 253 | const candidates = [ |
| 254 | path.resolve(process.cwd(), sessionPath, 'sessions.db'), |
| 255 | path.join(projectRoot, sessionPath, 'sessions.db'), |
| 256 | path.join(projectRoot, 'dist', sessionPath, 'sessions.db'), |
| 257 | path.join(projectRoot, 'src', sessionPath, 'sessions.db') |
| 258 | ] |
| 259 | |
| 260 | const found = candidates.find(p => fs.existsSync(p)) |
| 261 | return { dbPath: found ?? candidates[0], exists: Boolean(found), candidates } |
| 262 | } |
| 263 | |
| 264 | export function openSessionDb(dbPath, { readonly = false } = {}) { |
| 265 | return new DatabaseSync(dbPath, { readOnly: readonly }) |
no outgoing calls
no test coverage detected