Module analyzer

Module analyzer 

Source
Expand description

§Analyzer Module

Provides comprehensive CLI tool analysis capabilities including:

  • CLI Parsing: Executes binaries with --help and extracts structured information
  • Option Inference: Automatically detects option types (flags, paths, numbers, etc.)
  • Subcommand Detection: Recursively discovers subcommands and their options

§Architecture

The analyzer module follows a pipeline pattern:

Binary Path → CliParser → Option Detection → Type Inference → CliAnalysis
                             ↓
                   SubcommandDetector (recursive)

§Example Usage

use cli_testing_specialist::analyzer::CliParser;
use std::path::Path;

let parser = CliParser::new();
let analysis = parser.analyze(Path::new("/usr/bin/curl"))?;

println!("Found {} options", analysis.metadata.total_options);
println!("Found {} subcommands", analysis.subcommands.len());

§Performance Characteristics

  • Small CLI (~50 options): 100-200ms
  • Medium CLI (~100 options): 300-500ms
  • Large CLI (100+ subcommands): 1-3s

§Safety & Resource Limits

All binary executions are protected with:

  • Timeout limits (default: 30 seconds)
  • Memory limits (configurable)
  • Recursion depth limits for subcommands (max: 5 levels)

Re-exports§

pub use behavior_inferrer::BehaviorInferrer;
pub use cli_parser::CliParser;
pub use option_inferrer::apply_numeric_constraints;
pub use option_inferrer::load_enum_values;
pub use option_inferrer::OptionInferrer;
pub use subcommand_detector::SubcommandDetector;

Modules§

behavior_inferrer
cli_parser
option_inferrer
subcommand_detector