{
  "slug": "diff-code",
  "name": "gizza-ai/diff-code",
  "version": "0.1.0",
  "title": "Code Diff — Compare Two Code Snippets Side by Side — gizza.ai",
  "description": "Paste two code snippets and compare them side by side, with word- or character-level highlighting, a unified patch view, and change stats.",
  "tags": [
    "code diff",
    "compare code",
    "side by side diff",
    "word diff",
    "unified diff",
    "text compare",
    "developer"
  ],
  "category": "text",
  "urls": {
    "page": "https://gizza.ai/tools/diff-code/",
    "markdown": "https://gizza.ai/tools/diff-code/index.md",
    "descriptor": "https://gizza.ai/tools/diff-code/tool.json",
    "deep_link_example": "https://gizza.ai/tools/diff-code/?left=fn%20main%28%29%20%7B%0A%20%20%20%20println%21%28%22hi%22%29%3B%0A%7D&right=fn%20main%28%29%20%7B%0A%20%20%20%20println%21%28%22hello%22%29%3B%0A%20%20%20%20println%21%28%22world%22%29%3B%0A%7D&view=side-by-side&granularity=word&ignore_case=true&ignore_whitespace=true&context=3&line_numbers=true&width=60"
  },
  "cli": "gizza tool diff-code 'fn main() {\n    println!(\"hi\");\n}' 'right=fn main() {\n    println!(\"hello\");\n    println!(\"world\");\n}'",
  "tool": {
    "description": "Compare two code or text snippets and render the difference as side-by-side columns, a clean unified patch, a merged word-diff stream, a stat summary, or structured JSON. Uses a patience diff so repeated braces and blank lines stay aligned, then refines each changed line pair at word or character level and marks it with the git word-diff convention [-removed-]/{+added+}. Optional case-insensitive and whitespace-insensitive matching never alters the text that is echoed back. Context lines collapse unchanged regions. Limit 1 MB per side.",
    "parameters": {
      "additionalProperties": false,
      "properties": {
        "context": {
          "default": 3,
          "description": "Unchanged lines kept around each change; further runs collapse into a '… N unchanged lines …' marker. 0 shows only changes. Default 3.",
          "maximum": 100,
          "minimum": 0,
          "type": "integer"
        },
        "granularity": {
          "default": "word",
          "description": "Intra-line refinement for a changed line pair: 'word' marks changed tokens (default), 'char' marks individual characters, 'none' marks the whole line. Lines over 400 tokens per side fall back to whole-line marking.",
          "enum": [
            "word",
            "char",
            "none"
          ],
          "type": "string"
        },
        "ignore_case": {
          "default": false,
          "description": "Compare lines case-insensitively. Matching only — the output always echoes the original text. Default false.",
          "type": "boolean"
        },
        "ignore_whitespace": {
          "default": false,
          "description": "Collapse runs of whitespace and trim line ends before comparing. Matching only — the output always echoes the original text. Default false.",
          "type": "boolean"
        },
        "left": {
          "description": "The original/left code or text, newline-separated. Max 1 MB. Example: \"fn main() {\\n    println!(\\\"hi\\\");\\n}\".",
          "type": "string"
        },
        "line_numbers": {
          "default": true,
          "description": "Show per-side line numbers in the side-by-side and word-diff views. Ignored by 'unified', 'stats', and 'json'. Default true.",
          "type": "boolean"
        },
        "right": {
          "description": "The updated/right code or text to compare against left, newline-separated. Max 1 MB.",
          "type": "string"
        },
        "view": {
          "default": "side-by-side",
          "description": "How to render the diff: 'side-by-side' two aligned columns (default), 'unified' a clean @@ patch you can apply, 'word-diff' one merged stream using [-removed-]/{+added+}, 'stats' counts and similarity, 'json' a structured report with rows and spans.",
          "enum": [
            "side-by-side",
            "unified",
            "word-diff",
            "stats",
            "json"
          ],
          "type": "string"
        },
        "width": {
          "default": 60,
          "description": "Per-column content width in characters for the side-by-side view; tabs expand to 4 spaces for alignment. Default 60.",
          "maximum": 200,
          "minimum": 20,
          "type": "integer"
        }
      },
      "required": [
        "left",
        "right"
      ],
      "type": "object"
    }
  }
}