Take a look at the CLI subproject of https://github.com/sibyllinesoft/arbiter. It does all this. I am in the process of making a version of the CLI that's standalone with a fully open license, I'm just swamped ATM getting a side hustle ready for No Kings.