Refactor subcommands

Instead of handling all subcommands in `makeService`, move each of them to their own function.

Also fix a bug in the `command` subcommand, that executes `startup` before checking the command name. For example, if there is a schema mismatch, the `command` subcommand would always throw the schema mismatch error, even in the case of nonexistent command name. In this PR, the `command` subcommand is rewritten to load the command first, then run `startup` and execute the command at the end.