Adding macros to Touch Bar in Terminal.app
BetterTouchTool has the ability to create widgets on the Touch Bar. BTT cannot add widgets to the existing app controls, but can provide a secondary Touch Bar layout which can be switched to using your own defined shortcut or other trigger.

BTT provides normal buttons which can perform any action when tapped (whether standard actions provided by BTT or custom shell or AppleScript). BTT provides widgets which can run AppleScript or shell scripts, displaying the result on the bar in the button and colouring the button appropriately, or taking other action.