stemedb/applications/aphoria/src/handlers/mod.rs
jordan 41c676a78e feat: Aphoria enterprise features + ontology SDK + file length compliance
Enterprise Features:
- Hosted mode with remote sync for team pattern aggregation
- Community sharing with privacy-preserving anonymization
- LLM-based semantic claim extraction with Gemini integration
- Pattern learning with promotion to declarative extractors
- High-entropy secrets extractor with configurable thresholds
- Auth bypass and insecure cookies extractors

Module Refactoring:
- Split oversized files to comply with 500-line limit
- Config split: types/core.rs, types/extractors.rs, types/hosted.rs, etc.
- Handlers split: scan.rs, policy.rs, report.rs modules
- Extractors split: declarative/, high_entropy_secrets/, insecure_cookies/
- Learning split: store modules with metrics and persistence

SDK & Ontology:
- stemedb-ontology SDK with fluent builders and StemeDB client
- Pharma domain extractors for FDA Orange Book data
- Consumer health UAT test infrastructure

Code Quality:
- Fixed clippy warnings (needless_borrows_for_generic_args)
- Added KVStore trait imports where needed
- Fixed utoipa path re-exports for OpenAPI docs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 12:55:29 -07:00

90 lines
2.5 KiB
Rust

//! 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
}
}
}