Change templates package to layouts

Change the templates package to layouts. Includes a new method for
acting on a layout given an action (a function returning a map of
arbitrary values or an error), an error handler to use in case of
any errors, and a set of template globs to add to the layout for
the given action.

This updates the main command to use the new layouts package in
order to simplify the creation of handlers.