Covenant's embedded query system compiles documentation into WASM modules that can be queried at runtime. This directory demonstrates a cohesive pipeline from document ingestion to interactive querying.
docs/guide/*.md → doc-ingestion.wasm → output/*.cov → build.sh → *.wasm → query-repl.ts
(source) (ingestion) (data nodes) (compile) (query) (REPL)
- Ingest:
doc-ingestion.covreads external documentation and generates.covdata files - Build:
build.shconcatenates generated data with query examples and compiles to WASM - Query:
query-repl.tsprovides an interactive CLI to search and explore
# Build everything
./build.sh
# Start the REPL
deno run --allow-read query-repl.ts
# In the REPL:
query> :load output/rag-query.wasm
query> :query effects
query> get_all_docs
query> :quit| File | Description |
|---|---|
doc-ingestion.cov |
Ingests docs/guide/ → generates .cov data files + index.cov |
embedded-query.cov |
Basic queries: find_docs, ORDER BY, LIMIT |
parameterized-query.cov |
Dynamic search with runtime string parameters |
relation-traversal.cov |
Graph traversal from the generated index node |
rag-query.cov |
Full RAG system: search, traverse, hierarchy, code-doc linking |
build.sh |
Build script: ingest → concatenate → compile |
query-repl.ts |
Interactive REPL for querying compiled modules |
run-ingestion.ts |
Runner for the ingestion WASM |
:load <file.wasm> Load a compiled module
:query <term> Search all data nodes for term (easy search)
:list List available query functions
:nodes List all nodes in the module
:help Show help
:quit Exit
Direct function calls:
get_all_docs Call a no-arg function
search_by_keyword "x" Call with string argument
- embedded-query.cov - Basic queries, ORDER BY, LIMIT
- parameterized-query.cov - Runtime string parameters (
var="term") - relation-traversal.cov - Graph navigation from index node
- rag-query.cov - Complete RAG with search + traversal + hierarchy
doc-ingestion.cov reads markdown files and generates:
- Individual
.covfiles for each document - An
index.covwithcontainsrelations to all documents
Query functions use target="project" to query embedded data:
step id="s1" kind="query"
target="project"
select all
from="snippets"
where
contains field="content" var="search_term"
end
as="results"
end
Navigate the document graph using traverse steps:
step id="s1" kind="traverse"
target="project"
from="index"
follow type=contains
depth=1
direction=outgoing
as="all_docs"
end
deno run --allow-read test-embedded.ts
deno run --allow-read test-parameterized.ts
deno run --allow-read test-rag.ts