Skip to main content

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