1pub mod commands;
4pub mod display;
5pub mod mcp;
6pub mod session;
7
8use clap::{Parser, Subcommand};
9
10pub use commands::{HistoryArgs, LoginArgs, PixSendArgs, SignupArgs, VerifyArgs};
11pub use display::{
12 CommandName, OutputFormat, StatusColor, cents_to_brl, current_agent_name, emit_data, emit_line,
13 emit_message, emit_status, set_agent_name,
14};
15
16#[derive(clap::ValueEnum, Clone, Debug, Default)]
17pub enum McpClient {
18 #[default]
19 Claude,
20}
21
22#[derive(clap::Args, Debug, Clone)]
23pub struct McpServeArgs {
24 #[arg(long, conflicts_with = "http")]
26 pub stdio: bool,
27
28 #[arg(long, conflicts_with = "stdio")]
30 pub http: bool,
31
32 #[arg(long, default_value = "127.0.0.1", requires = "http")]
34 pub host: String,
35
36 #[arg(long, default_value_t = 8080, requires = "http")]
38 pub port: u16,
39
40 #[arg(long)]
42 pub device_id: Option<String>,
43}
44
45#[derive(clap::Args, Debug, Clone)]
46pub struct McpSetupArgs {
47 #[arg(long, value_enum, default_value_t = McpClient::Claude)]
49 pub client: McpClient,
50
51 #[arg(long)]
54 pub jwt: Option<String>,
55
56 #[arg(long)]
58 pub device_id: Option<String>,
59
60 #[arg(long)]
62 pub agent_name: Option<String>,
63
64 #[arg(long)]
66 pub print_only: bool,
67}
68
69#[derive(Subcommand, Debug)]
70pub enum McpCommand {
71 Serve(McpServeArgs),
73
74 #[command(alias = "setup")]
76 Install(McpSetupArgs),
77}
78
79#[derive(Parser, Debug)]
80#[command(name = "agentis-pay")]
81#[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."))]
82#[command(
83 subcommand_required = true,
84 infer_subcommands = true,
85 arg_required_else_help = true
86)]
87pub struct Cli {
88 #[arg(
90 short = 'f',
91 long,
92 global = true,
93 env = "AGENTIS_PAY_OUTPUT",
94 default_value_t = OutputFormat::Text,
95 value_enum
96 )]
97 pub output: OutputFormat,
98
99 #[arg(short, long, global = true)]
101 pub verbose: bool,
102
103 #[arg(short = 'q', long, global = true)]
105 pub quiet: bool,
106
107 #[command(subcommand)]
108 pub command: Command,
109}
110
111#[derive(Subcommand, Debug)]
112pub enum PixCommand {
113 #[command(alias = "pagar")]
115 Pay(commands::PixSendArgs),
116
117 #[command(alias = "chaves")]
119 Keys,
120
121 #[command(aliases = ["copia&cola", "copiacola"])]
123 Brcode(commands::BrcodeArgs),
124
125 #[command(alias = "extrato")]
127 History(commands::HistoryArgs),
128
129 Limits,
131
132 #[command(alias = "saldo")]
134 Balance,
135
136 #[command(alias = "depositar")]
138 Deposit,
139
140 #[command(alias = "conta")]
142 Account,
143}
144
145#[derive(Subcommand, Debug)]
146pub enum Command {
147 Signup(commands::SignupArgs),
149
150 Login(commands::LoginArgs),
152
153 Verify(commands::VerifyArgs),
155
156 Logout,
158
159 Whoami,
161
162 #[command(subcommand)]
164 Pix(PixCommand),
165
166 #[command(subcommand)]
168 Mcp(McpCommand),
169
170 #[command(name = "mcp-serve", hide = true)]
172 McpServeLegacy(McpServeArgs),
173
174 #[command(name = "setup-mcp", hide = true)]
176 SetupMcpLegacy(McpSetupArgs),
177}