Skip to main content

Quickstart

You will have your first semantic diff in under a minute. It takes two files and one command.

Step 1: Create two files

Create before.ts and after.ts. The example function is renamed and gains a parameter:

Step 2: Run the diff

Step 3: Read the output

Each line is a typed edit action prefixed with an icon: ~ update, + insert, - delete. The function rename is one action, not a delete and an insert. Compare that to a line diff of the same change:
The line diff says the whole function was deleted and rewritten. Differens says: the function was renamed, a parameter was added, a variable was added, and the return was replaced.
Nodes that did not change (like TAX_RATE) produce no output. The diff core only emits actions for nodes that differ between the two trees.

Step 4: Try JSON output

Pass --format=json for machine-readable output:
Each entry is one typed edit action: Insert, Delete, Update, or Move. The context field gives the containment chain (nearest ancestor first) so you can reconstruct where every change happened. See Machine Outputs for the full schema and the compact --format=llm mode.

Step 5: Diff a git working tree

Run differens with no arguments inside a git repository. It diffs the working tree against HEAD:
You can also diff a commit range:
Or two specific commits:

Step 6: Diff two directories

Compare two directories. Files present in both are diffed; files only on one side show as additions or removals:

What’s next

  • CLI reference: every command, flag, and format
  • Guides: git integration, machine outputs, and benchmarks
  • How it works: the matching algorithm, tier pipeline, and cross-file correlation