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