dirsql 0.3.111 → 0.3.113
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/columns-from-paths.md +2 -2
- package/docs/howto/define-tables.md +1 -1
- package/docs/howto/extract-from-contents.md +2 -2
- package/docs/howto/load-extension.md +1 -1
- package/docs/howto/search-by-meaning.md +2 -2
- package/docs/howto/skip-files.md +1 -1
- package/docs/reference/cli.md +14 -6
- package/docs/reference/sdk.md +11 -2
- package/package.json +11 -11
|
@@ -33,7 +33,7 @@ Pass the config with [`-c`](../reference/cli.md#flags) (`dirsql` does not
|
|
|
33
33
|
auto-load a `.dirsql.toml` from the current directory):
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
|
-
dirsql
|
|
36
|
+
dirsql query "SELECT year, month, basename FROM photos ORDER BY year, month" -c ./.dirsql.toml
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
```json
|
|
@@ -43,7 +43,7 @@ dirsql -c ./.dirsql.toml query "SELECT year, month, basename FROM photos ORDER B
|
|
|
43
43
|
Captures are real SQL columns, so aggregation works:
|
|
44
44
|
|
|
45
45
|
```bash
|
|
46
|
-
dirsql
|
|
46
|
+
dirsql query "SELECT year, COUNT(*) AS photos FROM photos GROUP BY year" -c ./.dirsql.toml
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
```json
|
|
@@ -31,7 +31,7 @@ auto-load a `.dirsql.toml` from the current directory. Each matched file is
|
|
|
31
31
|
one row:
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
|
-
dirsql
|
|
34
|
+
dirsql query "SELECT path, size FROM posts ORDER BY path" -c ./.dirsql.toml
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
```json
|
|
@@ -35,7 +35,7 @@ Pass the config with [`-c`](../reference/cli.md#flags) (`dirsql` does not
|
|
|
35
35
|
auto-load a `.dirsql.toml` from the current directory):
|
|
36
36
|
|
|
37
37
|
```bash
|
|
38
|
-
dirsql
|
|
38
|
+
dirsql query "SELECT title, author, year, path FROM books ORDER BY year" -c ./.dirsql.toml
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
```json
|
|
@@ -60,7 +60,7 @@ on-file = "jq -c -s '.' {path}"
|
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
```bash
|
|
63
|
-
dirsql
|
|
63
|
+
dirsql query "SELECT event, user FROM events" -c ./.dirsql.toml
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
```json
|
|
@@ -27,7 +27,7 @@ The extension's functions are callable (pass the config with
|
|
|
27
27
|
[`-c`](../reference/cli.md#flags) so its `[[dirsql.extension]]` entry loads):
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
|
-
dirsql
|
|
30
|
+
dirsql query "SELECT vec_version() AS vec_version" -c ./.dirsql.toml
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
```json
|
|
@@ -108,7 +108,7 @@ scan runs `embed.py` once per note, then the query argument goes straight to
|
|
|
108
108
|
`.dirsql.toml` from the current directory:
|
|
109
109
|
|
|
110
110
|
```bash
|
|
111
|
-
uvx --with sqlite-vec dirsql
|
|
111
|
+
uvx --with sqlite-vec dirsql query '{"q": "how do I cook pasta?"}' -c ./.dirsql.toml
|
|
112
112
|
```
|
|
113
113
|
|
|
114
114
|
```json
|
|
@@ -116,7 +116,7 @@ uvx --with sqlite-vec dirsql -c ./.dirsql.toml query '{"q": "how do I cook pasta
|
|
|
116
116
|
```
|
|
117
117
|
|
|
118
118
|
```bash
|
|
119
|
-
uvx --with sqlite-vec dirsql
|
|
119
|
+
uvx --with sqlite-vec dirsql query '{"q": "reviewing code on github"}' -c ./.dirsql.toml
|
|
120
120
|
```
|
|
121
121
|
|
|
122
122
|
```json
|
package/docs/howto/skip-files.md
CHANGED
|
@@ -35,7 +35,7 @@ Pass the config with [`-c`](../reference/cli.md#flags) (`dirsql` does not
|
|
|
35
35
|
auto-load a `.dirsql.toml` from the current directory):
|
|
36
36
|
|
|
37
37
|
```bash
|
|
38
|
-
dirsql
|
|
38
|
+
dirsql query "SELECT path FROM notes ORDER BY path" -c ./.dirsql.toml
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
```json
|
package/docs/reference/cli.md
CHANGED
|
@@ -48,7 +48,7 @@ requests, closes open `/events` streams, and exits.
|
|
|
48
48
|
| `-c, --config <path>` | baked-in default | 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, the [baked-in default](#default-mode) `files` table is served — 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), not a silent fallback to the default. |
|
|
49
49
|
| `--host <addr>` | `localhost` | Bind address. |
|
|
50
50
|
| `--port <n>` | `7117` | TCP port to bind. |
|
|
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).
|
|
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). Also available on [`dirsql query`](#dirsql-query), passed after the subcommand. See [Keep the index across restarts](../howto/persist.md). |
|
|
52
52
|
| `--extension <path>` | none | Load a SQLite extension by literal path, overriding the config's `[[dirsql.extension]]` entries. Repeatable. Format: `<path>` or `<path>::<entrypoint>`. Internal plumbing for the pip/npm launchers, which resolve package-name extensions and pass the resolved paths here — not intended for direct use. When any `--extension` is present, the config file's own extension entries are not loaded. |
|
|
53
53
|
| `--version` | | Print the version and exit. |
|
|
54
54
|
| `--help` | | Print usage and exit. |
|
|
@@ -115,10 +115,18 @@ Run a SQL query from the shell:
|
|
|
115
115
|
dirsql query "SELECT basename, size FROM files ORDER BY size DESC LIMIT 5"
|
|
116
116
|
# [{"basename":"model.bin","size":104857600}, …]
|
|
117
117
|
|
|
118
|
-
# A config table (`posts`) needs its config passed explicitly.
|
|
119
|
-
dirsql
|
|
118
|
+
# A config table (`posts`) needs its config passed explicitly, AFTER the subcommand.
|
|
119
|
+
dirsql query "SELECT COUNT(*) AS n FROM posts" -c ./.dirsql.toml | jq '.[0].n'
|
|
120
120
|
```
|
|
121
121
|
|
|
122
|
+
::: warning Config flags are subcommand-local
|
|
123
|
+
Pass `-c`/`--config`, `--persist`, and `--extension` **after** `query`
|
|
124
|
+
(`dirsql query "<sql>" -c <cfg>`). A config flag placed *before* the subcommand
|
|
125
|
+
is a hard error — `error: the subcommand 'query' cannot be used with
|
|
126
|
+
'--config <CONFIG>'` — never silently dropped. (In server mode, with no
|
|
127
|
+
subcommand, the same flags are passed directly: `dirsql -c <cfg>`.)
|
|
128
|
+
:::
|
|
129
|
+
|
|
122
130
|
The subcommand builds the index, runs the SQL, prints the result rows as a
|
|
123
131
|
JSON array on stdout (byte-identical to the [`POST /query`](./http-api.md)
|
|
124
132
|
response body), and exits `0`.
|
|
@@ -126,9 +134,9 @@ response body), and exits `0`.
|
|
|
126
134
|
`dirsql query` is a thin adapter over the **same query pipeline the server
|
|
127
135
|
uses**, so behavior is identical to `POST /query` by construction:
|
|
128
136
|
|
|
129
|
-
- **Config discovery** honors `--config` (with none
|
|
130
|
-
[baked-in default](#default-mode)), and `--extension` overrides,
|
|
131
|
-
server mode does.
|
|
137
|
+
- **Config discovery** honors `--config` passed after the subcommand (with none
|
|
138
|
+
given, the [baked-in default](#default-mode)), and `--extension` overrides,
|
|
139
|
+
exactly as server mode does.
|
|
132
140
|
- **`--persist [<path>]`** is honored, so a repeated `dirsql query` reuses the
|
|
133
141
|
on-disk cache. Because its value is optional, place a bare `--persist` after
|
|
134
142
|
the SQL (`dirsql query "SELECT …" --persist`) or use the `=` form
|
package/docs/reference/sdk.md
CHANGED
|
@@ -88,7 +88,7 @@ DirSQL::builder()
|
|
|
88
88
|
.poll_interval(duration) // optional; watch-loop cadence, default 200ms
|
|
89
89
|
.build() // -> Result<DirSQL> (synchronous scan)
|
|
90
90
|
// Shortcuts: DirSQL::new(root, tables), DirSQL::with_ignore(root, tables, ignore),
|
|
91
|
-
// DirSQL::
|
|
91
|
+
// DirSQL::from_config_path(path) // reads an explicit config file
|
|
92
92
|
```
|
|
93
93
|
|
|
94
94
|
:::
|
|
@@ -97,6 +97,15 @@ Creates a SQLite index over a directory. The index root is the explicit
|
|
|
97
97
|
`root` when given, else the **process cwd** — the `config` file's location
|
|
98
98
|
never sets the root.
|
|
99
99
|
|
|
100
|
+
Constructing with **neither a `config` nor programmatic `tables`** serves the
|
|
101
|
+
**baked-in default** `files` table (one row per file, over the root) — the
|
|
102
|
+
same shipped default the CLI serves with no [`-c`](./cli.md#default-mode), not
|
|
103
|
+
an empty index. There is no implicit `<root>/.dirsql.toml` discovery: to read a
|
|
104
|
+
config on disk, pass its path via `config` (Rust: `.config(path)` /
|
|
105
|
+
`DirSQL::from_config_path(path)`). The root-joining `DirSQL::from_config(root)`
|
|
106
|
+
shortcut was removed in #603 — use
|
|
107
|
+
`DirSQL::from_config_path(root.join(".dirsql.toml"))`.
|
|
108
|
+
|
|
100
109
|
**Parameters:**
|
|
101
110
|
|
|
102
111
|
- `root` — Directory to index. When omitted, the index roots at the process
|
|
@@ -294,7 +303,7 @@ let sync: DirSQL = db.sync()?; // unwrap the inner sync handle
|
|
|
294
303
|
```
|
|
295
304
|
|
|
296
305
|
Shortcuts mirror `DirSQL`: `AsyncDirSQL::new`, `with_ignore`,
|
|
297
|
-
`
|
|
306
|
+
`from_config_path`. Unlike the Python/TypeScript SDKs,
|
|
298
307
|
methods called before `ready().await` completes return a "not ready" error
|
|
299
308
|
rather than waiting — an intentional, language-idiomatic difference.
|
|
300
309
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dirsql",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.113",
|
|
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.113",
|
|
216
|
+
"@dirsql/lib-linux-arm64-gnu": "0.3.113",
|
|
217
|
+
"@dirsql/lib-darwin-x64": "0.3.113",
|
|
218
|
+
"@dirsql/lib-darwin-arm64": "0.3.113",
|
|
219
|
+
"@dirsql/lib-win32-x64-msvc": "0.3.113",
|
|
220
|
+
"@dirsql/cli-linux-x64-gnu": "0.3.113",
|
|
221
|
+
"@dirsql/cli-linux-arm64-gnu": "0.3.113",
|
|
222
|
+
"@dirsql/cli-darwin-x64": "0.3.113",
|
|
223
|
+
"@dirsql/cli-darwin-arm64": "0.3.113",
|
|
224
|
+
"@dirsql/cli-win32-x64-msvc": "0.3.113"
|
|
225
225
|
}
|
|
226
226
|
}
|