Built-in Module

git.diff

Generate git diffs for AI code review workflows. Outputs diff text that can be passed to ai.generate.

Configuration

ParameterTypeRequiredDescription
operationstringYesOperation type: diff, log, show
base_branchstringNoBranch to diff against (default: main)
max_linesnumberNoMaximum diff lines to return (default: 500)

Examples

Generate PR Diff

json
{
  "id": "get_diff",
  "type": "git.diff",
  "config": {
    "operation": "diff",
    "base_branch": "main",
    "max_lines": 300
  }
}

Full AI Code Review Workflow

json
{
  "name": "code-review",
  "steps": [
    {
      "id": "get_diff",
      "type": "git.diff",
      "config": {
        "operation": "diff",
        "base_branch": "main"
      }
    },
    {
      "id": "ai_review",
      "type": "ai.generate",
      "config": {
        "prompt": "Review this code diff and provide feedback:\n{{steps.get_diff.diff}}",
        "model": "gpt-4"
      },
      "depends_on": ["get_diff"]
    },
    {
      "id": "notify",
      "type": "slack.notify",
      "config": {
        "webhook_url": "{{env.SLACK_WEBHOOK_URL}}",
        "message": "Code Review:\n{{steps.ai_review.text}}"
      },
      "depends_on": ["ai_review"]
    }
  ]
}

Output

  • diff - The git diff text
  • files_changed - Number of files changed
  • insertions - Lines inserted
  • deletions - Lines deleted