systemprompt_cli/commands/infrastructure/
mod.rs1pub mod db;
8pub mod jobs;
9pub mod logs;
10pub mod services;
11
12use anyhow::Result;
13use clap::Subcommand;
14
15use crate::context::CommandContext;
16
17#[derive(Debug, Subcommand)]
18pub enum InfraCommands {
19 #[command(
20 subcommand,
21 about = "Service lifecycle management (start, stop, status)"
22 )]
23 Services(services::ServicesCommands),
24
25 #[command(subcommand, about = "Database operations and administration")]
26 Db(db::DbCommands),
27
28 #[command(subcommand, about = "Background jobs and scheduling")]
29 Jobs(jobs::JobsCommands),
30
31 #[command(subcommand, about = "Log streaming and tracing")]
32 Logs(logs::LogsCommands),
33}
34
35pub async fn execute(cmd: InfraCommands, ctx: &CommandContext) -> Result<()> {
36 if ctx.is_database_scoped() && !matches!(cmd, InfraCommands::Db(_) | InfraCommands::Logs(_)) {
37 return Err(crate::shared::database_scoped_command_error());
38 }
39
40 match cmd {
41 InfraCommands::Services(cmd) => services::execute(cmd, ctx).await,
42 InfraCommands::Db(cmd) => db::execute(cmd, ctx).await,
43 InfraCommands::Jobs(cmd) => jobs::execute(cmd, ctx).await,
44 InfraCommands::Logs(cmd) => logs::execute(cmd, ctx).await,
45 }
46}