dirsql 0.3.99 → 0.3.101
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/docs/howto/define-tables.md +4 -3
- package/docs/reference/cli.md +1 -1
- package/docs/reference/config.md +33 -1
- package/docs/reference/sdk.md +3 -1
- package/package.json +11 -11
|
@@ -42,9 +42,10 @@ zero-config default — only the tables you define are served.
|
|
|
42
42
|
|
|
43
43
|
## Multiple tables
|
|
44
44
|
|
|
45
|
-
Add one `[[table]]` entry per table. When a file matches several globs,
|
|
46
|
-
|
|
47
|
-
for that and the remaining keys
|
|
45
|
+
Add one `[[table]]` entry per table. When a file matches several globs, it
|
|
46
|
+
populates every matching table — each table is an independent view. See
|
|
47
|
+
[`[[table]]`](../reference/config.md#table) for that and the remaining keys
|
|
48
|
+
(`strict`, `on-file`).
|
|
48
49
|
|
|
49
50
|
## Going further
|
|
50
51
|
|
package/docs/reference/cli.md
CHANGED
|
@@ -45,7 +45,7 @@ requests, closes open `/events` streams, and exits.
|
|
|
45
45
|
|
|
46
46
|
| Flag | Default | Description |
|
|
47
47
|
|---|---|---|
|
|
48
|
-
| `-c, --config <path>` | `./.dirsql.toml` | Path to
|
|
48
|
+
| `-c, --config <path>` | `./.dirsql.toml` | 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 is always rooted at the **invocation directory** (the current working directory), regardless of where a config lives — so `--config /elsewhere/.dirsql.toml` still indexes the directory you ran `dirsql` from. With none given, `./.dirsql.toml` is used; when it does not exist, the server runs in [zero-config mode](#zero-config-mode). |
|
|
49
49
|
| `--host <addr>` | `localhost` | Bind address. |
|
|
50
50
|
| `--port <n>` | `7117` | TCP port to bind. |
|
|
51
51
|
| `--persist [<path>]` | off | Keep the SQLite index on disk between runs so a restart only re-parses files that actually changed. Bare `--persist` caches at `<root>/.dirsql/cache.db`; `--persist <path>` caches at `<path>`. Off by default (the index is ephemeral). Global — also honored by [`dirsql query`](#dirsql-query). See [Keep the index across restarts](../howto/persist.md). |
|
package/docs/reference/config.md
CHANGED
|
@@ -97,7 +97,7 @@ per-file command.
|
|
|
97
97
|
| Key | Required | Description |
|
|
98
98
|
|---|---|---|
|
|
99
99
|
| `ddl` | yes | A SQLite `CREATE TABLE` statement. The table name is parsed from it. Only columns declared here are populated; auto-injected facts not in the DDL are dropped. |
|
|
100
|
-
| `glob` | yes | Glob pattern matched against root-relative paths. May contain `{name}` [capture segments](./columns.md#glob-captures).
|
|
100
|
+
| `glob` | yes | Glob pattern matched against root-relative paths. May contain `{name}` [capture segments](./columns.md#glob-captures). Every table whose glob matches a file receives that file's rows — a file can populate multiple tables. |
|
|
101
101
|
| `strict` | no (default `false`) | When `true`, rows whose keys do not exactly match the declared columns are rejected with an error: extra keys error, and every declared column must be supplied (by the command/extract output, a glob capture, or a stat column). When `false`, extra keys are dropped and missing columns become `NULL`. |
|
|
102
102
|
| `on-file` | no | A command run once per matched file; its stdout (a JSON array of row objects) becomes the file's rows. Must be non-empty. See [Command hooks](./hooks.md#on-file). |
|
|
103
103
|
|
|
@@ -131,6 +131,38 @@ by the command wins over a same-named fact. Output that is not a JSON array
|
|
|
131
131
|
of objects is a per-file failure: the file is skipped with a stderr warning
|
|
132
132
|
and the scan continues (see [failure semantics](./hooks.md#failure-semantics)).
|
|
133
133
|
|
|
134
|
+
## Composing multiple configs
|
|
135
|
+
|
|
136
|
+
Pass [`-c`/`--config`](./cli.md#flags) more than once to compose several config
|
|
137
|
+
files — a shared team config plus local overrides, or a plugin's config
|
|
138
|
+
alongside your own:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
dirsql -c ./.dirsql.toml -c ~/team/embeddings.toml -c ./local.toml
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The configs load and merge in **argv order**:
|
|
145
|
+
|
|
146
|
+
- **`[[table]]`, `ignore`, and `[[dirsql.extension]]` entries accumulate** across
|
|
147
|
+
all configs, in order.
|
|
148
|
+
- **Each config's `on-file`, `pre-query`, and `post-query` hooks run from that
|
|
149
|
+
config file's own directory**, under that config's own
|
|
150
|
+
[`hook-timeout`](#dirsql-keys) — so a relative command like
|
|
151
|
+
`on-file = "sh ./extract.sh"` resolves against the config that declared it,
|
|
152
|
+
wherever it lives.
|
|
153
|
+
- **`pre-query` / `post-query` hooks chain FIFO**: the request body flows through
|
|
154
|
+
each `pre-query` stage in order to the final SQL, and the result rows flow
|
|
155
|
+
through each `post-query` stage to the response. See the
|
|
156
|
+
[hook contract](./hooks.md).
|
|
157
|
+
- Each config is **validated on its own** (the [parse errors](#parse-errors)
|
|
158
|
+
below apply per file). There is no cross-file merge validation, with one
|
|
159
|
+
structural exception: **two configs defining a table of the same name is an
|
|
160
|
+
error**, naming the table.
|
|
161
|
+
|
|
162
|
+
The index [root](./cli.md#flags) is the invocation directory regardless of where
|
|
163
|
+
any config lives. With no `-c`, `./.dirsql.toml` is used; a single `-c` behaves
|
|
164
|
+
exactly as before.
|
|
165
|
+
|
|
134
166
|
## Parse errors
|
|
135
167
|
|
|
136
168
|
Loading fails (the CLI enters [degraded mode](./cli.md#degraded-mode); the
|
package/docs/reference/sdk.md
CHANGED
|
@@ -318,7 +318,9 @@ Maps files to table rows.
|
|
|
318
318
|
- `ddl` — A SQLite `CREATE TABLE` statement; the table name is parsed from
|
|
319
319
|
it. Table names must be unique across all tables.
|
|
320
320
|
- `glob` — Glob pattern matched against root-relative paths. May contain
|
|
321
|
-
`{name}` [captures](./columns.md#glob-captures).
|
|
321
|
+
`{name}` [captures](./columns.md#glob-captures). Every table whose glob
|
|
322
|
+
matches a file receives that file's rows — a file can populate multiple
|
|
323
|
+
tables.
|
|
322
324
|
- `extract` — Callback receiving the matched file's full path (the root
|
|
323
325
|
joined with the file's relative path — absolute when `root` is absolute)
|
|
324
326
|
and returning the rows that file contributes. `dirsql` never reads file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dirsql",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.101",
|
|
4
4
|
"description": "Ephemeral SQL index over a local directory",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/thekevinscott/dirsql",
|
|
@@ -212,15 +212,15 @@
|
|
|
212
212
|
]
|
|
213
213
|
},
|
|
214
214
|
"optionalDependencies": {
|
|
215
|
-
"@dirsql/lib-linux-x64-gnu": "0.3.
|
|
216
|
-
"@dirsql/lib-linux-arm64-gnu": "0.3.
|
|
217
|
-
"@dirsql/lib-darwin-x64": "0.3.
|
|
218
|
-
"@dirsql/lib-darwin-arm64": "0.3.
|
|
219
|
-
"@dirsql/lib-win32-x64-msvc": "0.3.
|
|
220
|
-
"@dirsql/cli-linux-x64-gnu": "0.3.
|
|
221
|
-
"@dirsql/cli-linux-arm64-gnu": "0.3.
|
|
222
|
-
"@dirsql/cli-darwin-x64": "0.3.
|
|
223
|
-
"@dirsql/cli-darwin-arm64": "0.3.
|
|
224
|
-
"@dirsql/cli-win32-x64-msvc": "0.3.
|
|
215
|
+
"@dirsql/lib-linux-x64-gnu": "0.3.101",
|
|
216
|
+
"@dirsql/lib-linux-arm64-gnu": "0.3.101",
|
|
217
|
+
"@dirsql/lib-darwin-x64": "0.3.101",
|
|
218
|
+
"@dirsql/lib-darwin-arm64": "0.3.101",
|
|
219
|
+
"@dirsql/lib-win32-x64-msvc": "0.3.101",
|
|
220
|
+
"@dirsql/cli-linux-x64-gnu": "0.3.101",
|
|
221
|
+
"@dirsql/cli-linux-arm64-gnu": "0.3.101",
|
|
222
|
+
"@dirsql/cli-darwin-x64": "0.3.101",
|
|
223
|
+
"@dirsql/cli-darwin-arm64": "0.3.101",
|
|
224
|
+
"@dirsql/cli-win32-x64-msvc": "0.3.101"
|
|
225
225
|
}
|
|
226
226
|
}
|