//! Aphoria - A code-level truth linter powered by Episteme
//!
//! Aphoria scans a codebase, extracts the decisions embedded in config and code,
//! and checks them against authoritative sources. It finds the places where what
//! your code *does* contradicts what the specs *say*.
//!
//! # Architecture
//!
//! ```text
//! ┌──────────────────────────────────────────────────────────────┐
//! │                        aphoria CLI                           │
//! │                                                              │
//! │  ┌──────────┐   ┌────────────┐   ┌──────────┐   ┌────────┐  │
//! │  │ Walker   │──▶│ Extractors │──▶│ Ingester │──▶│ Report │  │
//! │  └──────────┘   └────────────┘   └──────────┘   └────────┘  │
//! │                                       │              ▲       │
//! │                                       ▼              │       │
//! │                              ┌──────────────┐        │       │
//! │                              │   Episteme   │────────┘       │
//! │                              │   (local)    │                │
//! │                              └──────────────┘                │
//! └──────────────────────────────────────────────────────────────┘
//! ```
//!
//! # Example
//!
//! ```ignore
//! use aphoria::{run_scan, AphoriaConfig, ScanArgs};
//!
//! let args = ScanArgs {
//!     path: ".".into(),
//!     format: "table".to_string(),
//!     exit_code_enabled: false,
//! };
//! let config = AphoriaConfig::default();
//! let result = run_scan(args, &config).await?;
//!
//! println!("{}", result.display());
//! ```

// Module declarations
pub mod ack_file;
mod baseline;
pub mod bridge;
pub mod community;
mod config;
pub mod corpus;
mod corpus_build;
mod episteme;
pub mod scope;
pub use episteme::{current_timestamp, current_timestamp_millis};
mod error;
pub mod eval;
pub mod evidence;
pub mod expiry;
pub mod extractors;
pub mod governance;
pub mod hosted;
mod init;
pub mod learning;
pub mod lifecycle;
pub mod llm;
pub mod policy;
mod policy_ops;
pub mod promotion;
pub mod report;
pub mod research;
mod research_commands;
mod scan;
pub mod shadow;
mod types;
mod walker;

// Public re-exports
pub use baseline::{set_baseline, show_diff};
pub use community::{
    compute_pattern_hash, AnonymizedObservation, CommunityClaimDef, CommunityExtractor,
    CommunityExtractorLoader, CommunityExtractorProvenance, CommunityObjectValue, PatternAggregate,
    PatternSyncer, SharedClaimTemplate, SharedPattern,
};
pub use config::{
    AphoriaConfig, AutonomousConfig, CommunityConfig, CorpusConfig, CrossProjectConfig, EvalConfig,
    GovernanceConfig, HostedConfig, LearningConfig, LlmConfig, OfflineFallback,
    PredicateAliasConfig, PromotionConfig, ShadowConfig, SyncMode,
};
pub use corpus::{CorpusBuildResult, CorpusBuilderInfo, CorpusRegistry};
pub use corpus_build::{build_corpus, list_corpus_sources, CorpusBuildArgs};
pub use error::AphoriaError;
pub use eval::{
    BaselineComparison, BaselineMetrics, CategoryMetrics, ClaimMatcher, CorpusManifest,
    CorpusMetadata, EvalDatabase, EvalHarness, EvalMode, EvalResult, EvalRunConfig, EvalVerdict,
    ExpectedClaim, FinalClaim, Fixture, FixtureExpected, FixtureInput, FixtureLoader,
    FixtureMetadata, FixtureResult, FixtureScoring, FixtureStatus, FixtureSummary, MatchResult,
    Metrics, Observation, ParsedClaim, Report, ReportFormat, ValidationError,
};
pub use evidence::{EvidenceDetector, EvidenceLevel, EvidenceSource, PatternEvidence};
pub use governance::{
    governance_store_dir, ApprovalDecision, ApprovalRequest, ApprovalStage, ApprovalStatus,
    ApprovalWorkflow, AuditEvent, AuditEventType, AuditTrail, Decision, ExportFormat,
    GovernanceStateMachine, GovernanceStore,
};
pub use init::{initialize, show_status};
pub use learning::{
    learning_store_dir, ClaimTemplate, LearnedPattern, LocalPatternStore, PatternStore, ValueType,
};
pub use lifecycle::{
    lifecycle_store_dir, DeprecatedUsage, KnowledgeLifecycle, KnowledgeStatus, LifecycleStore,
    MigrationProgress, MigrationStore, StatusTransition,
};
pub use policy::{PackPredicateAliasSet, PolicyManager, SignatureRecord, TrustPack};
pub use policy_ops::{
    acknowledge, bless, export_acks, export_policy, import_acks, import_policy, parse_value,
    resign_policy, update, AckExportStats, AckImportStats, ImportStats, ResignStats,
};
pub use promotion::{
    compute_metrics_delta, display_candidate, display_candidates_summary, ChangelogEntry,
    ExtractorChangelog, ExtractorValidator, ExtractorVersion, InteractiveReviewer, MetricsDelta,
    PromotionCandidate, PromotionMetadata, PromotionPipeline, PromotionStats, RegexGenerator,
    ReviewDecision, ReviewResult, ValidationResult, VersionStore, YamlWriter,
};
pub use research::{
    detect_gaps, Gap, GapRecord, GapStore, QualityReport, QualityValidator, ResearchConfig,
    ResearchOutcome, Researcher,
};
pub use research_commands::{record_scan_gaps, run_research, show_research_status, ResearchArgs};
pub use scan::{extract_claims, run_scan};
pub use scope::{
    override_store_dir, OverridePolicy, OverrideStore, OverrideValue, ScopeConfig, ScopeContext,
    ScopeId, ScopeLevel, ScopeOverride, ScopeResolver,
};
pub use shadow::{
    AutoRollbackResult, FeedbackCollector, FeedbackWithRollback, GraduationManager, MatchFeedback,
    ShadowDecision, ShadowDecisionKind, ShadowExecutor, ShadowExtractorRegistry, ShadowMatch,
    ShadowMetrics, ShadowStatus, ShadowStore, ShadowTest,
};
pub use types::{
    extract_leaf_concept, predicates, AcknowledgeArgs, BlessArgs, ConflictResult, ConflictTrace,
    DeprecatedUsageResult, ExtractedClaim, FileSource, PolicySourceInfo, PredicateAliasSet,
    ScanArgs, ScanMode, ScanResult, UpdateArgs, Verdict,
};

#[cfg(test)]
mod tests;
