You want to check a form file before an import, or see what changed between two files, in a
terminal or a pipeline. You need Bun and the editor’s source; mtif works on files alone, without a
system and without a network.
mtif runs from the editor’s source as bun packages/cli/src/main.ts. A launcher in your PATH makes
it the command mtif. This section writes it as mtif.
mtif check <file> Check a form file: the form check, what an import would refuse, and the
names of meters, domains, document folders and scripts that only the
target system can check.
mtif diff <old> <new> The differences between two form files, in words.
mtif help This text.
mtif version The version.
mtif --help and mtif -h print the same text, and mtif --version prints the version.
mtif check prints the form check of a file and what an import would refuse. It also names each meter, domain, document folder and automation script the file needs: only the target system can check them, and the import does.
$ mtif check docs/examples/locomotive-daily-check.inspform.json
docs/examples/locomotive-daily-check.inspform.json: form 1001 revision 1 "Locomotive daily check" (EAGLENA/BEDFORD), 2 sections, 6 questions, 2 rules
Not checked offline: 1 name the target system must hold. An import checks it there.
Document folder Photos, named by question 1.5 "Photo of the safety valve", field 1.
Clean: no findings.
mtif diff prints the differences of two files in the words of the import dialog and of the comparison in the editor.
$ mtif diff docs/examples/beam-engine-lubrication.inspform.json docs/examples/beam-engine-lubrication-r2.inspform.json
Form (1)
Revision: 1 → 2
Questions added (1)
2.2 "Temperature of the crank bearing (°C)"
Rules changed (2)
Unless 1.1 "Oil in the reservoir before the round (litres)" is >= 0 and <= 45, reject the answer with "The reservoir holds at most 45 litres.". Limit changed from 40 to 45. Message before: "The reservoir holds at most 40 litres.".
Unless 1.2 "Oil in the reservoir after the round (litres)" is >= 0 and <= 45, reject the answer with "The reservoir holds at most 45 litres.". Limit changed from 40 to 45. Message before: "The reservoir holds at most 40 litres.".
Exit codes, for a pipeline:
| Code | mtif check |
mtif diff |
|---|---|---|
| 0 | clean: no error, no warning | the files are equal |
| 1 | an error or a warning, or a reason an import would refuse the file | the files differ |
| 2 | a file that cannot be read, or a wrong command line | the same |
Information alone, such as “The form has no type.”, and the names only the target can check leave the
exit code at 0. In a pipeline that keeps forms in git, mtif check on every changed
*.inspform.json stops a file with an error or a warning.
