Skip to main content

Crate spec_drift

Crate spec_drift 

Source
Expand description

spec-drift — semantic coherence analysis between a project’s specification surfaces (README, AGENTS.md, examples, CI) and its Rust code.

The library exposes the domain model, analyzers, and reporters so they can be embedded in editors or other tools. The spec-drift binary is a thin CLI wrapper over run_cli.

Re-exports§

pub use config::Config;
pub use config::ConfigSource;
pub use context::ProjectContext;
pub use domain::Attribution;
pub use domain::ClaimKind;
pub use domain::CodeFact;
pub use domain::Confidence;
pub use domain::Divergence;
pub use domain::FactKind;
pub use domain::Location;
pub use domain::RuleId;
pub use domain::Severity;
pub use domain::SpecClaim;
pub use error::SpecDriftError;

Modules§

analyzers
auto_fix
Auto-fix suggestions for deterministic drift rules.
baseline
--baseline support.
blame
--blame divergence attribution via git blame --porcelain.
config
spec-drift.toml configuration.
context
domain
error
llm
LLM-backed rule support.
parsers
reporters
sources
suppress
Inline-ignore filtering.
workspace
Workspace member discovery via cargo metadata.

Structs§

RunConfig
Everything the orchestration layer needs to run a spec-drift analysis.

Enums§

Pillar
Pillar selection mirrors the CLI --docs / --examples / --tests / --ci flags.

Functions§

apply_config
Apply a Config to a divergence set: drop suppressed items and apply severity overrides.
apply_strict
Promote every non-deterministic divergence one severity level. Mirrors the --strict CLI flag — deterministic rules stay untouched because they already carry unambiguous verdicts.
normalize_locations
Render and baseline locations relative to the workspace root when possible. Analyzers work with absolute paths so suppression and blame can read files reliably; reporters should not leak machine-local temp or checkout paths.
run
Execute every analyzer in parallel and return divergences sorted deterministically by (file, line, rule) so output can be diffed between runs.
run_cli
Full end-to-end run: discover config, walk files, parse sources, select and run analyzers, apply suppression / baselines / strict, enrich with blame, and render through the chosen reporter.