Skip to main content

omni_index/
lib.rs

1// Allow some clippy lints that are too strict for our codebase
2#![allow(clippy::collapsible_if)]
3#![allow(clippy::too_many_arguments)]
4#![allow(clippy::manual_map)]
5#![allow(clippy::manual_strip)]
6#![allow(clippy::or_fun_call)]
7#![allow(clippy::only_used_in_recursion)]
8#![allow(clippy::double_ended_iterator_last)]
9#![allow(clippy::cmp_owned)]
10#![allow(clippy::unwrap_or_default)]
11
12//! Omniscient Code Index (OCI)
13//!
14//! A semantic, interventionist code indexer for AI coding agents.
15//!
16//! # Architecture
17//!
18//! The OCI maintains three interconnected graph layers:
19//!
20//! 1. **Module Topology (Layer 1)**: High-level view of crates, modules, and files
21//!    with import relationships and PageRank-based relevance scoring.
22//!
23//! 2. **Symbol Resolution (Layer 2)**: Precise symbol definitions and call graph
24//!    using incremental analysis for fast updates.
25//!
26//! 3. **Semantic Embeddings (Layer 3)**: Vector embeddings for semantic search
27//!    and duplicate detection.
28//!
29//! # Key Features
30//!
31//! - **Incremental Indexing**: Only re-parse changed files
32//! - **Active Intervention**: Detect semantic duplicates before code is written
33//! - **Dead Code Analysis**: Global reachability analysis across workspace
34//! - **Test Coverage Integration**: Map coverage data to symbols
35//! - **Virtual Context Documents**: Auto-generated architectural documentation
36//!
37//! # Usage
38//!
39//! ```ignore
40//! use omni_index::{OciState, IncrementalIndexer};
41//!
42//! let state = OciState::new("/path/to/repo".into());
43//! let indexer = IncrementalIndexer::new();
44//! indexer.full_index(&state, &state.root_path).await?;
45//!
46//! // Search for symbols
47//! let results = state.find_by_name("my_function");
48//! ```
49
50// Core modules (always available)
51pub mod cache;
52pub mod discovery;
53pub mod export;
54pub mod fold;
55pub mod incremental;
56pub mod parsing;
57pub mod query;
58pub mod search;
59pub mod state;
60pub mod topology;
61pub mod types;
62
63// Optional modules (feature-gated)
64#[cfg(feature = "analysis")]
65pub mod analysis;
66#[cfg(feature = "context")]
67pub mod context;
68#[cfg(feature = "intervention")]
69pub mod intervention;
70#[cfg(feature = "mcp")]
71pub mod mcp;
72#[cfg(feature = "semantic")]
73pub mod semantic;
74
75// Re-exports (core - always available)
76pub use cache::{FileFingerprint, IndexManifest};
77pub use discovery::FileDiscovery;
78pub use fold::{FunctionSignature, fold_to_signatures, parse_single_file};
79pub use incremental::IncrementalIndexer;
80pub use incremental::{IndexOptions, IndexReport};
81pub use query::{QueryFilters, QueryResponse, QueryResult, SearchDoc, SearchIndex, SearchState};
82pub use search::{
83    Bm25Index, HybridSearch, HybridSearchConfig, HybridSearchResult, SearchQualityMetrics,
84};
85pub use state::{IndexStats, OciState, SharedState, create_state};
86pub use types::*;
87
88// Re-exports (feature-gated)
89#[cfg(feature = "analysis")]
90pub use analysis::DeadCodeAnalyzer;
91#[cfg(feature = "context")]
92pub use context::{ContextChunk, ContextQuery, ContextResult, ContextSynthesizer};
93#[cfg(feature = "intervention")]
94pub use intervention::InterventionEngine;
95
96/// Server name for MCP.
97pub const SERVER_NAME: &str = "omni-index";
98/// Server version.
99pub const SERVER_VERSION: &str = env!("CARGO_PKG_VERSION");