Skip to main content

Crate diffler_core

Crate diffler_core 

Source
Expand description

Core review engine for diffler, with no terminal dependency: diffs, sessions, comments, viewed marks.

Modules§

classify
Which bucket a changed file belongs to, from its path alone. Rule order matters: Generated outranks Tests so a generated fixture reads as noise, and Build outranks Config so Cargo.toml reads as a manifest.
diff
Intra-line diff: byte ranges that differ between a paired old/new line.
diffalgo
Selectable line-diff algorithms. libgit2 has no histogram, so we run Histogram and Structural through imara-diff.
feedback
Markdown export of review comments with their diff context.
git
git2 backend for the Vcs trait.
highlight
Tree-sitter highlighting sliced into per-line styled ranges. We highlight whole files so multi-line strings stay correct across hunk boundaries.
jj
jj backend. Reads delegate to GitVcs: in a colocated repo git’s HEAD sits on @- and the worktree matches @; otherwise we open jj’s own git store and point its reads of HEAD at @-. Writes shell out to jj, which owns the operation log and working-copy snapshot.
language
A path’s language, its Linguist colour, and its comment syntax for the line counter. The syntax registry owns the extension table for every language it highlights; this module adds the ones it only counts.
lens
The symbol lens: the names on one diff line and their uses on lines the diff shows. A local reaches its enclosing function; a function, method or type reaches every file of the diff.
loggraph
The lanes git log --graph draws beside history, one row per commit so a row stays one entry: a merge or a fork draws its connector on the commit’s own row.
model
Diff model: files, hunks, lines.
pairing
Pair deleted/added line runs by best total similarity (delta’s homologous-line model) and attach intra-line emphasis. Unpaired lines render plain.
repo
Repository discovery and backend selection.
review
Facade over the VCS backend, session and store, used by the TUI and MCP layers.
session
Review session: comments and per-file viewed marks.
source
What a review is of, with a filesystem-safe persistence key and a label.
stats
Lines per language for the working tree, and churn per language for a review.
store
Session persistence: one file per review source under .diffler/reviews/. Legacy .diffler/session.json migrates to reviews/working.json, and a walkthrough embedded in an older review file splits into its own walkthrough-<id>.json on load.
syntax
Tree-sitter parsing shared by highlighting, scope context and the structural diff. We link grammars statically since musl-static binaries cannot dlopen. A parse failure or unknown language falls back to plain text.
vcs
Backend-agnostic VCS interface. Only the git and repo modules and test fixtures may import git2.
walkthrough
The agent’s reading order for a review. A stop is an agent comment with a title and an anchor. A walkthrough is its own review source, so every comment in that source’s session belongs to it.