Skip to main content

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/// On-disk persistence helpers (atomic-write, snapshot I/O primitives)
100pub mod persistence;
101
102/// Unified graph architecture for cross-language code analysis
103pub mod graph;
104
105/// Canonical schema types (single source of truth for semantic enums)
106pub mod schema;
107
108/// Shared relation extraction infrastructure for language plugins
109pub mod relations;
110
111/// Git integration for change tracking
112pub mod git;
113
114/// Project root lifecycle management (per PROJECT_ROOT_SPEC.md)
115pub mod project;
116
117/// Confidence metadata for analysis results
118pub mod confidence;
119
120/// Local uses and insights (privacy-respecting behavioral capture)
121///
122/// This module provides anonymous usage pattern collection that stays entirely local.
123/// All data uses strongly-typed enums - no arbitrary strings can leak.
124/// Users can disable via config, environment, or by building without the feature.
125#[cfg(feature = "uses")]
126pub mod uses;
127
128// NOTE: The original hybrid embeddings path (embeddings/vector/security
129// modules and related features) has been removed from the codebase. Natural language
130// support is provided exclusively via the NL→SQRY translation interface described in
131// docs/development/-nl-translation/01_SPEC.md.
132
133/// Common types and utilities
134pub mod common {
135    //! Common types used across the library
136}
137
138/// Test support utilities (verbose logging, artifacts)
139///
140/// This module provides testing infrastructure including environment-variable
141/// driven logging and test artifact generation. It's designed to be zero-overhead
142/// when not in use and completely opt-in via environment variables.
143///
144/// See module documentation for usage examples.
145#[cfg(any(test, feature = "test-support"))]
146pub mod test_support;
147
148/// Re-exports for convenience
149pub use anyhow::{Error, Result};
150pub use confidence::{ConfidenceLevel, ConfidenceMetadata};