dirsql 0.4.68 → 0.4.69

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.
@@ -116,8 +116,8 @@ templates, with the trigger mistakes that fail silently, are in
116
116
 
117
117
  ## Going further
118
118
 
119
- - The parser mechanics — placeholders, stdout protocol, per-file failure
120
- isolation — are the [`on-file` hook contract](../reference/hooks.md#on-file);
119
+ - The parser mechanics — placeholders, stdout protocol, failure semantics —
120
+ are the [`on-file` hook contract](../reference/hooks.md#on-file);
121
121
  [Extract rows from file contents](./extract-from-contents.md) is the fuller
122
122
  recipe.
123
123
  - Your directory layout encodes data (authors, dates, IDs)? Split the path in
@@ -4,8 +4,8 @@ By default the database is ephemeral: rebuilt from your files on every
4
4
  startup and discarded on exit. The [`--persist [PATH]`](../reference/cli.md#dirsql-server)
5
5
  flag keeps the SQLite index on disk instead, so a restart only re-parses
6
6
  files that actually changed — the difference between seconds and
7
- milliseconds on large trees, and between re-running and skipping expensive
8
- [`on-file`](./extract-from-contents.md) commands.
7
+ milliseconds on large trees, and between re-running and skipping an expensive
8
+ declared-table [`on-file`](./extract-from-contents.md) command.
9
9
 
10
10
  Whether and where to cache is a machine-local operational choice — it
11
11
  belongs to the command you run, not to the shared `.dirsql.toml`. That is
@@ -58,15 +58,11 @@ exactly what a non-persistent startup does.
58
58
  A run that changes nothing writes nothing: the cache file is read and left
59
59
  exactly as it was.
60
60
 
61
- This covers both kinds of table. Declared tables keep their indexed rows, and
62
- a [path-table](../reference/path-tables.md) parsed with `--on-file` keeps each
63
- file's parser output — so the second run over an unchanged tree spawns no
64
- parser process at all. A path-table's cached rows are keyed by the tree, the
65
- glob, the parser command and the `dirsql` version together, so changing any of
66
- them parses afresh rather than serving rows the current command never
67
- produced. A *stat* path-table caches nothing, because there is nothing to
68
- save: its columns are the metadata the scan already collected, and `content`
69
- is read live by design.
61
+ This covers declared tables, which keep their indexed rows. A
62
+ [path-table](../reference/path-tables.md) is not cached: a *stat* path-table
63
+ has nothing to save, since its columns are the metadata the scan already
64
+ collected and `content` is read live by design, and a path-table parsed with
65
+ `--on-file` runs its parser on every start.
70
66
 
71
67
  Persistence is a startup-time optimization, not a change in meaning: the
72
68
  database remains a derived view of your files, and queries return the same
@@ -223,11 +223,7 @@ every statement, so it is reported once and exits `1` before the first prompt.
223
223
  | Code | Meaning |
224
224
  |---|---|
225
225
  | `0` | Clean EOF (Ctrl-D, `exit`, `quit`, or the end of a piped script) — **including when statements failed**. Matches interactive `sqlite3`; use [`dirsql query`](#dirsql-query) when a script needs a statement's exit status. |
226
- | `1` | The index could not be built (a bad `-c`, an unresolvable `--on-file`), or stdin could not be read. Nothing was executed. |
227
-
228
- `23` (partial scan) is not produced here: skipped files are reported before the
229
- first prompt, and a session's exit code describes the session rather than one
230
- scan.
226
+ | `1` | The index could not be built (a bad `-c`, an unresolvable `--on-file`, a failed `on-file` command), or stdin could not be read. Nothing was executed. |
231
227
 
232
228
  ## `dirsql server`
233
229
 
@@ -330,9 +330,9 @@ integral number → `INTEGER`, any other number → `REAL`; a string → `TEXT`;
330
330
  nested array or object → its JSON text as `TEXT`.
331
331
 
332
332
  A row's columns are exactly the keys the command emits, narrowed to the DDL;
333
- dirsql merges nothing else in. Output that is not a JSON array of objects is a
334
- per-file failure: the file is skipped with a stderr warning and the scan
335
- continues (see [failure semantics](./hooks.md#failure-semantics)).
333
+ dirsql merges nothing else in. Output that is not a JSON array of objects fails
334
+ the table, and a failed table fails the build (see
335
+ [failure semantics](./hooks.md#failure-semantics)).
336
336
 
337
337
  ## Composing multiple configs
338
338
 
@@ -69,8 +69,8 @@ on-file = "timeout 30 my-extractor"
69
69
  ```
70
70
 
71
71
  When the wrapper kills an overrunning command, the run exits non-zero and
72
- the ordinary [failure semantics](#failure-semantics) apply — the file is
73
- skipped, the scan continues.
72
+ the ordinary [failure semantics](#failure-semantics) apply — the table's
73
+ command failed, so the build fails.
74
74
 
75
75
  ::: warning Windows
76
76
  Windows's built-in `timeout` command is a *sleep*, not a bound — it cannot
@@ -94,18 +94,17 @@ A hook run fails when the command:
94
94
  - exits zero but prints no non-empty stdout line,
95
95
  - or prints output that does not parse as a JSON array of row objects.
96
96
 
97
- What a failure *means*: **per-file isolation.** The file contributes no rows
98
- and is reported as skipped; the scan indexes every other file and commits.
99
- The CLI names up to ten skipped files on stderr, then `... and N more`, and
100
- exits `23` — distinct from `0` (clean) and `1` (the run failed), so a caller
101
- can tell a partial index from a complete one. A row the table rejects under
102
- `strict` counts as the same kind of failure.
97
+ What a failure *means*: the command ran once for the whole table, so its
98
+ failure is the table's, and a table that cannot be filled fails the build.
99
+ The error names the table and carries the command's exit status and stderr
100
+ tail; the CLI prints it and exits `1`. A row the table rejects under `strict`
101
+ counts as the same kind of failure.
103
102
 
104
103
  ## `on-file` contract
105
104
 
106
- Runs once per file matched by the table's `glob`, at initial scan and on
107
- every watched change. The command reads the file itself and prints a JSON
108
- array of row objects; see [`[[table]]`](./config.md#table) for the
105
+ Runs once per table, over every file matched by the table's `glob`, at
106
+ initial scan and on every watched change. The command reads the files itself
107
+ and prints a JSON array of row objects; see [`[[table]]`](./config.md#table) for the
109
108
  row-mapping rules.
110
109
 
111
110
  The same command is attachable two ways, over the same contract: the
@@ -159,18 +159,14 @@ placeholder, same timeout. Its output *is* the table:
159
159
  across the emitted rows. The stat columns (`path`, `size`, …) are **not**
160
160
  reachable on a parsed path-table — a parser that wants the path emits it (it
161
161
  has the paths). The two modes stay cleanly separate.
162
- - **Failures are isolated per file.** A file whose parser fails (spawn, non-zero
163
- exit, timeout, or no output) or whose output is not a JSON array of rows
164
- contributes no rows; a one-line warning naming the file goes to stderr and the
165
- scan continues. The schema is inferred from the files that did parse.
162
+ - **A parser failure is the table's failure.** A run that fails (spawn,
163
+ non-zero exit, a `timeout(1)` kill, or no output) or whose output is not a
164
+ JSON array of rows fails the query with an error naming the table; there is
165
+ no partial table.
166
166
  - **The skip rules still apply.** A parsed scan honors the same `node_modules`
167
167
  /`.git`/`ignore` rules a stat scan does (see below).
168
- - **`--persist` skips the parser for unchanged files.** With a
169
- [persistent cache](/howto/persist), each file's parser output is stored
170
- against its stat metadata, so a later run over an unchanged tree serves the
171
- rows from the cache and spawns no process. Change the file, the glob, the
172
- parser command, or the dirsql version and that file (or that whole table) is
173
- parsed again.
168
+ - **The parser runs on every start.** A parsed path-table is not kept in the
169
+ [persistent cache](/howto/persist); declared tables are.
174
170
 
175
171
  `--on-file` applies to **every** path-table in the query and may be given **at
176
172
  most once**. For different parsers per file set, define named tables in a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dirsql",
3
- "version": "0.4.68",
3
+ "version": "0.4.69",
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.68",
225
- "@dirsql/lib-linux-arm64-gnu": "0.4.68",
226
- "@dirsql/lib-darwin-x64": "0.4.68",
227
- "@dirsql/lib-darwin-arm64": "0.4.68",
228
- "@dirsql/lib-win32-x64-msvc": "0.4.68"
224
+ "@dirsql/lib-linux-x64-gnu": "0.4.69",
225
+ "@dirsql/lib-linux-arm64-gnu": "0.4.69",
226
+ "@dirsql/lib-darwin-x64": "0.4.69",
227
+ "@dirsql/lib-darwin-arm64": "0.4.69",
228
+ "@dirsql/lib-win32-x64-msvc": "0.4.69"
229
229
  }
230
230
  }