mt check

mt check checks every task source: field values, required fields, numeric bounds, links and dependency cycles. It also checks the task each template would file with its examples and, under [templates] check-defaults, with its defaults, as Templates & slots describes. It prints each problem it finds and exits non-zero if there’s at least one. Run it after you edit a task file by hand. A Typst warning repeated in the same message prints once, with its count and files. -v lists every site instead. Concepts says which mistakes the prelude catches and which mt check catches, and Rules covers the checks you can add. To check a commit message instead, run mt check --commit-msg <file> from a commit-msg hook. It checks the message against the project’s commit rules. In CI, mt check --commits <range> checks every commit in a range. Both skip merge commits unless you pass --check-merges.

Check every task and every template against your project's rules

mt checks a template as the task it would file.

Runs on every project of a set too. mt @work check checks each project under that project’s rules and ends with one line for the set.

-q, --quiet

Don't print the ok line when everything passes

Errors and warnings still print.

--commit-msg <FILE>

Check a commit message and the staged changes, not tasks

It checks them against your commit rules, instead of checking tasks. For a commit-msg hook: mt check --commit-msg "$1".

--commits <RANGE>

Check each commit in a git range, not tasks

It checks them against your commit rules, instead of checking tasks. For CI: mt check --commits origin/main..HEAD.

--check-merges

Check merge commits too

A merge joins commits already checked on their own, so --commit-msg and --commits skip one by default. With this flag, the check treats a merge like any other commit, and is_merge tells its rules that it is one.

--json

Print the problems as JSON on stdout instead of text on stderr

The exit code is the same.

$ mt check
ok: 14 tasks

Every command also takes the global flags.