sqlite-hub 0.16.0 → 0.17.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.
- package/README.md +106 -19
- package/bin/sqlite-hub.js +1041 -224
- package/frontend/index.html +1 -0
- package/frontend/js/api.js +28 -0
- package/frontend/js/app.js +362 -6
- package/frontend/js/components/modal.js +244 -44
- package/frontend/js/components/pageHeader.js +14 -16
- package/frontend/js/components/queryHistoryPanel.js +126 -131
- package/frontend/js/components/sidebar.js +1 -0
- package/frontend/js/router.js +8 -0
- package/frontend/js/store.js +641 -0
- package/frontend/js/utils/markdownDocuments.js +248 -0
- package/frontend/js/views/documents.js +300 -0
- package/frontend/js/views/settings.js +39 -3
- package/frontend/styles/components.css +13 -0
- package/frontend/styles/tailwind.generated.css +1 -1
- package/frontend/styles/views.css +422 -0
- package/package.json +2 -1
- package/server/routes/documents.js +163 -0
- package/server/routes/settings.js +22 -6
- package/server/server.js +6 -0
- package/server/services/storage/appStateStore.js +313 -0
- package/tests/cli-args.test.js +100 -0
- package/tests/copy-column-modal.test.js +83 -0
- package/tests/database-documents.test.js +85 -0
- package/tests/markdown-documents.test.js +79 -0
- package/tests/settings-metadata.test.js +16 -0
- package/tests/settings-view.test.js +32 -0
package/README.md
CHANGED
|
@@ -18,6 +18,7 @@ SQLite Hub keeps that workflow sharp:
|
|
|
18
18
|
- edit records in place with an SQL diff preview before saving
|
|
19
19
|
- export tables and query results as CSV, TSV, Markdown, or duplicate them as a table
|
|
20
20
|
- copy result columns with formatting, headers, first-10 previews, TXT export, and Markdown todo export
|
|
21
|
+
- keep database-scoped Markdown documents with previews, autosave, imports, exports, and saved-query inserts
|
|
21
22
|
- switch between recent databases with sidebar quick picks
|
|
22
23
|
- create simple local backups of the active database
|
|
23
24
|
- run and format SQL in a syntax-highlighted editor with history, messages, and performance metrics
|
|
@@ -65,6 +66,16 @@ Potentially destructive statements are tracked in query history, and SQLite Hub
|
|
|
65
66
|
|
|
66
67
|
SQLite Hub stores query history per database. You can search SQL, titles, and notes; mark useful queries as saved; re-run previous queries; and execute saved queries from the CLI.
|
|
67
68
|
|
|
69
|
+
### Documents
|
|
70
|
+
|
|
71
|
+
Documents are local Markdown notes scoped to the active database. SQLite Hub creates a document folder per database, keeps the sidebar fixed while the editor and preview panes scroll independently, and autosaves changes after a short debounce. You can create, rename, delete, import `.md` files, export the current document as Markdown, and toggle the editor or preview pane as needed.
|
|
72
|
+
|
|
73
|
+
The preview supports regular Markdown, ordered and unordered lists, tables, code blocks, links, and clickable task-list checkboxes. Documents can also pull context from saved SQL Editor queries:
|
|
74
|
+
|
|
75
|
+
- Insert Table opens a saved-query picker and inserts that query's result using the same Markdown table export logic as the SQL Editor.
|
|
76
|
+
- Insert Note opens saved queries that have notes and inserts the selected note directly into the document.
|
|
77
|
+
- Markdown Todo column exports from query results can create a new document without embedding the original SQL query.
|
|
78
|
+
|
|
68
79
|
### Charts
|
|
69
80
|
|
|
70
81
|
Create charts from chartable `SELECT` query-history entries. Charts can be saved per query, reopened later, and rendered from live query results.
|
|
@@ -123,6 +134,8 @@ SQLite Hub ships with a built-in CLI that lets you start the app or query inform
|
|
|
123
134
|
```bash
|
|
124
135
|
sqlite-hub # start on default port 4173
|
|
125
136
|
sqlite-hub --port:4174 # start on a custom port
|
|
137
|
+
sqlite-hub --open # open SQLite Hub in the browser
|
|
138
|
+
sqlite-hub --config # show port, URL, app version, and SQLite version
|
|
126
139
|
sqlite-hub --help # show help text
|
|
127
140
|
sqlite-hub --version # show version number
|
|
128
141
|
```
|
|
@@ -147,49 +160,123 @@ Shows an overview of all databases that have been opened in SQLite Hub, includin
|
|
|
147
160
|
Retrieve details about a single database by its name (case-insensitive):
|
|
148
161
|
|
|
149
162
|
```bash
|
|
150
|
-
sqlite-hub --database
|
|
151
|
-
sqlite-hub --database
|
|
152
|
-
sqlite-hub --database
|
|
163
|
+
sqlite-hub --database:Billly --path # get the file path
|
|
164
|
+
sqlite-hub --database:Billly --size # get the file size
|
|
165
|
+
sqlite-hub --database:Billly --lastopened # get last opened timestamp
|
|
153
166
|
```
|
|
154
167
|
|
|
155
168
|
### List all tables in a database
|
|
156
169
|
|
|
157
170
|
```bash
|
|
158
|
-
sqlite-hub --database
|
|
171
|
+
sqlite-hub --database:Billly --tables
|
|
159
172
|
```
|
|
160
173
|
|
|
161
174
|
Opens the database in read-only mode and prints all table names, sorted alphabetically.
|
|
162
175
|
|
|
176
|
+
### Inspect a table
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
sqlite-hub --database:Billly --table:companies
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Prints table metadata such as columns, primary keys, foreign keys, indexes, row count, and row identity strategy.
|
|
183
|
+
|
|
163
184
|
### SQL Editor - Saved Queries
|
|
164
185
|
|
|
165
186
|
List all saved queries for a database:
|
|
166
187
|
|
|
167
188
|
```bash
|
|
168
|
-
sqlite-hub --database:Unit-00 --
|
|
189
|
+
sqlite-hub --database:Unit-00 --queries
|
|
169
190
|
```
|
|
170
191
|
|
|
171
192
|
Execute a specific saved query by name:
|
|
172
193
|
|
|
173
194
|
```bash
|
|
174
|
-
sqlite-hub --database:Unit-00 --
|
|
195
|
+
sqlite-hub --database:Unit-00 --execute:"15min Posting Buckets without id 96"
|
|
175
196
|
```
|
|
176
197
|
|
|
177
198
|
This searches the query history for the given database, finds the matching saved query by title, executes it, and returns all results with metadata (row count, columns, timing, and data).
|
|
178
199
|
|
|
200
|
+
Show the saved query SQL without executing it:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
sqlite-hub --database:Unit-00 --query:"Stock Winners"
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Show the saved notes for a query:
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
sqlite-hub --database:Unit-00 --notes:"TOP25 Loser and Winner EOD, T1, T3, T5"
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Export a saved query using the same CSV, TSV, and Markdown export logic as the SQL Editor:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
sqlite-hub --database:Unit-00 --export:"Stock Winners" --format:csv
|
|
216
|
+
sqlite-hub --database:Unit-00 --export:"Stock Winners" --format:tsv
|
|
217
|
+
sqlite-hub --database:Unit-00 --export:"Stock Winners" --format:md
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
The export is written to the current working directory using the generated query export filename.
|
|
221
|
+
|
|
222
|
+
### Documents CLI
|
|
223
|
+
|
|
224
|
+
List all Markdown documents stored for a database:
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
sqlite-hub --database:Unit-00 --documents
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Print one document's Markdown content:
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
sqlite-hub --database:Unit-00 --documents:"Research Notes"
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Export one document as a `.md` file into the current working directory:
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
sqlite-hub --database:Unit-00 --documents:"Research Notes" --export
|
|
240
|
+
sqlite-hub --database:Unit-00 --documents:"Research Notes--export"
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Documents can be matched by id, filename, title, or a partial filename/title match.
|
|
244
|
+
|
|
245
|
+
### Row JSON export
|
|
246
|
+
|
|
247
|
+
Export a single row as JSON by primary key or rowid, using the same row-shaping logic as the Row Editor:
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
sqlite-hub --database:Unit-00 --table:companies --export:0a754aba373d34972998792a0be4333c
|
|
251
|
+
```
|
|
252
|
+
|
|
179
253
|
### Available flags
|
|
180
254
|
|
|
181
|
-
| Flag
|
|
182
|
-
|
|
|
183
|
-
| `--help`, `-h`
|
|
184
|
-
| `--version`, `-v`
|
|
185
|
-
| `--
|
|
186
|
-
| `--
|
|
187
|
-
| `--
|
|
188
|
-
| `--database
|
|
189
|
-
| `--database
|
|
190
|
-
| `--database
|
|
191
|
-
| `--database:name --
|
|
192
|
-
| `--database:name --
|
|
255
|
+
| Flag | Description |
|
|
256
|
+
| -------------------------------------------------------- | ----------------------------------------------- |
|
|
257
|
+
| `--help`, `-h` | Show help text |
|
|
258
|
+
| `--version`, `-v` | Show version number |
|
|
259
|
+
| `--config` | Show port, URL, app version, and SQLite version |
|
|
260
|
+
| `--open` | Open SQLite Hub in the browser |
|
|
261
|
+
| `--port:PORT` | Start the server on a custom port |
|
|
262
|
+
| `--database`, `-d` | List all imported databases |
|
|
263
|
+
| `--database:name` | Select a database by name or id |
|
|
264
|
+
| `--database:name --path` | Get the file path of a database |
|
|
265
|
+
| `--database:name --size` | Get the size of a database |
|
|
266
|
+
| `--database:name --lastopened` | Get the last opened timestamp |
|
|
267
|
+
| `--database:name --tables` | Get all table names from a database |
|
|
268
|
+
| `--database:name --queries` | List saved queries for a database |
|
|
269
|
+
| `--database:name --execute:"query"` | Execute a saved query by name |
|
|
270
|
+
| `--database:name --query:"query"` | Print a saved query by name |
|
|
271
|
+
| `--database:name --notes:"query"` | Print saved notes for a query |
|
|
272
|
+
| `--database:name --export:"query" --format:csv\|tsv\|md` | Set query export format |
|
|
273
|
+
| `--database:name --documents` | List Markdown documents for a database |
|
|
274
|
+
| `--database:name --documents:"document"` | Print a document's Markdown content |
|
|
275
|
+
| `--database:name --documents:"document" --export` | Export a document as Markdown |
|
|
276
|
+
| `--database:name --table:"table"` | Print table metadata |
|
|
277
|
+
| `--database:name --table:"table" --export:"pk"` | Export one row as JSON |
|
|
278
|
+
|
|
279
|
+
Legacy aliases such as `--database-path:name`, `--database-size:name`, `--database-lastopened:name`, `--database-tables:name`, and `--database:name --sqleditor:"query"` still work.
|
|
193
280
|
|
|
194
281
|
### SQL editor CLI example
|
|
195
282
|
|
|
@@ -198,7 +285,7 @@ This searches the query history for the given database, finds the matching saved
|
|
|
198
285
|
In the screenshot above, you can see a saved query from the SQL editor. You can create these queries using the graphical interface and execute them via the CLI if you want. To execute one, you would run:
|
|
199
286
|
|
|
200
287
|
```bash
|
|
201
|
-
sqlite-hub --database:Unit-00 --
|
|
288
|
+
sqlite-hub --database:Unit-00 --execute:"Group by creation Year"
|
|
202
289
|
```
|
|
203
290
|
|
|
204
291
|
Example output:
|