import path from "node:path";
import { patchtrailAppDataDir } from "../config/appDataPath.js";
import { LocalSqliteStore } from "./LocalSqliteStore.js";
export function createLocalStore(options) {
    const env = options.env ?? process.env;
    const dbPath = env.PATCHTRAIL_LOCAL_DB_PATH ?? defaultDbPath(env, options.mode);
    return LocalSqliteStore.openSync(dbPath);
}
function defaultDbPath(env, mode) {
    if (mode === "test")
        return ":memory:";
    return path.join(patchtrailAppDataDir(env), "patchtrail.sqlite");
}
