leindex 1.6.0

LeIndex MCP and semantic code search engine for AI tools and large codebases
// lepasserelle - Integration & API Layer
//
// *La Passerelle* (The Bridge) - Pure Rust orchestration, CLI, and MCP server
//
// This crate provides the integration and API layer for LeIndex, offering:
//
// - **LeIndex Orchestration**: Unified API for parsing, indexing, searching, and analysis
// - **CLI Interface**: Command-line tool for project indexing, search, and diagnostics
// - **MCP Server**: Model Context Protocol server for LLM tool integration
// - **Memory Management**: Automatic cache spilling and restoration with LRU eviction
//
// ## Features
//
// - `mcp-server` (default): MCP JSON-RPC server functionality
//
// ## Example
//
// ```no_run
// use leindex::cli::LeIndex;
//
// let leindex = LeIndex::new("/path/to/project")?;
// let stats = leindex.index_project()?;
// println!("Indexed {} files", stats.files_parsed);
//
// let results = leindex.search("authentication", 10)?;
// ```
//!
//! # LePasserelle - Integration & API Layer
//!
//! This crate provides the integration and API layer for LeIndex, offering:
//!
//! - **LeIndex Orchestration**: Unified API for parsing, indexing, searching, and analysis
//! - **CLI Interface**: Command-line tool for project indexing, search, and diagnostics
//! - **MCP Server**: Model Context Protocol server for LLM tool integration
//! - **Memory Management**: Automatic cache spilling and restoration with LRU eviction
//!
//! ## Features
//!
//! - `mcp-server` (default): MCP JSON-RPC server functionality
//!
//! ## Quick Start
//!
//! ```text
//! use leindex::cli::LeIndex;
//!
//! // Create a LeIndex instance for a project
//! let leindex = LeIndex::new("/path/to/project")?;
//!
//! // Index the project
//! let stats = leindex.index_project()?;
//! println!("Indexed {} files", stats.files_parsed);
//!
//! // Search for code
//! let results = leindex.search("authentication", 10)?;
//! for result in results {
//!     println!("{}: {}", result.symbol_name, result.file_path);
//! }
//! ```
//!
//! ## CLI Usage
//!
//! ```bash
//! # Index a project
//! leindex index /path/to/project
//!
//! # Search for code
//! leindex search "authentication"
//!
//! # Deep analysis
//! leindex analyze "How does authentication work?"
//!
//! # System diagnostics
//! leindex diagnostics
//! ```

#![warn(missing_docs)]
#![warn(unused_extern_crates)]

#[allow(clippy::module_inception)]
/// Command-line interface definitions and handling.
pub mod cli;
/// Configuration for projects, languages, and storage.
pub mod config;
/// Error types and error handling logic.
pub mod errors;
/// Indexing pipeline: project parsing, PDG building, search indexing.
pub mod index_builder;
/// Cache subsystem: CacheSpiller, project scan, file stats cache.
pub mod index_cache;
/// Staleness detection: is_stale_fast, check_freshness, check_manifest_stale.
pub mod index_freshness;
/// Core orchestration logic for indexing and search.
pub mod leindex;
/// Memory management and cache orchestration.
pub mod memory;
/// Multi-project registry with per-project concurrency.
#[cfg(feature = "mcp-server")]
pub mod registry;
/// Shared directory exclusion constants.
pub mod skip_dirs;
/// File watcher for auto-reindex.
#[cfg(feature = "mcp-server")]
pub mod watcher;

/// Model Context Protocol (MCP) server implementation.
#[cfg(feature = "mcp-server")]
pub mod mcp;

pub use cli::{Cli, Commands};
pub use config::{LanguageConfig, ProjectConfig, StorageConfig, TokenConfig};
pub use errors::{ErrorContext, LeIndexError, RecoveryStrategy, Result as LeIndexResult};
pub use leindex::{AnalysisResult as LeIndexAnalysisResult, Diagnostics, IndexStats, LeIndex};
pub use memory::{MemoryConfig as MemoryManagementConfig, MemoryManager};

#[cfg(feature = "mcp-server")]
pub use mcp::{
    error_codes, JsonRpcError, JsonRpcRequest, JsonRpcResponse, McpServer, McpServerConfig,
};
#[cfg(feature = "mcp-server")]
pub use registry::ProjectRegistry;

/// Library initialization
pub fn init() {
    let _ = tracing::subscriber::set_default(tracing::subscriber::NoSubscriber::default());
}