Refactor alias machinery

This refactors the alias machinery to use magic commands instead of a separate namespace, as per the roadmap. So long as the user has automagics enabled (which is the default), they won't see much difference: aliases will continue to work much as they did before.

One minor difference is that the old implementation supported nested aliases (i.e. one alias could point to another, which described an actual system command). I don't know if that was ever used much - none of the default aliases appear to rely on it. If we decide it's important, we could probably add it back in, but it would be a bit of extra complexity.