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 device_id: Option<String>,
34}
35
36#[derive(clap::Args, Debug, Clone)]
37#[command(group(ArgGroup::new("mcp-jwt-source").args(["jwt_file", "jwt_stdin"]).multiple(false)))]
38pub struct McpSetupArgs {
39 #[arg(long, value_enum, default_value_t = McpClient::Claude)]
41 pub client: McpClient,
42
43 #[arg(long, value_name = "PATH")]
46 pub jwt_file: Option<PathBuf>,
47
48 #[arg(long)]
50 pub jwt_stdin: bool,
51
52 #[arg(long)]
54 pub device_id: Option<String>,
55
56 #[arg(long)]
58 pub agent_name: Option<String>,
59
60 #[arg(long)]
62 pub print_only: bool,
63}
64
65#[derive(Subcommand, Debug)]
66pub enum McpCommand {
67 Serve(McpServeArgs),
69
70 #[command(alias = "setup")]
72 Install(McpSetupArgs),
73}
74
75#[derive(Parser, Debug)]
76#[command(name = "agentis-pay")]
77#[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."))]
78#[command(
79 subcommand_required = true,
80 infer_subcommands = true,
81 arg_required_else_help = true
82)]
83pub struct Cli {
84 #[arg(
86 short = 'f',
87 long,
88 global = true,
89 env = "AGENTIS_PAY_OUTPUT",
90 default_value_t = OutputFormat::Text,
91 value_enum
92 )]
93 pub output: OutputFormat,
94
95 #[arg(short, long, global = true)]
97 pub verbose: bool,
98
99 #[arg(short = 'q', long, global = true)]
101 pub quiet: bool,
102
103 #[command(subcommand)]
104 pub command: Command,
105}
106
107#[derive(Subcommand, Debug)]
108pub enum PixCommand {
109 #[command(alias = "pagar")]
111 Pay(commands::PixSendArgs),
112
113 #[command(alias = "chaves")]
115 Keys,
116
117 #[command(aliases = ["copia&cola", "copiacola"])]
119 Brcode(commands::BrcodeArgs),
120
121 #[command(alias = "extrato")]
123 History(commands::HistoryArgs),
124
125 Limits,
127
128 #[command(alias = "saldo")]
130 Balance,
131
132 #[command(alias = "depositar")]
134 Deposit,
135
136 #[command(alias = "conta")]
138 Account,
139}
140
141#[derive(Subcommand, Debug)]
142pub enum Command {
143 Signup(commands::SignupArgs),
145
146 Login(commands::LoginArgs),
148
149 Verify(commands::VerifyArgs),
151
152 Logout,
154
155 Whoami,
157
158 #[command(subcommand)]
160 Pix(PixCommand),
161
162 #[command(subcommand)]
164 Mcp(McpCommand),
165
166 #[command(name = "mcp-serve", hide = true)]
168 McpServeLegacy(McpServeArgs),
169
170 #[command(name = "setup-mcp", hide = true)]
172 SetupMcpLegacy(McpSetupArgs),
173}