Right now, when a plugin wants to add WP-CLI actions, they need to do something like the following:
if ( defined( 'WP_CLI' ) && WP_CLI ) {
add_action( 'plugins_loaded', 'my_plugin_cli_init' );
}
We should have WP-CLI add an action 'cli_init' that matches 'init' and 'admin_init' and allows for easier hooking of commands:
add_action( 'cli_init', 'my_plugin_cli_init' );
If WP-CLI is not loaded, the action will not be triggered. No other checks are needed.