aimo-cli 0.1.7

AiMo Network client CLI
use std::path::PathBuf;

use clap::{Parser, Subcommand};

use aimo_core::keys::Scope;

#[derive(Debug, Parser)]
#[command(version, about, long_about = None)]
pub struct CliArgs {
    #[command(subcommand)]
    pub command: CommandArgs,
}

#[derive(Debug, Subcommand)]
pub enum CommandArgs {
    /// Generate a secret key for your wallet
    Keygen {
        /// The scope tag of the secret key, e.g. dev
        #[arg(
            long,
            short,
            default_value = "dev",
            long_help = "Scope tag is set to `dev` by default. By specifying this, you get a secret key like: `aimo-sk-<tag>-xxxxxxx`"
        )]
        tag: String,

        /// How many days should the secret key valid for
        #[arg(long, short, default_value_t = 90)]
        valid_for: u32,

        /// Scopes to enable for this secret key
        #[arg(
            long,
            short,
            value_delimiter = ',',
            long_help = "Specify which scopes to enable with comma-seperated values. Current supported values are: \"completion_model\"",
            default_value = "completion_model"
        )]
        scopes: Vec<Scope>,

        /// Usage limit of the secret key
        #[arg(long, short, default_value_t = 0)]
        usage_limit: u64,

        /// Path to secret key signer's Solana wallet id file
        #[arg(
            long,
            value_name = "FILE",
            long_help = "Specify a Solana wallet id file (id.json, generated with `solana-keygen new`) to sign the secret key. Defaults to `~/.config/solana/id.json`."
        )]
        id: Option<PathBuf>,
    },

    /// Run a proxy to connect your endpoint to AiMo Network directly
    Proxy {
        /// Path to proxy configuration file (TOML)
        #[arg(short, long)]
        config: std::path::PathBuf,

        /// Path to the provider's Solana wallet id file
        #[arg(long, value_name = "FILE")]
        id: Option<PathBuf>,
    },

    /// Top up your escrow account with tokens (includes 3% fee)
    Topup {
        /// Amount of tokens to top up (e.g., 0.5)
        amount: f64,

        /// Name or mint address for the token to top-up.
        ///
        /// `USDC` by default.
        token: Option<String>,

        /// Use devnet token mints
        #[arg(short, long, action)]
        devnet_tokens: bool,

        /// Solana RPC cluster URL
        #[arg(long, default_value = "https://api.devnet.solana.com")]
        rpc_url: String,

        /// AiMo Node base URL
        #[arg(long, default_value = "https://devnet.aimo.network")]
        router_url: String,

        /// Path to the keypair file to use for signing
        #[arg(
            long,
            value_name = "FILE",
            long_help = "Specify a Solana wallet id file (id.json, generated with `solana-keygen new`) to use for the topup. Defaults to `~/.config/solana/id.json`."
        )]
        id: Option<PathBuf>,
    },
}