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::context::CommandContext;
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 async fn execute(command: ConfigCommands, ctx: &CommandContext) -> Result<()> {
79 match command {
80 ConfigCommands::Show => {
81 let result = show::execute(&ctx.cli)?;
82 render_result(&result, &ctx.cli);
83 Ok(())
84 },
85 ConfigCommands::List(args) => {
86 let result = list::execute(args, &ctx.cli);
87 render_result(&result, &ctx.cli);
88 Ok(())
89 },
90 ConfigCommands::Validate(args) => {
91 let result = validate::execute(&args, &ctx.cli)?;
92 render_result(&result, &ctx.cli);
93 Ok(())
94 },
95 ConfigCommands::RateLimits(cmd) => rate_limits::execute(cmd, &ctx.cli),
96 ConfigCommands::Server(ref cmd) => server::execute(cmd, &ctx.cli),
97 ConfigCommands::Runtime(cmd) => runtime::execute(cmd, &ctx.cli),
98 ConfigCommands::Security(ref cmd) => security::execute(cmd, &ctx.cli),
99 ConfigCommands::Paths(cmd) => paths::execute(cmd, &ctx.cli),
100 ConfigCommands::Provider(cmd) => provider::execute(cmd, &ctx.cli),
101 ConfigCommands::Gateway(ref cmd) => gateway::execute(cmd, &ctx.cli).await,
102 ConfigCommands::Governance(ref cmd) => governance::execute(cmd, &ctx.cli),
103 ConfigCommands::Catalog(ref cmd) => catalog::execute(cmd, &ctx.cli).await,
104 ConfigCommands::Secret(ref cmd) => secret::execute(cmd, &ctx.cli),
105 }
106}