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 background_indexer;
30pub mod cache;
31pub mod cli;
32pub mod context;
33pub mod content_store;
34pub mod dependency;
35pub mod formatter;
36pub mod git;
37pub mod indexer;
38pub mod interactive;
39pub mod line_filter;
40pub mod mcp;
41pub mod models;
42pub mod output;
43pub mod parsers;
44pub mod query;
45pub mod regex_trigrams;
46pub mod semantic;
47pub mod symbol_cache;
48pub mod trigram;
49pub mod watcher;
50
51// Re-export commonly used types
52pub use cache::CacheManager;
53pub use indexer::Indexer;
54pub use models::{
55    Dependency, DependencyInfo, FileGroupedResult, ImportType, IndexConfig, IndexStats, IndexStatus, IndexWarning,
56    IndexWarningDetails, IndexedFile, Language, MatchResult, QueryResponse, SearchResult, Span, SymbolKind,
57};
58pub use query::{QueryEngine, QueryFilter};
59pub use watcher::{watch, WatchConfig};