I built herdr-triggers, a herdr plugin for Linux and macOS (it also runs with the Herdr desktop app). It watches your panes for any regex you write, and the moment it appears a rule acts: it types the answer, posts a notification, runs a script, or marks the tab. One triggers.toml serves the herdr TUI and the desktop app.
Any regex, any pane: aim a rule by pane, tab or workspace name (scope = { pane_title = "^console$" }), or let it watch everything.
Five actions: send_text, notify, run, coprocess (types back a script's answer) and tab_mark.
Secrets stay secret: ${secret:NAME} comes from a mode-0600 secrets.toml, is read at fire time and never written to the log.
Safe by default: tail_within answers only the prompt actually waiting at the bottom of the screen; text already on screen when a rule arms does not fire it; once fires once per terminal, and write bursts are capped.
Light: it checks the screen every 200 ms by default and stayed around 3 to 7 MiB of memory in the README's benchmarks.
An automated console login (anchor the scope at both ends on any rule that types a secret: pane_title matches any name the pane, its tab or its workspace carries):
[[rules]]
regex = "Password:"
once = true
scope = { pane_title = "^console$" }
tail_within = 2
action = { type = "send_text", text = "${secret:DEVICE_PASS}\n" }
Install in the herdr TUI (0.8.2 or later; it builds from source with your Rust):
herdr plugin install cantona/herdr-triggers --ref v0.2.2
herdr plugin action invoke triggers-start --plugin cantona.herdr-triggers
$EDITOR "$(herdr plugin config-dir cantona.herdr-triggers)/triggers.toml"
herdr plugin action invoke triggers-reload --plugin cantona.herdr-triggers
Put the rule in that triggers.toml, with DEVICE_PASS = "..." in a secrets.toml beside it (mode 0600, or the daemon refuses it).
In the Herdr desktop app (open it once first so it writes its keys.json):
cargo install --locked --git https://github.com/cantona/herdr-triggers
herdr-triggersd install # shows what it will change, asks y/N
mkdir -p ~/.config/herdr-triggers
$EDITOR ~/.config/herdr-triggers/triggers.toml
herdr-triggersd --host core reload
The app reads ~/.config/herdr-triggers/. Install the TUI plugin first and the app's install links that folder to the plugin's, so both hosts share one triggers.toml and secrets.toml.
Feedback and rule ideas welcome. GitHub: https://github.com/cantona/herdr-triggers