mirage_analyzer/lib.rs
1//! Mirage - Path-Aware Code Intelligence Engine
2//!
3//! A control-flow and logic graph engine for multi-language codebases.
4//!
5//! # Getting Started
6//!
7//! ```rust,no_run
8//! use mirage_analyzer::Backend;
9//! use std::path::Path;
10//!
11//! // Auto-detect and open the database backend
12//! let backend = Backend::detect_and_open(Path::new("codegraph.db"))?;
13//!
14//! // Query CFG blocks (works with both SQLite and native-v3)
15//! let blocks = backend.get_cfg_blocks(123)?;
16//! # Ok::<(), anyhow::Error>(())
17//! ```
18//!
19//! # Backend Support
20//!
21//! Mirage supports two storage backends:
22//! - **SQLite**: Default backend, backward compatible with Magellan v7+
23//! - **Native-V3**: High-performance KV backend (requires `backend-native-v3` feature)
24//!
25//! The backend is automatically detected from the database file format.
26//!
27//! # Public API
28//!
29//! - [`Backend`] - Enum wrapping storage backends with auto-detection
30//! - [`StorageTrait`] - Backend-agnostic storage interface
31//! - [`MirageDb`] - Legacy database connection (wraps Backend internally)
32
33#![allow(dead_code)]
34
35// Compile-time guard: prevent enabling both backends simultaneously
36// This must be at the lib level since storage/mod.rs is compiled first
37#[cfg(all(feature = "backend-sqlite", feature = "backend-native-v3"))]
38compile_error!(
39 "Features 'backend-sqlite' and 'backend-native-v3' are mutually exclusive. \
40 Enable only one backend feature. Use either: \
41 \
42 SQLite (default): cargo build \
43 Native-V3: cargo build --features backend-native-v3 --no-default-features"
44);
45
46pub mod analysis;
47pub mod cli;
48pub mod cfg;
49pub mod integrations;
50pub mod mir;
51pub mod output;
52pub mod router;
53pub mod storage;
54
55// Public API exports
56pub use storage::{MirageDb, create_schema, DatabaseStatus, Backend, StorageTrait, CfgBlockData};