Skip to content

feat(m7.5d): TypeScript reins CLI over a reflected SQLite database - #34

Merged
shamspias merged 1 commit into
mainfrom
build/m7.5d-ts-cli
Jul 6, 2026
Merged

feat(m7.5d): TypeScript reins CLI over a reflected SQLite database#34
shamspias merged 1 commit into
mainfrom
build/m7.5d-ts-cli

Conversation

@shamspias

Copy link
Copy Markdown
Owner

The zero-code path for the TS port: point the reins CLI at a SQLite database and inspect/ask/chat over it — the mirror of the Go CLI.

  • cli/sqlite.ts: live schema reflection via the built-in node:sqlite (ZERO new deps). reflectSqlite reads PRAGMA table_info/index_list into the same ORM-neutral ModelInfo the Drizzle path uses, so it flows straight through the shared buildCapabilities (intent names, natural-key lookups, linting, trimming, schema index). SqliteBackend runs the six ops as parameterized SQL with validated + double-quoted identifiers (§2.6) and boolean/value coercion for SQLite binding.
  • cli/cli.ts: inspect / ask / chat as plain functions taking a line Writer and a reins.Model, so they test with a FakeModel and no network. ask/chat build a read_only agent (writes aren't generated); inspect --write reveals the gated create/update/delete. openDb accepts ./app.db, :memory:, sqlite:/// URLs, file: URIs.
  • cli/main.ts: the reins bin (package.json bin) — inspect/ask/chat/version, --model (provider:model) or env auto-detect, --write. node:sqlite is imported lazily so version/help don't emit its experimental-feature warning.
  • tests: cli.test.ts covers inspect (read-only vs --write), FakeModel-driven ask/chat, and openDb happy/hinted-error paths.

Verified: make js-check green — format, typecheck, 143 tests (142 pass, 1 skip); a built bin smoke-tested against a real SQLite file (reflected a table, chose the unique non-pk column as the natural key, gated writes behind --write).

The zero-code path for the TS port: point the reins CLI at a SQLite database and
inspect/ask/chat over it — the mirror of the Go CLI.

- cli/sqlite.ts: live schema reflection via the built-in node:sqlite (ZERO new
  deps). reflectSqlite reads PRAGMA table_info/index_list into the same ORM-neutral
  ModelInfo the Drizzle path uses, so it flows straight through the shared
  buildCapabilities (intent names, natural-key lookups, linting, trimming, schema
  index). SqliteBackend runs the six ops as parameterized SQL with validated +
  double-quoted identifiers (§2.6) and boolean/value coercion for SQLite binding.
- cli/cli.ts: inspect / ask / chat as plain functions taking a line Writer and a
  reins.Model, so they test with a FakeModel and no network. ask/chat build a
  read_only agent (writes aren't generated); inspect --write reveals the gated
  create/update/delete. openDb accepts ./app.db, :memory:, sqlite:/// URLs, file:
  URIs.
- cli/main.ts: the reins bin (package.json bin) — inspect/ask/chat/version, --model
  (provider:model) or env auto-detect, --write. node:sqlite is imported lazily so
  version/help don't emit its experimental-feature warning.
- tests: cli.test.ts covers inspect (read-only vs --write), FakeModel-driven
  ask/chat, and openDb happy/hinted-error paths.

Verified: make js-check green — format, typecheck, 143 tests (142 pass, 1 skip);
a built bin smoke-tested against a real SQLite file (reflected a table, chose the
unique non-pk column as the natural key, gated writes behind --write).
@shamspias
shamspias merged commit 243af00 into main Jul 6, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant