Skip to main content

aprender_shell/
lib.rs

1//! aprender-shell library
2//!
3//! AI-powered shell completion trained on your history.
4//! This library exposes the core components for benchmarking and testing.
5//!
6//! # Hardening (v0.2.0)
7//!
8//! This version includes hardening per `aprender-shell-harden-plan.md`:
9//! - **Error handling**: `ShellError` type with graceful degradation
10//! - **Input validation**: `sanitize_prefix` for safe input handling
11//! - **Security filtering**: `is_sensitive_command` for credential protection
12
13// Allow unwrap()/expect() in tests only — banned in production code.
14// (Established convention; see crates/aprender-core/src/lib.rs.)
15#![cfg_attr(test, allow(clippy::disallowed_methods))]
16
17pub mod config;
18pub mod corpus;
19pub mod error;
20pub mod history;
21pub mod model;
22pub mod paged_model;
23pub mod quality;
24pub mod security;
25pub mod synthetic;
26pub mod trie;
27pub mod validation;
28
29// Library-level robustness suite salvaged from the deleted CLI test targets.
30#[cfg(test)]
31mod robustness_tests;
32
33// Re-exports for convenience
34pub use config::{suggest_with_fallback, ShellConfig};
35pub use error::ShellError;
36pub use history::HistoryParser;
37pub use model::MarkovModel;
38pub use paged_model::PagedMarkovModel;
39pub use quality::{
40    apply_typo_corrections, filter_quality_suggestions, suggestion_quality_score,
41    validate_suggestion,
42};
43pub use security::{filter_sensitive_commands, filter_sensitive_suggestions, is_sensitive_command};
44pub use synthetic::SyntheticPipeline;
45pub use validation::{load_model_graceful, sanitize_prefix};
46
47// Corpus management
48pub use corpus::{Corpus, CorpusError, CorpusResult, CorpusStats};