ggen_cli_lib/cmds/
mod.rs

1//! Command Router Module - clap-noun-verb v3.4.0 Auto-Discovery
2//!
3//! This module provides the entry point for clap-noun-verb auto-discovery.
4//! All noun modules with `\[verb\]` functions are automatically discovered and registered.
5//!
6//! ## Architecture
7//! ```text
8//! cmds (router) -> auto-discovery -> [verb] functions -> domain (async logic)
9//! ```
10
11// Command modules - clap-noun-verb auto-discovery
12pub mod ai;
13pub mod graph;
14pub mod hook;
15pub mod marketplace;
16pub mod paper;
17pub mod project;
18pub mod template;
19pub mod utils;
20pub mod workflow;
21
22use ggen_utils::error::Result;
23
24/// Setup and run the command router using clap-noun-verb v3.4.0 auto-discovery
25pub fn run_cli() -> Result<()> {
26    // Handle --version flag before delegating to clap-noun-verb
27    let args: Vec<String> = std::env::args().collect();
28    if args.iter().any(|arg| arg == "--version" || arg == "-V") {
29        log::info!("ggen {}", env!("CARGO_PKG_VERSION"));
30        return Ok(());
31    }
32
33    // Use clap-noun-verb's auto-discovery to find all [verb] functions
34    clap_noun_verb::run()
35        .map_err(|e| ggen_utils::error::Error::new(&format!("CLI execution failed: {}", e)))?;
36    Ok(())
37}