sqry_core/lib.rs
1//! sqry-core: Core library for semantic code search
2//!
3//! This library provides the foundational components for sqry, a semantic code search tool
4//! that understands code structure through AST analysis.
5//!
6//! # Architecture
7//!
8//! The library is organized into several key modules:
9//!
10//! - **search**: Core search engine and pattern matching
11//! - **ast**: AST parsing and querying
12//! - **indexing**: Incremental hashing and index compression utilities
13//! - **cache**: Caching layer for performance
14//! - **session**: Session-level caching for warm multi-query execution
15//! - **plugin**: Plugin system for language extensibility
16//! - **output**: Output formatters (text, JSON)
17//!
18//! # Example
19//!
20//! ```rust,ignore
21//! use sqry_core::search::SearchEngine;
22//!
23//! let engine = SearchEngine::new();
24//! let results = engine.search("pattern", "path/to/code")?;
25//! ```
26//!
27//! # Status
28//!
29//! This library is under active development (Phase 0). APIs are subject to change.
30
31#![warn(missing_docs)]
32#![warn(clippy::all)]
33#![allow(clippy::mixed_attributes_style)]
34#![cfg_attr(
35 test,
36 allow(
37 clippy::large_stack_arrays,
38 reason = "libtest harness generates a large test table; no user code allocates large stack arrays"
39 )
40)]
41
42/// Core search functionality
43pub mod search;
44
45/// AST parsing and querying
46pub mod ast;
47
48/// Error types for programmatic tool integration
49pub mod errors;
50
51/// Configuration module (buffer sizes, tuning parameters)
52pub mod config;
53
54/// JSON response types for programmatic tool integration
55pub mod json_response;
56
57/// I/O utilities for efficient file operations
58pub mod io;
59
60/// BLAKE3 hashing utilities for cache module
61pub mod hash;
62
63/// Caching layer
64pub mod cache;
65
66/// Indexing utilities (incremental hashing, compression)
67pub mod indexing;
68
69/// Progress reporting for indexing and graph builds
70pub mod progress;
71
72/// Session management for multi-query caching
73pub mod session;
74
75/// File system watcher for CLI watch mode
76pub mod watch;
77
78/// Plugin system for language extensibility
79pub mod plugin;
80
81/// Shared metadata constants for language plugins
82pub mod metadata;
83
84/// Metadata normalization for backward compatibility
85pub mod normalizer;
86
87/// Query language for AST-aware code search
88pub mod query;
89
90/// Workspace registry and discovery utilities
91pub mod workspace;
92
93/// Visualization helpers (graph exporters for DOT, D2, Mermaid, JSON)
94pub mod visualization;
95
96/// Output formatting (text, JSON, diagrams)
97pub mod output;
98
99/// Unified graph architecture for cross-language code analysis
100pub mod graph;
101
102/// Canonical schema types (single source of truth for semantic enums)
103pub mod schema;
104
105/// Shared relation extraction infrastructure for language plugins
106pub mod relations;
107
108/// Git integration for change tracking
109pub mod git;
110
111/// Project root lifecycle management (per PROJECT_ROOT_SPEC.md)
112pub mod project;
113
114/// Confidence metadata for analysis results
115pub mod confidence;
116
117/// Local uses and insights (privacy-respecting behavioral capture)
118///
119/// This module provides anonymous usage pattern collection that stays entirely local.
120/// All data uses strongly-typed enums - no arbitrary strings can leak.
121/// Users can disable via config, environment, or by building without the feature.
122#[cfg(feature = "uses")]
123pub mod uses;
124
125// NOTE: The original hybrid embeddings path (embeddings/vector/security
126// modules and related features) has been removed from the codebase. Natural language
127// support is provided exclusively via the NL→SQRY translation interface described in
128// docs/development/-nl-translation/01_SPEC.md.
129
130/// Common types and utilities
131pub mod common {
132 //! Common types used across the library
133}
134
135/// Test support utilities (verbose logging, artifacts)
136///
137/// This module provides testing infrastructure including environment-variable
138/// driven logging and test artifact generation. It's designed to be zero-overhead
139/// when not in use and completely opt-in via environment variables.
140///
141/// See module documentation for usage examples.
142#[cfg(any(test, feature = "test-support"))]
143pub mod test_support;
144
145/// Re-exports for convenience
146pub use anyhow::{Error, Result};
147pub use confidence::{ConfidenceLevel, ConfidenceMetadata};