@tryformation/querylight-cli 0.2.4 → 0.2.6
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/Dockerfile +5 -0
- package/README.md +50 -2
- package/dist/cli/main.js +333 -167
- package/dist/core/archive.d.ts +18 -0
- package/dist/core/constants.d.ts +2 -2
- package/dist/index.js +81 -19
- package/dist/types/models.d.ts +3 -0
- package/dist/vector/runtime.d.ts +1 -4
- package/package.json +12 -8
- package/scripts/assert-release-version.mjs +48 -0
package/Dockerfile
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
FROM node:22-slim
|
|
2
2
|
WORKDIR /app
|
|
3
|
+
RUN apt-get update \
|
|
4
|
+
&& apt-get install -y --no-install-recommends curl ca-certificates \
|
|
5
|
+
&& rm -rf /var/lib/apt/lists/* \
|
|
6
|
+
&& curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
7
|
+
ENV PATH="/root/.local/bin:${PATH}"
|
|
3
8
|
COPY package.json package-lock.json ./
|
|
4
9
|
RUN npm ci
|
|
5
10
|
COPY . .
|
package/README.md
CHANGED
|
@@ -15,6 +15,7 @@ It is designed for local, inspectable workflows:
|
|
|
15
15
|
- normalize content into Markdown-like text
|
|
16
16
|
- chunk documents for retrieval
|
|
17
17
|
- build a portable local Querylight index
|
|
18
|
+
- package a workspace as a zip for deployment
|
|
18
19
|
- search and generate retrieval context for external agents and tools
|
|
19
20
|
- serve an OpenSearch-like `_search` API over one or more local knowledge bases
|
|
20
21
|
- inspect workspace state, diffs, and change reports
|
|
@@ -55,6 +56,8 @@ Publish releases from semantic version tags such as `0.1.1`.
|
|
|
55
56
|
|
|
56
57
|
The GitHub Actions publish workflow publishes `@tryformation/querylight-cli` to the public npm registry.
|
|
57
58
|
|
|
59
|
+
The publish workflow builds the package and verifies that the built CLI JSON envelope reports the same version as `package.json` before it publishes.
|
|
60
|
+
|
|
58
61
|
Configure npm trusted publishing for this repository before the first release. The publish workflow uses GitHub OIDC and does not use an `NPM_TOKEN` secret.
|
|
59
62
|
|
|
60
63
|
### Local Development with `npm link`
|
|
@@ -103,10 +106,17 @@ Build the knowledge base:
|
|
|
103
106
|
qli ingest
|
|
104
107
|
```
|
|
105
108
|
|
|
109
|
+
Package it for deployment:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
qli package ./docs-kb.zip
|
|
113
|
+
```
|
|
114
|
+
|
|
106
115
|
Search it:
|
|
107
116
|
|
|
108
117
|
```bash
|
|
109
118
|
qli search "API authentication"
|
|
119
|
+
qli search --workspace ./docs-kb.zip "API authentication"
|
|
110
120
|
qli search --source-type rss --since 2026-05-01 --has-publication-date
|
|
111
121
|
qli search-json '{"query":{"match":{"text":"API authentication"}},"size":5}'
|
|
112
122
|
curl -X POST http://127.0.0.1:3000/_search \
|
|
@@ -134,7 +144,7 @@ qli serve
|
|
|
134
144
|
|
|
135
145
|
`qli serve` loads the current workspace index once at startup and reuses it for each request.
|
|
136
146
|
Use `POST /_search` or `POST /<configured-index-name>/_search` for a single workspace.
|
|
137
|
-
Use `POST /<directory-name>/_search` when `--workspace` points to a directory whose children
|
|
147
|
+
Use `POST /<directory-name>/_search` when `--workspace` points to a directory whose children are packaged `.zip` workspaces or directories that contain `.kb`.
|
|
138
148
|
|
|
139
149
|
## Example Skill: `qli` with `bunx` and `uv`
|
|
140
150
|
|
|
@@ -239,6 +249,22 @@ Use a custom workspace with:
|
|
|
239
249
|
qli --workspace ./my-kb <command>
|
|
240
250
|
```
|
|
241
251
|
|
|
252
|
+
Package a built workspace with:
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
qli package ./docs-kb.zip --workspace ./my-kb
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Read-only commands can use the zip directly:
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
qli search --workspace ./docs-kb.zip "authentication"
|
|
262
|
+
qli context --workspace ./docs-kb.zip "How does auth work?"
|
|
263
|
+
qli serve --workspace ./docs-kb.zip
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Zip workspaces are read-only. Rebuild the directory workspace and package it again when source content changes.
|
|
267
|
+
|
|
242
268
|
Control the default remote concurrency in `config.yaml`:
|
|
243
269
|
|
|
244
270
|
```yaml
|
|
@@ -248,6 +274,15 @@ crawler:
|
|
|
248
274
|
|
|
249
275
|
Set `crawl.maxConcurrentRequests` on a website or RSS source when one source needs a different limit.
|
|
250
276
|
|
|
277
|
+
Control the default number of search results returned when `--top-k` is omitted:
|
|
278
|
+
|
|
279
|
+
```yaml
|
|
280
|
+
search:
|
|
281
|
+
defaultTopK: 50
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
For `qli search --source-type rss` with a time-window filter such as `--since`, `--until`, or `--publication-date-from`, `qli` uses `500` results when `--top-k` is omitted.
|
|
285
|
+
|
|
251
286
|
## Supported Sources
|
|
252
287
|
|
|
253
288
|
Current source types:
|
|
@@ -281,6 +316,8 @@ All commands support:
|
|
|
281
316
|
--verbose
|
|
282
317
|
```
|
|
283
318
|
|
|
319
|
+
`--workspace` accepts a directory workspace. Read-only commands also accept a packaged `.zip` workspace.
|
|
320
|
+
|
|
284
321
|
Long-running commands print progress to stderr by default. Use `--silent` to suppress progress output. Use `--json` when another tool needs stable structured output.
|
|
285
322
|
|
|
286
323
|
### Initialize
|
|
@@ -291,6 +328,16 @@ qli init --workspace ./kb
|
|
|
291
328
|
qli init --force
|
|
292
329
|
```
|
|
293
330
|
|
|
331
|
+
### Package
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
qli package ./docs-kb.zip
|
|
335
|
+
qli package ./deploy/docs-kb.zip --workspace ./docs/.kb
|
|
336
|
+
qli package ./docs-kb.zip --force --json
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
The archive stores workspace contents at the zip root. Use the zip with `search`, `search-json`, `related`, `context`, `status`, `doctor`, and `serve`.
|
|
340
|
+
|
|
294
341
|
### Manage Sources
|
|
295
342
|
|
|
296
343
|
Add sources:
|
|
@@ -393,11 +440,12 @@ Serve the lexical index over HTTP:
|
|
|
393
440
|
```bash
|
|
394
441
|
qli serve
|
|
395
442
|
qli serve --workspace ./docs/.kb --port 4000
|
|
443
|
+
qli serve --workspace ./docs-kb.zip --port 4000
|
|
396
444
|
qli serve --workspace ./kbs --host 0.0.0.0 --port 4000
|
|
397
445
|
```
|
|
398
446
|
|
|
399
447
|
For a single workspace, use `POST /_search` or `POST /<configured-index-name>/_search`.
|
|
400
|
-
For a directory of knowledge bases, use `POST /<directory-name>/_search`.
|
|
448
|
+
For a directory of knowledge bases, use `POST /<directory-name>/_search`. Child `.zip` files use the file stem as the route name.
|
|
401
449
|
The request body must be a Querylight JSON DSL object.
|
|
402
450
|
|
|
403
451
|
### Change Inspection
|