Syntax-aware diff CLI for comparing code and directories by structure rather than raw lines.
$brew install difftastic
Agent Compatibility
JSON Output
Agent Skill
MCP Support
AI Analysis
difftastic is a structural diff CLI that parses supported languages and highlights syntactic changes instead of raw line churn. It can compare files, directories, and VCS diffs, with line-oriented fallback when syntax support or diff size gets in the way.
What It Enables
- Compare two files or directories and see code changes with syntax-aware alignment that separates real edits from formatting churn.
- Use it as an external diff for Git and other version control workflows, or inspect a file with conflict markers to view the two conflicting states.
- Check whether edits changed syntax, ignore comments when needed, and emit JSON summaries for downstream review or verification tooling.
Agent Fit
--display jsonprovides structured diff data, while--exit-codeand--check-onlymake it easy to gate follow-up automation on whether syntactic changes exist.- It works cleanly in inspect and verify loops around generated edits because it handles files, directories, stdin, and VCS-provided temp paths without requiring an interactive session.
- Best as a verification and review primitive rather than a mutation tool; agents can parse the summary, but the richest side-by-side output is still optimized for humans.
Caveats
- It does not generate patches or perform merges, so it cannot be the write path for change application.
- Unsupported languages, parse errors, or byte and graph limits can force line-oriented fallback, and the project documents performance and memory issues on large diffs.