Reorganize the repl task

The reorg-repl branch has existed for quite a while now and, as it stands now, has many improvements to offer. The new code is reasonably well-coverd with tests and works for me from the command line in a variety of contexts.

Some deficiencies in the behavior of the repl task stem from bugs in `main.clj` so it has become difficult to make the repl task work flawlessy without cherry-picking from master. In order not to let these interdependencies spin out of hand, I propose to merge now. There are some conflicts at surprising places; I would like @technomancy to review those.