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