CLI tool
yoshiko-pg/difit avatar
yoshiko-pg/difit

difit: a local diff server that exports its comments as prompts, and waits for consent

A lightweight command-line tool that spins up a local web server to display Git commit diffs in a GitHub-like Files changed view

3,328 stars213 forksTypeScriptMIT

At a glance

What is it?
A command line tool that serves your working tree diffs in a GitHub style viewer, with a comment system whose output is copied straight into an agent prompt. The two shipped agent skills both refuse to act unless the user asks for difit by name.
Who is it for?
Use difit when you review diffs locally and want the findings to come back out as something an agent can act on, since the comment system exists for that rather than for a team workflow. The piped mode makes it useful beyond git, since any tool that emits a unified diff can be reviewed in the same viewer.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 79 days ago.
What is it written in?
Mainly TypeScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • yoshiko-pg/difit3,328 ★ · +138
Star history
Repository2026-09-242026-11-15
yoshiko-pg/difit3.2k3.3k

138 Stars in the last 52 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

Three ways in, and both skills wait for consent

There are three entry points and one of them is not for you.

To try it, a single command serves the latest commit's diff in a web interface. To keep it, you install the package globally and run the same command. Those are the two human paths, and neither needs a repository of its own: the tool reads whatever repository you are standing in.

The third path installs skills into your agent:

bash
npx skills add yoshiko-pg/difit # Add the Skills to your agent

That installs two skills, and the description of each is worth reading closely, because both are gated. The first asks the user for a review in the difit viewer when the user explicitly opts in to difit. The second reviews a specific diff or pull request and shows the findings inside the viewer, when the user explicitly asks for difit.

So the design position is that an agent using this must be told to, twice over, for two different skills. That is unusual in a repository whose selling point is agent integration, and it is the most interesting thing in the README.

Targets, comparisons and three special words

The command line takes a target and an optional second revision, and the defaults make the common case short.

With no arguments you get the diff of the most recent commit. Pass a commit hash and you get that commit. Pass a branch name and you get the latest commit on that branch. Pass two revisions and you get the difference between them, with an at-sign accepted as an alias for the current head.

Three arguments are special rather than revisions. A dot means all uncommitted changes, and the documentation is precise that this covers both the staging area and unstaged files. The word staged means the staging area alone. The word working means unstaged changes alone.

That trio is the difference between a reviewer who reads the whole working state and one who reviews what they happen to have staged, and it is cheap to get wrong in a tool that shows everything at once.

One more flag changes the comparison rather than the target: the merge base option resolves the base revision with git's own merge base logic first, and it applies only in git revision mode, not for pull requests or piped input.

Stdin is chosen by intent, not by sniffing

The tool can review a diff that did not come from git, and the way it decides is the part with the most thought behind it.

The pattern is to pipe a unified diff into it. So a plain diff between two files works, a saved patch file works, a diff computed against a merge base works, and there is even a documented case for reviewing an entire existing file as though it were newly added, by diffing it against the null device.

The decision procedure is called intent first, and it has three rules.

An explicit dash enables stdin mode outright. If you pass positional arguments or the pull request flag, the command is treated as a git or pull request run and will not read stdin at all. And automatic stdin detection applies only when no explicit mode was selected and stdin is a pipe, a file or a socket.

That ordering matters for a tool people script. Without it, a script that pipes a diff while also naming a target would get a different result depending on how the shell wired the pipe, and the failure would look like a bug in the tool rather than an ambiguity in the command.

Pull request mode shells out to gh and imports the review threads

Reviewing a pull request takes a URL and a flag:

bash
difit --pr https://github.com/owner/repo/pull/123

The implementation is honest about its mechanism: it fetches the patch by running the GitHub CLI's diff command with the patch flag underneath. So it is not an independent GitHub client; it borrows the one you probably already have authenticated, and it inherits whatever that authentication can see.

Authentication is therefore the GitHub CLI's business. The documentation recommends logging in once, and offers a token environment variable for continuous integration and other non-interactive cases. For a self-hosted enterprise instance there is a hostname option on the login command, and an environment variable that sets the host alongside the token.

The second thing pull request mode does is import the unresolved inline review threads from the pull request, and it shows them as startup comments in the viewer. So a review that already happened in the browser shows up in the local view, and the comments you add locally are a continuation of that conversation rather than a fresh one.

Comments become prompts, and they live in the browser

The comment system is the reason this tool exists rather than being one of several diff viewers, so it is worth describing end to end.

You add a comment by clicking the comment button on a diff line, or by dragging to select a range. You can edit an existing one. Each comment has a button that copies a prompt, and there is a second button that copies every comment in a structured format. The point of both is that the output is not a note to yourself, it is input to a coding agent.

The prompt carries the location automatically, so you write only the instruction. A line comment produces a file path and a line number followed by your text. A range produces a start and an end line. That marker is added for you.

Storage is the browser's local storage, scoped per commit. So comments live on the machine and in the browser profile rather than in the repository, and they follow the commit they were made against.

The command line has the mirror image of this. A repeatable comment flag injects comments at startup, accepting one JSON object or an array, with a thread type that creates a new thread at a diff position and a reply type that adds a reply to the latest existing thread there. If a comment already exists, it is skipped rather than duplicated.

Port 4966 with a fallback, and a loopback default

The options table is short, and three entries in it are about the server rather than the diff.

The preferred port is 4966, and if it is occupied the tool falls back to the next one rather than failing. The host address defaults to loopback, and the documentation notes that you would use the all-interfaces address for external access. There is also a flag to stop it opening your browser automatically, one to clear all existing comments and viewed files on startup, one to keep the server running after the browser disconnects, and one to keep it running in the background while printing JSON connection information.

Because the host default is loopback, the practical security posture is that the viewer is reachable only from your own machine unless you change it. The README does not describe authentication on the viewer itself, so loopback is the boundary rather than a convenience.

Two diff options are worth pairing with that. Untracked files can be included automatically, but only when the target is the dot or the word working. And a context option limits the surrounding lines per change, defaulting to whatever git itself defaults to, with zero meaning changes only; it is not available in pull request mode or stdin mode, which is a sensible restriction since those diffs are already fixed.

Two builds from one repository, plus an extension package

The build setup explains a project that ships a command line tool, a web client, a documentation site and something else.

The command line is compiled with the TypeScript compiler under its own configuration file, separately from the client, which is bundled by one build tool under another configuration. The documentation site is a third build with its own configuration, and it is gated on an environment variable that the scripts set, so the site build only does the site thing when it is meant to.

The published package is deliberately narrow. Its file list is the build output plus the readme, with two exclusions that remove the client site data and the site build from what ships, which is why those paths can exist in the repository without bloating an install.

And there is a fourth artefact: a package script that builds a Visual Studio Code extension from a workspace package. So the diff viewer also exists as an editor integration.

Quality tooling is not one tool but four. A linter is run with type aware checking and warnings denied, a formatter checks formatting, a dead code detector is configured separately, and git hooks come from a hooks tool with versions pinned by a tool manager. Tests run on one runner with a setup file and an environment stub. And the readme is translated into Japanese, Simplified Chinese and Korean, alongside the English one.

Editorial conclusion

Use difit when you review diffs locally and want the findings to come back out as something an agent can act on, since the comment system exists for that rather than for a team workflow. The piped mode makes it useful beyond git, since any tool that emits a unified diff can be reviewed in the same viewer. Two things to check first. Its agent skills are opt-in by design, so it will not open itself uninvited, and that is the right default. And the server binds to loopback on a fixed port with a fallback, so if you plan to reach it from another machine, read the host option before you start it rather than after. Nothing in the README describes authentication on the viewer itself, so treat loopback as the security boundary.

Frequently asked questions

How do I run difit without installing it?

Run npx difit, which serves the latest commit's diff in the web interface. The alternative is to install the package globally and run the same command; both read whatever git repository you are standing in.

What are the special arguments in difit?

A dot means all uncommitted changes, covering both the staging area and unstaged files, the word staged means the staging area alone, and the word working means unstaged changes alone. Including untracked files automatically only applies with the dot or the word working.

Can difit review a GitHub pull request?

Yes, with the pull request flag and a URL. It fetches the patch by running the GitHub CLI diff command underneath, and imports unresolved inline review threads as startup comments. Authentication is the GitHub CLI's, either a login or a token environment variable.

How does difit decide to read from stdin?

By intent rather than by sniffing. A dash explicitly enables stdin mode, positional arguments or the pull request flag force git or pull request mode and suppress reading stdin, and automatic detection only happens when no explicit mode was selected and stdin is a pipe, file or socket.

Where does difit store review comments?

In the browser's local storage, scoped per commit, which is what lets the copy prompt buttons produce text for an agent. The command line can also inject comments at startup through a repeatable comment flag that accepts a JSON object or array.

What port does the difit server use?

Port 4966 by default, falling back to the next port if it is occupied. The host defaults to the loopback address, and the documentation notes you would use the all-interfaces address for external access.

Official sources

  1. License: MIT
  2. Project website
  3. README
  4. Releases
  5. yoshiko-pg/difit on GitHub
Community

Where developers are discussing it

Posts on Hacker News, dev.to and Lobsters that link to this repository, found by our scan of those communities. 1 in the last 30 days; newest first.

Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/yoshiko-pg-difit.svg)](https://hysenlabs.com/projects/yoshiko-pg-difit)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/yoshiko-pg-difit.svg)](https://hysenlabs.com/projects/yoshiko-pg-difit)

Was this useful?