refactor(cli): better CLI support and test coverage