Skip to main content

aidiff

Track which lines in your codebase were written by AI.

PyPI version PyPI downloads License: MIT

aidiff demo


aidiff is git blame for AI-generated code. It tracks, scores, and visualizes how much of your codebase was written by AI assistants like Copilot, Claude, ChatGPT, and Cursor.

Why?

AI-generated code is becoming a significant portion of modern codebases. Studies show that AI-assisted developers accept ~30% of suggestions, and that number is growing fast.

But nobody tracks it. This creates invisible technical debt:

  • Which files are mostly AI-generated?
  • Are AI-written functions getting proper review?
  • What's your team's actual AI code ratio over time?

aidiff answers these questions.

Quick Start

pip install aidiff

cd your-repo
aidiff scan          # Scan and show AI ratio
aidiff status        # Full statistics
aidiff report        # Generate HTML report

That's it. Three commands to understand your AI code footprint.

How It Works

aidiff uses a hybrid detection approach:

  1. Explicit tags - # ai-generated, Co-authored-by: Claude, [AI] in commits
  2. Commit analysis - Patterns in commit messages indicating AI involvement
  3. Heuristic analysis - Detects AI coding patterns:
    • Overly verbose variable names (user_authentication_token_validation)
    • Redundant comments (# Initialize the result dictionary)
    • Placeholder TODOs (# TODO: Add error handling)
    • Docstrings longer than the function body
    • Universal type hints on every function

Commands

Command Description
aidiff scan Scan repo and calculate AI ratio
aidiff status Show full statistics with tables
aidiff track <file> Show AI-scored lines in a file
aidiff report Generate HTML report with charts
aidiff install Install pre-commit git hook
aidiff check --ci CI-friendly output for pipelines
aidiff init-action Generate GitHub Action workflow

HTML Report

aidiff report generates a beautiful, self-contained HTML report with:

  • AI code ratio trends over time (Chart.js)
  • File-by-file AI score heatmap
  • Contributor AI usage breakdown
  • Recent commit AI classification

GitHub Action

aidiff init-action  # Generates .github/workflows/aigate.yml

This creates a GitHub Action that automatically comments on PRs with the AI code ratio, warning when it exceeds 70%.

Git Hook

aidiff install  # Installs pre-commit hook

Automatically runs aidiff scan before each commit, keeping .aidiff/data.json up to date.

Configuration

aidiff stores data in .aidiff/data.json in your repo root. This file is meant to be committed and shared with your team.

Insiders

Early supporters get priority features and direct input on the roadmap.

Become a Sponsor to unlock:

  • Custom detection rules
  • Team dashboard
  • Slack/Discord notifications
  • Priority support

License

MIT

Download files

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

Source Distribution

aidiff-0.1.1.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

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

aidiff-0.1.1-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file aidiff-0.1.1.tar.gz.

File metadata

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

File hashes

Hashes for aidiff-0.1.1.tar.gz
Algorithm Hash digest
SHA256 fbcca50507b27f1f006f9e55e34fd9fe5834ddc6874acf2c5b013b31e3c6e652
MD5 948edec66a871f715ddd230272ff969f
BLAKE2b-256 82eb4bab55c347c50193bed5cbd3907e028875eb6a042ce98c2825f849e379ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for aidiff-0.1.1.tar.gz:

Publisher: publish.yml on techino35/aidiff

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

File details

Details for the file aidiff-0.1.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for aidiff-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 33a3b9033ea79c269ac0a8353e1621a56c5fd7ce60670aec464086a9cbd62a48
MD5 2c5263cc242ae25605c69fbb665fdf30
BLAKE2b-256 f9bf441b9c42f2a5049fbb5beafe697b7326205b58fd1868fbd7c119e0e8cee0

See more details on using hashes here.

Provenance

The following attestation bundles were made for aidiff-0.1.1-py3-none-any.whl:

Publisher: publish.yml on techino35/aidiff

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

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

Supported by

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