Skip to main content

ripr/
lib.rs

1#![forbid(unsafe_code)]
2//! `ripr` is a static RIPR mutation-exposure analyzer for Rust workspaces.
3//!
4//! It does not run mutants. It reads changed Rust code, creates mutation-shaped
5//! probes, and estimates whether tests appear to reach, infect, propagate, and
6//! reveal those changed behaviors through meaningful oracles.
7//!
8//! # Library entry points
9//!
10//! Most integrations should start with [`check_workspace`] to analyze a unified
11//! diff and obtain structured findings.
12//!
13//! # Typical integration flow
14//!
15//! 1. Build a [`CheckInput`] with repository root, target diff, and options.
16//! 2. Call [`check_workspace`] to produce a [`CheckOutput`] report.
17//! 3. For a specific probe id, call [`explain_finding`] to inspect evidence.
18//! 4. Use [`collect_context`] when you need neighboring source context for UX.
19//!
20//! The CLI wraps these same APIs and renders the resulting model in human,
21//! JSON, and annotation formats.
22//!
23//! # Output and compatibility
24//!
25//! [`CheckOutput`] and the domain re-exports in this crate are the intended
26//! integration surface for editor tooling, CI automation, and custom reporting.
27//! Prefer consuming these typed values over parsing CLI output so integrations
28//! remain resilient as human-readable formatting evolves.
29//!
30//! # Exposure language
31//!
32//! `ripr` reports static exposure estimates such as [`ExposureClass::Exposed`]
33//! and [`ExposureClass::WeaklyExposed`]. Findings can also remain unknown when
34//! static evidence is incomplete. These results are intended to guide targeted
35//! test intent, not to claim runtime mutation outcomes.
36//!
37//! # Quick start
38//!
39//! ```no_run
40//! use ripr::{CheckInput, check_workspace};
41//! use std::path::PathBuf;
42//!
43//! let report = check_workspace(CheckInput {
44//!     root: PathBuf::from("."),
45//!     ..CheckInput::default()
46//! })?;
47//!
48//! println!("findings: {}", report.findings.len());
49//! # Ok::<(), String>(())
50//! ```
51//!
52
53#[cfg(not(feature = "lang-rust"))]
54compile_error!(
55    "ripr requires the `lang-rust` Cargo feature; build rust-only binaries with `--no-default-features --features lang-rust`."
56);
57
58// Kept public for compatibility; prefer the crate-root re-exports for new
59// integrations.
60pub(crate) mod agent;
61#[doc(hidden)]
62pub mod analysis;
63// Kept public for compatibility; prefer the crate-root re-exports for new
64// integrations.
65#[doc(hidden)]
66pub mod app;
67// Kept public for compatibility with existing embedders.
68#[doc(hidden)]
69pub mod cli;
70pub(crate) mod config;
71// Kept public for compatibility; prefer the crate-root domain type re-exports
72// for new integrations.
73#[doc(hidden)]
74pub mod domain;
75// Kept public for compatibility with experimental editor integrations.
76#[doc(hidden)]
77pub mod lsp;
78// Kept public for compatibility with existing render integrations.
79#[doc(hidden)]
80pub mod output;
81
82/// Analyze a workspace diff using the default RIPR static pipeline.
83pub use app::{CheckInput, CheckOutput, check_workspace, collect_context, explain_finding};
84/// Domain model types exposed as part of the stable public contract.
85pub use domain::{ExposureClass, Finding, Probe, ProbeFamily, RiprEvidence};