|
tin
1.5.9
|
tools/tsm_tool.py is the dependency-free command line tool for moving state machine definitions between authoring formats, reviewed YAML/JSON IR, diagrams, test simulators, and generated integration skeletons.
Use it when a machine definition needs to cross a boundary:
.hsm or YAML file as canonical JSON;The tool does not replace production C++ execution. Production behavior still runs through tsm::hsm, runtime policies, and the selected executor.
The tool accepts:
.hsm or .tsm: human authoring syntax documented in hsm_dsl_grammar;.yaml or .yml: compact verified-tsm.machine.v1 authoring with inferred states and events;.json: verified-tsm.machine.v1 machine IR documented in machine_ir_json.The importer treats .hsm and .tsm as the same DSL family. YAML and JSON use the same schema and normalize to the same internal machine model.
Compact YAML is usually the easiest form to review:
Import a human-authored machine to JSON IR:
Validate an IR file:
Export review artifacts:
Generate implementation skeletons:
| Format | Command | Use |
|---|---|---|
json | export or import | canonical machine IR for tooling and automation |
artifacts | export | tin artifact manifest for target, runtime, generated outputs, evidence, and package metadata |
scxml | export | interchange with state-machine tools |
plantuml | export | diagram review in PlantUML workflows |
mermaid | export | diagram review in Markdown workflows |
python | export | lightweight simulator for tests and notebooks |
cpp-skeleton | generate | initial C++ authoring scaffold |
pybind11 | generate | Python extension bridge scaffold |
For product code, keep the generated skeleton under review and edit it into a normal tsm definition. For tests and tools, use YAML for human-owned source and JSON as the stable machine interchange format.
Machine JSON can carry deployment intent that tools should preserve even when the production C++ runtime remains hand-selected:
The validator checks the shape of this metadata:
target.profile is required when a target object is present;target.tick.rep and target.tick.period record the configured tick type;export --format artifacts emits a tin.artifacts.v1 manifest. It gives build, review, and CI tooling one place to inspect the machine, selected target metadata, runtime metadata, transport metadata, evidence obligations, tin version, public headers, and related generated artifact kinds.
The manifest includes entries for:
verified-tsm.machine.v1 machine IR;tsm.resource_manifest.v1 runtime resource manifests;verified-tsm.trace.v1 replay traces;verified-tsm.traceability.v1 traceability records.Use the artifact manifest as the index for a generated evidence bundle. The individual generated files still come from their normal commands.
The quality suite already exercises the tool path:
.hsm import to JSON;