systemprompt_cli/commands/cloud/profile/
args.rs1use clap::{Args, Subcommand, ValueEnum};
7use systemprompt_identifiers::{ProfileName, TenantId};
8use systemprompt_manifest::none_if_blank;
9
10use crate::shared::{parse_profile_name, parse_tenant_id};
11
12#[derive(Debug, Subcommand)]
13pub enum ProfileCommands {
14 #[command(about = "Create a new profile", hide = true)]
15 Create(CreateArgs),
16
17 #[command(about = "List all profiles")]
18 List,
19
20 #[command(
21 about = "Show profile configuration",
22 after_help = "EXAMPLES:\n systemprompt cloud profile show\n systemprompt cloud profile \
23 show --filter agents\n systemprompt cloud profile show --json"
24 )]
25 Show {
26 name: Option<String>,
27
28 #[arg(short, long, value_enum, default_value = "all")]
29 filter: ShowFilter,
30
31 #[arg(long, help = "Output as JSON")]
32 json: bool,
33
34 #[arg(long, help = "Output as YAML")]
35 yaml: bool,
36 },
37
38 #[command(about = "Delete a profile")]
39 Delete(DeleteArgs),
40
41 #[command(about = "Edit profile configuration")]
42 Edit(EditArgs),
43}
44
45#[derive(Debug, Args)]
46pub struct DeleteArgs {
47 pub name: String,
48
49 #[arg(short = 'y', long, help = "Skip confirmation prompts")]
50 pub yes: bool,
51}
52
53#[derive(Debug, Args)]
54pub struct CreateArgs {
55 #[arg(value_parser = parse_profile_name)]
56 pub name: ProfileName,
57
58 #[arg(
59 long = "tenant-id",
60 value_parser = parse_tenant_id,
61 help = "Tenant ID (required in non-interactive mode)"
62 )]
63 pub tenant: Option<TenantId>,
64
65 #[arg(long, value_enum, default_value = "local", help = "Tenant type")]
66 pub tenant_type: TenantTypeArg,
67
68 #[arg(
69 long,
70 env = "ANTHROPIC_API_KEY",
71 hide_env_values = true,
72 help = "Anthropic (Claude) API key"
73 )]
74 pub anthropic_key: Option<String>,
75
76 #[arg(
77 long,
78 env = "OPENAI_API_KEY",
79 hide_env_values = true,
80 help = "OpenAI (GPT) API key"
81 )]
82 pub openai_key: Option<String>,
83
84 #[arg(
85 long,
86 env = "GEMINI_API_KEY",
87 hide_env_values = true,
88 help = "Google AI (Gemini) API key"
89 )]
90 pub gemini_key: Option<String>,
91
92 #[arg(
93 long,
94 env = "GITHUB_TOKEN",
95 hide_env_values = true,
96 help = "GitHub token (optional)"
97 )]
98 pub github_token: Option<String>,
99}
100
101impl CreateArgs {
102 pub const fn has_api_key(&self) -> bool {
103 self.anthropic_key.is_some() || self.openai_key.is_some() || self.gemini_key.is_some()
104 }
105
106 #[must_use]
107 pub fn normalized(mut self) -> Self {
108 self.anthropic_key = none_if_blank(self.anthropic_key);
109 self.openai_key = none_if_blank(self.openai_key);
110 self.gemini_key = none_if_blank(self.gemini_key);
111 self.github_token = none_if_blank(self.github_token);
112 self
113 }
114}
115
116#[derive(Clone, Copy, Debug, ValueEnum)]
117pub enum TenantTypeArg {
118 Local,
119 Cloud,
120}
121
122#[derive(Debug, Args)]
123pub struct EditArgs {
124 pub name: Option<String>,
125
126 #[arg(long, help = "Set Anthropic API key")]
127 pub set_anthropic_key: Option<String>,
128
129 #[arg(long, help = "Set OpenAI API key")]
130 pub set_openai_key: Option<String>,
131
132 #[arg(long, help = "Set Gemini API key")]
133 pub set_gemini_key: Option<String>,
134
135 #[arg(long, help = "Set GitHub token")]
136 pub set_github_token: Option<String>,
137
138 #[arg(long, help = "Set database URL")]
139 pub set_database_url: Option<String>,
140
141 #[arg(long, help = "Set external URL (cloud profiles)")]
142 pub set_external_url: Option<String>,
143
144 #[arg(long, help = "Set server host")]
145 pub set_host: Option<String>,
146
147 #[arg(long, help = "Set server port")]
148 pub set_port: Option<u16>,
149}
150
151impl EditArgs {
152 pub const fn has_updates(&self) -> bool {
153 self.set_anthropic_key.is_some()
154 || self.set_openai_key.is_some()
155 || self.set_gemini_key.is_some()
156 || self.set_github_token.is_some()
157 || self.set_database_url.is_some()
158 || self.set_external_url.is_some()
159 || self.set_host.is_some()
160 || self.set_port.is_some()
161 }
162}
163
164#[derive(Clone, Copy, Debug, ValueEnum)]
165pub enum ShowFilter {
166 All,
167 Agents,
168 Mcp,
169 Skills,
170 Ai,
171 Web,
172 Content,
173 Env,
174 Settings,
175}