//! Command handlers for Aphoria CLI use std::process::ExitCode; use aphoria::AphoriaConfig; use crate::cli::Commands; mod corpus; mod extractors; mod policy; mod policy_ops; mod research; mod scan; mod utils; // Re-export for public API compatibility. // These are used by the CLI binary but not within this module, // so we allow unused imports for the re-export pattern. #[allow(unused_imports)] pub use corpus::*; #[allow(unused_imports)] pub use extractors::*; #[allow(unused_imports)] pub use policy::*; #[allow(unused_imports)] pub use policy_ops::*; #[allow(unused_imports)] pub use research::*; #[allow(unused_imports)] pub use scan::*; #[allow(unused_imports)] pub use utils::*; /// Dispatch and execute CLI commands pub async fn handle_command(command: Commands, config: &AphoriaConfig) -> ExitCode { match command { Commands::Scan { path, format, exit_code, strict, persist, debug, sync, staged, community_preview, } => { if community_preview { scan::handle_community_preview(path, config).await } else { scan::handle_scan( path, format, exit_code, strict, persist, debug, sync, staged, config, ) .await } } Commands::Ack { concept_path, reason } => { policy_ops::handle_ack(concept_path, reason, config).await } Commands::Bless { concept_path, predicate, value, reason } => { policy_ops::handle_bless(concept_path, predicate, value, reason, config).await } Commands::Update { concept_path, value, reason } => { policy_ops::handle_update(concept_path, value, reason, config).await } Commands::Baseline => policy_ops::handle_baseline(config).await, Commands::Diff => policy_ops::handle_diff(config).await, Commands::Status => policy_ops::handle_status(config).await, Commands::Init => policy_ops::handle_init(config).await, Commands::Corpus { command } => corpus::handle_corpus_command(command, config).await, Commands::Research { command } => research::handle_research_command(command, config).await, Commands::Policy { command } => policy::handle_policy_command(command, config).await, Commands::Extractors { command } => { extractors::handle_extractor_command(command, config).await } } }