Skip to content

saadnvd1/cc-diff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cc-diff

Track and view files changed by Claude Code with an fzf-powered diff viewer. Like Cursor, but for your terminal.

See what Claude changed without leaving your terminal. No more guessing what changed!

Installation

git clone https://github.com/saadnvd1/cc-diff
cd cc-diff
./install.sh

This will:

  1. Link cc-diff to ~/.local/bin
  2. Add a PostToolUse hook to Claude Code settings

Make sure ~/.local/bin is in your PATH. Add to your shell config (~/.zshrc or ~/.bashrc):

export PATH="$HOME/.local/bin:$PATH"

Requirements

  • fzf - Interactive file picker
  • git - For diffs
  • Optional: delta for prettier diffs
  • Optional: xclip or xsel for clipboard support on Linux

macOS:

brew install fzf git-delta

Linux (Debian/Ubuntu):

sudo apt install fzf xclip

Usage

From your terminal

cc-diff          # Interactive browser with diff preview
cc-diff list     # List changed files
cc-diff diff     # Show full diff of all changes
cc-diff clear    # Clear log (start fresh before new task)

From within Claude Code

While Claude is waiting for input, prefix with !:

!cc-diff

How It Works

  1. Hook: When Claude Code edits/writes a file, a hook logs the file path to /tmp/cc-diff.log
  2. Viewer: cc-diff reads this log and shows files in an fzf picker with live diff preview

Manual Hook Setup

If the installer couldn't update your settings, add this to ~/.claude/settings.json:

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "cc-diff log"
          }
        ]
      }
    ]
  }
}

Keybindings (in fzf)

Key Action
↑/↓ Navigate files
Enter View full diff in pager
Ctrl-Y Copy file path
Esc Exit

Configuration

Environment variables:

  • CC_DIFF_LOG - Log file path (default: /tmp/cc-diff.log)
  • CC_DIFF_CMD - Diff command (default: git diff)

Workflow

  1. Start a Claude Code session
  2. Run !cc-diff clear to start fresh
  3. Work with Claude...
  4. Run !cc-diff anytime to see what changed
  5. Browse files, preview diffs, review changes

About

Track and view files changed by Claude Code with fzf-powered diff viewer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages