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
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# - go-sdk {ubuntu, macos} cgo against libsqlrite_c + go test
# - wasm-build ubuntu wasm-pack build + size report
# - desktop-build ubuntu npm ci + cargo build -p sqlrite-desktop
# - journal-build ubuntu npm ci + cargo build -p sqlrite-journal (SQLR-41 example)
#
# All jobs use caching so a warm PR run takes 2–3 minutes on ubuntu.
# Go CI skips Windows for Phase 6b — Go's cgo on Windows needs a mingw
Expand Down Expand Up @@ -102,6 +103,7 @@ jobs:
run: |
cargo build --workspace \
--exclude sqlrite-desktop \
--exclude sqlrite-journal \
--exclude sqlrite-python \
--exclude sqlrite-nodejs \
--exclude sqlrite-benchmarks \
Expand All @@ -111,6 +113,7 @@ jobs:
run: |
cargo test --workspace \
--exclude sqlrite-desktop \
--exclude sqlrite-journal \
--exclude sqlrite-python \
--exclude sqlrite-nodejs \
--exclude sqlrite-benchmarks
Expand Down Expand Up @@ -147,6 +150,7 @@ jobs:
run: |
cargo clippy --workspace \
--exclude sqlrite-desktop \
--exclude sqlrite-journal \
--exclude sqlrite-python \
--exclude sqlrite-nodejs \
--exclude sqlrite-benchmarks \
Expand All @@ -158,6 +162,7 @@ jobs:
run: |
cargo doc --workspace \
--exclude sqlrite-desktop \
--exclude sqlrite-journal \
--exclude sqlrite-python \
--exclude sqlrite-nodejs \
--exclude sqlrite-benchmarks \
Expand Down Expand Up @@ -400,3 +405,58 @@ jobs:

- name: Build Rust side
run: cargo build -p sqlrite-desktop

# ---------------------------------------------------------------------------
# Journal example (SQLR-41): Tauri 2 + Svelte 5 daily-notes app under
# `examples/desktop-journal/`. Same shape as `desktop-build` — frontend
# first, then `cargo build -p sqlrite-journal`. Excluded from the
# default workspace commands for the same reasons (Svelte build is a
# prerequisite that the main rust-build-and-test job can't satisfy).
journal-build:
name: journal-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: examples/desktop-journal/package-lock.json

- uses: dtolnay/rust-toolchain@stable

- name: Install Tauri Linux deps
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
libayatana-appindicator3-dev \
librsvg2-dev \
patchelf

- uses: Swatinem/rust-cache@v2
with:
shared-key: journal-build

- name: npm install
working-directory: examples/desktop-journal
# `npm ci` would be ideal, but the example doesn't ship a
# lockfile in version control (it's listed in .gitignore so
# downstream forkers don't have to fight a node-version-pinned
# lockfile). `npm install` is acceptable for an example app;
# the engine API surface is what we're really exercising.
run: npm install

- name: Build frontend
working-directory: examples/desktop-journal
run: npm run build

- name: Build Rust side (with ask)
run: cargo build -p sqlrite-journal --all-targets

- name: Build Rust side (no ask)
run: cargo build -p sqlrite-journal --no-default-features --all-targets

- name: Run journal unit tests
run: cargo test -p sqlrite-journal
103 changes: 103 additions & 0 deletions .github/workflows/journal-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# SQLRite Journal — installer build workflow (SQLR-41).
#
# Produces packaged installers for the example desktop journal app:
# - macOS: .dmg + .app bundle
# - Linux: .deb + .AppImage
# - Windows: .msi (best-effort; flag in README if it lights up red)
#
# Manual trigger by default — installers are heavy (~30–40 min total
# wall clock across the matrix), and the example app changes much less
# often than the engine. Tagged pushes matching `journal-v*` also fire.
# Artifacts are attached to a draft GitHub release rather than the
# engine's own release stream so engine releases don't accidentally
# ship a journal binary baseline that's lagging behind.

name: Journal example — installers

on:
workflow_dispatch:
push:
tags:
- 'journal-v*'

permissions:
contents: write # tauri-action needs this to upload to the draft release

jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
label: macos-arm64
target: aarch64-apple-darwin
- os: macos-13
label: macos-x86_64
target: x86_64-apple-darwin
- os: ubuntu-latest
label: linux-x86_64
target: x86_64-unknown-linux-gnu
- os: windows-latest
label: windows-x86_64
target: x86_64-pc-windows-msvc

name: build (${{ matrix.label }})
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '20'

- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- name: Install Tauri Linux deps
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
libayatana-appindicator3-dev \
librsvg2-dev \
patchelf \
libsoup-3.0-dev \
libjavascriptcoregtk-4.1-dev

- uses: Swatinem/rust-cache@v2
with:
workspaces: ./examples/desktop-journal/src-tauri
shared-key: journal-release-${{ matrix.label }}

- name: npm install
working-directory: examples/desktop-journal
run: npm install

# tauri-action does the magic: builds frontend, runs `cargo tauri
# build`, and uploads the resulting installers to a draft release
# tagged with `tagName`. We deliberately don't auto-publish — a
# human reviews the draft and clicks publish.
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
projectPath: examples/desktop-journal
tagName: ${{ startsWith(github.ref, 'refs/tags/journal-v') && github.ref_name || format('journal-v{0}', github.run_number) }}
releaseName: 'SQLRite Journal ${{ startsWith(github.ref, ''refs/tags/journal-v'') && github.ref_name || format(''build-{0}'', github.run_number) }}'
releaseBody: |
Installer artifacts for the SQLRite Journal example app
(SQLR-41). Built against the engine version pinned in
`examples/desktop-journal/src-tauri/Cargo.toml`.

* macOS: `.dmg` (Apple Silicon + Intel)
* Linux: `.deb` + `.AppImage`
* Windows: `.msi`

Source: <https://github.com/joaoh82/rust_sqlite/tree/main/examples/desktop-journal>
releaseDraft: true
prerelease: false
args: --target ${{ matrix.target }}
14 changes: 8 additions & 6 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ SQLRite is a from-scratch SQLite-style embedded database written in Rust. It's p

## Workspace layout

`Cargo.toml` is a workspace whose members are: `.` (the engine, package `sqlrite-engine`, lib `sqlrite`), `desktop/src-tauri`, `sqlrite-ffi`, `sqlrite-ask`, `sqlrite-mcp`, `sdk/python`, `sdk/nodejs`, `benchmarks`. `sdk/wasm` and `sdk/go` are deliberately **not** workspace members (wasm32 target / cgo separation).
`Cargo.toml` is a workspace whose members are: `.` (the engine, package `sqlrite-engine`, lib `sqlrite`), `desktop/src-tauri`, `examples/desktop-journal/src-tauri`, `sqlrite-ffi`, `sqlrite-ask`, `sqlrite-mcp`, `sdk/python`, `sdk/nodejs`, `benchmarks`. `sdk/wasm` and `sdk/go` are deliberately **not** workspace members (wasm32 target / cgo separation).

- `src/` — engine. Public API is `Connection`/`Statement`/`Rows`/`Row`/`Value` from [src/connection.rs](src/connection.rs), re-exported via [src/lib.rs](src/lib.rs). Any new SDK should bind only to this surface.
- `sqlrite-ask/` — pure-Rust LLM adapter (Anthropic/OpenAI/Ollama) for natural-language → SQL. The engine's `ask` feature provides the thin `ConnectionAskExt::ask` glue.
- `sqlrite-mcp/` — MCP stdio server. Seven tools: `list_tables`, `describe_table`, `query`, `execute`, `schema_dump`, `vector_search`, `ask`. `--read-only` opens with a shared lock and hides `execute`.
- `sqlrite-ffi/` — C ABI cdylib + generated `sqlrite.h` header. Backs the Go SDK and any C consumer.
- `desktop/` — Tauri 2 + Svelte 5 GUI. Embeds the engine directly (no FFI hop).
- `desktop/` — Tauri 2 + Svelte 5 generic SQL playground GUI. Embeds the engine directly (no FFI hop).
- `examples/desktop-journal/` — Tauri 2 + Svelte 5 local-first journaling app (SQLR-41). Showcase for Phase 8 BM25 + `ask` in a non-AI-native product. Mirrors `desktop/`'s engine-as-Cargo-dep pattern but uses the modern `Connection` API.
- `benchmarks/` — SQLR-4 / SQLR-16 bench harness. `Driver` trait + SQLRite + SQLite (rusqlite-bundled) drivers + criterion-driven workloads. Excluded from the default CI build/test/clippy/doc commands; run locally with `make bench` (or `make bench-duckdb`). See [docs/benchmarks-plan.md](docs/benchmarks-plan.md).
- `web/` — marketing + docs site (Next.js 15 + Tailwind v4). Independent of the Cargo workspace; lives in-repo for now but is structured to lift into its own repository later. See [web/README.md](web/README.md).

Expand All @@ -30,16 +31,16 @@ CI is the source of truth — the workspace excludes that follow are required be

```sh
# Build / test the Rust workspace (matches CI)
cargo build --workspace --exclude sqlrite-desktop --exclude sqlrite-python --exclude sqlrite-nodejs --exclude sqlrite-benchmarks --all-targets
cargo test --workspace --exclude sqlrite-desktop --exclude sqlrite-python --exclude sqlrite-nodejs --exclude sqlrite-benchmarks
cargo build --workspace --exclude sqlrite-desktop --exclude sqlrite-journal --exclude sqlrite-python --exclude sqlrite-nodejs --exclude sqlrite-benchmarks --all-targets
cargo test --workspace --exclude sqlrite-desktop --exclude sqlrite-journal --exclude sqlrite-python --exclude sqlrite-nodejs --exclude sqlrite-benchmarks

# Single test (exact name; --nocapture to see println!)
cargo test <test_name> -- --nocapture

# Lint (CI runs all three)
cargo fmt --all -- --check
cargo clippy --workspace --exclude sqlrite-desktop --exclude sqlrite-python --exclude sqlrite-nodejs --exclude sqlrite-benchmarks --all-targets
cargo doc --workspace --exclude sqlrite-desktop --exclude sqlrite-python --exclude sqlrite-nodejs --exclude sqlrite-benchmarks --no-deps
cargo clippy --workspace --exclude sqlrite-desktop --exclude sqlrite-journal --exclude sqlrite-python --exclude sqlrite-nodejs --exclude sqlrite-benchmarks --all-targets
cargo doc --workspace --exclude sqlrite-desktop --exclude sqlrite-journal --exclude sqlrite-python --exclude sqlrite-nodejs --exclude sqlrite-benchmarks --no-deps

# Run the REPL (default features include cli + ask + file-locks)
cargo run # in-memory
Expand All @@ -50,6 +51,7 @@ cargo run -- --readonly path/to/db.sqlrite # shared-lock open
cargo build --release -p sqlrite-ffi # C cdylib + sqlrite.h
cd desktop && npm install && npm run tauri dev # desktop app dev mode
cargo run -p sqlrite-mcp -- /path/to.sqlrite # MCP server (stdio)
cd examples/desktop-journal && npm install && npm run tauri dev # journal example app

# Benchmarks (SQLR-4 / SQLR-16) — local-only, never CI
make bench # SQLRite + SQLite (lean)
Expand Down
13 changes: 13 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# wasm32-unknown-unknown. `cargo build --workspace` on a native host
# would fail on a wasm-only crate; wasm-pack drives that build
# separately.
members = [".", "desktop/src-tauri", "sqlrite-ffi", "sqlrite-ask", "sqlrite-mcp", "sdk/python", "sdk/nodejs", "benchmarks"]
members = [".", "desktop/src-tauri", "examples/desktop-journal/src-tauri", "sqlrite-ffi", "sqlrite-ask", "sqlrite-mcp", "sdk/python", "sdk/nodejs", "benchmarks"]
resolver = "3"

[package]
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ Beyond the per-language quickstarts in [`examples/`](examples/), the SQLR-38 umb
|---|---|---|
| [Python LLM agent with persistent memory](examples/python-agent/) | Python | Vector + lexical recall, fact extraction, summaries — all in one `.sqlrite` file |
| [Chat-with-your-notes via Claude Desktop MCP](examples/nodejs-notes/) | Node.js | Markdown → hybrid HNSW + BM25 index → `sqlrite-mcp --read-only` → Claude Desktop |
| [Local-first journaling desktop app](examples/desktop-journal/) | Tauri 2 + Svelte 5 | Markdown daily-notes, BM25 full-text search with hit highlighting, "ask my journal" panel — entire data layer is one `.sqlrite` file |

### Developer guide

Expand Down
9 changes: 9 additions & 0 deletions examples/desktop-journal/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Tauri / Vite / Node
dist/
node_modules/
src-tauri/target/
src-tauri/gen/
*.log

# Tauri builds runtime caches into the bundle dir
src-tauri/Cargo.lock
Loading
Loading