Finite state machines: define states and transitions, check the definition, fire events with guards and hooks, load from TOML, YAML or JSON, draw as Mermaid or Graphviz
fsmstate-machineworkflowstatestransitions
[decks]
"@deckyard/fsm" = "^0.1.0"| Version | Status | Kind | Pin | Requires | Engines | Capabilities |
|---|---|---|---|---|---|---|
| 0.1.0 | live | git | 2c6276d5991a | - | jennifer >=0.25.0 jennifer-tiny >=0.25.0 | - |
LGPL-3.0-only
0.1.0Times a client asked this registry where to find this deck. Not downloads: the registry only stores metadata, and the code is fetched from its repository directly, so we never see an install and cannot count one. Repeated builds inflate these numbers; installs from an existing lockfile do not appear at all. Counted in UTC.
Finite state machines for Jennifer: define states and transitions, fire events with guards and enter and leave hooks, and keep the current state wherever the program already keeps its data. A misspelt state or a transition that could never be taken fails when the machine is built; check finds unreachable states and dead ends. Machines load from TOML, YAML or JSON and draw as Mermaid or Graphviz.
jvc add @deckyard/fsmThis vendors the deck to vendor/<scope>/fsm/. Without jvc, unpack the src/ subtree of a release archive (<scope>-fsm-<version>.tar.gz) there.
import "@deckyard/fsm/" as fsm;
def m as fsm.Machine init fsm.machine("door", "closed");
$m = fsm.addStates($m, ["open", "locked"]);
$m = fsm.addTransition($m, "open", ["closed"], "open");
$m = fsm.addTransition($m, "close", ["open"], "closed");
$m = fsm.addTransition($m, "lock", ["closed"], "locked");
$m = fsm.addTransition($m, "unlock", ["locked"], "closed");
def state as string init "closed";
$state = fsm.fire($m, $state, "lock", {}).target;
io.printf("%s, can %v\n", $state, fsm.events($m, $state, {})); # locked, can ["unlock"]Jennifer 0.25.0 or newer, jennifer or jennifer-tiny. No capabilities: the deck is pure computation.
tools/check-all.sh # the full gate, as CI runs it
jennifer test src/fsm_test.j # the test overlay
tools/check-docs.sh # docs against the code
tools/pack.sh dist # build the release archiveLGPL-3.0-only, see LICENSE. Copyright (C) 2026 mplx <[email protected]>.
tools/check-headers.sh checks every source file's SPDX header against deck.toml.