dirsql 0.3.74 → 0.3.75
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/reference/cli.md +42 -1
- package/package.json +11 -11
package/docs/reference/cli.md
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
# CLI
|
|
2
2
|
|
|
3
|
-
The `dirsql` binary has
|
|
3
|
+
The `dirsql` binary has three modes:
|
|
4
4
|
|
|
5
5
|
| Invocation | Behavior |
|
|
6
6
|
|---|---|
|
|
7
7
|
| `dirsql` (no subcommand) | Start a long-lived HTTP server exposing a SQL view of a directory. See [HTTP API](./http-api.md). |
|
|
8
|
+
| `dirsql query "<sql>"` | Build the index, run one query, print the rows as JSON, exit. No server, no watch. |
|
|
8
9
|
| `dirsql init` | Generate a starter `.dirsql.toml` by running `claude` over a directory. |
|
|
9
10
|
|
|
10
11
|
## Installation
|
|
@@ -97,6 +98,46 @@ with a JSON body describing the failure:
|
|
|
97
98
|
| `0` | Clean shutdown after `SIGINT` / `SIGTERM`. |
|
|
98
99
|
| `1` | Failed to bind `host:port`, or an error during shutdown. |
|
|
99
100
|
|
|
101
|
+
## `dirsql query`
|
|
102
|
+
|
|
103
|
+
Run one SQL query from the shell — for ad-hoc inspection, scripting, and
|
|
104
|
+
docs verification snippets — without booting the server and `curl`ing it:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
dirsql query "SELECT _basename, _size FROM files ORDER BY _size DESC LIMIT 5"
|
|
108
|
+
# [{"_basename":"model.bin","_size":104857600}, …]
|
|
109
|
+
|
|
110
|
+
dirsql query "SELECT COUNT(*) AS n FROM posts" | jq '.[0].n'
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The subcommand builds the index, runs the SQL, prints the result rows as a
|
|
114
|
+
JSON array on stdout (byte-identical to the [`POST /query`](./http-api.md)
|
|
115
|
+
response body), and exits `0`.
|
|
116
|
+
|
|
117
|
+
`dirsql query` is a thin adapter over the **same query pipeline the server
|
|
118
|
+
uses**, so behavior is identical to `POST /query` by construction:
|
|
119
|
+
|
|
120
|
+
- **Config discovery** honors `--config` (default `./.dirsql.toml`),
|
|
121
|
+
[zero-config mode](#zero-config-mode), and `--extension` overrides,
|
|
122
|
+
exactly as server mode does.
|
|
123
|
+
- **Hooks** ([`pre-query`](./hooks.md#pre-query) /
|
|
124
|
+
[`post-query`](./hooks.md#post-query)) and the
|
|
125
|
+
[`[dirsql].hook-timeout`](./config.md#dirsql-keys) apply identically.
|
|
126
|
+
- The **30-second query timeout**, the **read-only rule**, and the
|
|
127
|
+
`_dirsql_*` **internal-table denial** apply identically. A rejected read
|
|
128
|
+
is an error, not empty output.
|
|
129
|
+
|
|
130
|
+
Errors print the same diagnostic the HTTP `{"error": …}` body carries —
|
|
131
|
+
config failures, SQL errors, rejected reads, hook failures, timeouts — to
|
|
132
|
+
stderr, with exit code `1`.
|
|
133
|
+
|
|
134
|
+
### Exit codes
|
|
135
|
+
|
|
136
|
+
| Code | Meaning |
|
|
137
|
+
|---|---|
|
|
138
|
+
| `0` | Query succeeded; rows printed on stdout. |
|
|
139
|
+
| `1` | Any failure: config, SQL, rejected read, hook, or timeout. The diagnostic is on stderr. |
|
|
140
|
+
|
|
100
141
|
## `dirsql init`
|
|
101
142
|
|
|
102
143
|
Generates a `.dirsql.toml` by running the `claude` CLI over the target
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dirsql",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.75",
|
|
4
4
|
"description": "Ephemeral SQL index over a local directory",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/thekevinscott/dirsql",
|
|
@@ -230,15 +230,15 @@
|
|
|
230
230
|
]
|
|
231
231
|
},
|
|
232
232
|
"optionalDependencies": {
|
|
233
|
-
"@dirsql/lib-linux-x64-gnu": "0.3.
|
|
234
|
-
"@dirsql/lib-linux-arm64-gnu": "0.3.
|
|
235
|
-
"@dirsql/lib-darwin-x64": "0.3.
|
|
236
|
-
"@dirsql/lib-darwin-arm64": "0.3.
|
|
237
|
-
"@dirsql/lib-win32-x64-msvc": "0.3.
|
|
238
|
-
"@dirsql/cli-linux-x64-gnu": "0.3.
|
|
239
|
-
"@dirsql/cli-linux-arm64-gnu": "0.3.
|
|
240
|
-
"@dirsql/cli-darwin-x64": "0.3.
|
|
241
|
-
"@dirsql/cli-darwin-arm64": "0.3.
|
|
242
|
-
"@dirsql/cli-win32-x64-msvc": "0.3.
|
|
233
|
+
"@dirsql/lib-linux-x64-gnu": "0.3.75",
|
|
234
|
+
"@dirsql/lib-linux-arm64-gnu": "0.3.75",
|
|
235
|
+
"@dirsql/lib-darwin-x64": "0.3.75",
|
|
236
|
+
"@dirsql/lib-darwin-arm64": "0.3.75",
|
|
237
|
+
"@dirsql/lib-win32-x64-msvc": "0.3.75",
|
|
238
|
+
"@dirsql/cli-linux-x64-gnu": "0.3.75",
|
|
239
|
+
"@dirsql/cli-linux-arm64-gnu": "0.3.75",
|
|
240
|
+
"@dirsql/cli-darwin-x64": "0.3.75",
|
|
241
|
+
"@dirsql/cli-darwin-arm64": "0.3.75",
|
|
242
|
+
"@dirsql/cli-win32-x64-msvc": "0.3.75"
|
|
243
243
|
}
|
|
244
244
|
}
|