Track which lines in your codebase were written by AI
Project description
aidiff
Track which lines in your codebase were written by AI.
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:
- Explicit tags -
# ai-generated,Co-authored-by: Claude,[AI]in commits - Commit analysis - Patterns in commit messages indicating AI involvement
- 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
- Overly verbose variable names (
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbcca50507b27f1f006f9e55e34fd9fe5834ddc6874acf2c5b013b31e3c6e652
|
|
| MD5 |
948edec66a871f715ddd230272ff969f
|
|
| BLAKE2b-256 |
82eb4bab55c347c50193bed5cbd3907e028875eb6a042ce98c2825f849e379ca
|
Provenance
The following attestation bundles were made for aidiff-0.1.1.tar.gz:
Publisher:
publish.yml on techino35/aidiff
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aidiff-0.1.1.tar.gz -
Subject digest:
fbcca50507b27f1f006f9e55e34fd9fe5834ddc6874acf2c5b013b31e3c6e652 - Sigstore transparency entry: 1232876415
- Sigstore integration time:
-
Permalink:
techino35/aidiff@25ef9654419d21fc6a064525567dd365f475af69 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/techino35
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@25ef9654419d21fc6a064525567dd365f475af69 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33a3b9033ea79c269ac0a8353e1621a56c5fd7ce60670aec464086a9cbd62a48
|
|
| MD5 |
2c5263cc242ae25605c69fbb665fdf30
|
|
| BLAKE2b-256 |
f9bf441b9c42f2a5049fbb5beafe697b7326205b58fd1868fbd7c119e0e8cee0
|
Provenance
The following attestation bundles were made for aidiff-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on techino35/aidiff
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aidiff-0.1.1-py3-none-any.whl -
Subject digest:
33a3b9033ea79c269ac0a8353e1621a56c5fd7ce60670aec464086a9cbd62a48 - Sigstore transparency entry: 1232876512
- Sigstore integration time:
-
Permalink:
techino35/aidiff@25ef9654419d21fc6a064525567dd365f475af69 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/techino35
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@25ef9654419d21fc6a064525567dd365f475af69 -
Trigger Event:
push
-
Statement type: