knowledge-base-cli
This crate provides the knowledge-base executable for validating, reading, querying, and updating a file-based knowledge base.
It supports the canonical 0.2.0 schema only. It does not accept the legacy transit-owned schema; migrate existing repositories before use with the repository migration guide.
Installation
Install the executable from crates.io:
Every executable command reads the knowledge-base root from KNOWLEDGE_BASE_PATH:
--help and --version do not require KNOWLEDGE_BASE_PATH.
Commands
Validate the complete knowledge base:
Read stored resources by their typed identifiers:
Query entities using one or more typed property-value filters:
Multiple filters must all match. Results are deterministic YAML and default to 100 items from offset 0.
Inspect direct incoming, outgoing, and self-referential relationships:
Preview and apply a YAML statement manifest:
An example manifest is:
statements:
- entity: Q1
property: P1
value:
references:
The CLI assigns statement identifiers. Each item must contain entity, property, value, and at least one reference. A batch is applied completely or not at all.
Register a reference or reuse one with the exact same canonical URL:
The command records its current UTC time as retrieved_at. It never fetches a source; callers supply the canonical URL and metadata. Exact URL matches return an existing-reference outcome without changing metadata or identifier allocation. Registration and dry runs validate both the baseline and staged repository; their YAML output contains status (previewed, registered, or existing) and the reference identifier.
Output and exit status
Read commands write stored files to standard output exactly as written. Query and mutation commands produce deterministic YAML. Validation diagnostics and command errors are written to standard error.
Commands exit unsuccessfully when configuration is missing, input is invalid, a resource cannot be read, validation diagnostics are found, or a mutation cannot be applied.