tok

v1.0.3
io.github.tok-lang-bpm/tok Checked 3 days ago Published 1 month ago

Model BPMN processes and DMN decisions as text: check, export, import, simulate, evaluate.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

check Check a tok model

Check a tok document and list its diagnostics (code, severity, line, element, message), as `tok check --json`. Every layer is checked: tokens, statements, references, BPMN 2.0 rules, the Camunda 8 profile of executable documents, decisions, FEEL and simulation parameters. A document with errors is a successful call with errors > 0; fix the errors and check again. Codes are explained in the reference topic 'diagnostics'.

ParameterTypeDescription
bpmnbooleanAlso check the BPMN 2.0 rules of the exported model (E, W, L codes).
classstringBPMN 2.0.2 conformance class to check against; elements outside it are R075.
langstringLanguage of diagnostics and reports.
levelstringTeaching level: the elements the document may use (spec §13).
pathstringPath of a .tok file, read by the server (relative to its working directory). Give either text or path.
textstringThe tok document. Give either text or path.

check_bpmn Check a BPMN file

Check BPMN 2.0 XML, from tok or from any modelling tool, with the BPMN rules of the tok checker, as `tok check FILE.bpmn --json`: every finding has a code, a severity, the line and the id of its element and a message. steps requires every element name to start with the step number of a process description (K01); description, the text of that description, reports steps without an element and elements without a step (K02, K03); camunda adds the Camunda 8 profile of executable models (C codes; with path, forms and decisions are looked for in the file's folder). XML with errors is a successful cal…

ParameterTypeDescription
camundabooleanAlso check the Camunda 8 profile of executable models (C codes).
descriptionstringThe process description whose table lists the steps (its first column holds the step numbers); checks that every step is in the model (K02, K03).
langstringLanguage of diagnostics and reports.
pathstringPath of a .bpmn file, read by the server (relative to its working directory). Give either xml or path.
stepsbooleanElement names start with step numbers (K01).
xmlstringThe BPMN 2.0 XML. Give either xml or path.

fmt Format a tok model

Print a tok document in its canonical form, as `tok fmt`. The document must have no syntax errors. The result is the text only; write it to the file yourself.

ParameterTypeDescription
langstringLanguage of diagnostics and reports.
pathstringPath of a .tok file, read by the server (relative to its working directory). Give either text or path.
textstringThe tok document. Give either text or path.

export Export a tok model

Export a checked tok document and return the contents of the files `tok export` writes: BPMN 2.0 XML with diagram layout (NAME.bpmn), its SVG picture (NAME.svg), DMN files of the decisions (with NAME.drd.svg pictures in languages 0.7 and 1.0) and Camunda form files (ID.form). With path, the layout sidecar FILE.tok.layout next to the file is used. A document with errors is a tool error listing them.

ParameterTypeDescription
formatsarrayThe kinds of file to return; all when left out. 'dmn' includes the decision diagrams (.drd.svg).
langstringLanguage of diagnostics and reports.
namestringStem of the BPMN and SVG file names; default: the stem of path, or 'model'.
pathstringPath of a .tok file, read by the server (relative to its working directory). Give either text or path.
sidecarbooleanUse the layout sidecar FILE.tok.layout next to path.
textstringThe tok document. Give either text or path.

import Import BPMN or DMN

Convert a BPMN 2.0 XML or DMN 1.1–1.5 file to a tok document, as `tok import`. Elements tok does not keep are listed in warnings. For BPMN the diagram of the file is returned as a layout sidecar: save it as FILE.tok.layout next to the document to keep the drawing.

ParameterTypeDescription
flow_idsbooleanKeep the identifiers of sequence flows (false prints compact chains).
formatstring
layoutbooleanReturn the layout sidecar of a BPMN file.
pathstringPath of a .bpmn or .dmn file, read by the server. Give either xml or path.
xmlstringThe BPMN or DMN XML. Give either xml or path.

sim Simulate a tok model

Run the discrete-event simulation of a tok document, as `tok sim`: indicators (cases per end event, cycle times, waiting and processing times, resource utilization) and the report text. The same seed gives the same run. The event log and the case table are large; ask for them only when needed.

ParameterTypeDescription
casesintegerNumber of cases; overrides `simulate cases=`.
cases_tablebooleanInclude one object per case.
csvbooleanInclude the event log and the case table as CSV text.
langstringLanguage of diagnostics and reports.
logbooleanInclude the event log (one object per activity instance).
pathstringPath of a .tok file, read by the server (relative to its working directory). Give either text or path.
seedintegerRandom seed; overrides `simulate seed=`.
textstringThe tok document. Give either text or path.
xesbooleanInclude the event log as XES.

eval Evaluate a decision

Evaluate a decision of a tok document for input values, as `tok eval`. In languages 0.7 and 1.0 the decision is evaluated with everything it requires and values are given by the FEEL names of input data; in earlier languages the decision table alone is evaluated over its input columns. Values are JSON (numbers, text, booleans, null, lists, objects as contexts).

ParameterTypeDescription
decision *stringIdentifier of the decision.
langstringLanguage of diagnostics and reports.
pathstringPath of a .tok file, read by the server (relative to its working directory). Give either text or path.
textstringThe tok document. Give either text or path.
valuesobjectInput name → value.

reference tok language reference

The reference documentation of the tok language: 'cheatsheet' (the whole language on one page; read it before writing a model), 'spec' (the normative specification), 'diagnostics' (every diagnostic code), 'feel' (expressions), 'cli' (the tok command). The same texts are resources tok://reference/TOPIC.

ParameterTypeDescription
topicstring