dirsql 0.4.118 → 0.4.120

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.
@@ -237,6 +237,50 @@ On startup the server prints `Running at <host>:<port>` to stdout. It runs
237
237
  until it receives `SIGINT` (Ctrl-C) or `SIGTERM`, then drains in-flight
238
238
  requests, closes open `/events` streams, and exits.
239
239
 
240
+ Pass `--frontend` to serve the bundled dirsql SQL explorer shell at `/` on
241
+ the same origin as the HTTP API. It works offline and prints `Frontend at
242
+ http://<host>:<actual-port>/` without opening a browser. With `--port 0`, the
243
+ printed URL uses the assigned port. The page offers an editable SQL box
244
+ holding the starter query `SELECT * FROM './' LIMIT 100`. Nothing runs until
245
+ you press **Run** (or Ctrl/Cmd+Enter); pressing it again refreshes the
246
+ result. Queries go through `POST /query`, so the read-only rule applies, and
247
+ run exactly as written. The page shows elapsed time, the number of rows
248
+ returned, and errors. Values render as text (`NULL` is marked), and only the
249
+ first 1000 rows are displayed. An empty result says so and shows no column
250
+ names, since the response carries none.
251
+
252
+ ```bash
253
+ dirsql server --frontend
254
+ dirsql server --frontend -c .dirsql.toml
255
+ ```
256
+
257
+ The shell reads `GET /frontend/state`. When the index is ready it returns
258
+ HTTP `200`:
259
+
260
+ ```json
261
+ {
262
+ "error": null,
263
+ "root": "/abs/path/of/the/invocation/directory",
264
+ "tables": [
265
+ {"name": "posts", "columns": [{"name": "basename", "type": "TEXT"}]}
266
+ ]
267
+ }
268
+ ```
269
+
270
+ `root` is the query root, where [path-tables](./path-tables.md) resolve.
271
+ `tables` lists the declared tables, ordered by name, each with its columns in
272
+ declaration order and the declared SQLite type (`""` when untyped). Empty
273
+ tables are listed. A configless server, or a config with only functions or
274
+ extensions, returns `"tables": []`. dirsql's bookkeeping tables, SQLite's own
275
+ tables, virtual tables with their shadow tables, and path-tables are never
276
+ listed. The metadata is read from SQLite's catalog: no file is parsed, no
277
+ directory walked, no table counted.
278
+
279
+ When config loading fails the endpoint returns HTTP `503` with
280
+ `{"error":"<diagnostic>"}` and no `root` or `tables`. Fix the config and
281
+ restart the server. Without `--frontend`, the `/` and `/frontend/state`
282
+ routes return `404`. `POST /query` is unchanged.
283
+
240
284
  ### Flags
241
285
 
242
286
  Config flags are subcommand-local: pass them after `server`
@@ -247,6 +291,7 @@ Config flags are subcommand-local: pass them after `server`
247
291
  | `-c, --config <path>` | none | Path to a [config file](./config.md). **Repeatable** (`-c a -c b`): the configs load and merge in argv order — see [Composing multiple configs](./config.md#composing-multiple-configs). The index root is the **invocation directory** (the current working directory) and governs path-tables; a config's `[[table]]` globs anchor at **that config's own directory** (see [glob anchor](./config.md#glob-anchor)), so `--config /elsewhere/.dirsql.toml` indexes `/elsewhere`, from any working directory. With none given, **no named tables are defined** — query the filesystem with a [path-table](./path-tables.md) (`FROM './'`). A `./.dirsql.toml` on disk is **not** auto-loaded; pass it explicitly. A `-c` naming a file that does not exist is an [error](#degraded-mode). |
248
292
  | `--host <addr>` | `localhost` | Bind address. |
249
293
  | `--port <n>` | `7117` | TCP port to bind. |
294
+ | `--frontend` | off | Serve the bundled SQL explorer shell and print its URL. |
250
295
  | `--cors-origin <origin>` | off | Let browser pages on `<origin>` (an exact origin such as `http://localhost:3202`, or `*` for any) call `/query` and open `/events`. See [Cross-origin requests](#cross-origin-requests). |
251
296
  | `--persist [<path>]` | off | Keep the SQLite index on disk between runs so a restart only re-parses files that actually changed. Bare `--persist` caches under the platform cache directory (`$XDG_CACHE_HOME/dirsql/<root hash>/cache.db` on Linux), outside the root; `--persist <path>` caches at `<path>`. Off by default (the index is ephemeral). Also available on [`dirsql query`](#dirsql-query). See [Keep the index across restarts](../howto/persist.md). |
252
297
  | `--no-ignore` | off | Scan files a `.gitignore` would hide. [Path-tables](./path-tables.md#skip-rules) respect `.gitignore` files by default; this flag restores the full walk. The built-in `.git` skip and configured `ignore` patterns still apply. Also available on [`dirsql query`](#dirsql-query). |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dirsql",
3
- "version": "0.4.118",
3
+ "version": "0.4.120",
4
4
  "description": "Ephemeral SQL index over a local directory",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/thekevinscott/dirsql",
@@ -221,10 +221,10 @@
221
221
  ]
222
222
  },
223
223
  "optionalDependencies": {
224
- "@dirsql/lib-linux-x64-gnu": "0.4.118",
225
- "@dirsql/lib-linux-arm64-gnu": "0.4.118",
226
- "@dirsql/lib-darwin-x64": "0.4.118",
227
- "@dirsql/lib-darwin-arm64": "0.4.118",
228
- "@dirsql/lib-win32-x64-msvc": "0.4.118"
224
+ "@dirsql/lib-linux-x64-gnu": "0.4.120",
225
+ "@dirsql/lib-linux-arm64-gnu": "0.4.120",
226
+ "@dirsql/lib-darwin-x64": "0.4.120",
227
+ "@dirsql/lib-darwin-arm64": "0.4.120",
228
+ "@dirsql/lib-win32-x64-msvc": "0.4.120"
229
229
  }
230
230
  }