systemprompt_cli/commands/core/
mod.rs1pub mod artifacts;
2pub mod content;
3pub mod contexts;
4pub mod files;
5pub mod playbooks;
6pub mod skills;
7
8use anyhow::Result;
9use clap::Subcommand;
10use systemprompt_runtime::DatabaseContext;
11
12use crate::CliConfig;
13
14#[derive(Debug, Subcommand)]
15pub enum CoreCommands {
16 #[command(subcommand, about = "Artifact inspection and debugging")]
17 Artifacts(artifacts::ArtifactsCommands),
18
19 #[command(subcommand, about = "Content management and analytics")]
20 Content(content::ContentCommands),
21
22 #[command(subcommand, about = "File management and uploads")]
23 Files(files::FilesCommands),
24
25 #[command(subcommand, about = "Context management")]
26 Contexts(contexts::ContextsCommands),
27
28 #[command(
29 subcommand,
30 about = "Workflow playbooks - step-by-step operational guides"
31 )]
32 Playbooks(playbooks::PlaybooksCommands),
33
34 #[command(subcommand, about = "Skill management and database sync")]
35 Skills(skills::SkillsCommands),
36}
37
38pub async fn execute(cmd: CoreCommands, config: &CliConfig) -> Result<()> {
39 match cmd {
40 CoreCommands::Artifacts(cmd) => artifacts::execute(cmd, config).await,
41 CoreCommands::Content(cmd) => content::execute(cmd).await,
42 CoreCommands::Files(cmd) => files::execute(cmd, config).await,
43 CoreCommands::Contexts(cmd) => contexts::execute(cmd, config).await,
44 CoreCommands::Playbooks(cmd) => playbooks::execute(cmd, config).await,
45 CoreCommands::Skills(cmd) => skills::execute(cmd).await,
46 }
47}
48
49pub async fn execute_with_db(
50 cmd: CoreCommands,
51 db_ctx: &DatabaseContext,
52 config: &CliConfig,
53) -> Result<()> {
54 match cmd {
55 CoreCommands::Content(cmd) => content::execute_with_db(cmd, db_ctx, config).await,
56 CoreCommands::Files(cmd) => files::execute_with_db(cmd, db_ctx, config).await,
57 CoreCommands::Artifacts(_)
58 | CoreCommands::Contexts(_)
59 | CoreCommands::Playbooks(_)
60 | CoreCommands::Skills(_) => {
61 anyhow::bail!("This command requires full profile context")
62 },
63 }
64}