Querylight CLI is a TypeScript command line application for building and querying local knowledge bases with Querylight TS.
- Package:
@tryformation/querylight-cli - Binary:
qli - Runtime: Node.js 22+
It is designed for local, inspectable workflows:
- ingest files, directories, URLs, and websites
- normalize content into Markdown-like text
- chunk documents for retrieval
- build a portable local Querylight index
- search and generate retrieval context for external agents and tools
- inspect workspace state, diffs, and change reports
Run without installing globally:
bunx @tryformation/querylight-cli initFor agent and Python automation examples that use bunx and uv, see examples/skills/qli-bunx-uv/SKILL.md.
Install as a dependency:
npm install @tryformation/querylight-cliThen run:
npx qli --helpIf you prefer to avoid a local install, use:
bunx @tryformation/querylight-cli --helpPublish releases from semantic version tags such as 0.1.1.
The GitHub Actions publish workflow publishes @tryformation/querylight-cli to the public npm registry.
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.
If you are working from a local checkout of this repository and want a real qli command available in any directory:
cd /path/to/querylight-cli
npm install
npm run build
npm linkAfter that, you can use qli anywhere on your machine:
cd /some/project
qli --helpTo remove the linked command later:
npm unlink -g @tryformation/querylight-cliInitialize a workspace:
qli initAdd a local docs directory:
qli source add directory ./docs --name "Local Docs" --tag docsBuild the knowledge base:
qli rebuildSearch it:
qli search "API authentication"
qli search --source-type rss --since 2026-05-01 --has-publication-dateFind related documents for an existing one:
qli related <document-id-or-uri>Generate retrieval context:
qli context "How do I authenticate API requests?" --top-k 8The repository includes an example skill for running qli without a global install and calling it from Python with uv:
It covers:
- running
qliwithbunx @tryformation/querylight-cli - using
--jsonfor automation and agents - calling
qli searchandqli contextfrom Python withsubprocess
This example uses a local linked build of qli to create a test knowledge base for the Querylight documentation website.
- Link the local CLI:
cd /path/to/querylight-cli
npm install
npm run build
npm link- Create a fresh test workspace:
mkdir -p ~/querylight-ts-search
cd ~/querylight-ts-search- Initialize the knowledge base:
qli init- Add the Querylight website as a source:
qli source add website https://querylight.tryformation.com \
--name "Querylight TS Docs" \
--max-depth 2 \
--max-pages 50 \
--include /docs/ \
--tag docs- Build the local index:
qli rebuild- Inspect and query the result:
qli status
qli source list
qli search "BM25 ranking"
qli context "How does Querylight TS handle BM25 ranking?" --top-k 8If you want the workspace somewhere else, use:
qli --workspace /custom/path/.kb <command>The default workspace is .kb/.
.kb/
config.yaml
sources/
sources.jsonl
documents/
documents.jsonl
chunks/
chunks.jsonl
raw/
normalized/
indexes/
latest.json
latest.meta.json
runs/
logs/
Use a custom workspace with:
qli --workspace ./my-kb <command>Current source types:
filedirectoryurlwebsiterssmarkdowntext
Current local file ingestion support:
.md.txt.html.htm.pdf.docx
All commands support:
--workspace <path>
--config <path>
--json
--verbose
--quietqli init
qli init --workspace ./kb
qli init --forceAdd sources:
qli source add file ./docs/guide.md --name "Guide"
qli source add directory ./docs --name "Docs" --tag docs
qli source add url https://example.com/docs/auth --name "Auth Page"
qli source add website https://example.com --name "Example Site" --max-depth 2 --max-pages 50
qli source add rss https://example.com/feed.xml --name "Release Feed"List and manage them:
qli source list
qli source config <source-id> --retention-days 30
qli source config <source-id> --name "Docs Feed" --tag rss docs
qli source disable <source-id>
qli source enable <source-id>
qli source remove <source-id>Build dense vectors first:
qli models pull --dense
qli rebuildOr pull every model that is available on the current machine:
qli models pullThen ask for documents related to an existing document id or URI:
qli related <document-id>
qli related https://example.com/docs/authqli ingest
qli chunk
qli index buildRun the full pipeline:
qli rebuild
qli rebuild --source <source-id>
qli rebuild --changed-onlySearch:
qli search "pricing API limits"
qli search "refund policy" --tag support --top-k 20
qli search --source-type rss,url --since 2026-05-01 --has-publication-date --top-k 25
qli search --source-name "Release Feed,Company Blog" --uri-prefix https://example.com/news,https://example.com/blog
qli search --source-type rss,url --top-k 25 --json
qli search "authentication" --jsonBuild retrieval context:
qli context "How do I configure the API?"
qli context "What changed in pricing?" --top-k 12 --max-chars 12000qli diff
qli diff --source <source-id>
qli diff --document <document-id>
qli diff --since 2026-05-01qli report changes --since 2026-05-01
qli report changes --source <source-id>qli status
qli doctorAgent-facing and automation-friendly commands support --json.
The output envelope is:
{
"ok": true,
"command": "search",
"workspace": "/absolute/path/.kb",
"version": "0.1.0",
"data": {}
}Build the image:
docker build -t querylight-cli .Run commands against a mounted workspace:
docker run --rm -v "$PWD:/data" querylight-cli init --workspace /data/.kb
docker run --rm -v "$PWD:/data" querylight-cli rebuild --workspace /data/.kb
docker run --rm -v "$PWD:/data" querylight-cli search --workspace /data/.kb "authentication"Install dependencies:
npm installRun checks:
npm run checkBuild:
npm run build