prodex 0.47.0

OpenAI profile pooling and safe auto-rotate for Codex CLI and Claude Code
Documentation
use super::*;

mod routed_command;

use routed_command::{CommandAction, RoutedCommand};

macro_rules! impl_command_action {
    ($($ty:ty),+ $(,)?) => {
        $(
            impl CommandAction for $ty {
                fn run(self: Box<Self>) -> Result<()> {
                    <$ty>::execute(*self)
                }
            }
        )+
    };
}

impl_command_action!(
    AddProfileArgs,
    AuditArgs,
    CavemanArgs,
    ClaudeArgs,
    CleanupCommand,
    CodexPassthroughArgs,
    CurrentCommand,
    DoctorArgs,
    ExportProfileArgs,
    ImportCurrentArgs,
    ImportProfileArgs,
    InfoArgs,
    ListProfilesCommand,
    LogoutArgs,
    ProfileSelector,
    QuotaArgs,
    RemoveProfileArgs,
    RunArgs,
    RuntimeBrokerArgs,
);

impl Commands {
    pub(super) fn execute(self) -> Result<()> {
        self.into_routed_command().execute()
    }

    pub(super) fn should_show_update_notice(&self) -> bool {
        !matches!(self, Commands::RuntimeBroker(_))
    }

    fn into_routed_command(self) -> RoutedCommand {
        match self {
            Commands::Profile(command) => command.into_routed_command(),
            Commands::UseProfile(command) => RoutedCommand::new(command),
            Commands::Current => RoutedCommand::new(CurrentCommand),
            Commands::Info(command) => RoutedCommand::new(command),
            Commands::Doctor(command) => RoutedCommand::new(command),
            Commands::Audit(command) => RoutedCommand::new(command),
            Commands::Cleanup => RoutedCommand::new(CleanupCommand),
            Commands::Login(command) => RoutedCommand::new(command),
            Commands::Logout(command) => RoutedCommand::new(command),
            Commands::Quota(command) => RoutedCommand::new(command),
            Commands::Run(command) => RoutedCommand::new(command),
            Commands::Caveman(command) => RoutedCommand::new(command),
            Commands::Claude(command) => RoutedCommand::new(command),
            Commands::RuntimeBroker(command) => RoutedCommand::new(command),
        }
    }
}

impl ProfileCommands {
    fn into_routed_command(self) -> RoutedCommand {
        match self {
            ProfileCommands::Add(command) => RoutedCommand::new(command),
            ProfileCommands::Export(command) => RoutedCommand::new(command),
            ProfileCommands::Import(command) => RoutedCommand::new(command),
            ProfileCommands::ImportCurrent(command) => RoutedCommand::new(command),
            ProfileCommands::List => RoutedCommand::new(ListProfilesCommand),
            ProfileCommands::Remove(command) => RoutedCommand::new(command),
            ProfileCommands::Use(command) => RoutedCommand::new(command),
        }
    }
}