Skip to main content

seshat_core/
lib.rs

1//! # Seshat Core
2//!
3//! Foundational types, traits, and intermediate representation (IR) shared
4//! across all Seshat crates. This crate has zero dependencies on other seshat
5//! crates and defines the common vocabulary used throughout the pipeline:
6//!
7//! - **IR types** (`ProjectFile`, `LanguageIR`): normalized, language-agnostic
8//!   representation of parsed source code
9//! - **Knowledge types** (`KnowledgeNode`, `KnowledgeNature`, `KnowledgeWeight`):
10//!   the two-dimensional typing system for the knowledge graph
11//! - **Edge types** (`Edge`, `EdgeType`): typed relationships between knowledge nodes
12//! - **Type-safe IDs** (`NodeId`, `EdgeId`, `BranchId`): newtype wrappers preventing
13//!   accidental misuse
14//! - **Detector results** (`ConventionFinding`, `DetectorResults`): output types
15//!   flowing from detectors through storage to the graph
16//! - **Configuration** (`ScanConfig`, `DetectionConfig`, `ServerConfig`): all
17//!   implement `Default` for zero-config operation
18
19pub mod config;
20pub mod dependency;
21pub mod detector_result;
22pub mod edge;
23pub mod error;
24pub mod ids;
25pub mod ir;
26pub mod knowledge;
27pub mod snippet;
28pub mod symbol_snippet;
29
30#[cfg(any(test, feature = "test-helpers"))]
31pub mod test_helpers;
32
33pub use config::{BackupConfig, DetectionConfig, ScanConfig, ServerConfig};
34pub use dependency::{
35    DependencyDomain, classify_domain, is_python_stdlib_module, matches_keyword_at_boundary,
36    top_level_module,
37};
38pub use detector_result::{
39    AnchorKind, CodeEvidence, ConventionFinding, DetectorResults, FindingKind,
40};
41pub use edge::{Edge, EdgeType};
42pub use error::{CoreError, ParseEnumError};
43pub use ids::{BranchId, EdgeId, NodeId};
44pub use ir::{
45    DependencyUsage, DeriveUsage, Export, Function, FunctionCall, Import, JavaScriptIR, Language,
46    LanguageIR, MacroCall, ModDeclaration, ModuleSystem, ProjectFile, PythonIR, RustIR, TraitImpl,
47    TypeDef, TypeDefKind, TypeScriptIR,
48};
49pub use knowledge::{KnowledgeNature, KnowledgeNode, KnowledgeWeight, Trend};
50pub use snippet::{CodeSnippet, MAX_SNIPPET_LINES, truncate_snippet, truncate_snippet_to};
51pub use symbol_snippet::{
52    MAX_DEFINITION_SNIPPET_LINES, export_definition_snippet, function_definition_snippet,
53    type_definition_snippet,
54};