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