systemprompt_cli/commands/core/
mod.rs1pub mod artifacts;
9pub mod content;
10pub mod contexts;
11pub mod files;
12pub mod hooks;
13pub mod plugins;
14pub mod skills;
15
16use anyhow::Result;
17use clap::Subcommand;
18use systemprompt_runtime::DatabaseContext;
19
20use crate::CliConfig;
21
22#[derive(Debug, Subcommand)]
23pub enum CoreCommands {
24 #[command(subcommand, about = "Artifact inspection and debugging")]
25 Artifacts(artifacts::ArtifactsCommands),
26
27 #[command(subcommand, about = "Content management and analytics")]
28 Content(content::ContentCommands),
29
30 #[command(subcommand, about = "File management and uploads")]
31 Files(files::FilesCommands),
32
33 #[command(subcommand, about = "Context management")]
34 Contexts(contexts::ContextsCommands),
35
36 #[command(subcommand, about = "Skill management and database sync")]
37 Skills(skills::SkillsCommands),
38
39 #[command(subcommand, about = "Plugin management and marketplace generation")]
40 Plugins(plugins::PluginsCommands),
41
42 #[command(subcommand, about = "Hook validation and inspection")]
43 Hooks(hooks::HooksCommands),
44}
45
46pub async fn execute(cmd: CoreCommands, config: &CliConfig) -> Result<()> {
47 match cmd {
48 CoreCommands::Artifacts(cmd) => artifacts::execute(cmd, config).await,
49 CoreCommands::Content(cmd) => content::execute(cmd).await,
50 CoreCommands::Files(cmd) => files::execute(cmd, config).await,
51 CoreCommands::Contexts(cmd) => contexts::execute(cmd, config).await,
52 CoreCommands::Skills(cmd) => skills::execute(cmd),
53 CoreCommands::Plugins(cmd) => plugins::execute(cmd),
54 CoreCommands::Hooks(cmd) => hooks::execute(cmd),
55 }
56}
57
58pub async fn execute_with_db(
59 cmd: CoreCommands,
60 db_ctx: &DatabaseContext,
61 config: &CliConfig,
62) -> Result<()> {
63 match cmd {
64 CoreCommands::Content(cmd) => content::execute_with_db(cmd, db_ctx, config).await,
65 CoreCommands::Files(cmd) => files::execute_with_db(cmd, db_ctx, config).await,
66 CoreCommands::Artifacts(_)
67 | CoreCommands::Contexts(_)
68 | CoreCommands::Skills(_)
69 | CoreCommands::Plugins(_)
70 | CoreCommands::Hooks(_) => {
71 anyhow::bail!("This command requires full profile context")
72 },
73 }
74}