cli_testing_specialist/analyzer/
mod.rs

1//! # Analyzer Module
2//!
3//! Provides comprehensive CLI tool analysis capabilities including:
4//!
5//! - **CLI Parsing**: Executes binaries with `--help` and extracts structured information
6//! - **Option Inference**: Automatically detects option types (flags, paths, numbers, etc.)
7//! - **Subcommand Detection**: Recursively discovers subcommands and their options
8//!
9//! ## Architecture
10//!
11//! The analyzer module follows a pipeline pattern:
12//!
13//! ```text
14//! Binary Path → CliParser → Option Detection → Type Inference → CliAnalysis
15//!                              ↓
16//!                    SubcommandDetector (recursive)
17//! ```
18//!
19//! ## Example Usage
20//!
21//! ```no_run
22//! use cli_testing_specialist::analyzer::CliParser;
23//! use std::path::Path;
24//!
25//! let parser = CliParser::new();
26//! let analysis = parser.analyze(Path::new("/usr/bin/curl"))?;
27//!
28//! println!("Found {} options", analysis.metadata.total_options);
29//! println!("Found {} subcommands", analysis.subcommands.len());
30//! # Ok::<(), cli_testing_specialist::error::CliTestError>(())
31//! ```
32//!
33//! ## Performance Characteristics
34//!
35//! - **Small CLI (~50 options)**: 100-200ms
36//! - **Medium CLI (~100 options)**: 300-500ms
37//! - **Large CLI (100+ subcommands)**: 1-3s
38//!
39//! ## Safety & Resource Limits
40//!
41//! All binary executions are protected with:
42//! - Timeout limits (default: 30 seconds)
43//! - Memory limits (configurable)
44//! - Recursion depth limits for subcommands (max: 5 levels)
45
46pub mod behavior_inferrer;
47pub mod cli_parser;
48pub mod option_inferrer;
49pub mod subcommand_detector;
50
51pub use behavior_inferrer::BehaviorInferrer;
52pub use cli_parser::CliParser;
53pub use option_inferrer::{apply_numeric_constraints, load_enum_values, OptionInferrer};
54pub use subcommand_detector::SubcommandDetector;