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;
20
21use ggen_utils::error::Result;
22
23/// Setup and run the command router using clap-noun-verb v3.4.0 auto-discovery
24pub fn run_cli() -> Result<()> {
25    // Handle --version flag before delegating to clap-noun-verb
26    let args: Vec<String> = std::env::args().collect();
27    if args.iter().any(|arg| arg == "--version" || arg == "-V") {
28        log::info!("ggen {}", env!("CARGO_PKG_VERSION"));
29        return Ok(());
30    }
31
32    // Use clap-noun-verb's auto-discovery to find all [verb] functions
33    clap_noun_verb::run()
34        .map_err(|e| ggen_utils::error::Error::new(&format!("CLI execution failed: {}", e)))?;
35    Ok(())
36}