smriti/backend
Himanshu Dongre f22056418d Add optional local-first SQLite mode (Phase A core)
Smriti can now run against a file-backed SQLite database with no Docker
and no Postgres, removing the operate-a-backend burden for solo builders.
Postgres remains the stronger shared/team mode, unchanged.

- Portable column types (app/db/types.py): JSON renders as JSONB on
  PostgreSQL and generic JSON on SQLite; the pgvector embedding column
  renders as JSON on SQLite. Same models and create_all on both backends.
- Mode resolution (config.py): SMRITI_DB_MODE=local|postgres, defaulting
  to local when unconfigured. An explicitly-set Postgres DATABASE_URL
  preserves Postgres behavior, so existing setups are unaffected. Local
  DB defaults to ~/.smriti/smriti.db; SMRITI_LOCAL_DB_PATH overrides.
- SQLite engine setup (database.py): check_same_thread plus foreign_keys
  / WAL / busy_timeout pragmas; a lazy first-run create_all bootstrap on
  first DB use, which keeps the integration test suite insulated.
- Removed the integration-test JSONB/VECTOR DDL substitution hack — the
  models are genuinely portable now, so conftest needs no type patching.
- Alembic resolves its URL through the same logic (Postgres mode only).
- New persistent file-backed SQLite smoke test, plus mode-resolution and
  per-dialect type-rendering tests.

Local mode uses create_all, not Alembic. No schema changes.
2026-05-16 22:26:05 +05:30
..
alembic Add optional local-first SQLite mode (Phase A core) 2026-05-16 22:26:05 +05:30
app Add optional local-first SQLite mode (Phase A core) 2026-05-16 22:26:05 +05:30
config Initial public release 2026-03-22 13:48:50 +05:30
tests Add optional local-first SQLite mode (Phase A core) 2026-05-16 22:26:05 +05:30
alembic.ini Initial public release 2026-03-22 13:48:50 +05:30
Dockerfile Initial public release 2026-03-22 13:48:50 +05:30
pyproject.toml Load .env via python-dotenv so extractor gets API keys reliably 2026-04-12 13:11:57 +05:30