Hammerspoon : the best Mac software you've never heard of
medium.com
medium.com
As for the authors original use case.. all the overhead could simply be avoided by correctly setting up their network preferences in the first place!
Step 1. Prioritize your preferred Wi-Fi networks, either by Network Preferences>Advanced... or using: networksetup -addpreferredwirelessnetworkatindex via the command line.
Step 2. Select SushiNet and uncheck "Automatically join this network" via Network Preferences.