#![cfg_attr(coverage_nightly, coverage(off))]
use crate::models::error::TemplateError;
use crate::services::git_analysis::GitAnalysisService;
use crate::services::unified_ast_engine::{AstForest, ProjectMetrics, UnifiedAstEngine};
use chrono::Utc;
use serde_json::{json, Value};
use std::collections::BTreeMap;
use std::path::{Path, PathBuf};
pub struct DogfoodingEngine {
ast_engine: UnifiedAstEngine,
}
#[derive(Debug, Clone)]
pub struct FileContext {
pub path: PathBuf,
pub functions: usize,
pub structs: usize,
pub traits: usize,
pub max_complexity: u32,
pub lines: usize,
}
#[derive(Debug, Clone)]
pub struct ChurnMetrics {
pub files_changed: usize,
pub commit_count: usize,
pub total_additions: usize,
pub total_deletions: usize,
pub hotspots: Vec<FileHotspot>,
}
#[derive(Debug, Clone)]
pub struct FileHotspot {
pub path: PathBuf,
pub change_count: usize,
pub complexity_score: u32,
pub risk_score: f64,
}
#[derive(Debug, Clone)]
pub struct DagMetrics {
pub node_count: usize,
pub edge_count: usize,
pub density: f64,
pub diameter: usize,
pub clustering: f64,
pub strongly_connected_components: usize,
}
impl DogfoodingEngine {
#[must_use]
#[provable_contracts_macros::contract("pmat-core.yaml", equation = "check_compliance")]
pub fn new() -> Self {
Self {
ast_engine: UnifiedAstEngine::new(),
}
}
}
impl Default for DogfoodingEngine {
fn default() -> Self {
Self::new()
}
}
include!("dogfooding_engine_generators.rs");
include!("dogfooding_engine_analysis.rs");
include!("dogfooding_engine_tests.rs");