# Start titles with a verb

Refuse a task whose title doesn’t start with a verb, so each line of a list says what the task does.

A backlog reads “Login redirect broken”, “Redis” and “Audit log pagination”. Each line points at a thing, so you open the task to learn whether it’s a bug, a feature or a question. Start each title with a verb, like “Fix the login redirect”, “Add a Redis client” and “Paginate the audit log”, and the list tells you what to do before you open anything.

## Config

[`examples/api-service/.mindtape/config.toml`](https://github.com/mlavrinenko/mindtape/blob/main/examples/api-service/.mindtape/config.toml)

```toml
# The mindtape:tasks pack ships this rule. Without the pack, add it yourself.
[[tasks.rules]]
name = "start-title-with-verb"
assert = 'in_dict("verbs", word(title, 1))'
when = "!terminal"
message = "start the title with an imperative verb"
severity = "error"

[dicts.verbs]
include = ["mindtape-verbs", "mindtape-dev-verbs"]
values = ["backport", "dockerize"]
```

## Behavior

`sections.yaml` contains the `AS-IS` and the other sections the template needs. Only the title then changes. `mt add` refuses a title that doesn’t start with a verb, states the nearest verbs, and doesn’t write a file. It files the ones that start with a verb:

```
$ mt add Login redirect broken -f sections.yaml
error: <new task from template 'task'>:2: rules.start-title-with-verb: start the title with an imperative verb
hint: 'Login' is not in dict verbs; did you mean begin, join or log?
hint: run mt dicts verbs to see its entries
$ mt add Fix the login redirect -f sections.yaml
wrote tasks/fix-the-login-redirect.typ (wcw)
next: mt eval wcw
$ mt add Backport the login redirect fix to v1 -f sections.yaml
wrote tasks/backport-the-login-redirect-fix-to-v1.typ (a67)
next: mt eval a67
```

“Backport” is in neither built-in list. The `values` line adds it.

## Rule details

`word(title, 1)` is the title’s first word, and `in_dict()` looks it up in the `verbs` dictionary, ignoring case. A hyphenated word stays whole, so `rate-limit` is one word. `!terminal` runs the rule on open tasks only, so an old done task with a noun for a title doesn’t fail `mt check`. [Filter language](https://mlavrinenko.github.io/mindtape/filters/index.md) covers both functions.

`include` pulls in the two word lists `mt` provides. `mindtape-verbs` contains the 500 most frequent English verbs, and `mindtape-dev-verbs` adds the ones software work uses, like `refactor`, `deprecate` and `rate-limit`. Run `mt dicts verbs` to see every word the rule accepts, yours included.

To accept a word such as “dockerize” or “backport”, put it in `values`. A longer list fits better in a file with one word per line, named by `path`. [Views & dictionaries](https://mlavrinenko.github.io/mindtape/named-sets/index.md) covers every dictionary key.

The example project extends the `mindtape:tasks` [rule pack](https://mlavrinenko.github.io/mindtape/packs/index.md), which provides the rule and a `verbs` dictionary, so it only declares `[dicts.verbs]`. That replaces the pack’s dictionary by name, so keep the `include` line when you add words.

This repo gets the rule from the pack in [`.mindtape/config.toml`](https://github.com/mlavrinenko/mindtape/blob/main/.mindtape/config.toml).
