Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/install-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ jobs:
with:
submodules: recursive

- name: Cache Bun binary
uses: actions/cache@v3
with:
path: ~/.bun
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
restore-keys: ${{ runner.os }}-bun-

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
Expand Down
5 changes: 4 additions & 1 deletion install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ if (Test-Path (Join-Path $SMRITI_HOME ".git")) {
Push-Location $SMRITI_HOME
git submodule update --init --recursive 2>&1 | Out-Null
Pop-Location
Push-Location $SMRITI_HOME; bun install --silent; Pop-Location
Push-Location $SMRITI_HOME
# Use --frozen-lockfile for faster cached installs (validates lockfile)
bun install --frozen-lockfile --silent 2>$null || bun install --silent
Pop-Location
Ok "Dependencies installed"

# ─── smriti.cmd shim ─────────────────────────────────────────────────────────
Expand Down
3 changes: 2 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ git submodule update --init --recursive 2>/dev/null || true
# --- Install dependencies ----------------------------------------------------

info "Installing dependencies..."
bun install --frozen-lockfile 2>/dev/null || bun install
# Use --frozen-lockfile for fast cached installs, fallback to regular install
bun install --frozen-lockfile 2>/dev/null || bun install --no-progress

# --- Create binary wrapper ----------------------------------------------------

Expand Down
8 changes: 7 additions & 1 deletion src/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

import { Database } from "bun:sqlite";
import * as sqliteVec from "sqlite-vec";
import { mkdirSync } from "fs";
import { dirname } from "path";
import { QMD_DB_PATH } from "./config";
import { initializeMemoryTables } from "./qmd";

Expand All @@ -19,7 +21,11 @@ let _db: Database | null = null;
/** Get or create the shared database connection */
export function getDb(path?: string): Database {
if (_db) return _db;
_db = new Database(path || QMD_DB_PATH);
const dbPath = path || QMD_DB_PATH;
// Ensure parent directory exists before creating database file
const dbDir = dirname(dbPath);
mkdirSync(dbDir, { recursive: true });
_db = new Database(dbPath);
_db.exec("PRAGMA journal_mode = WAL");
_db.exec("PRAGMA foreign_keys = ON");
// Load sqlite-vec extension for vector search support
Expand Down
Loading