Skip to main content

systemprompt_cli/commands/core/
mod.rs

1//! `core` command group: the platform's primary domain commands.
2//!
3//! Dispatches the [`CoreCommands`] subgroups — artifacts, content, files,
4//! contexts, skills, plugins, and hooks. On a `--database-url` invocation only
5//! the content and files subgroups are served; the rest require a full
6//! profile context.
7
8pub 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;
18
19use crate::context::CommandContext;
20
21#[derive(Debug, Subcommand)]
22pub enum CoreCommands {
23    #[command(subcommand, about = "Artifact inspection and debugging")]
24    Artifacts(artifacts::ArtifactsCommands),
25
26    #[command(subcommand, about = "Content management and analytics")]
27    Content(content::ContentCommands),
28
29    #[command(subcommand, about = "File management and uploads")]
30    Files(files::FilesCommands),
31
32    #[command(subcommand, about = "Context management")]
33    Contexts(contexts::ContextsCommands),
34
35    #[command(subcommand, about = "Skill management and database sync")]
36    Skills(skills::SkillsCommands),
37
38    #[command(subcommand, about = "Plugin management and marketplace generation")]
39    Plugins(plugins::PluginsCommands),
40
41    #[command(subcommand, about = "Hook validation and inspection")]
42    Hooks(hooks::HooksCommands),
43}
44
45pub async fn execute(cmd: CoreCommands, ctx: &CommandContext) -> Result<()> {
46    if ctx.is_database_scoped() && !matches!(cmd, CoreCommands::Content(_) | CoreCommands::Files(_))
47    {
48        anyhow::bail!("This command requires full profile context");
49    }
50
51    match cmd {
52        CoreCommands::Artifacts(cmd) => artifacts::execute(cmd, ctx).await,
53        CoreCommands::Content(cmd) => content::execute(cmd, ctx).await,
54        CoreCommands::Files(cmd) => files::execute(cmd, ctx).await,
55        CoreCommands::Contexts(cmd) => contexts::execute(cmd, ctx).await,
56        CoreCommands::Skills(cmd) => skills::execute(cmd, ctx),
57        CoreCommands::Plugins(cmd) => plugins::execute(cmd, ctx),
58        CoreCommands::Hooks(cmd) => hooks::execute(cmd, ctx),
59    }
60}