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// Re-exports for convenience
30pub use config::{suggest_with_fallback, ShellConfig};
31pub use error::ShellError;
32pub use history::HistoryParser;
33pub use model::MarkovModel;
34pub use paged_model::PagedMarkovModel;
35pub use quality::{
36    apply_typo_corrections, filter_quality_suggestions, suggestion_quality_score,
37    validate_suggestion,
38};
39pub use security::{filter_sensitive_commands, filter_sensitive_suggestions, is_sensitive_command};
40pub use synthetic::SyntheticPipeline;
41pub use validation::{load_model_graceful, sanitize_prefix};
42
43// Corpus management
44pub use corpus::{Corpus, CorpusError, CorpusResult, CorpusStats};