Skip to content

hegner123/cleanDiff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cleanDiff

Compact git diff as structured JSON. Strips context padding by default, outputting only changed lines grouped by file. Cuts diff token cost by 60-80% compared to raw git diff output.

Works as both an MCP tool and a standalone CLI.

Installation

go build -o cleanDiff
sudo cp cleanDiff /usr/local/bin/
codesign -s - /usr/local/bin/cleanDiff

Or with just:

just install

Usage

CLI

cleanDiff --cli --ref HEAD~1
cleanDiff --cli --staged --stat-only
cleanDiff --cli --path /some/repo --ref main..feature --context 3
cleanDiff --cli --files main.go,util.go

MCP

Register as an MCP server:

claude mcp add --transport stdio --scope user cleanDiff -- cleanDiff

Parameters

Param Type Description
path string Repo path (default: cwd)
ref string Git ref/range (HEAD~1, main..HEAD, etc.)
staged bool Show staged changes (--cached)
stat_only bool File stats only, no line content
file_filter array Restrict to specific files
context_lines int Context lines (default 0)

Output

{
  "summary": {"files_changed": 3, "insertions": 15, "deletions": 8},
  "files": [
    {
      "path": "main.go",
      "status": "modified",
      "insertions": 5,
      "deletions": 2,
      "hunks": [
        {
          "old_start": 10,
          "old_count": 3,
          "new_start": 10,
          "new_count": 4,
          "added": ["new line 1", "new line 2"],
          "removed": ["old line"]
        }
      ]
    }
  ]
}

License

MIT

About

Compact git diff as structured JSON. MCP tool and CLI. Strips context padding, outputs only changed lines. 60-80% fewer tokens than raw diff.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors