Skip to main content

ggen_cli_lib/cmds/
mod.rs

1//! Command Router Module - clap-noun-verb v26.5.19 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//! ## Removed Commands
12//!
13//! The following commands were removed in v26.5.19:
14//! - `ggen generate` → Use `ggen sync`
15//! - `ggen validate` → Use `ggen sync --validate-only`
16//! - `ggen template *` → Use `ggen sync`
17//! - `ggen project *` → Add back in v26.5.19+
18//! - `ggen graph *` → Add back in v26.5.19+
19//! - `ggen ontology *` → Add back in v26.5.19+
20//! - `ggen marketplace *` → Add back in v26.5.19+
21//! - `ggen ai *` → Add back in v26.5.19+
22//! - `ggen test *` → Add back in v26.5.19+
23//! - `ggen utils *` → Add back in v26.5.19+
24//! - `ggen ci *` → Add back in v26.5.19+
25//! - `ggen workflow *` → Add back in v26.5.19+
26
27// Shared helpers for command modules
28pub mod helpers;
29
30// Core commands: ggen sync & ggen init
31pub mod git_hooks;
32pub mod init;
33pub mod sync;
34// ARCHIVED (v26.5.28): ambiguous noun, gated behind default-off `experimental`.
35#[cfg(feature = "experimental")]
36pub mod wizard;
37
38// Command modules - clap-noun-verb auto-discovery
39// ARCHIVED (v26.5.28): a2a/framework/mcp/sigma not provable as finished; gated
40// behind default-off `experimental` so they leave the default CLI surface while
41// the code is preserved (non-deletion doctrine). See cmds/mod.rs feature note.
42#[cfg(feature = "experimental")]
43pub mod a2a;
44pub mod doctor;
45#[cfg(feature = "experimental")]
46pub mod framework; // Framework bridge commands (LangChain, etc.)
47pub mod graph;
48#[cfg(feature = "lsp")]
49pub mod lsp; // ggen lsp noun (start/check/init/serve/mine/metrics/replay/field-status/emit_pack/verify_pack) — opt-in: --features lsp
50#[cfg(feature = "experimental")]
51pub mod mcp; // MCP delivered via `ggen lsp serve --protocol mcp` (lsp feature) + ggen-lsp-mcp binary
52pub mod pack; // Singular alias for `packs` noun (golden-path: ggen pack add <name>)
53pub mod packs_receipt; // pack-install receipt emitter (full-closure, fail-closed) — invoked by `pack add`
54pub mod receipt; // ggen receipt verify / info — cryptographic receipt CLI surface (BUG-005)
55pub mod policy;
56#[cfg(feature = "experimental")]
57pub mod sigma;
58pub mod utils;
59
60use crate::prelude::*;
61
62/// Setup and run the command router using clap-noun-verb v26.5.19 auto-discovery
63pub fn run_cli() -> Result<()> {
64    // Handle --version flag before delegating to clap-noun-verb
65    let args: Vec<String> = std::env::args().collect();
66    if args.iter().any(|arg| arg == "--version" || arg == "-V") {
67        log::info!("ggen {}", env!("CARGO_PKG_VERSION"));
68        return Ok(());
69    }
70
71    // Use clap-noun-verb's auto-discovery to find all [verb] functions
72    clap_noun_verb::run().map_err(GgenError::from_clap_error)?;
73    Ok(())
74}