systemprompt_cli/commands/admin/config/
mod.rs1pub mod catalog;
9pub mod config_section;
10pub mod gateway;
11pub mod governance;
12pub mod list;
13pub mod paths;
14pub mod profile_io;
15pub mod provider;
16pub mod rate_limit_types;
17pub mod rate_limits;
18pub mod reconcile;
19pub mod runtime;
20pub mod secret;
21pub mod security;
22pub mod server;
23pub mod show;
24pub mod types;
25pub mod validate;
26
27use anyhow::Result;
28use clap::Subcommand;
29
30use crate::CliConfig;
31use crate::cli_settings::get_global_config;
32use crate::shared::render_result;
33
34#[derive(Debug, Subcommand)]
35pub enum ConfigCommands {
36 #[command(about = "Show configuration overview")]
37 Show,
38
39 #[command(about = "List all configuration files")]
40 List(list::ListArgs),
41
42 #[command(about = "Validate configuration files")]
43 Validate(validate::ValidateArgs),
44
45 #[command(subcommand, about = "Rate limit configuration")]
46 RateLimits(rate_limits::RateLimitsCommands),
47
48 #[command(subcommand, about = "Server configuration")]
49 Server(server::ServerCommands),
50
51 #[command(subcommand, about = "Runtime configuration")]
52 Runtime(runtime::RuntimeCommands),
53
54 #[command(subcommand, about = "Security configuration")]
55 Security(security::SecurityCommands),
56
57 #[command(subcommand, about = "Paths configuration")]
58 Paths(paths::PathsCommands),
59
60 #[command(subcommand, about = "AI provider configuration")]
61 Provider(provider::ProviderCommands),
62
63 #[command(subcommand, about = "Gateway configuration (routes, default provider)")]
64 Gateway(gateway::GatewayCommands),
65
66 #[command(subcommand, about = "Governance authorization hook configuration")]
67 Governance(governance::GovernanceCommands),
68
69 #[command(
70 subcommand,
71 about = "Provider registry (profile.providers: providers, models)"
72 )]
73 Catalog(catalog::CatalogCommands),
74
75 #[command(subcommand, about = "Profile secrets")]
76 Secret(secret::SecretCommands),
77}
78
79pub async fn execute(command: ConfigCommands, config: &CliConfig) -> Result<()> {
80 match command {
81 ConfigCommands::Show => {
82 let result = show::execute(config)?;
83 render_result(&result);
84 Ok(())
85 },
86 ConfigCommands::List(args) => {
87 let result = list::execute(args, config);
88 render_result(&result);
89 Ok(())
90 },
91 ConfigCommands::Validate(args) => {
92 let result = validate::execute(&args, config)?;
93 render_result(&result);
94 Ok(())
95 },
96 ConfigCommands::RateLimits(cmd) => rate_limits::execute(cmd, config),
97 ConfigCommands::Server(ref cmd) => server::execute(cmd, config),
98 ConfigCommands::Runtime(cmd) => runtime::execute(cmd, config),
99 ConfigCommands::Security(ref cmd) => security::execute(cmd, config),
100 ConfigCommands::Paths(cmd) => paths::execute(cmd, config),
101 ConfigCommands::Provider(cmd) => provider::execute(cmd, config),
102 ConfigCommands::Gateway(ref cmd) => gateway::execute(cmd, config).await,
103 ConfigCommands::Governance(ref cmd) => governance::execute(cmd, config),
104 ConfigCommands::Catalog(ref cmd) => catalog::execute(cmd, config).await,
105 ConfigCommands::Secret(ref cmd) => secret::execute(cmd, config),
106 }
107}
108
109pub fn execute_default() -> Result<()> {
110 let config = get_global_config();
111 let result = show::execute(&config)?;
112 render_result(&result);
113 Ok(())
114}