Add the necessary boilerplate for cli.ts to provide more than one
command, with the resource gathering step split out from the build
step in order for it to be re-usable.
Provide a transformation function that maps absolute references to
resources into relative references based on the location of a page.
This makes it possible to use the same links across multiple pages
in the hierarchy that works when loaded as files from the filesystem.