feat(m7.5d): TypeScript reins CLI over a reflected SQLite database - #34
Merged
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
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).