Auto start, pause, resume, and stop Tempomat
time trackers from the pane you focus in Herdr. No manual tempo start /
tempo stop needed for work that matches your rules.
Requirements
tempo setupalready run (Atlassian + Tempo API tokens configured).- Bun 1.3 or newer. Built on the Crust
CLI framework (
@crustjs/core,@crustjs/plugins).
How it works
On every pane.focused event, the plugin reads the focused pane's title,
its tab label, its cwd, and its foreground cwd, and checks them against your
rules (first match wins):
ticket_pattern: a regex searched across those four sources. The match (or its named groupissue) becomes the Tempo issue key.path_glob: a glob matched against cwd/foreground_cwd. Requires an explicitissue, since a path carries no ticket key.
State transitions:
| Focused pane... | Action |
|---|---|
| Matches issue X, nothing tracked yet | tempo tracker:start X |
| Matches the issue already tracked | no-op (or tracker:resume if paused) |
| Matches a different issue Y | tracker:stop the old one, tracker:start Y |
| Matches nothing | tracker:pause the current tracker |
Stays unmatched past grace_period_seconds |
tracker:stop (worklog written) |
Pane close, tab close, and workspace close are treated the same as an unmatched focus, so a tracker left running in a closed pane still gets its grace period and eventually gets flushed — including on Herdr restart, via the plugin's startup hook.
Setup
- Link the plugin from this repo:
The plugin'sherdr plugin link /home/zenobius/Projects/dotfiles/.mise/conf.d/shells-herdr/plugins/local/tempomat[[build]]step runsbun installto fetch@crustjs/coreand@crustjs/pluginsinto the plugin directory. - Find your config directory:
herdr plugin config-dir tempomat - Copy
rules.example.tomltorules.tomlin that directory and edit your rules. - Leave
live = falseat first. Work for a while, then inspectdry-run.login the plugin's state directory (printed byherdr plugin log list --plugin tempomat --limit 20on error, or found next tostate.jsonunder Herdr's plugin state root) to confirm the matched issues and transitions look right. - Set
live = trueinrules.tomlonce you trust it.
Actions
herdr plugin action invoke tempomat.status # show current issue/state/live flag
herdr plugin action invoke tempomat.stop # force-finalize now, skip the grace period
Troubleshooting
herdr plugin list --plugin tempomat --json
herdr plugin log list --plugin tempomat --limit 20
A rule pattern that never matches produces no trackers at all — check
tempomat.status first, then confirm your regex/glob against the pane's
actual title/cwd with herdr pane get <pane_id>.
Task guide
Use the focus-tracking task guide for a cautious dry-run setup.