Views & dictionaries

How views name a filter with its sort and columns, and dictionaries name a set of strings, for rules to share.

Views

If you keep typing the same filter, give it a name. [views.<name>] names a filter together with a sort and a set of columns, so you can ask for the listing by name:

# examples/named-sets/.mindtape/config.toml: the listing a bare `mt ls` shows
[views.default]
filter = "!terminal"

# examples/named-sets/.mindtape/config.toml: a filter, a sort, columns and a description
[views.waiting]
filter = "blocked"
sort = ["priority:desc"]
columns = ["slug#", "title", "why"]
description = "Blocked tasks and what each waits on"

Every key is optional. filter is a filter expression, and an empty one matches every task. sort takes the same specs as --sort, and columns the same column names as --columns. The mt ls page lists both. mt config show --resolved prints the description.

mt ls @name applies the view’s filter, sort and columns. Inside a larger expression, @name is just the view’s filter, as in mt ls '@waiting && kind == "feat"'. If no [[ls.rules]] entry matches, a bare mt ls shows the view named default, or the one [ls] default-view names.

$ mt ls @waiting
SLUG# TITLE WHY
50r Retry failed invoice payments waits on: rotate-the-signing-keys (wip)

1 of 3 tasks · waiting view (Blocked tasks and what each waits on)

mt checks every view when it loads the config. Each filter must parse. Each sort and columns entry must refer to a known field or view, including a scalar derived.<name>. Each @name must refer to a view, and no view may reference itself through @name.

Dictionaries

When rules and allow-lists share a list of words, keep it in one place. [dicts.<name>] names a set of strings that rules, filters and allow-lists share:

# examples/named-sets/.mindtape/config.toml: both built-in verb lists under one name
[dicts.verbs]
include = ["mindtape-verbs", "mindtape-dev-verbs"]

# examples/named-sets/.mindtape/config.toml: inline values, a file of entries, and the case rule
[dicts.areas]
values = ["auth", "billing"]
path = "areas.txt"
case = "fold"

# examples/named-sets/.mindtape/config.toml: inline values only
[dicts.kinds]
values = ["feat", "fix", "chore"]

# examples/named-sets/.mindtape/config.toml: the values an `x-` field takes
[dicts.teams]
values = ["payments", "platform"]

A dictionary takes entries from three keys, and needs at least one. values lists them inline. path names a file with one entry per line, relative to the project root, or to the pack’s directory for a dictionary a pack declares. mt trims each line and skips blank lines and lines starting with #. include adds every entry of other dictionaries, your own or the built-ins.

case decides how a lookup compares. fold, the default, ignores ASCII case, so the title word Rotate matches the entry rotate. exact compares bytes. An included dictionary’s entries compare under the including dictionary’s case.

mt includes two dictionaries you can use without declaring them:

Your own dictionary names can’t start with mindtape-, because that prefix is for the built-ins.

mt dicts lists every dictionary with its entry count, case and source, the built-ins included. A dictionary built from include names the dictionaries it sums. mt dicts <name> prints one dictionary’s entries, one per line, after mt merges include, values and path. That’s the list a rule reading the dictionary accepts, and a fold dictionary prints it lowercase:

$ mt dicts
areas 4 case fold inline
kinds 3 case fold inline
mindtape-dev-verbs 318 case fold inline
mindtape-verbs 500 case fold inline
teams 2 case fold inline
verbs 818 case fold include: mindtape-verbs, mindtape-dev-verbs
$ mt dicts areas
auth
billing
notifications
search

Using a dictionary

[tasks.tags] allowed and [tasks.fields.<name>] values accept @<dict> in place of an entry, and a rule reads one with in_dict():

# examples/named-sets/.mindtape/config.toml: allow-lists that read a dictionary
[tasks.tags]
allowed = ["@areas", "security"]

[tasks.fields.kind]
values = ["@kinds"]

[tasks.fields.x-team]
values = ["@teams"]
required = "!terminal"

# examples/named-sets/.mindtape/config.toml: a rule that reads a dictionary
[[tasks.rules]]
name = "imperative-title"
when = "!terminal"
assert = 'in_dict("verbs", word(title, 1))'
message = "start the title with a verb"
severity = "error"

mt expands each @<dict> when it loads the config, so validation, mt add completion and the generated schema all see a plain list. The list keeps its literal entries in order, adds each dictionary’s entries in alphabetical order, and drops repeats. An entry starting with @ always names a dictionary, so no tag or field value can start with @. mt refuses a tag outside the list and exits 1:

$ mt set fix-the-refund-rounding tags+=payments
error: tasks/fix-the-refund-rounding.typ:8: tags: `payments` is not an allowed tag
hint: use one of: auth, billing, notifications, search, security

When a rule refuses a task because in_dict() missed, the refusal says which word the dictionary lacks and names up to three of its nearest entries, as in hint: 'Login' is not in dict verbs; did you mean begin, join or log?. A second hint runs mt dicts on that dictionary, so you can read every entry.

mt checks every dictionary when it loads the config. Each must have a source and resolve to at least one entry. Each path must be readable. Each include and @<dict> must refer to a dictionary. For an unknown name, mt suggests the closest match. No dictionary may include itself, directly or through others.