sqlrite-engine 0.1.19

Light version of SQLite developed with Rust. Published as `sqlrite-engine` on crates.io; import as `use sqlrite::…`.
Documentation
[workspace]
# Root Cargo package (the engine crate) + the Tauri desktop app + the
# C FFI shim + the language-SDK wrappers (Python, Node.js, WASM …).
# The engine is also the workspace root's own package for historical
# compatibility with scripts that assume `cargo build` at the repo
# root produces the REPL binary.
#
# Note: sdk/wasm isn't a workspace member because its target is
# 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", "sdk/python", "sdk/nodejs"]
resolver = "3"

[package]
# Published to crates.io as `sqlrite-engine` because `sqlrite` was
# already taken (unrelated project — RAG-oriented SQLite wrapper). The
# lib target below keeps `name = "sqlrite"`, so downstream Rust code
# still writes `use sqlrite::…` — only the `cargo add` line and the
# dependency declaration change:
#
#     [dependencies]
#     sqlrite-engine = "0.1"
#     # then in code: use sqlrite::{Database, …};
#
# Any workspace member here that depends on the engine uses the
# `package =` key so the import name stays `sqlrite` internally:
#     sqlrite = { package = "sqlrite-engine", path = "…" }
name = "sqlrite-engine"
version = "0.1.19"
authors = ["Joao Henrique Machado Silva <joaoh82@gmail.com>"]
edition = "2024"
rust-version = "1.85"
description = "Light version of SQLite developed with Rust. Published as `sqlrite-engine` on crates.io; import as `use sqlrite::…`."
repository = "https://github.com/joaoh82/rust_sqlite"
license = "MIT"


# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

# Library target — the engine. Used by the REPL binary below, by tests, and
# by the Tauri desktop app under `desktop/src-tauri/`. Keep the lib's public
# surface small (see `src/lib.rs`); the internals are versioned with
# on-disk format changes, so consumers should stick to the re-exports.
[lib]
name = "sqlrite"
path = "src/lib.rs"

# Binary target — the interactive REPL. Needs the `cli` feature
# (rustyline/clap/env_logger) AND the `ask` feature (sqlrite-ask
# integration for the `.ask` meta-command). Both are default-on; a
# `--no-default-features` build (e.g. for WASM or a minimal
# embedding) skips the bin entirely via `required-features`.
[[bin]]
name = "sqlrite"
path = "src/main.rs"
required-features = ["cli", "ask"]

# Phase 5a quickstart — the canonical "how do I use this as a library?"
# walkthrough. Run with `cargo run --example quickstart`. Lives under
# `examples/rust/` so the top-level `examples/` directory can fan out
# into sibling language-SDK directories (python/, nodejs/, go/, wasm/)
# as each Phase 5 sub-phase lands.
[[example]]
name = "quickstart"
path = "examples/rust/quickstart.rs"

[features]
# Default build includes everything: the REPL binary (cli) and
# POSIX/Windows advisory file locks on the Pager (file-locks).
# Disabled per-feature for embeddings that don't need them —
# notably the WASM SDK, which builds the engine with
# `default-features = false` so rustyline, clap, env_logger, and
# fs2 don't try to compile against wasm32-unknown-unknown (none of
# them support that target).
default = ["cli", "ask", "file-locks"]
cli = ["dep:rustyline", "dep:rustyline-derive", "dep:env_logger", "dep:clap"]
# Phase 7g.2: optional engine integration with the `sqlrite-ask`
# natural-language → SQL crate. Adds `sqlrite::ConnectionAskExt::ask`
# (and the schema-introspection helper that powers it) when enabled.
# The core LLM/HTTP machinery still lives in `sqlrite-ask` itself —
# this feature is just the thin engine-side glue (extension trait +
# schema dump). Exists as a feature so library-only embedders
# (Tauri without ask, the WASM SDK, lean SDK builds) don't pay the
# `sqlrite-ask` weight by default.
#
# The CLI binary requires both `cli` and `ask` (see required-features
# on the `[[bin]]` section) — `.ask` is part of the standard REPL
# surface as of Phase 7g.2.
ask = ["dep:sqlrite-ask"]
file-locks = ["dep:fs2"]

[dependencies]
# Always-on engine deps — pure-Rust and wasm-compatible.
log = "0.4"
sqlparser = "0.61"
thiserror = "2.0"
prettytable-rs = "0.10"
# Phase 7e: JSON column type. `serde_json` powers both the validation
# step at INSERT time (parse-and-discard to confirm the text is valid
# JSON) and the path extraction inside the json_extract / json_type
# / json_array_length / json_object_keys SQL functions. `preserve_order`
# keeps object keys in insertion order so json_object_keys output is
# stable; without it, BTreeMap-backed Maps would alphabetically sort,
# which surprises callers re-serializing the same JSON.
serde_json = { version = "1", features = ["preserve_order"] }

# CLI-only deps (feature-gated). `optional = true` + the `cli`
# feature above means these only land in the dep graph when
# something enables the feature.
rustyline = { version = "18.0", optional = true }
rustyline-derive = { version = "0.12", optional = true }
env_logger = { version = "0.11", optional = true }
clap = { version = "4.6", features = ["cargo"], optional = true }

# Cross-platform advisory file locks. Used by the Pager for
# single-writer exclusion (Phase 4a → 4e). Feature-gated because
# fs2 wraps POSIX flock / Windows LockFileEx — neither exists on
# wasm32-unknown-unknown.
fs2 = { version = "0.4", optional = true }

# Phase 7g.2: REPL `.ask` command. Optional + gated under the `cli`
# feature because library-only embedders shouldn't have to pull in
# the LLM stack (HTTP / TLS / extra serde derives) just to use the
# engine. WASM builds skip it via `default-features = false` per
# Q9's JS-callback shape — they do prompt construction in-page but
# never make the HTTP call themselves.
#
# `version = "0.1"` is required for `cargo publish` — the engine
# crate publishes to crates.io, and a path-only dep without a
# version field fails the manifest verification step. See PR #58
# retrospective in docs/roadmap.md.
sqlrite-ask = { version = "0.1", path = "sqlrite-ask", optional = true }