| Crates.io | scribe-core |
| lib.rs | scribe-core |
| version | 0.5.0 |
| created_at | 2025-09-13 06:22:23.736843+00 |
| updated_at | 2025-09-19 03:42:16.896958+00 |
| description | Core types and utilities for the Scribe code analysis library |
| homepage | https://github.com/sibyllinesoft/scribe |
| repository | https://github.com/sibyllinesoft/scribe |
| max_upload_size | |
| id | 1837297 |
| size | 206,286 |
Core types, utilities, and foundational components for the Scribe code analysis library.
scribe-core provides the fundamental data structures and traits used across all other Scribe crates. It includes comprehensive error handling, file analysis types, scoring components, configuration management, and extensibility traits.
Add this to your Cargo.toml:
[dependencies]
scribe-core = "0.1.0"
Basic usage:
use scribe_core::{Config, Language, ScoreComponents, HeuristicWeights, Result};
// Create a default configuration
let config = Config::default();
// Detect programming language from file extension
let language = Language::from_extension("rs");
assert_eq!(language, Language::Rust);
// Work with scoring components
let mut scores = ScoreComponents::zero();
scores.doc_score = 0.8;
scores.import_score = 0.6;
let weights = HeuristicWeights::default();
scores.compute_final_score(&weights);
println!("Final score: {}", scores.final_score);
ScribeError: Comprehensive error type for all Scribe operationsResult<T>: Type alias for std::result::Result<T, ScribeError>FileInfo: Complete file metadata and analysis resultsLanguage: Programming language detection and classificationFileType: File type classification (source, test, documentation, etc.)RenderDecision: Include/exclude decisions for filesScoreComponents: Individual heuristic score componentsHeuristicWeights: Configurable weights for scoringRepositoryInfo: Repository-level statistics and metadataConfig: Main configuration structureFeatureFlags: Enable/disable experimental featuresFileAnalyzer: Custom file analysis implementationsHeuristicScorer: Custom scoring algorithmsOutputFormatter: Custom output formatsCacheStorage: Custom caching implementationsThe crate is organized into several modules:
error: Comprehensive error types and handlingfile: File metadata and analysis typestypes: Core data structures and scoring componentsconfig: Configuration managementtraits: Extensibility traits and abstractionsutils: Common utility functionsScribe Core is built with Rust's ownership principles in mind:
Run the test suite:
cargo test
Run benchmarks:
cargo bench
This crate serves as the foundation for the entire Scribe ecosystem. When adding new functionality:
ScribeErrorLicensed under either of Apache License, Version 2.0 or MIT license at your option.