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