Skip to main content

Crate differential_engine

Crate differential_engine 

Source
Expand description

Core engine: git io, diff parsing, byte-exact apply, shape classes, invariants, and plan-document assembly.

The canonical enumeration (git diff -U0 --no-renames) processes every file with no exclusions (ADR 0005); the rename-detected view (-M) only annotates it (ADR 0003). Repo config tunes classification hints and can never remove anything from enumeration (ADR 0012).

Re-exports§

pub use grouping::GroupingOptions;
pub use pipeline::PipelineOutput;
pub use pipeline::StackOutput;
pub use pipeline::resolve_range;
pub use pipeline::run_grouped_pipeline;
pub use pipeline::run_pipeline;
pub use pipeline::run_stack_pipeline;
pub use review_session::ReviewSession;
pub use stack::StackOptions;
pub use stack::StackResult;

Modules§

apply
Byte-exact hunk applier.
config
Per-repo configuration: .differential.toml at the target repo’s root.
document
Assemble the frozen-schema plan document from the engine’s outputs.
gitio
Git subprocess runner. Bytes in, bytes out — UTF-8 decoding happens only at display boundaries (ADR 0002). Plumbing commands only (ADR 0011).
grouping
The grouping stage: an LLM merges and labels shape-class ids — never hunks (ADR 0001) — behind the LlmBackend abstraction (ADR 0016), with a coverage audit that back-fills anything the model drops (invariant 5) and a content-hash cache that pins groupings (ADR 0009).
invariants
Invariants 1–4 (spec/invariants.md). All of them run before any document is emitted; every one caught a real bug during prototype validation.
lang
Language abstraction (ADR 0015).
model
Data model for the canonical diff view.
ordering
The ordering stage: foundation-first arrangement of the close section.
parse
Parser for git diff-tree -r -U0 --no-renames patch output.
paths
Path extraction from diff --git a/X b/Y headers.
pipeline
End-to-end core pipeline: enumerate → annotate → classify → verify → emit.
rename_view
The rename-detected classification view (ADR 0003).
review_session
An open review: the engine-owned session over one plan document.
review_state
The review-state sidecar store (ADR 0013, spec/persistence.md).
shape
Shape classes and hunk digests.
stack
The shadow-branch renderer: the diff rewritten as a synthetic commit stack on a refs/review/…/stack ref, one commit per group in reading order — git log --oneline alone shows the shape of the change, and skim remainders are skippable on their subject line.
tree
Build the final tree from applied hunks, via plumbing against a temporary index (ADR 0011). No checkout, no touching the user’s index or worktree.
worktree
Tree snapshots of uncommitted state (ADR 0017): the index and the worktree as plain tree oids, so the rest of the pipeline — diff-tree enumeration, the invariants, blob reads — runs on them unchanged.

Enums§

EngineError