sqlite-hub 1.4.0 → 2.0.0

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.
Files changed (46) hide show
  1. package/README.md +14 -1
  2. package/bin/sqlite-hub-mcp.js +8 -0
  3. package/bin/sqlite-hub.js +555 -122
  4. package/docs/API.md +30 -0
  5. package/docs/CLI.md +22 -0
  6. package/docs/CLI_API_PARITY.md +61 -0
  7. package/docs/MCP.md +85 -0
  8. package/docs/changelog.md +13 -1
  9. package/docs/guidelines/AGENTS.md +32 -0
  10. package/docs/{DESIGN_GUIDELINES.md → guidelines/DESIGN.md} +10 -0
  11. package/docs/todo.md +1 -14
  12. package/frontend/js/api.js +49 -0
  13. package/frontend/js/app.js +202 -2
  14. package/frontend/js/components/connectionCard.js +3 -1
  15. package/frontend/js/components/modal.js +356 -15
  16. package/frontend/js/components/sidebar.js +41 -7
  17. package/frontend/js/components/topNav.js +2 -14
  18. package/frontend/js/router.js +10 -0
  19. package/frontend/js/store.js +483 -7
  20. package/frontend/js/utils/inputClear.js +36 -0
  21. package/frontend/js/utils/syntheticData.js +240 -0
  22. package/frontend/js/views/backups.js +52 -0
  23. package/frontend/js/views/data.js +16 -0
  24. package/frontend/js/views/logs.js +339 -0
  25. package/frontend/js/views/settings.js +266 -30
  26. package/frontend/js/views/structure.js +6 -0
  27. package/frontend/js/views/tableAdvisor.js +385 -0
  28. package/frontend/js/views/tableDesigner.js +6 -0
  29. package/frontend/styles/components.css +149 -0
  30. package/frontend/styles/tailwind.generated.css +1 -1
  31. package/frontend/styles/views.css +31 -0
  32. package/package.json +4 -2
  33. package/server/mcp/stdioServer.js +272 -0
  34. package/server/routes/data.js +45 -0
  35. package/server/routes/externalApi.js +285 -2
  36. package/server/routes/logs.js +127 -0
  37. package/server/routes/settings.js +47 -0
  38. package/server/server.js +3 -0
  39. package/server/services/databaseCommandService.js +284 -2
  40. package/server/services/mcpStatusService.js +140 -0
  41. package/server/services/mcpToolService.js +274 -0
  42. package/server/services/sqlite/dataBrowserService.js +36 -0
  43. package/server/services/sqlite/introspection.js +226 -22
  44. package/server/services/sqlite/syntheticDataGenerator.js +728 -0
  45. package/server/services/sqlite/tableAdvisor.js +790 -0
  46. package/server/services/storage/appStateStore.js +821 -169
package/README.md CHANGED
@@ -39,6 +39,7 @@ SQLite Hub keeps that workflow sharp:
39
39
  - inspect database health, storage metrics, and schema connectivity from one overview
40
40
  - filter, sort, page through, and export table data
41
41
  - inspect schema, structure, and relationships
42
+ - analyze individual tables with a deterministic local advisor
42
43
  - generate TypeScript, Rust, Kotlin, or Swift types from table schemas
43
44
  - edit records in place with typed value previews and an SQL diff preview before saving
44
45
  - export tables and query results as CSV, TSV, Markdown, JSON, Parquet, or duplicate them as a table
@@ -73,12 +74,20 @@ Type generation uses SQLite's declared column types plus schema constraints such
73
74
 
74
75
  The same generator is available through the [CLI](./docs/CLI.md) and [local API](./docs/API.md) for automation.
75
76
 
77
+ ### Table Advisor
78
+
79
+ The Table Advisor analyzes one table at a time and produces a deterministic, local health report. It does not call an external service; the result is derived from SQLite schema metadata, indexes, foreign keys, row counts, and column profiles from the active database.
80
+
81
+ For each table, SQLite Hub calculates a score, lists findings by severity, shows the evidence behind each finding, and includes copyable SQL suggestions where a direct fix is useful. The advisor can flag missing primary keys, foreign-key-like columns without constraints, join/filter columns without indexes, likely-unique values without a UNIQUE index, enum-like columns that could use a `CHECK` constraint, mostly-null columns, empty strings mixed with nullable text, timestamp columns that need defaults or update logic, and generic column names that hide intent.
82
+
76
83
  ### Data browser
77
84
 
78
85
  [![SQLite Hub data browser](./frontend/assets/mockups/data_1_1920.webp)](./frontend/assets/mockups/data_1_1920.webp)
79
86
 
80
87
  Scan rows, sort columns, move through local data quickly, and export full tables as CSV, TSV, Markdown, JSON, or Parquet.
81
88
 
89
+ Use `Generate` in the Data browser to create local synthetic test rows from the current table schema. The generator respects required columns, foreign keys, simple `CHECK` constraints, and shows a preview before insertion.
90
+
82
91
  The Data browser also supports duplicating exports as a new table, searchable and hideable table navigation, page sizes up to 250 rows, and advanced filters with column/operator/value controls. Text filters support case-insensitive `contains`, `not contains`, and exact `equals` matching.
83
92
 
84
93
  Wide tables keep their horizontal scroll position when sorting causes the grid to re-render. Cells use compact previews for long values, BLOBs, and detected file paths, while exports retain complete BLOB content.
@@ -256,7 +265,11 @@ rows as JSON, generating schema types, and working with Markdown documents. See
256
265
 
257
266
  ## API
258
267
 
259
- SQLite Hub also provides a local JSON API for app info, database metadata, tables, saved queries, exports, documents, and schema type generation. `/api/v1/info` returns the same app/version status as `sqlite-hub --info`; database data is protected by database-specific API itokens created in Settings. See the [API documentation](./docs/API.md) for authentication, endpoints, and examples.
268
+ SQLite Hub also provides a local JSON API for app info, database metadata, tables, saved queries, exports, documents, and schema type generation. `/api/v1/info` returns the same app/version status as `sqlite-hub --info`; database data is protected by database-specific API tokens created in Settings. See the [API documentation](./docs/API.md) for authentication, endpoints, and examples.
269
+
270
+ ## MCP
271
+
272
+ SQLite Hub includes a local stdio MCP server for agents such as Codex. It exposes the shared API/CLI service layer as guarded tools for schema inspection, read-only queries, query-plan explanation, backups, type generation, documents, and chart creation. See the [MCP documentation](./docs/MCP.md) for setup, tool names, and security boundaries.
260
273
 
261
274
  ## Changelog
262
275
 
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { startMcpStdioServer } = require("../server/mcp/stdioServer");
4
+
5
+ startMcpStdioServer().catch((error) => {
6
+ process.stderr.write(`SQLite Hub MCP failed to start: ${error.message}\n`);
7
+ process.exitCode = 1;
8
+ });