feat(m6.7): Go reins CLI over a reflected SQLite database - #26
Merged
Conversation
Closes the last user-facing gap in the Go port: a zero-code path. Go has no SQLAlchemy-automap, so instead of hand-written models the CLI reflects a live database through its own schema. - orm/sqlreflect.go: ReflectSQLite reads a live SQLite schema via PRAGMA into the same ORM-neutral ModelInfo the GORM path uses, so it flows straight through the existing BuildCapabilities (intent names, natural-key lookups, linting, trimming, schema index). SQLBackend runs the six ops as portable, parameterized SQL with validated + double-quoted identifiers (§2.6 — treat every name as untrusted); FromSQL wires reflect → capabilities. database/sql keeps the orm package driver-free. - cli/cli.go: Inspect / Ask / Chat as plain functions taking an io.Writer and a reins.Model, so they test with a FakeModel and no network. ask/chat build a READ_ONLY agent (writes aren't even generated); inspect --write reveals the gated create/update/delete. OpenDB accepts ./app.db, :memory:, sqlite:/// URLs, and file: URIs. - cmd/reins/main.go: the thin entrypoint — inspect/ask/chat/version, --model (provider:model) or env auto-detect, --write. The pure-Go glebarez/go-sqlite driver ships with the CLI (core stays driver-free; it is the driver GORM already pulls in, so no double-registration). - version.go: Version const (0.1.0a1) matching the Python package, so `reins version` reports the same string across languages. - README: Go section (install, inspect/ask/chat, in-code Define/NewAgent/Ask) and the roadmap now records Go as a working alpha that passes the shared conformance suite. Verified: make go-check green (gofmt, vet, all tests — reflect round-trips, linted generated caps, read-only omits writes, injection-rejecting identifier quoting, FakeModel-driven ask/chat, hinted errors) and a built binary 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.
Closes the last user-facing gap in the Go port: a zero-code path. Go has no SQLAlchemy-automap, so instead of hand-written models the CLI reflects a live database through its own schema.
reins versionreports the same string across languages.Verified: make go-check green (gofmt, vet, all tests — reflect round-trips, linted generated caps, read-only omits writes, injection-rejecting identifier quoting, FakeModel-driven ask/chat, hinted errors) and a built binary smoke-tested against a real SQLite file (reflected a table, chose the unique non-pk column as the natural key, gated writes behind --write).