separating output/exit codes/json/cli and the app management library, adding cli test