Move CliApp and related classes to lib/