home / dev-tools / diffsitter

diffsitter

2.3k

AST-aware diff CLI that compares syntax trees instead of raw lines for source files.

$cargo install diffsitter --bin diffsitter
Language
Rust
Stars
2,339
Category
Dev Tools
Agent
Ready
Agent Compatibility
JSON Output
Agent Skill
MCP Support
AI Analysis

diffsitter is a local semantic diff CLI that parses source files with tree-sitter and compares syntax trees instead of raw lines. It is aimed at code review and edit inspection where formatting noise would otherwise dominate a normal diff.

What It Enables
  • Compare two source files and surface structural code changes while ignoring whitespace-only or formatting-only churn.
  • Force a language, adjust node filtering and whitespace handling, and tune file associations so diffs follow the syntax that matters for a project.
  • Emit diff data as JSON or terminal output, then plug it into review scripts, git difftool flows, or post-edit verification steps.
Agent Fit
  • The interface is non-interactive by default: two file paths in, exit status and diff output out, with --renderer json available for follow-up parsing.
  • It fits local inspect loops well when an agent needs to compare generated code or review a patch semantically before handing results to a human.
  • Scope is narrower than tools like git or ast-grep: it only compares files, depends on supported tree-sitter grammars, and does not mutate repositories or services.
Caveats
  • The README explicitly says the project is still a work in progress and not yet production ready.
  • Unsupported file types require a configured fallback diff command, and language support is bounded by bundled or loadable tree-sitter grammars.