Skip to main content

weavatrix_rust/engine/
mod.rs

1//! In-memory repository state and the retargetable Weavatrix engine session.
2
3mod repository_state;
4mod session;
5
6use crate::analyzer::Analyzer;
7use crate::model::Snapshot;
8use blazingly_json::Value;
9use std::collections::BTreeMap;
10use std::path::PathBuf;
11use std::sync::{Arc, OnceLock};
12use std::time::{Duration, Instant};
13use weavatrix_graph::{Graph, NodeIndex};
14use weavatrix_scan::ScanReport;
15
16pub use repository_state::git_head;
17
18#[derive(Debug, Clone)]
19pub struct RepositoryState {
20    root: PathBuf,
21    snapshot: Snapshot,
22    graph: Arc<Graph>,
23    scan: ScanReport,
24    build_time: Duration,
25    built_at: Instant,
26    weak_components: Arc<OnceLock<Vec<Vec<NodeIndex>>>>,
27}
28
29pub struct Weavatrix {
30    analyzer: Analyzer,
31    state: RepositoryState,
32    known_states: BTreeMap<PathBuf, RepositoryState>,
33    last_used: BTreeMap<PathBuf, Instant>,
34    tool_cache: BTreeMap<String, Value>,
35}