Syster CLI
Command-line interface for SysML v2 and KerML analysis, interchange, and semantic model editing.
Installation
Or build from source:
The interchange feature (enabled by default) adds model export/import, decompilation, and semantic editing commands.
Usage
Basic Analysis
# Analyze a single file
# Analyze a directory
# With verbose output
# Standard library is loaded by default; skip with --no-stdlib
# Custom stdlib path
Export Formats
Export models to various interchange formats:
# Export to XMI (OMG standard)
# Export to YAML (human-readable)
# Export to JSON-LD (linked data)
# Export to KPAR (Kernel Package Archive)
# Export AST as JSON
# Self-contained export (includes stdlib)
Import and Roundtrip
# Import and validate an XMI file
# Import into workspace for analysis
# Decompile XMI back to SysML text + metadata
Decompilation produces two files:
model.sysml— the reconstructed SysML textmodel.metadata.json— element ID mappings for round-trip fidelity
Query and Inspect
Browse the semantic model without modifying it:
# List all elements in a model
# Search elements by name (substring match)
# Filter by metaclass kind
# Inspect a specific element (children, relationships, ID)
# Inspect by qualified name
# JSON output for any command
Rename Elements
Rename a definition or usage across the model:
# Rename an element
The renamed output is written to the specified file (or stdout). A companion .metadata.json file is written alongside the output so that element IDs are preserved through subsequent edits.
Add Members
Add a new part, attribute, or other member to an existing element:
# Add an untyped part
# Add a typed part
# Add an attribute
The format is PARENT:KIND:NAME[:TYPE]. Supported kinds:
| Kind string | Element kind |
|---|---|
PartUsage, part |
Part usage |
PartDefinition, part_def |
Part definition |
AttributeUsage, attribute, attr |
Attribute usage |
AttributeDefinition, attr_def |
Attribute definition |
PortUsage, port |
Port usage |
PortDefinition, port_def |
Port definition |
ItemUsage, item |
Item usage |
ItemDefinition, item_def |
Item definition |
Package |
Package |
Remove Elements
Remove an element from the model by name or qualified name:
# Remove by simple name
# Remove by qualified name
Metadata and ID Preservation
When working with interchange formats, element identity (UUIDs) matters. The CLI uses companion .metadata.json files to preserve element IDs across edits:
- Export a model to XMI — each element gets a stable UUID.
- Decompile the XMI back to SysML — a
.metadata.jsonfile records the original IDs. - Edit the SysML (rename, add, remove) — the CLI reads the companion metadata and carries IDs forward.
- Re-export — previously-known elements retain their original UUIDs.
# Full round-trip example
Export Format Examples
Given this SysML input:
part def Vehicle {
attribute mass : Real;
}
XMI Output
YAML Output
- '@type': PartDefinition
'@id': cc10f11d-996f-4251-8952-9723018b762d
name: Vehicle
qualifiedName: Vehicle
ownedMember:
- '@id': 48e432b9-fdfe-483a-bd2d-36e6417703b2
- '@type': AttributeUsage
'@id': 48e432b9-fdfe-483a-bd2d-36e6417703b2
name: mass
qualifiedName: Vehicle::mass
owner:
'@id': cc10f11d-996f-4251-8952-9723018b762d
- '@type': FeatureTyping
'@id': rel_1
source:
'@id': 48e432b9-fdfe-483a-bd2d-36e6417703b2
target:
'@id': Real
AST JSON Output (--export-ast)
All Options
syster [OPTIONS] <FILE>
Arguments:
<FILE> Input file or directory to analyze
Options:
-v, --verbose Enable verbose output
-o, --output <FILE> Write output to file instead of stdout
--json Output results as JSON
--no-stdlib Skip loading standard library
--stdlib-path Path to custom standard library
Analysis:
--export-ast Export AST as JSON
Interchange (requires interchange feature):
--export <FMT> Export model (xmi, yaml, json-ld, kpar)
--self-contained Include stdlib in export
--import Import and validate interchange file
--import-workspace Import into workspace for analysis
--decompile Decompile interchange to SysML + metadata
Semantic Model:
--list List all model elements
--query <NAME> Search elements by name (substring)
--kind <KIND> Filter by metaclass kind
--inspect <NAME> Inspect element details
--rename <OLD=NEW> Rename an element
--add-member <PARENT:KIND:NAME[:TYPE]> Add a member element
--remove-member <NAME> Remove an element
Exit Codes
| Code | Meaning |
|---|---|
0 |
Success — no errors |
1 |
Error — parse failure, missing element, invalid input, or hard validation error |
2 |
Success with warnings — e.g. --import with unresolved stdlib type references |
Features
- Parse and validate SysML v2 and KerML files
- Symbol table analysis with qualified names
- Import resolution and type checking
- Error reporting with source locations
- Export to XMI, YAML, JSON-LD, and KPAR formats
- Import and validate interchange files
- Decompile XMI back to SysML text with metadata
- Self-contained export with embedded stdlib
- Semantic model queries (list, search, inspect)
- In-place model editing (rename, add member, remove)
- Element ID preservation across edit round-trips via companion metadata
Supported Formats
| Format | Extension | Description |
|---|---|---|
| XMI | .xmi |
OMG XML Metadata Interchange (standard) |
| YAML | .yaml |
Human-readable YAML representation |
| JSON-LD | .jsonld |
JSON Linked Data format |
| KPAR | .kpar |
Kernel Package Archive (ZIP) |
License
MIT