Refactor command code to allow caching half-run command

Splits up prepare and run, so that there can be a separate preview step.
When a command is to be run, it's parsed and prepared; this is to allow
most of the work to be done on init, and a commit be done later, while
allowing a preview of the changes that will be made on commit.
Full implementation of command preview system

Does not include code necessary to display them interestingly or
generate interesting ones, just finishes the plumbing to get it from one
place to the other.