Skip to content

Commit f1bca97

Browse files
davidsmfreireclaude
andcommitted
docs: refresh feature coverage across READMEs and CHANGELOG
Recent feature work — Go and JS/TS extractors, MERGE validation, Postgres identifier folding, live database introspection, the first-party VS Code extension, and expanded LSP filetype coverage — hadn't been reflected in the user-facing docs yet. Update the language list, feature matrix, workspace layout, CLI flag table, LSP filetype list, and CHANGELOG so the docs match what ships. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 9c278bb commit f1bca97

6 files changed

Lines changed: 79 additions & 22 deletions

File tree

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,23 @@ From the first tagged release onward, this file is maintained by
1616
- CI matrix across ubuntu/macos/windows with fmt + clippy + cargo-deny gates.
1717
- `dependabot`, `release-plz`, `cargo-deny`, and `CHANGELOG.md` infrastructure.
1818
- MSRV declared as 1.80 (earliest version supporting `std::sync::LazyLock`).
19+
- Go SQL extractor (`finder/go.rs`): raw / interpreted string literals
20+
and `fmt.Sprintf`-style verbs.
21+
- JavaScript / TypeScript SQL extractor (`finder/javascript.rs`):
22+
single-, double-, and template-string literals across `.js`, `.ts`,
23+
and `.tsx`; `${…}` substitutions stripped before parsing.
24+
- `MERGE INTO … USING … ON … WHEN [NOT] MATCHED` validation
25+
(`validation/clauses/merge.rs`).
26+
- Postgres-aware identifier folding (`schema::sql::fold_ident`):
27+
unquoted identifiers fold to lower case, quoted identifiers preserve
28+
case. Other dialects keep ASCII case-insensitive matching.
29+
- `sqlshield-introspect` crate: live schema reader for Postgres and
30+
SQLite. Wired into the CLI as `--db-url` (and `db_url` in
31+
`.sqlshield.toml`); mutually exclusive with `--schema`.
32+
- First-party VS Code extension under `editors/vscode/` wrapping
33+
`sqlshield-lsp` over stdio.
34+
- LSP filetype coverage extended to `go`, `javascript`, `typescript`,
35+
and `typescriptreact` alongside `python`, `rust`, and `sql`.
1936

2037
### Changed
2138
- `validate_files` now returns `Result` rather than panicking on schema load.

CONTRIBUTING.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ Rough recipe:
5050
## Architecture at a glance
5151

5252
```
53-
Source file (*.py, *.rs)
53+
Source file (*.py, *.rs, *.go, *.js, *.ts, *.tsx)
5454
│ tree-sitter extracts string literals
5555
56-
SQL string (with {…} placeholders replaced by `1`)
56+
SQL string (with {…} / ${…} / fmt verbs replaced by `1`)
5757
│ sqlparser parses
5858
5959
AST (Vec<Statement>)
@@ -66,6 +66,9 @@ Vec<SqlValidationError>
6666
- `sqlshield-cli` — thin clap-based CLI wrapper
6767
- `sqlshield-py` — PyO3 bindings exposing `validate_query` / `validate_files`
6868
- `sqlshield-lsp` — Language Server for editor integration
69+
- `sqlshield-introspect` — live schema reader for Postgres / SQLite,
70+
consumed by the CLI's `--db-url` flag
71+
- `editors/vscode` — first-party VS Code extension wrapping `sqlshield-lsp`
6972

7073
## Releases
7174

README.md

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ It works on:
2828
- Plain `"…"` and raw `r#"…"#` Rust string literals (sqlx-idiomatic).
2929
- Python f-strings (`f"…{x}…"`) and `.format()` strings (`{{` / `}}`
3030
escapes preserved).
31+
- Go raw / interpreted string literals, including `fmt.Sprintf` verbs.
32+
- JavaScript / TypeScript single-, double-, and template-string literals
33+
(`.js`, `.ts`, `.tsx`); `${…}` template substitutions are stripped
34+
before parsing.
3135
- Standalone `.sql` files (via the LSP).
3236

3337
It checks:
@@ -118,8 +122,16 @@ config; the config overrides defaults.
118122
schema = "db/schema.sql"
119123
directory = "src"
120124
dialect = "postgres"
125+
# Or pull the schema from a live database instead of a file:
126+
# db_url = "postgres://user:pass@localhost/mydb"
127+
# db_url = "sqlite:///abs/path/to/db.sqlite"
121128
```
122129

130+
Live introspection is feature-gated; the published binary ships with it
131+
on. To validate against a running database without a `.sql` file, pass
132+
`--db-url` (or set `db_url` in the config). Postgres and SQLite are
133+
supported today; MySQL is pending a Rust toolchain bump.
134+
123135
Supported dialects: `generic` (default), `postgres` / `postgresql` / `pg`,
124136
`mysql`, `sqlite`, `mssql` / `sqlserver`, `snowflake`, `bigquery` / `bq`,
125137
`redshift`, `clickhouse`, `duckdb`, `hive`, `ansi`. The dialect controls
@@ -134,10 +146,14 @@ The walker prunes `target/`, `.git/`, `node_modules/`, `.venv/`, `venv/`,
134146

135147
[`sqlshield-lsp`](sqlshield-lsp/README.md) is a Language Server that
136148
publishes diagnostics for embedded SQL on every `didOpen` / `didChange`.
137-
Any LSP-aware editor (VS Code, Neovim, Helix, Emacs, Zed) can show inline
149+
Any LSP-aware editor (Neovim, Helix, Emacs, Zed, …) can show inline
138150
squiggles on the offending SQL string. The crate's README has the wiring
139151
recipes.
140152

153+
A first-party VS Code extension lives at
154+
[`editors/vscode/`](editors/vscode/README.md) — it spawns `sqlshield-lsp`
155+
over stdio and forwards diagnostics as you type.
156+
141157
## Python integration
142158

143159
[`sqlshield-py`](sqlshield-py/) exposes `validate_query` and
@@ -176,9 +192,10 @@ errors = sqlshield.validate_query(
176192
| Function args / `CASE` / `CAST` / arithmetic ||
177193
| Case-insensitive identifier matching ||
178194
| 12 SQL dialects via `--dialect` ||
179-
| Live database introspection ||
180-
| Quoted-vs-unquoted identifier folding (Postgres rules) ||
181-
| `MERGE` ||
195+
| `MERGE INTO … USING … WHEN [NOT] MATCHED` ||
196+
| Postgres quoted-vs-unquoted identifier folding ||
197+
| Live database introspection (Postgres + SQLite) ||
198+
| MySQL live introspection ||
182199

183200
## Limitations
184201

@@ -219,6 +236,10 @@ Workspace layout:
219236
- [`sqlshield-cli/`](sqlshield-cli/) — clap-based CLI wrapper.
220237
- [`sqlshield-py/`](sqlshield-py/) — PyO3 bindings.
221238
- [`sqlshield-lsp/`](sqlshield-lsp/)`tower-lsp` Language Server.
239+
- [`sqlshield-introspect/`](sqlshield-introspect/) — live schema reader
240+
for Postgres and SQLite (consumed by `--db-url`).
241+
- [`editors/vscode/`](editors/vscode/) — first-party VS Code extension
242+
wrapping `sqlshield-lsp`.
222243

223244
## Similar tools
224245

@@ -233,9 +254,9 @@ Workspace layout:
233254
linter; complementary, not overlapping (squawk lints DDL, sqlshield
234255
lints embedded DML/SELECT).
235256

236-
sqlshield's niche: language-agnostic extraction (Python + Rust today,
237-
extensible) with a multi-dialect parser, no database connection
238-
required.
257+
sqlshield's niche: language-agnostic extraction (Python, Rust, Go, and
258+
JavaScript / TypeScript today, extensible) with a multi-dialect parser,
259+
no database connection required (live introspection optional).
239260

240261
## Contributing
241262

sqlshield-cli/README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# sqlshield-cli
22

33
Command-line linter for [sqlshield](https://github.com/davidsmfreire/sqlshield)
4-
validates raw SQL strings embedded in Python and Rust source files
5-
against a declared schema, without touching a database.
4+
validates raw SQL strings embedded in Python, Rust, Go, and
5+
JavaScript / TypeScript source files against a declared schema (or a
6+
live Postgres / SQLite database).
67

78
## Install
89

@@ -23,7 +24,13 @@ sqlshield --directory src --schema schema.sql
2324
sqlshield [OPTIONS]
2425
2526
-d, --directory <DIRECTORY> Default: "."
26-
-s, --schema <SCHEMA> Default: "schema.sql"
27+
-s, --schema <SCHEMA> Default: "schema.sql".
28+
Mutually exclusive with --db-url.
29+
--db-url <URL> Read schema from a live database instead
30+
of a file. Examples:
31+
postgres://user:pass@localhost/mydb
32+
sqlite:///abs/path/to/db.sqlite
33+
./relative.sqlite
2734
--dialect <DIALECT> generic | postgres | mysql | sqlite |
2835
mssql | snowflake | bigquery | redshift |
2936
clickhouse | duckdb | hive | ansi
@@ -46,6 +53,8 @@ for full details.
4653
schema = "db/schema.sql"
4754
directory = "src"
4855
dialect = "postgres"
56+
# Optional: introspect a running DB instead of reading schema.sql
57+
# db_url = "postgres://user:pass@localhost/mydb"
4958
```
5059

5160
### Exit codes

sqlshield-lsp/README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# sqlshield-lsp
22

33
Language Server Protocol frontend for [sqlshield](../README.md). Emits
4-
schema-aware SQL diagnostics for embedded queries in `.py` and `.rs` files as
5-
well as plain `.sql` files. Every editor that speaks LSP (VS Code, Neovim,
6-
Helix, Emacs, Zed, …) can show squiggles on the offending SQL string.
4+
schema-aware SQL diagnostics for embedded queries in `.py`, `.rs`, `.go`,
5+
`.js`, `.ts`, and `.tsx` files as well as plain `.sql` files. Every
6+
editor that speaks LSP (VS Code, Neovim, Helix, Emacs, Zed, …) can show
7+
squiggles on the offending SQL string.
78

89
> **Status:** experimental — full-document sync, diagnostics only. No
910
> completion, hover, or code actions yet.
@@ -42,7 +43,10 @@ if not configs.sqlshield_lsp then
4243
configs.sqlshield_lsp = {
4344
default_config = {
4445
cmd = { "sqlshield-lsp" },
45-
filetypes = { "python", "rust", "sql" },
46+
filetypes = {
47+
"python", "rust", "go", "javascript",
48+
"typescript", "typescriptreact", "sql",
49+
},
4650
root_dir = require("lspconfig.util").root_pattern(".sqlshield.toml", ".git"),
4751
settings = {},
4852
},
@@ -53,8 +57,10 @@ require("lspconfig").sqlshield_lsp.setup({})
5357

5458
### VS Code
5559

56-
Any generic LSP extension (for example, `llllvvuu.llmvm-lsp-client`) can
57-
launch `sqlshield-lsp`. A first-party VS Code extension is future work.
60+
A first-party VS Code extension lives at
61+
[`editors/vscode/`](../editors/vscode/README.md). It spawns
62+
`sqlshield-lsp` over stdio and forwards diagnostics to the editor as you
63+
type. Set `sqlshield.serverPath` if the binary isn't on `PATH`.
5864

5965
## Debugging
6066

sqlshield-py/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ for err in errors:
3737
# ./src/queries.py:7: Column `nickname` not found in table `users`
3838
```
3939

40-
`validate_files` walks `.py` and `.rs` source files, extracts every
41-
embedded SQL string, and validates each against the schema. Generated
42-
and vendored directories (`.git`, `target`, `node_modules`, `.venv`,
43-
`__pycache__`, …) are skipped automatically.
40+
`validate_files` walks `.py`, `.rs`, `.go`, `.js`, `.ts`, and `.tsx`
41+
source files, extracts every embedded SQL string, and validates each
42+
against the schema. Generated and vendored directories (`.git`,
43+
`target`, `node_modules`, `.venv`, `__pycache__`, …) are skipped
44+
automatically.
4445

4546
Each `SqlValidationError` exposes:
4647

0 commit comments

Comments
 (0)