Refactor repo spec to separate subcommands
[Repo remove] Improve test coverage
[Repo remove] Handle file permission errors

Fixes #1778