Event data in shell scripts
Shell scripts run in zsh and receive event details as environment variables.
CRANK_EVENT_SOURCE, CRANK_EVENT_KIND, and CRANK_EVENT_TIMESTAMP are always set.
Each trigger adds its own: a USB event sets deviceName, Wi-Fi sets networkName, Calendar sets eventTitle and minutesUntil.
Rate limiting
Set a cooldown period on a rule to avoid triggering it multiple times in a short window.
File system events and battery percentage changes can come in bursts. Without a limit, one blip could run your action ten times before it finishes.