1pub mod commands;
4pub mod display;
5pub mod mcp;
6mod pix_key;
7pub mod session;
8
9use std::path::PathBuf;
10
11use clap::{ArgGroup, Parser, Subcommand};
12
13pub use commands::{HistoryArgs, LoginArgs, PixSendArgs, SignupArgs, VerifyArgs};
14pub use display::{
15 CommandName, OutputFormat, StatusColor, cents_to_brl, current_agent_name, emit_data, emit_line,
16 emit_message, emit_status, set_agent_name,
17};
18
19#[derive(clap::ValueEnum, Clone, Debug, Default)]
20pub enum McpClient {
21 #[default]
22 Claude,
23}
24
25#[derive(clap::Args, Debug, Clone)]
26pub struct McpServeArgs {
27 #[arg(long)]
29 pub stdio: bool,
30
31 #[arg(long)]
33 pub http: bool,
34
35 #[arg(long, default_value = "0.0.0.0", env = "AGENTIS_PAY_HOST")]
37 pub host: String,
38
39 #[arg(long, default_value_t = 8080, env = "AGENTIS_PAY_PORT")]
41 pub port: u16,
42
43 #[arg(long)]
45 pub device_id: Option<String>,
46}
47
48#[derive(clap::Args, Debug, Clone)]
49#[command(group(ArgGroup::new("mcp-jwt-source").args(["jwt_file", "jwt_stdin"]).multiple(false)))]
50pub struct McpSetupArgs {
51 #[arg(long, value_enum, default_value_t = McpClient::Claude)]
53 pub client: McpClient,
54
55 #[arg(long, value_name = "PATH")]
58 pub jwt_file: Option<PathBuf>,
59
60 #[arg(long)]
62 pub jwt_stdin: bool,
63
64 #[arg(long)]
66 pub device_id: Option<String>,
67
68 #[arg(long)]
70 pub agent_name: Option<String>,
71
72 #[arg(long)]
74 pub print_only: bool,
75}
76
77#[derive(Subcommand, Debug)]
78pub enum McpCommand {
79 Serve(McpServeArgs),
81
82 #[command(alias = "setup")]
84 Install(McpSetupArgs),
85}
86
87#[derive(Parser, Debug)]
88#[command(name = "agentis-pay")]
89#[command(author, version, about = "CLI client for Bipa's agentis-pay service", long_about = Some("Interact with pix accounts via Bipa gRPC with MCP support for agent workflows."))]
90#[command(
91 subcommand_required = true,
92 infer_subcommands = true,
93 arg_required_else_help = true
94)]
95pub struct Cli {
96 #[arg(
98 short = 'f',
99 long,
100 global = true,
101 env = "AGENTIS_PAY_OUTPUT",
102 default_value_t = OutputFormat::Text,
103 value_enum
104 )]
105 pub output: OutputFormat,
106
107 #[arg(short, long, global = true)]
109 pub verbose: bool,
110
111 #[arg(short = 'q', long, global = true)]
113 pub quiet: bool,
114
115 #[command(subcommand)]
116 pub command: Command,
117}
118
119#[derive(Subcommand, Debug)]
120pub enum PixCommand {
121 #[command(alias = "pagar")]
123 Pay(commands::PixSendArgs),
124
125 #[command(alias = "chaves")]
127 Keys,
128
129 #[command(aliases = ["copia&cola", "copiacola"])]
131 Brcode(commands::BrcodeArgs),
132
133 #[command(alias = "extrato")]
135 History(commands::HistoryArgs),
136
137 Limits,
139
140 #[command(alias = "saldo")]
142 Balance,
143
144 #[command(alias = "depositar")]
146 Deposit,
147
148 #[command(alias = "conta")]
150 Account,
151}
152
153#[derive(Subcommand, Debug)]
154pub enum Command {
155 Signup(commands::SignupArgs),
157
158 Login(commands::LoginArgs),
160
161 Verify(commands::VerifyArgs),
163
164 Logout,
166
167 Whoami,
169
170 #[command(subcommand)]
172 Pix(PixCommand),
173
174 #[command(subcommand)]
176 Mcp(McpCommand),
177
178 #[command(name = "mcp-serve", hide = true)]
180 McpServeLegacy(McpServeArgs),
181
182 #[command(name = "setup-mcp", hide = true)]
184 SetupMcpLegacy(McpSetupArgs),
185}