CLI Reference

Complete reference for the stl command-line tool (10 commands).

Install: pip install -e . from the parser/ directory. Usage: stl <command> [options]


validate

Validate an STL file and report errors/warnings.

stl validate <file>

Exit code: 0 (valid), 1 (errors found).


parse

Parse an STL file and output as JSON.

stl parse <file> [--json/-j]
FlagDefaultDescription
--json / -jTrueOutput as JSON

convert

Convert STL to another format.

stl convert <file> --to <format> [--format <rdf_format>] [--output <path>]
FlagDefaultDescription
--to / -tjsonOutput format: json, rdf, turtle, xml, nt, json-ld
--format / -fturtleRDF sub-format (when --to rdf)
--output / -ostdoutWrite to file

Examples:

stl convert data.stl --to json --output data.json
stl convert data.stl --to rdf --format turtle --output data.ttl
stl convert data.stl --to rdf --format json-ld

analyze

Show graph statistics for an STL file.

stl analyze <file>

Reports: node/edge counts, density, cycles, conflicts, centrality rankings, tension metrics.


build

Build a single STL statement.

stl build <source> <target> [--mod <modifiers>] [--output <path>]
FlagDefaultDescription
--mod / -mComma-separated key=value pairs
--output / -ostdoutWrite to file

Values are auto-typed: 0.85 → float, true → bool, hello → string.

Example:

stl build "[Rain]" "[Flooding]" --mod "rule=causal,confidence=0.85,strength=0.8"

clean

Clean and repair LLM-generated STL output.

stl clean <file> [--schema <path>] [--show-repairs] [--output <path>]
FlagDefaultDescription
--schema / -sSchema file for post-repair validation
--show-repairsFalseDisplay repair actions as table
--output / -ostdoutWrite cleaned output to file

Example:

stl clean llm_output.txt --show-repairs --output cleaned.stl

schema-validate

Validate an STL file against a domain schema.

stl schema-validate <file> --schema <schema_path>
FlagDefaultDescription
--schema / -s(required)Path to .stl.schema file

Exit code: 0 (valid), 1 (errors).

Example:

stl schema-validate knowledge.stl --schema docs/schemas/medical.stl.schema

query

Search and filter STL documents.

stl query <file> [--where <conditions>] [--select <fields>] [--pointer <path>]
                 [--format <fmt>] [--count] [--limit <n>]
FlagDefaultDescription
--where / -wFilter: field=value,field__op=value
--select / -sProject: comma-separated field names
--pointer / -pSTL pointer path (e.g., /0/source/name)
--format / -ftableOutput: table, json, stl, csv
--countFalseOnly print match count
--limitMaximum results

Operators for —where:

=, __gt=, __gte=, __lt=, __lte=, __ne=, __contains=, __startswith=, __in= (pipe-separated values)

Examples:

stl query data.stl --where "rule=causal,confidence__gte=0.8"
stl query data.stl --select "source,target,confidence" --format csv
stl query data.stl --pointer "/0/source/name"
stl query data.stl --where "confidence__gte=0.9" --count

diff

Compare two STL files.

stl diff <file_a> <file_b> [--format <fmt>] [--summary] [--quiet]
FlagDefaultDescription
--format / -ftextOutput: text, json
--summary / -sFalseOnly print summary counts
--quietFalseExit code only: 0=identical, 1=different

Example:

stl diff v1.stl v2.stl
stl diff v1.stl v2.stl --format json > changes.json

patch

Apply a diff to an STL file.

stl patch <file> <diff_file> [--output <path>]
FlagDefaultDescription
--output / -ostdoutWrite patched output to file

The diff file must be JSON format (produced by stl diff --format json).

Example:

stl patch base.stl changes.json --output patched.stl