reflex/lib.rs
1//! Reflex: Local-first, structure-aware code search engine
2//!
3//! Reflex is a fast, deterministic code search tool designed specifically
4//! for AI coding agents. It provides structured results (symbols, spans,
5//! scopes) with sub-100ms latency by maintaining a lightweight, incremental
6//! cache in `.reflex/`.
7//!
8//! # Architecture
9//!
10//! - **Indexer**: Scans code and builds trigram index; writes to cache
11//! - **Query Engine**: Loads cache on demand; executes deterministic searches; parses symbols at runtime
12//! - **Cache**: Memory-mapped storage for trigrams, content, and metadata
13//!
14//! # Example Usage
15//!
16//! ```no_run
17//! use reflex::{cache::CacheManager, indexer::Indexer, models::IndexConfig};
18//!
19//! // Create and initialize index
20//! let cache = CacheManager::new(".");
21//! let config = IndexConfig::default();
22//! let indexer = Indexer::new(cache, config);
23//! let stats = indexer.index(".", false).unwrap();
24//!
25//! println!("Indexed {} files", stats.total_files);
26//! ```
27
28pub mod ast_query;
29pub mod cache;
30pub mod cli;
31pub mod content_store;
32pub mod formatter;
33pub mod git;
34pub mod indexer;
35pub mod line_filter;
36pub mod mcp;
37pub mod models;
38pub mod parsers;
39pub mod query;
40pub mod regex_trigrams;
41pub mod trigram;
42pub mod watcher;
43
44// Re-export commonly used types
45pub use cache::CacheManager;
46pub use indexer::Indexer;
47pub use models::{
48 IndexConfig, IndexStats, IndexStatus, IndexWarning, IndexWarningDetails, IndexedFile,
49 Language, QueryResponse, SearchResult, Span, SymbolKind,
50};
51pub use query::{QueryEngine, QueryFilter};
52pub use watcher::{watch, WatchConfig};