Communication Mod starts a process you configure, writes the current game state to its standard input as JSON whenever the game is ready for a decision, and reads commands such as play, end, choose, potion and proceed back from its standard output.
It is also published on the Steam Workshop, and it depends on ModTheSpire and BaseMod.