Adding macros to Touch Bar in Terminal.app Whenever you type in a command, there is a macro on the touch bar that displays the manpage for whatever command you are currently typing. 

Is it possible to add (e.g.) a macro to compile a project or refresh a python webserver?
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.