Skip to content

Commit 726b5ff

Browse files
committed
fixing a failing test
1 parent ce8e746 commit 726b5ff

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/import/importers/CursorImporter.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66
import path from 'node:path';
7-
import { DatabaseSync } from 'node:sqlite';
87
import fse from 'fs-extra';
98
import type {
109
ImportSource,
@@ -442,7 +441,7 @@ export class CursorImporter extends BaseImporter {
442441
});
443442

444443
try {
445-
const sessionData = this.readCursorSession(dbPath);
444+
const sessionData = await this.readCursorSession(dbPath);
446445

447446
if (!sessionData || sessionData.messages.length === 0) {
448447
skipped++;
@@ -484,14 +483,16 @@ export class CursorImporter extends BaseImporter {
484483
* Reads a single Cursor session from its SQLite store.db.
485484
* Returns extracted metadata and converted messages, or null if unreadable.
486485
*/
487-
private readCursorSession(dbPath: string): {
486+
private async readCursorSession(dbPath: string): Promise<{
488487
agentId: string;
489488
name: string;
490489
model: string;
491490
createdAt: string;
492491
projectPath: string;
493492
messages: SessionMessage[];
494-
} | null {
493+
} | null> {
494+
// Lazy-load node:sqlite so the binary doesn't crash on runtimes that lack it (e.g. Bun)
495+
const { DatabaseSync } = await import('node:sqlite');
495496
const db = new DatabaseSync(dbPath, { readOnly: true } as Record<string, unknown>);
496497

497498
try {

0 commit comments

Comments
 (0)