Skip to content

Releases: shhac/agent-sql

v1.3.0

29 Mar 18:31
01be814

Choose a tag to compare

What's new

  • --compact for schema commands — typed NDJSON: {"type":"tables","values":[...]}. Same token-saving pattern as query compact.
  • schema dump --format sql — outputs CREATE TABLE DDL statements. Replay a schema elsewhere.
  • connection list shows display_url — credential-safe URL showing the connection target
  • go install supportgo install github.com/shhac/agent-sql/cmd/agent-sql@latest
  • Docker test infrastructuredocker-compose.test.yml + make test-integration for PG, MySQL, MariaDB, MSSQL

Install / upgrade

brew upgrade shhac/tap/agent-sql

v1.2.0

29 Mar 17:58
9371424

Choose a tag to compare

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.
  • --compact mode — typed NDJSON messages: columns sent once, then row arrays. Saves tokens for LLMs.
  • Output formats--format json|yaml|csv alongside 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-sql

v1.1.0

29 Mar 17:18
830f9d8

Choose a tag to compare

What's new

  • Output formats--format json|yaml|csv alongside the default NDJSON (jsonl). JSON/YAML produce buffered envelope output; CSV streams rows with RFC 4180 quoting.
  • Format resolution--format flag > defaults.format config > NDJSON default
  • Schema commands respect --format yaml
  • Removed legacy Bun implementation

Install / upgrade

brew upgrade shhac/tap/agent-sql

v1.0.0

29 Mar 16:41
0f9f255

Choose a tag to compare

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:// and sqlserver:// URL schemes
  • Keyword-based PG guard — replaces WASM-based libpg-query parser. Combined with server-side BEGIN READ ONLY for 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   # upgrade

Or download a binary from the assets below. DuckDB support requires the duckdb CLI on PATH.

v0.7.0

29 Mar 11:11
8b67c05

Choose a tag to compare

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_time instead of MySQL's MAX_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   # upgrade

Or download a binary from the assets below.

v0.6.0

28 Mar 16:50
6005e76

Choose a tag to compare

What's new

  • DuckDB driver — subprocess-based driver using the duckdb CLI. Supports .duckdb files, duckdb:// URLs, and in-memory mode for querying Parquet, CSV, and JSON files directly. Read-only via -readonly CLI flag (engine-level). Requires duckdb CLI installed separately (brew install duckdb).
  • CockroachDB driver — thin wrapper over PostgreSQL with correct defaults (port 26257, database defaultdb). Recognizes cockroachdb:// 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   # upgrade

Or download a binary from the assets below. DuckDB support requires the duckdb CLI on PATH.

v0.5.0

28 Mar 15:17
b64cf10

Choose a tag to compare

What's new

  • CockroachDB driver supportcockroachdb:// URLs now work for both ad-hoc and named connections. Thin wrapper over the PG driver with correct defaults (port 26257, database defaultdb). 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   # upgrade

Or download a binary from the assets below.

v0.4.0

28 Mar 02:08
9de79ed

Choose a tag to compare

Code quality and type safety improvements

New utilities

  • withCatch / withCatchSync — typed error tuples [Error] | [undefined, T], eliminating all let from business logic
  • withRetry — generic retry with configurable backoff, applied to Snowflake HTTP client
  • withDriver — resource management for driver connections (open + use + close)
  • withDriverAction — combines withDriver + error handling, applied to all 10+ CLI handlers
  • assertNever — exhaustive switch checking for formats and driver types

Type safety

  • Exhaustive switch on output formats — adding a format now causes compile errors everywhere
  • Single Driver union type source of truth (was duplicated in 2 files)
  • Boundary validation on config.json and credential parsing — clear errors on corrupt data
  • PG array_agg results properly parsed (Bun.SQL returns string literals via sql.unsafe())

Structure

  • Driver files split into subdirectories: pg/, mysql/, snowflake/ with separate schema modules
  • resolve.ts split 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 DriverConnection interface 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

28 Mar 00:39
8f3454a

Choose a tag to compare

New

  • connection add accepts 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 sf

Flags (--driver, --host, etc.) still work and override parsed values.

v0.3.0

28 Mar 00:06
547ad84

Choose a tag to compare

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.
  • @pagination metadata 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 json gives the previous {columns, rows} envelope
  • config set defaults.format json to revert permanently