package
0.5.1
Repository: https://github.com/jsmorph/sheens.git
Documentation: pkg.go.dev

# README

A tool to work with specs

A machine specification is of course a data structure, so we can analyze and manipulate it. Though this tool mostly serves as a demonstration, some of its functionality might actually be useful.

spectool expects a specification (in either YAML or JSON) from stdin, and spectool writes out a spec (by default in YAML). So you can chain spectool invocations via pipes.

Example

cat demo.yaml | \
  spectool inlines -d . | \
  spectool macroexpand | \
  spectool addOrderedOutMessages -p 'lunch_' -s '00' -e done -d 3s \
     -m '[{"e":{"order":"beer"},"r":{"deliver":"beer"}},{"e":{"order":"queso"},"r":{"deliver":"queso"}},{"e":{"order":"tacos"},"r":{"deliver":"tacos"}}]' | \
  spectool addGenericCancelNode | \
  spectool addMessageBranches -P -p '{"ctl":"cancel"}' -t cancel | \
  spectool dot | \
  spectool mermaid | \
  spectool analyze |
  spectool yamltojson > \
  demo.json

The analysis function generates output like

errors: []
nodecount: 16
branches: 24
actions: 9
guards: 0
terminalnodes: []
orphans:
- lunch_00
- demo
emptytargets: []
missingtargets:
- there
- lunch_start
branchtargetvariables:
- '@from'
interpreters:
- ecmascript

If you have Mermaid installed, you can render that output spec as an SVG:

./node_modules/.bin/mmdc -i spec.mermaid -o demo.svg

mermaid

If you have Graphviz instaled, you can render that output spec with

dot -Tpng spec.dot -o demo.png

graphviz

# Functions

AddGenericCancelNode adds a 'cancel' node as given by CancelNodeYAML.
AddMessageBranches adds a branch to each message node in the Spec.
No description provided by the author
No description provided by the author

# Variables

CancelNodeYAML is a node that iterates through any _.bindings.cleanupMessages and emits them.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author