Task links
Typed links between tasks, the built-in and custom link kinds, and what mt check refuses.
Use links: to say how a task relates to others: it depends on one, it’s part of another, it replaces a third. Each edge has a kind and a target. The target is the path from this file to the other task’s file, as Concepts explains. mt check reports a target that doesn’t resolve to a task, a cycle, and an edge missing a note its kind requires.
Writing edges by hand
Each kind has a helper that takes one or more targets and an optional trailing note. A helper returns an array. You join two or more with +:
// tasks/wire-oauth.typ: three kinds joined with +, and the note related requires
links: depends-on("pick-a-provider.typ")
+ parent("auth-epic.typ")
+ related("write-docs.typ")[the docs ship in the same release],
// tasks/speed-up-search.typ: the duplicate targets the task it repeats
links: duplicates("search-too-slow.typ"),An array of helper calls means the same as +. For a kind with no helper, such as one you declare in config, use edge("<kind>", ...):
// tasks/drop-legacy-cli.typ: an array mixing a built-in kind with the project's discharged-by
links: (
supersedes("legacy-cli.typ"),
edge("discharged-by", "https://github.com/acme/api/pull/42"),
),The built-in kinds
| Kind | A kind("target.typ") edge means |
|---|---|
depends-on | This task can’t start until the target finishes. Until then, mt blocks the task. mt check refuses a cycle of these edges. |
parent | This task is part of the target. mt check refuses a cycle of these edges. A task has at most one. |
recurred-from | The target is the previous occurrence of this recurring task. mt recur writes it. See Recurring tasks. A task has at most one. |
supersedes | This task replaces the target. |
duplicates | This task is the same work as the target. |
related | The edge connects the two tasks. It needs a note that says how. |
Parents and progress
Each task gets two computed fields from the parent edges that target it. children counts those tasks. progress is the share of them in a terminal status. A cancelled child then counts as finished. In the table, the progress column shows the counts:
$ mt ls 'children > 0' --columns title,status,progress
TITLE STATUS PROGRESS
Ship end-to-end auth 🔨 wip 0/1
1 of 8 tasks · your filterA filter, --sort, --json and --format csv read progress as a fraction from 0 to 1, so mt ls 'progress == 1 && !terminal' lists the parents ready to close. A task without children has no progress. It prints as null in JSON and an empty cell in the table, and a comparison such as progress < 1 never matches it.
mt flip won’t move a parent with unfinished children into a status that’s both terminal and unblocked. See Statuses.
Writing edges with mt link
Working out a relative path by hand is fiddly. mt link <task> <kind> adds the edge and writes the path for you. You name a target the way you name any task, by its stem, the stem hash
<target>mt ls prints, or a path, and a path starts at the linking file. A stem or a hash finds the task in any folder, and mt link writes the path from the linking file to it. If the edge is already there, mt link leaves it alone:
$ mt link write-docs depends-on pick-a-provider
linked write-docs: +depends-on -> pick-a-provider.typ
$ mt link write-docs depends-on pick-a-provider.typ
unchanged write-docs: every edge was already thereThe --apply map
To add many edges at once, mt link --apply <file> merges a map of task to kind to targets, from YAML or JSON. Pass - to read it from stdin. A target is a stem string, or a target and note mapping when the edge needs a note. A kind with one target takes the bare string, and a kind with two or more targets takes a list. A map and its run:
$ cat links.yaml
write-docs:
depends-on: [wire-oauth, speed-up-search]
related:
- target: search-too-slow
note: same release
search-too-slow:
depends-on: auth-epic
$ mt link --apply links.yaml
linked write-docs: +depends-on -> wire-oauth.typ, +depends-on -> speed-up-search.typ, +related -> search-too-slow.typ
linked search-too-slow: +depends-on -> auth-epic.typThe mt link page lists its other flags, such as --replace and --dry-run.
Project-declared kinds
[[tasks.links.kinds]] adds your own kinds next to the six built-ins. A task writes one with edge("<kind>", ...), like the discharged-by edge above. examples/links/ declares these:
# examples/links/.mindtape/config.toml: three kinds whose targets are outside the backlog, and one that allows a task one edge
[[tasks.links.kinds]]
name = "discharged-by"
validate = "url"
note = "optional"
[[tasks.links.kinds]]
name = "landed-as"
validate = "git-sha"
[[tasks.links.kinds]]
name = "ticket"
validate = "regex"
regex = "^ACME-[0-9]+$"
[[tasks.links.kinds]]
name = "split-from"
max = 1
note = "forbidden"| Key | Default | Purpose |
|---|---|---|
acyclic | false | Whether edges of this kind must not form a cycle. Applies only when validate is local-task-path, because only edges between tasks can form one. |
blocking | false | Whether an unfinished target keeps the task from being ready. Applies only when validate is local-task-path, because only a task can stay unfinished. |
max | Most edges of this kind one task may carry. Absent means no limit. | |
name | "" | Kind name, matched against an edge’s kind. |
note | "optional" | Note requirement for edges of this kind. |
regex | Regex a target must match when validate = "regex". That validator requires it, and every other validator rejects it. A missing or invalid pattern is a config error. | |
validate | "local-task-path" | The kind of thing this kind’s targets are. The default, local-task-path, is a path from the linking task’s file to another task’s file. Any other value makes the targets something outside the backlog, such as a commit, a pull request or a build. |
validate takes one of these values:
| Value | Meaning |
|---|---|
local-task-path | A path from the linking task’s file to another task’s file (the default, and the only validator whose edges join the task graph). |
url | An RFC 3986 URI: a scheme, then only URI-legal characters. |
git-sha | A hexadecimal git object name of 7 to 64 characters, from an abbreviated SHA-1 up to a full SHA-256. |
uuid | A UUID, hyphenated, as 32 bare hex digits, in braces, or with a urn:uuid: prefix. |
regex | A project-supplied pattern, taken from the kind’s sibling regex key. |
any | Any non-empty text, with no shape check. |
A kind whose validate isn’t local-task-path accepts a target outside the backlog: a URL, a commit or a ticket. mt check reports a target that doesn’t fit the validator, and names the kind, the validator and the value. mt never resolves such a target to a task. It leaves it out of max, of cycle checks and of readiness, even when the kind sets blocking. mt graph draws each such target as a leaf node.
The graph
To see the edges, mt graph prints the tasks as a Graphviz DOT graph, or as a Mermaid flowchart with --format mermaid. Pass a filter to graph only the tasks that match, and --no-terminal to leave out the finished ones. Each node shows a task’s title and status. A ready task is green, a blocked one red and a finished one gray. The graph of examples/links/, the project this page quotes:
mt graph on examples/links/, drawn by Graphviz