Releases: shhac/agent-sql
v1.3.0
What's new
--compactfor schema commands — typed NDJSON:{"type":"tables","values":[...]}. Same token-saving pattern as query compact.schema dump --format sql— outputsCREATE TABLEDDL statements. Replay a schema elsewhere.connection listshowsdisplay_url— credential-safe URL showing the connection targetgo installsupport —go install github.com/shhac/agent-sql/cmd/agent-sql@latest- Docker test infrastructure —
docker-compose.test.yml+make test-integrationfor PG, MySQL, MariaDB, MSSQL
Install / upgrade
brew upgrade shhac/tap/agent-sqlv1.2.0
What's new
- True streaming for SQL drivers — database cursor → output writer, never buffers all rows. SQLite, PG, MySQL, MSSQL stream via
QueryStream; DuckDB/Snowflake use buffered fallback. --compactmode — typed NDJSON messages: columns sent once, then row arrays. Saves tokens for LLMs.- Output formats —
--format json|yaml|csvalongside default NDJSON - Snowflake bug fix — transport errors now retry (was dead code)
- 467 tests (was 217 at Go rewrite start) — resolve, credential, URL parsing, guard bypasses, driver helpers all covered
- Structural improvements — extracted
ScanAllRows,fetchConstraints, unified DuckDB exec, consolidated write commands
Install / upgrade
brew upgrade shhac/tap/agent-sqlv1.1.0
What's new
- Output formats —
--format json|yaml|csvalongside the default NDJSON (jsonl). JSON/YAML produce buffered envelope output; CSV streams rows with RFC 4180 quoting. - Format resolution —
--formatflag >defaults.formatconfig > NDJSON default - Schema commands respect
--format yaml - Removed legacy Bun implementation
Install / upgrade
brew upgrade shhac/tap/agent-sqlv1.0.0
v1.0.0 — Go Rewrite
Complete rewrite from TypeScript/Bun to Go. Single compiled binary, no runtime dependencies.
Highlights
- 8 database drivers: PostgreSQL, CockroachDB, MySQL, MariaDB, SQLite, DuckDB, Snowflake, and MSSQL (new)
- 15 MB binary (was 59 MB) — pure Go, no CGo
- 353 unit tests + 57 parity tests across 5 live databases
- Full CLI: 25 subcommands across query, schema, connection, credential, and config
- Streaming NDJSON output with @Truncated metadata
- Read-only by default with defense-in-depth per driver
New in v1.0.0
- MSSQL support — native Go driver (
go-mssqldb), keyword-based read-only guard,mssql://andsqlserver://URL schemes - Keyword-based PG guard — replaces WASM-based
libpg-queryparser. Combined with server-sideBEGIN READ ONLYfor defense in depth. - Snowflake mock server for testing (
internal/testutil/mockservers/) - goreleaser config for cross-compilation
Migration from v0.x
The Go binary is a drop-in replacement. Same CLI interface, same config files (~/.config/agent-sql/), same output format. The Bun implementation is preserved in agent-sql-bun/ for reference.
Install / upgrade
brew install shhac/tap/agent-sql # new install
brew upgrade shhac/tap/agent-sql # upgradeOr download a binary from the assets below. DuckDB support requires the duckdb CLI on PATH.
v0.7.0
What's new
- MariaDB driver — promoted from a silent MySQL alias to its own first-class driver type. Uses
mariadb://URL scheme and the correct timeout syntax (max_statement_timeinstead of MySQL'sMAX_EXECUTION_TIME). Thin wrapper over the MySQL driver, same pattern as CockroachDB wrapping PostgreSQL.
Now supports 7 databases: PostgreSQL, CockroachDB, MySQL, MariaDB, SQLite, DuckDB, and Snowflake.
Install / upgrade
brew install shhac/tap/agent-sql # new install
brew upgrade shhac/tap/agent-sql # upgradeOr download a binary from the assets below.
v0.6.0
What's new
- DuckDB driver — subprocess-based driver using the
duckdbCLI. Supports.duckdbfiles,duckdb://URLs, and in-memory mode for querying Parquet, CSV, and JSON files directly. Read-only via-readonlyCLI flag (engine-level). RequiresduckdbCLI installed separately (brew install duckdb). - CockroachDB driver — thin wrapper over PostgreSQL with correct defaults (port 26257, database
defaultdb). Recognizescockroachdb://URLs. Read-only guard (libpg-query) works unchanged.
DuckDB quick start
# Query a DuckDB file
agent-sql run -c ./analytics.duckdb 'SELECT * FROM events'
# Query Parquet/CSV/JSON files directly (in-memory, no database needed)
agent-sql run -c duckdb:// "SELECT * FROM 'data/*.parquet'"
agent-sql run -c duckdb:// "SELECT * FROM 'logs.csv' WHERE level = 'ERROR'"Install / upgrade
brew install shhac/tap/agent-sql # new install
brew upgrade shhac/tap/agent-sql # upgradeOr download a binary from the assets below. DuckDB support requires the duckdb CLI on PATH.
v0.5.0
What's new
- CockroachDB driver support —
cockroachdb://URLs now work for both ad-hoc and named connections. Thin wrapper over the PG driver with correct defaults (port 26257, databasedefaultdb). Read-only guard (libpg-query) works unchanged — fails closed for CRDB-specific syntax.
Install / upgrade
brew install shhac/tap/agent-sql # new install
brew upgrade shhac/tap/agent-sql # upgradeOr download a binary from the assets below.
v0.4.0
Code quality and type safety improvements
New utilities
withCatch/withCatchSync— typed error tuples[Error] | [undefined, T], eliminating allletfrom business logicwithRetry— generic retry with configurable backoff, applied to Snowflake HTTP clientwithDriver— resource management for driver connections (open + use + close)withDriverAction— combineswithDriver+ error handling, applied to all 10+ CLI handlersassertNever— exhaustive switch checking for formats and driver types
Type safety
- Exhaustive
switchon output formats — adding a format now causes compile errors everywhere - Single
Driverunion type source of truth (was duplicated in 2 files) - Boundary validation on config.json and credential parsing — clear errors on corrupt data
- PG
array_aggresults properly parsed (Bun.SQL returns string literals viasql.unsafe())
Structure
- Driver files split into subdirectories:
pg/,mysql/,snowflake/with separate schema modules resolve.tssplit into 3 files (was 393 lines, over the 350-line limit)- Shared CLI helpers eliminate boilerplate across all command handlers
Testing
- Driver contract test suite — validates
DriverConnectioninterface generically - Runs against SQLite (always), PG + MySQL (Docker-gated)
- New unit tests: withCatch, withRetry, action-helpers, quote-ident, validate, connection-add parsing
- 488 tests pass (0 skip with Docker PG + MySQL)
v0.3.1
New
connection addaccepts a connection string as a positional argument — auto-detects driver and parses host/port/database from URLs or file paths
Example
agent-sql connection add mydb postgres://localhost:5432/myapp --credential pg-cred
agent-sql connection add local ./data.db
agent-sql connection add sf snowflake://org-acct/DB/SCHEMA?warehouse=WH --credential sfFlags (--driver, --host, etc.) still work and override parsed values.
v0.3.0
JSONL default output format
Breaking change: Default output format is now JSONL (one JSON object per line). Use --format json for the previous envelope format.
New
- JSONL format — each row is a self-contained
{"col": val, ...}line. LLMs never lose track of which value belongs to which column. @paginationmetadata line appended when more rows exist- Compact mode with JSONL reconstructs named keys (no positional arrays)
Example
$ agent-sql run "SELECT id, name FROM users"
{"id": 1, "name": "Alice", "@truncated": null}
{"id": 2, "name": "Bob", "@truncated": null}
Notes
- Non-tabular output (schema, config, explain, count, admin) still uses JSON envelope
--format jsongives the previous{columns, rows}envelopeconfig set defaults.format jsonto revert permanently