ggen_cli_lib/cmds/ai/
mod.rs

1//! AI-powered template generation commands
2
3use clap::{Args, Subcommand};
4use ggen_utils::error::Result;
5
6pub mod config;
7pub mod demo;
8pub mod from_source;
9pub mod frontmatter;
10pub mod generate;
11pub mod graph;
12pub mod models;
13pub mod project;
14pub mod sparql;
15pub mod validate;
16
17#[derive(Debug, Args)]
18pub struct AiArgs {
19    #[command(subcommand)]
20    pub command: AiCommand,
21}
22
23#[derive(Debug, Subcommand)]
24pub enum AiCommand {
25    /// Generate templates using AI
26    Generate(generate::GenerateArgs),
27    /// Generate SPARQL queries using AI
28    Sparql(sparql::SparqlArgs),
29    /// Generate RDF graphs using AI
30    Graph(graph::GraphArgs),
31    /// Run the AI template demo
32    Demo,
33    /// Generate frontmatter using AI
34    Frontmatter(frontmatter::FrontmatterArgs),
35    /// List available AI models
36    Models(models::ModelsArgs),
37    /// Validate templates
38    Validate(validate::ValidateArgs),
39    /// Generate complete template projects
40    Project(project::ProjectArgs),
41    /// Generate template from existing source file
42    FromSource(from_source::FromSourceArgs),
43}
44
45pub async fn run(args: &AiArgs) -> Result<()> {
46    match &args.command {
47        AiCommand::Generate(args) => generate::run(args).await,
48        AiCommand::Sparql(args) => sparql::run(args).await,
49        AiCommand::Graph(args) => graph::run(args).await,
50        AiCommand::Demo => demo::run().await,
51        AiCommand::Frontmatter(args) => frontmatter::run(args).await,
52        AiCommand::Models(args) => models::run(args).await,
53        AiCommand::Validate(args) => validate::run(args).await,
54        AiCommand::Project(args) => project::run(args).await,
55        AiCommand::FromSource(args) => from_source::run(args).await,
56    }
57}