The exit status of pbpaste is a proxy for whether the user has set up
reattach-to-user-namespace. It should be 0 if it is set up, 1 otherwise.
This is the same hack as Homebrew/homebrew-services#48.
This is the (partially) documented public API for Homebrew.
The main class you should look at is the {Formula} class (and classes linked from there). That's the class that's used to create Homebrew formulae (i.e. package descriptions). Assume anything else you stumble upon is private.