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;
28
29#[cfg(any(test, feature = "test-helpers"))]
30pub mod test_helpers;
31
32pub use config::{BackupConfig, DetectionConfig, ScanConfig, ServerConfig};
33pub use dependency::{
34    DependencyDomain, classify_domain, is_python_stdlib_module, matches_keyword_at_boundary,
35    top_level_module,
36};
37pub use detector_result::{
38    AnchorKind, CodeEvidence, ConventionFinding, DetectorResults, FindingKind,
39};
40pub use edge::{Edge, EdgeType};
41pub use error::{CoreError, ParseEnumError};
42pub use ids::{BranchId, EdgeId, NodeId};
43pub use ir::{
44    DependencyUsage, DeriveUsage, Export, Function, FunctionCall, Import, JavaScriptIR, Language,
45    LanguageIR, MacroCall, ModDeclaration, ModuleSystem, ProjectFile, PythonIR, RustIR, TraitImpl,
46    TypeDef, TypeDefKind, TypeScriptIR,
47};
48pub use knowledge::{KnowledgeNature, KnowledgeNode, KnowledgeWeight, Trend};
49pub use snippet::{CodeSnippet, MAX_SNIPPET_LINES, truncate_snippet, truncate_snippet_to};