1pub mod commands;
4pub mod display;
5pub mod mcp;
6mod pix_key;
7pub mod session;
8pub mod updater;
9
10use std::path::PathBuf;
11
12use clap::{ArgGroup, Parser, Subcommand};
13
14pub use commands::{HistoryArgs, LoginArgs, PixSendArgs, SignupArgs, VerifyArgs};
15pub use display::{
16 CommandName, OutputFormat, StatusColor, cents_to_brl, current_agent_name, emit_data, emit_line,
17 emit_message, emit_status, set_agent_name,
18};
19
20#[derive(clap::ValueEnum, Clone, Debug, Default)]
21pub enum McpClient {
22 #[default]
23 Claude,
24}
25
26#[derive(clap::Args, Debug, Clone)]
27pub struct McpServeArgs {
28 #[arg(long)]
30 pub stdio: bool,
31
32 #[arg(long)]
34 pub http: bool,
35
36 #[arg(long, default_value = "0.0.0.0", env = "AGENTIS_PAY_HOST")]
38 pub host: String,
39
40 #[arg(long, default_value_t = 8080, env = "AGENTIS_PAY_PORT")]
42 pub port: u16,
43
44 #[arg(long)]
46 pub device_id: Option<String>,
47}
48
49#[derive(clap::Args, Debug, Clone)]
50#[command(group(ArgGroup::new("mcp-jwt-source").args(["jwt_file", "jwt_stdin"]).multiple(false)))]
51pub struct McpSetupArgs {
52 #[arg(long, value_enum, default_value_t = McpClient::Claude)]
54 pub client: McpClient,
55
56 #[arg(long, value_name = "PATH")]
59 pub jwt_file: Option<PathBuf>,
60
61 #[arg(long)]
63 pub jwt_stdin: bool,
64
65 #[arg(long)]
67 pub device_id: Option<String>,
68
69 #[arg(long)]
71 pub agent_name: Option<String>,
72
73 #[arg(long)]
75 pub print_only: bool,
76}
77
78#[derive(Subcommand, Debug)]
79pub enum McpCommand {
80 Serve(McpServeArgs),
82
83 #[command(alias = "setup")]
85 Install(McpSetupArgs),
86}
87
88#[derive(Parser, Debug)]
89#[command(name = "agentis-pay")]
90#[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."))]
91#[command(
92 subcommand_required = true,
93 infer_subcommands = true,
94 arg_required_else_help = true
95)]
96pub struct Cli {
97 #[arg(
99 short = 'f',
100 long,
101 global = true,
102 env = "AGENTIS_PAY_OUTPUT",
103 default_value_t = OutputFormat::Text,
104 value_enum
105 )]
106 pub output: OutputFormat,
107
108 #[arg(short, long, global = true)]
110 pub verbose: bool,
111
112 #[arg(short = 'q', long, global = true)]
114 pub quiet: bool,
115
116 #[command(subcommand)]
117 pub command: Command,
118}
119
120#[derive(Subcommand, Debug)]
121pub enum PixCommand {
122 #[command(alias = "pagar")]
124 Pay(commands::PixSendArgs),
125
126 #[command(alias = "chaves")]
128 Keys,
129
130 #[command(aliases = ["copia&cola", "copiacola"])]
132 Brcode(commands::BrcodeArgs),
133
134 #[command(alias = "extrato")]
136 History(commands::HistoryArgs),
137
138 Limits,
140
141 #[command(alias = "saldo")]
143 Balance,
144
145 #[command(alias = "depositar")]
147 Deposit,
148
149 #[command(alias = "conta")]
151 Account,
152}
153
154#[derive(Subcommand, Debug)]
155pub enum Command {
156 Signup(commands::SignupArgs),
158
159 Login(commands::LoginArgs),
161
162 Verify(commands::VerifyArgs),
164
165 Logout,
167
168 Whoami,
170
171 Skill,
173
174 #[command(subcommand)]
176 Pix(PixCommand),
177
178 Update,
180
181 #[command(subcommand)]
183 Mcp(McpCommand),
184
185 #[command(name = "mcp-serve", hide = true)]
187 McpServeLegacy(McpServeArgs),
188
189 #[command(name = "setup-mcp", hide = true)]
191 SetupMcpLegacy(McpSetupArgs),
192}