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