@tryformation/querylight-cli 0.2.3 → 0.2.5
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 +37 -0
- package/dist/cli/main.js +397 -90
- package/dist/core/constants.d.ts +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +310 -76
- package/dist/query/search-service.d.ts +7 -1
- package/dist/server/search-api.d.ts +15 -0
- package/dist/types/models.d.ts +3 -0
- package/dist/vector/dense.d.ts +6 -1
- package/package.json +3 -2
- package/scripts/assert-release-version.mjs +48 -0
- package/scripts/sparse-encode.py +29 -8
package/README.md
CHANGED
|
@@ -16,6 +16,7 @@ It is designed for local, inspectable workflows:
|
|
|
16
16
|
- chunk documents for retrieval
|
|
17
17
|
- build a portable local Querylight index
|
|
18
18
|
- search and generate retrieval context for external agents and tools
|
|
19
|
+
- serve an OpenSearch-like `_search` API over one or more local knowledge bases
|
|
19
20
|
- inspect workspace state, diffs, and change reports
|
|
20
21
|
|
|
21
22
|
## Install
|
|
@@ -54,6 +55,8 @@ Publish releases from semantic version tags such as `0.1.1`.
|
|
|
54
55
|
|
|
55
56
|
The GitHub Actions publish workflow publishes `@tryformation/querylight-cli` to the public npm registry.
|
|
56
57
|
|
|
58
|
+
The publish workflow builds the package and verifies that the built CLI JSON envelope reports the same version as `package.json` before it publishes.
|
|
59
|
+
|
|
57
60
|
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.
|
|
58
61
|
|
|
59
62
|
### Local Development with `npm link`
|
|
@@ -108,6 +111,9 @@ Search it:
|
|
|
108
111
|
qli search "API authentication"
|
|
109
112
|
qli search --source-type rss --since 2026-05-01 --has-publication-date
|
|
110
113
|
qli search-json '{"query":{"match":{"text":"API authentication"}},"size":5}'
|
|
114
|
+
curl -X POST http://127.0.0.1:3000/_search \
|
|
115
|
+
-H 'content-type: application/json' \
|
|
116
|
+
-d '{"query":{"match":{"text":"API authentication"}},"size":5}'
|
|
111
117
|
```
|
|
112
118
|
|
|
113
119
|
Find related documents for an existing one:
|
|
@@ -122,6 +128,16 @@ Generate retrieval context:
|
|
|
122
128
|
qli context "How do I authenticate API requests?" --top-k 8
|
|
123
129
|
```
|
|
124
130
|
|
|
131
|
+
Serve the lexical index over HTTP:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
qli serve
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
`qli serve` loads the current workspace index once at startup and reuses it for each request.
|
|
138
|
+
Use `POST /_search` or `POST /<configured-index-name>/_search` for a single workspace.
|
|
139
|
+
Use `POST /<directory-name>/_search` when `--workspace` points to a directory whose children each contain their own `.kb` workspace.
|
|
140
|
+
|
|
125
141
|
## Example Skill: `qli` with `bunx` and `uv`
|
|
126
142
|
|
|
127
143
|
The repository includes an example skill for running `qli` without a global install and calling it from Python with `uv`:
|
|
@@ -234,6 +250,15 @@ crawler:
|
|
|
234
250
|
|
|
235
251
|
Set `crawl.maxConcurrentRequests` on a website or RSS source when one source needs a different limit.
|
|
236
252
|
|
|
253
|
+
Control the default number of search results returned when `--top-k` is omitted:
|
|
254
|
+
|
|
255
|
+
```yaml
|
|
256
|
+
search:
|
|
257
|
+
defaultTopK: 50
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
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.
|
|
261
|
+
|
|
237
262
|
## Supported Sources
|
|
238
263
|
|
|
239
264
|
Current source types:
|
|
@@ -374,6 +399,18 @@ qli context "How do I configure the API?"
|
|
|
374
399
|
qli context "What changed in pricing?" --top-k 12 --max-chars 12000
|
|
375
400
|
```
|
|
376
401
|
|
|
402
|
+
Serve the lexical index over HTTP:
|
|
403
|
+
|
|
404
|
+
```bash
|
|
405
|
+
qli serve
|
|
406
|
+
qli serve --workspace ./docs/.kb --port 4000
|
|
407
|
+
qli serve --workspace ./kbs --host 0.0.0.0 --port 4000
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
For a single workspace, use `POST /_search` or `POST /<configured-index-name>/_search`.
|
|
411
|
+
For a directory of knowledge bases, use `POST /<directory-name>/_search`.
|
|
412
|
+
The request body must be a Querylight JSON DSL object.
|
|
413
|
+
|
|
377
414
|
### Change Inspection
|
|
378
415
|
|
|
379
416
|
```bash
|