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 inverse_sync;
34pub mod sync;
35// ARCHIVED (v26.5.28): ambiguous noun, gated behind default-off `experimental`.
36#[cfg(feature = "experimental")]
37pub mod wizard;
38
39// Command modules - clap-noun-verb auto-discovery
40// ARCHIVED (v26.5.28): a2a/framework/mcp/sigma not provable as finished; gated
41// behind default-off `experimental` so they leave the default CLI surface while
42// the code is preserved (non-deletion doctrine). See cmds/mod.rs feature note.
43#[cfg(feature = "experimental")]
44pub mod a2a;
45pub mod agent; // AGI-facing lifecycle surface over ggen_core::agent::PackAgent (`ggen agent <verb>`)
46pub mod capability; // capability surfaces → atomic packs (`ggen capability enable/list/inspect`)
47pub mod doctor;
48#[cfg(feature = "experimental")]
49pub mod framework; // Framework bridge commands (LangChain, etc.)
50pub mod graph;
51#[cfg(feature = "lsp")]
52pub mod lsp; // ggen lsp noun (start/check/init/serve/mine/metrics/replay/field-status/emit_pack/verify_pack) — opt-in: --features lsp
53#[cfg(feature = "experimental")]
54pub mod mcp; // MCP delivered via `ggen lsp serve --protocol mcp` (lsp feature) + ggen-lsp-mcp binary
55pub mod ontology; // ggen ontology noun (list/status/info/search) — embedded and marketplace ontology management
56pub mod pack; // Singular alias for `packs` noun (golden-path: ggen pack add <name>)
57pub mod packs; // lockfile-oriented multi-pack management (`ggen packs install/list/validate/show`)
58pub mod packs_receipt; // pack-install receipt emitter (full-closure, fail-closed) — invoked by `pack add`
59pub mod policy;
60pub mod receipt; // ggen receipt verify / info — cryptographic receipt CLI surface (BUG-005)
61#[cfg(feature = "experimental")]
62pub mod sigma;
63pub mod utils;
64
65use crate::prelude::*;
66
67/// Setup and run the command router using clap-noun-verb v26.5.19 auto-discovery
68pub fn run_cli() -> Result<()> {
69    // Handle --version flag before delegating to clap-noun-verb
70    let args: Vec<String> = std::env::args().collect();
71    if args.iter().any(|arg| arg == "--version" || arg == "-V") {
72        log::info!("ggen {}", env!("CARGO_PKG_VERSION"));
73        return Ok(());
74    }
75
76    // Use clap-noun-verb's auto-discovery to find all [verb] functions
77    clap_noun_verb::run().map_err(GgenError::from_clap_error)?;
78    Ok(())
79}