Command-line reference¶
The package installs one console command, longeron. The nine subcommands map onto the
Python API one-to-one, so anything the command line does, a script can do.
Subcommand |
Does |
Python equivalent |
|---|---|---|
syntax-check |
||
validate a model and print diagnostics |
||
serialize a model to JSON, SysML, KerML, or API JSON |
|
|
invoke a |
||
instantiate a |
|
|
execute an |
|
|
simulate a |
||
verify |
||
serve a workspace over the Systems Modeling API |
Errors and exit codes¶
Expected failures – a missing or unreadable file, a syntax error, an
unknown qualified name, a malformed .json input, a missing optional
extra – print a single error: ... line to stderr and exit 1, without
a Python traceback:
$ longeron calc examples/deepscout Rotorcraft::Nope
error: Rotorcraft has no member 'Nope'
Pass --traceback (any subcommand) to re-raise the underlying exception
with its full traceback. Genuinely unexpected errors – bugs – always
show their traceback.
Code |
Meaning |
|---|---|
|
Success. For |
|
|
|
Command-line usage error (reported by argparse). |
|
|
longeron parse¶
parse syntax-checks a source file, or every source file under a
directory, without building a model:
$ longeron parse examples/deepscout/aircraft.sysml
OK: examples/deepscout/aircraft.sysml parses as sysml
Option |
Effect |
|---|---|
|
Force the KerML grammar. On a directory, check |
|
Print the raw ANTLR parse tree for a single file. |
The grammar is chosen from the file suffix unless --kerml forces it.
In directory mode every file is reported – failures print as FAIL:
lines with their syntax errors and do not stop the sweep; the exit code
is 1 when any file failed.
Syntax errors are reported compactly: ANTLR’s expected-token dumps are
rewritten (unexpected ';' (expected an expression) instead of a 20-token
set listing), and each error echoes the offending source line with a ^
caret under the column. The verbatim ANTLR message stays available on
SyntaxIssue.raw_message for grammar work.
KerML support is parse-and-validate only. The builder, and therefore every other subcommand, consumes SysML sources (see Grammar conformance).
longeron lint¶
lint validates a model and prints one line per diagnostic, then a
summary line:
$ longeron lint demo.sysml
demo.sysml:3:5: error[duplicate-name] Demo::Wheel: name 'Wheel' is already used by another member of Demo
demo.sysml:5:9: warning[unresolved-reference] Demo::Vehicle::mass: typed by 'Reall' does not resolve
1 error(s), 1 warning(s)
The file:line:column prefix comes from parsing; models rebuilt from a
.json export or from a warm model cache
entry carry no source positions, so their diagnostics print without the
prefix. Pass --no-cache to re-parse and get positions back.
Option |
Effect |
|---|---|
|
Strict mode: unresolved references and the other resolution failures become errors, and a bare |
|
Additionally warn ( |
|
Additionally warn ( |
|
Do not resolve names against the standard library. Every library reference then warns. |
The Validation guide documents every diagnostic code, its severity, and how name resolution works.
longeron export¶
export serializes a model and writes it to stdout, or to --output:
$ longeron export examples/deepscout --format sysml # regenerated text
$ longeron export model.json --format sysml # JSON in, SysML out
$ longeron export models/ --format json -o merged.json # directory, merged
Option |
Effect |
|---|---|
|
Output format (default |
|
With |
|
Write to a file instead of stdout. |
JSON round-trips are lossless. SysML output re-parses to the same model. KerML is a one-way projection. See the interchange reference.
longeron calc¶
calc invokes a calc def as a function and prints the result:
$ longeron calc examples/deepscout DeepScout::HoverTime capacity=5200
23.28358208955224
The positional name is the qualified name of the calc. Trailing
name=value pairs bind its in parameters.
longeron check¶
check instantiates a part def, prints the instance as JSON, and then
checks every constraint and requirement against it:
$ longeron check examples/deepscout Rotorcraft::QuadCopter payloadMass=0.9
{ ... the instance, as JSON ... }
[FAIL] assert takeoffMassLimit: totalMass <= maxTakeoffMass
[PASS] assert canHover: 4.0 * thrustPerRotor > totalMass * 9.81
$ echo $?
1
Each verdict line reads [PASS], [FAIL], or [SKIP] (a requirement
whose assumptions do not hold is skipped). Trailing name=value pairs
override attribute values, which makes check a one-line what-if tool.
If any constraint fails, the command exits 1.
longeron run¶
run executes an action def and prints the step trace, the outputs,
and any sent payloads:
$ longeron run examples/deepscout DeepScout::PlanBattery distanceKm=20
assign requiredWh := 7.4
...
outputs: {"requiredWh": 7.4, ...}
Option |
Effect |
|---|---|
|
Comma-separated event names, delivered to |
Trailing name=value pairs bind the action’s in parameters.
longeron simulate¶
simulate starts a state def, feeds it events, and prints the
transition trace:
$ longeron simulate examples/deepscout DeepScout::FlightStates --events launch,airborne
idle --launch--> takingOff
takingOff --airborne--> flying
final state: flying
Option |
Effect |
|---|---|
|
Comma-separated event names, sent in order. |
Events the machine cannot consume are reported on an
ignored events: line. The --events list carries event names only.
To advance the simulation clock for accept after/accept at triggers,
use the Python API, where a plain number in the events list advances
the clock (simulate()).
longeron evidence¶
evidence carries the provenance workflow of the
evidence guide, as two sub-commands.
evidence verify loads a model (the shared model-input forms and
--no-cache/--stdlib apply), re-checks every SourceEvidence
citation, and prints one verdict per citation:
$ longeron evidence verify examples/deepscout
status element document detail
------ ------------------------------------ ----------------------------------------- ------
intact ScoutParts::F450Kit::Propeller::mass https://www.apcprop.com/product/10x4-5mr/
1 citation(s): 0 drifted or lost
The exit code is the count of drifted and lost citations, so a CI step can gate on it directly.
Option |
Effect |
|---|---|
|
Stay offline: URL documents verify against the local evidence cache only. An uncached URL document reports |
evidence init writes the git-LFS stanza for the evidence/ directory
into .gitattributes (storage pattern 1: owned documents commit as LFS
objects). It preserves existing .gitattributes content and is
idempotent.
$ longeron evidence init
wrote .gitattributes
Option |
Effect |
|---|---|
|
Repository root; defaults to |
longeron serve¶
serve exposes a workspace as a git-backed OMG Systems Modeling API
server (requires pip install "longeron[server]"):
$ longeron serve path/to/models --port 9000
INFO: Uvicorn running on http://127.0.0.1:9000 (Press CTRL+C to quit)
Option |
Effect |
|---|---|
|
Directory (or single |
|
Bind address. Defaults to |
|
Port; defaults to |
Unlike the other subcommands, serve takes no --no-cache/--stdlib
options: it always loads through the model cache, and it blocks until
interrupted. See API server & client for the resource
model, the git-commit mapping, and the /x/ extension endpoints.