dirsql 0.3.125 → 0.3.126
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 +1 -1
- package/docs/getting-started.md +4 -4
- package/docs/howto/load-extension.md +1 -1
- package/docs/howto/persist.md +1 -1
- package/docs/howto/react-to-changes.md +2 -2
- package/docs/howto/search-by-meaning.md +1 -1
- package/docs/reference/cli.md +35 -14
- package/docs/reference/config.md +1 -1
- package/docs/reference/http-api.md +1 -1
- package/docs/reference/sdk.md +1 -1
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -89,7 +89,7 @@ Each event has `.action` (`'insert'` | `'update'` | `'delete'` | `'error'`), `.t
|
|
|
89
89
|
|
|
90
90
|
## CLI
|
|
91
91
|
|
|
92
|
-
`npx dirsql` runs an HTTP server exposing the SDK over HTTP: `POST /query` for SQL and `GET /events` for a Server-Sent Events change stream. Requires **Node >= 20.11**. See the [CLI reference](https://thekevinscott.github.io/dirsql/reference/cli).
|
|
92
|
+
`npx dirsql "<sql>"` runs one query and prints the rows as JSON — the default. `npx dirsql server` starts an HTTP server exposing the SDK over HTTP: `POST /query` for SQL and `GET /events` for a Server-Sent Events change stream. Requires **Node >= 20.11**. See the [CLI reference](https://thekevinscott.github.io/dirsql/reference/cli).
|
|
93
93
|
|
|
94
94
|
## License
|
|
95
95
|
|
package/docs/getting-started.md
CHANGED
|
@@ -68,11 +68,11 @@ this directory anyway — from inside `my-notes`, run one command:
|
|
|
68
68
|
::: code-group
|
|
69
69
|
|
|
70
70
|
```bash [npm]
|
|
71
|
-
npx dirsql
|
|
71
|
+
npx dirsql "SELECT COUNT(*) AS files FROM './'"
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
```bash [PyPI]
|
|
75
|
-
uvx dirsql
|
|
75
|
+
uvx dirsql "SELECT COUNT(*) AS files FROM './'"
|
|
76
76
|
```
|
|
77
77
|
|
|
78
78
|
:::
|
|
@@ -168,11 +168,11 @@ pass it explicitly with `-c`, **after** the SQL:
|
|
|
168
168
|
::: code-group
|
|
169
169
|
|
|
170
170
|
```bash [npm]
|
|
171
|
-
npx dirsql
|
|
171
|
+
npx dirsql "SELECT dir, basename, size FROM notes ORDER BY dir, basename" -c .dirsql.toml | jq
|
|
172
172
|
```
|
|
173
173
|
|
|
174
174
|
```bash [PyPI]
|
|
175
|
-
uvx dirsql
|
|
175
|
+
uvx dirsql "SELECT dir, basename, size FROM notes ORDER BY dir, basename" -c .dirsql.toml | jq
|
|
176
176
|
```
|
|
177
177
|
|
|
178
178
|
:::
|
package/docs/howto/persist.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Keep the index across restarts
|
|
2
2
|
|
|
3
3
|
By default the database is ephemeral: rebuilt from your files on every
|
|
4
|
-
startup and discarded on exit. The [`--persist [PATH]`](../reference/cli.md#server
|
|
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
7
|
milliseconds on large trees, and between re-running and skipping expensive
|
|
@@ -18,8 +18,8 @@ glob = "**/*"
|
|
|
18
18
|
|
|
19
19
|
## 1. Open the stream
|
|
20
20
|
|
|
21
|
-
With the server running (`npx dirsql -c ./.dirsql.toml` /
|
|
22
|
-
`uvx dirsql -c ./.dirsql.toml`), subscribe from another terminal:
|
|
21
|
+
With the server running (`npx dirsql server -c ./.dirsql.toml` /
|
|
22
|
+
`uvx dirsql server -c ./.dirsql.toml`), subscribe from another terminal:
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
25
|
curl -N http://localhost:7117/events
|
|
@@ -10,7 +10,7 @@ embed each question at query time.
|
|
|
10
10
|
::: tip Just want it working?
|
|
11
11
|
[`dirsql-plugin-embeddings`](https://pypi.org/project/dirsql-plugin-embeddings/)
|
|
12
12
|
packages exactly what this guide builds, ready to install:
|
|
13
|
-
`uvx --with dirsql-plugin-embeddings dirsql`. Keep reading to see how it's
|
|
13
|
+
`uvx --with dirsql-plugin-embeddings dirsql server`. Keep reading to see how it's
|
|
14
14
|
built — the same three pieces, from scratch.
|
|
15
15
|
:::
|
|
16
16
|
|
package/docs/reference/cli.md
CHANGED
|
@@ -1,39 +1,56 @@
|
|
|
1
1
|
# CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Query is the default: `dirsql "<sql>"` runs one query and prints JSON rows.
|
|
4
|
+
The `dirsql` binary has these modes:
|
|
4
5
|
|
|
5
6
|
| Invocation | Behavior |
|
|
6
7
|
|---|---|
|
|
7
|
-
| `dirsql`
|
|
8
|
-
| `dirsql query "<sql>"` |
|
|
9
|
-
| `dirsql
|
|
8
|
+
| `dirsql "<sql>"` | Run one query over the directory and print the rows as JSON. The default; identical to `dirsql query "<sql>"`. |
|
|
9
|
+
| `dirsql query "<sql>"` | Explicit synonym for the default one-shot query. |
|
|
10
|
+
| `dirsql server` | Start a long-lived HTTP server exposing a SQL view of a directory. See [HTTP API](./http-api.md). |
|
|
11
|
+
| `dirsql init` | Generate a `.dirsql.toml`. |
|
|
12
|
+
|
|
13
|
+
Bare `dirsql` with no SQL is a usage error pointing at `dirsql server` — it
|
|
14
|
+
does **not** start the server.
|
|
10
15
|
|
|
11
16
|
## Installation
|
|
12
17
|
|
|
13
18
|
::: code-group
|
|
14
19
|
|
|
15
20
|
```bash [npm]
|
|
16
|
-
npx dirsql
|
|
21
|
+
npx dirsql "SELECT * FROM './'"
|
|
17
22
|
```
|
|
18
23
|
|
|
19
24
|
```bash [PyPI]
|
|
20
|
-
uvx dirsql
|
|
25
|
+
uvx dirsql "SELECT * FROM './'"
|
|
21
26
|
```
|
|
22
27
|
|
|
23
28
|
```bash [Cargo]
|
|
24
29
|
# The `cli` feature is opt-in; this installs the binary only.
|
|
25
30
|
cargo install dirsql --features cli
|
|
26
|
-
dirsql
|
|
31
|
+
dirsql "SELECT * FROM './'"
|
|
27
32
|
```
|
|
28
33
|
|
|
29
34
|
:::
|
|
30
35
|
|
|
31
36
|
The npm launcher requires **Node ≥ 20.11**.
|
|
32
37
|
|
|
33
|
-
##
|
|
38
|
+
## Default query mode
|
|
34
39
|
|
|
35
40
|
```bash
|
|
36
|
-
|
|
41
|
+
# No -c: query the filesystem with a path-table.
|
|
42
|
+
dirsql "SELECT basename, size FROM './' ORDER BY size DESC LIMIT 5"
|
|
43
|
+
# [{"basename":"model.bin","size":104857600}, …]
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
`dirsql "<sql>"` is exactly [`dirsql query "<sql>"`](#dirsql-query) — same
|
|
47
|
+
pipeline, same flags, same output. See that section for config discovery,
|
|
48
|
+
`--persist`, `--on-file`, hooks, and exit codes.
|
|
49
|
+
|
|
50
|
+
## `dirsql server`
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
dirsql server
|
|
37
54
|
# Running at localhost:7117
|
|
38
55
|
```
|
|
39
56
|
|
|
@@ -43,12 +60,15 @@ requests, closes open `/events` streams, and exits.
|
|
|
43
60
|
|
|
44
61
|
### Flags
|
|
45
62
|
|
|
63
|
+
Config flags are subcommand-local: pass them after `server`
|
|
64
|
+
(`dirsql server -c <cfg>`).
|
|
65
|
+
|
|
46
66
|
| Flag | Default | Description |
|
|
47
67
|
|---|---|---|
|
|
48
|
-
| `-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 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, **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). |
|
|
68
|
+
| `-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 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 server` from. 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). |
|
|
49
69
|
| `--host <addr>` | `localhost` | Bind address. |
|
|
50
70
|
| `--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). Also available on [`dirsql query`](#dirsql-query)
|
|
71
|
+
| `--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). See [Keep the index across restarts](../howto/persist.md). |
|
|
52
72
|
| `--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
73
|
| `--version` | | Print the version and exit. |
|
|
54
74
|
| `--help` | | Print usage and exit. |
|
|
@@ -124,8 +144,9 @@ dirsql query "SELECT COUNT(*) AS n FROM posts" -c ./.dirsql.toml | jq '.[0].n'
|
|
|
124
144
|
Pass `-c`/`--config`, `--persist`, and `--extension` **after** `query`
|
|
125
145
|
(`dirsql query "<sql>" -c <cfg>`). A config flag placed *before* the subcommand
|
|
126
146
|
is a hard error — `error: the subcommand 'query' cannot be used with
|
|
127
|
-
'--config <CONFIG>'` — never silently dropped. (
|
|
128
|
-
|
|
147
|
+
'--config <CONFIG>'` — never silently dropped. (The default mode without the
|
|
148
|
+
`query` keyword takes the same flags after the SQL: `dirsql "<sql>" -c <cfg>`;
|
|
149
|
+
for the server they follow the subcommand: `dirsql server -c <cfg>`.)
|
|
129
150
|
:::
|
|
130
151
|
|
|
131
152
|
The subcommand builds the index, runs the SQL, prints the result rows as a
|
|
@@ -199,7 +220,7 @@ The output does **not** auto-load. Once you've tweaked it, pass it explicitly
|
|
|
199
220
|
to run against it:
|
|
200
221
|
|
|
201
222
|
```bash
|
|
202
|
-
dirsql -c ./.dirsql.toml
|
|
223
|
+
dirsql "SELECT * FROM files" -c ./.dirsql.toml
|
|
203
224
|
```
|
|
204
225
|
|
|
205
226
|
### Flags
|
package/docs/reference/config.md
CHANGED
|
@@ -40,7 +40,7 @@ hook-timeout = 300
|
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
Persistence is not a config key. Keep the SQLite index on disk between runs
|
|
43
|
-
with the [`--persist [PATH]` CLI flag](./cli.md#server
|
|
43
|
+
with the [`--persist [PATH]` CLI flag](./cli.md#dirsql-server) — a machine-local
|
|
44
44
|
operational choice that belongs to the runner, not to shareable config.
|
|
45
45
|
|
|
46
46
|
## `[[dirsql.extension]]`
|
package/docs/reference/sdk.md
CHANGED
|
@@ -130,7 +130,7 @@ shortcut was removed in #603 — use
|
|
|
130
130
|
ephemeral, rebuilt every startup). The cache lives at
|
|
131
131
|
`<root>/.dirsql/cache.db` by default; on restart, only files whose stat
|
|
132
132
|
changed are re-parsed. (The CLI exposes the same switch as the
|
|
133
|
-
[`--persist [PATH]`](./cli.md#server
|
|
133
|
+
[`--persist [PATH]`](./cli.md#dirsql-server) flag; it is not a config key.)
|
|
134
134
|
- `persist_path` / `persistPath` — Override the cache location. Ignored when
|
|
135
135
|
persistence is off. Constructor values are used as given. In Rust these two
|
|
136
136
|
parameters collapse into a single builder method: `.persist(None)` enables
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dirsql",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.126",
|
|
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.126",
|
|
216
|
+
"@dirsql/lib-linux-arm64-gnu": "0.3.126",
|
|
217
|
+
"@dirsql/lib-darwin-x64": "0.3.126",
|
|
218
|
+
"@dirsql/lib-darwin-arm64": "0.3.126",
|
|
219
|
+
"@dirsql/lib-win32-x64-msvc": "0.3.126",
|
|
220
|
+
"@dirsql/cli-linux-x64-gnu": "0.3.126",
|
|
221
|
+
"@dirsql/cli-linux-arm64-gnu": "0.3.126",
|
|
222
|
+
"@dirsql/cli-darwin-x64": "0.3.126",
|
|
223
|
+
"@dirsql/cli-darwin-arm64": "0.3.126",
|
|
224
|
+
"@dirsql/cli-win32-x64-msvc": "0.3.126"
|
|
225
225
|
}
|
|
226
226
|
}
|