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