Skip to main content

Terminal diff viewer with inline review comments

Project description

nit

Terminal diff viewer with inline review comments.

Navigate diffs with vim-style keybindings, leave comments on specific lines, and persist them as structured JSON. Useful for code review workflows, self-review before committing, and giving feedback to AI coding tools.

Install

brew install joshuazd/tap/nit

Or via pip/pipx:

pipx install nit-cli

Or from source:

git clone https://github.com/joshuazd/nit.git
pipx install ./nit

Usage

# Review current branch changes (vs main/master)
nit

# Review unstaged changes
nit --mode unstaged

# Review all uncommitted changes
nit --mode all

# Review a specific commit range
nit HEAD~3..HEAD
nit main..feature

# Review any file (read-only, no git required)
nit path/to/file.py

# Filter to specific files or directories
nit --path src/
nit --path src/nit/app.py main..feature

# Export comments on quit
nit --export-comments comments.md
nit --export-comments - --export-format json  # stdout as JSON

On main/master, nit defaults to unstaged mode. On feature branches, it defaults to branch diff. The diff auto-refreshes every 5 seconds.

Keybindings

Key Action
j / k Move cursor down / up
J / K Jump to next / previous hunk
n / p Next / previous file
] / [ Jump to next / previous comment
gg / G Jump to top / bottom
c Add comment on current line
d Delete comment on current line
e Export comments to clipboard
m Cycle diff mode (branch / unstaged / staged / all)
s Toggle side-by-side diff view
w Toggle word-level diff highlighting
W Toggle hide whitespace-only changes
h Toggle syntax highlighting
r Refresh diff
q Quit

Git operations (g-prefixed)

Key Action
ga Stage hunk under cursor
gu Unstage hunk (staged mode)
gx Discard hunk
gc Commit with message prompt

Comment Storage

Comments are saved to .nit.json at the root of your git repository. The format is structured JSON:

{
  "version": 1,
  "branch": "my-feature",
  "base": "main",
  "comments": [
    {
      "file": "src/app.py",
      "line": 42,
      "line_content": "    return result",
      "comment": "Should handle the empty case here",
      "hunk_context": ["...", "..."],
      "timestamp": "2025-01-15T10:30:00+00:00",
      "diff_mode": "branch"
    }
  ]
}

Add .nit.json to your global gitignore to keep comments local:

echo '.nit.json' >> ~/.config/git/ignore

Claude Code Integration

nit works as a review tool for Claude Code. Leave comments on Claude's changes using nit, then have Claude read them with /nit. This creates a feedback loop where you can guide Claude's work through inline code review.

Install the plugin

In Claude Code:

/plugin marketplace add joshuazd/nit
/plugin install nit

Then use /nit in any project to have Claude read and address your comments.

Local development

If you cloned the repo, you can test the plugin directly:

claude --plugin-dir /path/to/nit

Development

git clone https://github.com/joshuazd/nit.git
cd nit
pip install -e ".[dev]"
pytest

The ./nit bootstrap script auto-creates a virtualenv at ~/.local/share/nit/venv for quick local use without a manual install.

License

GPL-3.0 - see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nit_cli-0.4.2.tar.gz (37.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nit_cli-0.4.2-py3-none-any.whl (32.0 kB view details)

Uploaded Python 3

File details

Details for the file nit_cli-0.4.2.tar.gz.

File metadata

  • Download URL: nit_cli-0.4.2.tar.gz
  • Upload date:
  • Size: 37.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nit_cli-0.4.2.tar.gz
Algorithm Hash digest
SHA256 7d03dc2e433753daaeea8526678d6d9ddb3ffaa61a6e6106f50e512d353969b5
MD5 a2ebd05670bf6b0ab7587595cc874f70
BLAKE2b-256 2a40bcb1a19a4e905d770a63ac4cac9da0d6c690b5df941370ea9219ff99f4c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for nit_cli-0.4.2.tar.gz:

Publisher: publish.yml on joshuazd/nit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nit_cli-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: nit_cli-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 32.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nit_cli-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e480cdc797dc2a72247c46b3e57bf5dbd88d71df1807005d3c9faf0aded7df54
MD5 f3398b5c54ce5556d56fa995c678b54c
BLAKE2b-256 4c9e7ac6eb8e61cfefd2828580b894fbb06eef9f74bbf599f6c8d5e619548b72

See more details on using hashes here.

Provenance

The following attestation bundles were made for nit_cli-0.4.2-py3-none-any.whl:

Publisher: publish.yml on joshuazd/nit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page