Skip to navigation
ReferenceKnowledge and DeliveryKnowledge Contracts

DocsFab Knowledge CLI

Dev
View as Markdown

The DocsFab knowledge command-line interface (CLI) operates the local, single-process control plane. For more information, refer to Knowledge Contracts in DocsFab.

Run the knowledge CLI from the DocsFab repository root.

node packages/knowledge/src/cli.mjs <command> [options]

The server binds only to loopback. It is not an authenticated production service. Every mutation requires the exact current stream version.

Choose a Command

NeedCommand
Inspect usage and the control-plane boundary.help
Start the loopback control plane.serve
Inspect reconstructed state or the underlying ledger.state or events
Submit one optimistic-concurrency mutation.command
Produce a deterministic Markdown projection.export

Commands

CommandRequired optionsOptional optionsPurpose
helpNoneNoneDisplay command usage and the control-plane boundary.
serve--data PATH--port PORTStart the loopback HTTP server. The default port is 4310.
state--data PATHNonePrint the reconstructed canonical state as JSON.
events--data PATHNonePrint the append-only event stream as JSON.
command--data PATH, --name NAME, --expected-version N, --actor NAME, --input JSONNoneSubmit one version-bound state mutation.
export--data PATH, --kind KIND, --id ID--version IDRender a deterministic Markdown projection.

Export Kinds

The --kind option accepts the following values:

ValueOutput
shared-modelA selected shared model and optional version
documentation-briefA documentation-readiness and planning brief
workflowA workflow record

An unknown export kind fails instead of returning an empty projection.

Versioned Mutations

Before you submit command, read the current state and use its version as --expected-version. If another accepted command advances the stream first, the stale command fails. Reload the state, review the intervening event, and reconstruct the mutation only if it remains valid.

Data Directory

The --data path contains control-plane runtime state. Choose an explicit, access-controlled directory. Do not place provider credentials in that directory, command input, event records, or exported artifacts.

Authoritative Sources