sqlsift-lsp 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,151 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- ## [0.1.0-alpha.8] - 2026-02-13
11
-
12
- ### Changed
13
- - **Project renamed from sqlsurge to sqlsift** to avoid name conflict with existing [senkenn/sqlsurge](https://github.com/senkenn/sqlsurge) VS Code extension
14
- - crate names: `sqlsift-core`, `sqlsift-cli`, `sqlsift-lsp`
15
- - npm package: `sqlsift-cli`
16
- - binary: `sqlsift`
17
- - config file: `sqlsift.toml`
18
-
19
- ### Fixed
20
- - Fix `auto-tag.yml` release automation: add `actions: write` permission to enable `gh workflow run`
21
-
22
- ## [0.1.0-alpha.7] - 2026-02-11
23
-
24
- ### Added
25
- - **LSP server** (`sqlsift-lsp`): Language Server Protocol support for real-time SQL diagnostics in editors
26
- - textDocument/didOpen, didChange, didSave, didClose
27
- - Automatic schema loading from `sqlsift.toml`
28
- - Schema file change detection with catalog rebuild
29
- - Diagnostic severity, error codes, and help messages
30
- - 12 unit tests (diagnostic conversion, state management)
31
- - **VS Code extension** (`editors/vscode/`): Thin LSP client for VS Code
32
- - Configurable server path via `sqlsift.serverPath` setting
33
- - SQL language configuration (comments, brackets)
34
- - **Neovim support**: Works out of the box with built-in LSP client
35
-
36
- ### Fixed
37
- - `SELECT *` diagnostic now points to the `SELECT` keyword instead of file start
38
-
39
- ## [0.1.0-alpha.6] - 2026-02-08
40
-
41
- ### Added
42
- - **Type inference engine**: SQL expression type checking for WHERE clauses and JOIN conditions
43
- - E0003 (type-mismatch): Detect incompatible type comparisons (e.g., `WHERE id = 'text'`)
44
- - E0007 (join-type-mismatch): Detect JOIN condition type incompatibilities (e.g., `ON users.id = orders.name`)
45
- - Binary operator type validation: comparisons (=, !=, <, >, <=, >=) and arithmetic (+, -, *, /)
46
- - Nested expression type inference: `(a + b) * 2 = c`
47
- - Numeric type compatibility: implicit casts between TINYINT, SMALLINT, INTEGER, BIGINT
48
-
49
- ### Changed
50
- - Reorganized test suite: moved integration tests to `tests/analyzer_tests.rs` (74 tests)
51
- - Improved API documentation with doc-test examples
52
- - Replaced `unwrap()` with `expect()` in catalog code for better error messages
53
-
54
- ## [0.1.0-alpha.5] - 2026-02-08
10
+ ## [0.1.2](https://github.com/yukikotani231/sqlsift/compare/v0.1.1...v0.1.2) - 2026-02-19
55
11
 
56
12
  ### Added
57
- - **MySQL dialect support**: Full schema parsing and query validation for MySQL
58
- - MySQL-specific types: `TINYINT`, `MEDIUMINT`, `UNSIGNED` integer variants, `DATETIME`, inline `ENUM`
59
- - `AUTO_INCREMENT` handling with implicit NOT NULL inference
60
- - 10 MySQL unit tests covering schema parsing, SELECT, JOIN, INSERT, UPDATE, DELETE, subquery, CTE, and error detection
61
- - Real-world MySQL test fixtures:
62
- - **Sakila** (BSD): 16 tables, 40 valid queries, 12 error detection tests
63
- - **Chinook MySQL** (MIT): 11 tables, 40 valid queries, 12 error detection tests
64
13
 
65
- ## [0.1.0-alpha.4] - 2026-02-08
14
+ - add LSP auto-completion for table/column/view names ([#53](https://github.com/yukikotani231/sqlsift/pull/53))
15
+ - add inline comment directives for diagnostic suppression ([#52](https://github.com/yukikotani231/sqlsift/pull/52))
16
+ - add textDocument/hover for table, view, and column info ([#49](https://github.com/yukikotani231/sqlsift/pull/49))
66
17
 
67
- ### Added
68
- - **Derived table (subquery in FROM) support**: Resolve aliases and validate column references for `FROM (SELECT ...) AS sub`
69
- - **LATERAL vs non-LATERAL scope isolation**: Non-LATERAL subqueries correctly cannot see outer FROM tables
70
- - **UPDATE ... FROM / DELETE ... USING**: PostgreSQL-specific multi-table update/delete syntax
71
- - **Recursive CTE support**: CTEs can reference themselves in recursive queries
72
- - **Table-valued functions in FROM**: `generate_series()`, `unnest()` etc. recognized as table sources
73
- - **UNION/INTERSECT/EXCEPT column inference**: Infer output columns from set operations for CTE/derived table validation
74
- - **Comprehensive expression resolution**: AtTimeZone, Collate, Ceil/Floor, Overlay, IsDistinctFrom, IsUnknown, SimilarTo, Tuple, Array, Subscript, Method, GroupingSets/Cube/Rollup
75
- - **Function FILTER/OVER clause resolution**: Validate column references in `COUNT(*) FILTER (WHERE ...)` and `OVER (PARTITION BY ... ORDER BY ...)`
76
- - **ORDER BY column resolution**: Validate ORDER BY references including SELECT alias support
77
- - **Named function argument resolution**: Handle `func(name => value)` syntax
78
- - 72 PostgreSQL pattern test fixtures (basic, advanced, and expression coverage)
18
+ ### Other
79
19
 
80
- ### Fixed
81
- - WHERE subquery scope leak: subqueries in IN/EXISTS no longer pollute outer table scope
82
- - VALUES derived table column aliases now correctly applied
83
- - Empty derived_columns (table-valued functions) no longer cause false column-not-found errors
20
+ - add GitHub templates and CI integration examples ([#54](https://github.com/yukikotani231/sqlsift/pull/54))
84
21
 
85
- ## [0.1.0-alpha.3] - 2026-02-08
86
-
87
- ### Added
88
- - **`--dialect` flag wired up**: CLI `--dialect` option now correctly configures the SQL parser dialect (previously ignored)
89
- - **Real-world schema test fixtures**: Chinook, Pagila, Northwind schemas with comprehensive valid/invalid query tests covering SELECT, JOIN, INSERT, UPDATE, DELETE, subqueries, and CTEs
90
- - Third-party license file for test fixtures
91
-
92
- ### Fixed
93
- - `--dialect` CLI flag was completely ignored; PostgreSQL dialect was hardcoded throughout
94
- - ALTER TABLE warnings for non-schema-affecting operations (e.g., `OWNER TO`) are now suppressed
95
-
96
- ## [0.1.0-alpha.2] - 2026-02-08
97
-
98
- ### Added
99
- - **CHECK constraints**: Column-level and table-level CHECK constraint parsing and storage
100
- - **CREATE TYPE AS ENUM**: Enum type definitions with value storage in catalog
101
- - **GENERATED AS IDENTITY**: ALWAYS and BY DEFAULT identity columns with implicit NOT NULL
102
- - **CREATE VIEW**: View definitions with column inference from SELECT projection, wildcard expansion, and query-time resolution
103
- - **ALTER TABLE**: ADD COLUMN, DROP COLUMN, RENAME COLUMN, RENAME TABLE, ADD CONSTRAINT support
104
- - **Resilient SQL parsing**: Gracefully skip unsupported DDL statements (CREATE FUNCTION, CREATE TRIGGER, CREATE DOMAIN, etc.) instead of failing the entire schema file
105
- - Real-world test fixtures from Sakila and webknossos schemas
106
-
107
- ### Fixed
108
- - Schema files with mixed supported/unsupported SQL statements now parse correctly
109
- - Comments preceding DDL statements no longer cause statement-by-statement parsing to skip valid statements
110
-
111
- ### Changed
112
- - Known Limitations updated: VIEWs are now supported; ALTER TABLE is now supported
113
-
114
- ## [0.1.0-alpha.1] - 2026-02-07
115
-
116
- ### Added
117
- - Initial release of sqlsift
118
- - SQL static analysis against schema definitions
119
- - Support for PostgreSQL dialect
120
- - Schema parsing from CREATE TABLE statements
121
- - Query validation for SELECT, INSERT, UPDATE, DELETE statements
122
- - Error detection:
123
- - E0001: Table not found
124
- - E0002: Column not found
125
- - E0003: Type mismatch (reserved)
126
- - E0004: Potential NULL violation (reserved)
127
- - E0005: Column count mismatch in INSERT
128
- - E0006: Ambiguous column reference
129
- - E0007: JOIN type mismatch (reserved)
130
- - E1000: Parse error
131
- - JOIN condition validation
132
- - Subquery support (including correlated subqueries)
133
- - CTE (Common Table Expressions) support
134
- - Error position reporting (line and column numbers)
135
- - Multiple output formats: human-readable, JSON, SARIF
136
- - Configuration file support (sqlsift.toml)
137
- - Rule disabling via CLI (--disable) or config file
138
- - CLI with check, schema, and parse commands
139
- - Typo suggestions using Levenshtein distance
140
- - CI/CD integration support via exit codes and SARIF output
141
- - Framework integration examples (Rails, Prisma)
22
+ ## [0.1.1](https://github.com/yukikotani231/sqlsift/compare/sqlsift-lsp-v0.1.0...sqlsift-lsp-v0.1.1) - 2026-02-14
142
23
 
143
- ### Known Limitations
144
- - Only PostgreSQL dialect fully supported
145
- - Type checking is basic (existence only, not full type inference)
146
- - No support for VIEWs, functions, or stored procedures
147
- - Derived table (subquery in FROM) column resolution is incomplete
24
+ ### Other
148
25
 
149
- [Unreleased]: https://github.com/yukikotani231/sqlsift/compare/v0.1.0-alpha.8...HEAD
150
- [0.1.0-alpha.8]: https://github.com/yukikotani231/sqlsift/compare/v0.1.0-alpha.7...v0.1.0-alpha.8
151
- [0.1.0-alpha.7]: https://github.com/yukikotani231/sqlsift/compare/v0.1.0-alpha.6...v0.1.0-alpha.7
152
- [0.1.0-alpha.6]: https://github.com/yukikotani231/sqlsift/compare/v0.1.0-alpha.5...v0.1.0-alpha.6
153
- [0.1.0-alpha.5]: https://github.com/yukikotani231/sqlsift/compare/v0.1.0-alpha.4...v0.1.0-alpha.5
154
- [0.1.0-alpha.4]: https://github.com/yukikotani231/sqlsift/compare/v0.1.0-alpha.3...v0.1.0-alpha.4
155
- [0.1.0-alpha.3]: https://github.com/yukikotani231/sqlsift/compare/v0.1.0-alpha.2...v0.1.0-alpha.3
156
- [0.1.0-alpha.2]: https://github.com/yukikotani231/sqlsift/compare/v0.1.0-alpha.1...v0.1.0-alpha.2
157
- [0.1.0-alpha.1]: https://github.com/yukikotani231/sqlsift/releases/tag/v0.1.0-alpha.1
26
+ - update README and CLAUDE.md for current state
27
+ - Rename project from sqlsurge to sqlsift
28
+ - add comprehensive TODO documentation for type inference
29
+ - Prepare v0.1.0-alpha.5 release
30
+ - Update docs to reflect current PostgreSQL support level
31
+ - Update README and CLAUDE.md to reflect current features
32
+ - Prepare v0.1.0-alpha.1 release
33
+ - Add npm package distribution via cargo-dist
34
+ - Fix GitHub username in URLs
35
+ - Add README, CLAUDE.md, and CI workflow
package/README.md CHANGED
@@ -146,6 +146,26 @@ sqlsift check --schema schema/*.sql queries/**/*.sql
146
146
  - ⏳ CASE expression type consistency
147
147
  - ⏳ Subquery/CTE column type inference
148
148
 
149
+ ### Inline Suppression
150
+
151
+ Suppress diagnostics on specific lines using SQL comments:
152
+
153
+ ```sql
154
+ -- Suppress a specific rule on the next line
155
+ -- sqlsift:disable E0002
156
+ SELECT legacy_col FROM users;
157
+
158
+ -- Suppress on the same line
159
+ SELECT legacy_col FROM users; -- sqlsift:disable E0002
160
+
161
+ -- Suppress multiple rules
162
+ SELECT bad_col FROM missing_table; -- sqlsift:disable E0001, E0002
163
+
164
+ -- Suppress all rules on the next line
165
+ -- sqlsift:disable
166
+ SELECT bad_col FROM missing_table;
167
+ ```
168
+
149
169
  ## CLI Reference
150
170
 
151
171
  ```
@@ -193,6 +213,46 @@ sqlsift check -s schema.sql -f json queries/*.sql
193
213
  sqlsift check -s schema.sql -f sarif queries/*.sql > results.sarif
194
214
  ```
195
215
 
216
+ ## CI Integration
217
+
218
+ ### GitHub Actions
219
+
220
+ Add sqlsift to your CI pipeline to catch SQL errors in pull requests:
221
+
222
+ ```yaml
223
+ # .github/workflows/sqlsift.yml
224
+ name: SQL Lint
225
+ on: [push, pull_request]
226
+ jobs:
227
+ sqlsift:
228
+ runs-on: ubuntu-latest
229
+ steps:
230
+ - uses: actions/checkout@v4
231
+ - run: npx sqlsift-cli check --schema schema.sql queries/*.sql
232
+ ```
233
+
234
+ ### GitHub Code Scanning (SARIF)
235
+
236
+ Upload results to GitHub's Security tab:
237
+
238
+ ```yaml
239
+ # .github/workflows/sqlsift.yml
240
+ name: SQL Lint
241
+ on: [push, pull_request]
242
+ jobs:
243
+ sqlsift:
244
+ runs-on: ubuntu-latest
245
+ permissions:
246
+ security-events: write
247
+ steps:
248
+ - uses: actions/checkout@v4
249
+ - run: npx sqlsift-cli check -s schema.sql -f sarif queries/*.sql > results.sarif
250
+ continue-on-error: true
251
+ - uses: github/codeql-action/upload-sarif@v3
252
+ with:
253
+ sarif_file: results.sarif
254
+ ```
255
+
196
256
  ## Supported SQL Queries
197
257
 
198
258
  - SELECT, INSERT, UPDATE, DELETE with full column/table validation
@@ -23,7 +23,7 @@
23
23
  "hasInstallScript": true,
24
24
  "license": "MIT",
25
25
  "name": "sqlsift-lsp",
26
- "version": "0.1.0"
26
+ "version": "0.1.2"
27
27
  },
28
28
  "node_modules/@isaacs/balanced-match": {
29
29
  "engines": {
@@ -515,5 +515,5 @@
515
515
  }
516
516
  },
517
517
  "requires": true,
518
- "version": "0.1.0"
518
+ "version": "0.1.2"
519
519
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "artifactDownloadUrl": "https://github.com/yukikotani231/sqlsift/releases/download/v0.1.0",
2
+ "artifactDownloadUrl": "https://github.com/yukikotani231/sqlsift/releases/download/v0.1.2",
3
3
  "bin": {
4
4
  "sqlsift-lsp": "run-sqlsift-lsp.js"
5
5
  },
@@ -91,7 +91,7 @@
91
91
  "zipExt": ".tar.xz"
92
92
  }
93
93
  },
94
- "version": "0.1.0",
94
+ "version": "0.1.2",
95
95
  "volta": {
96
96
  "node": "18.14.1",
97
97
  "npm": "9.5.0"