Metadata-Version: 2.4
Name: cc-ai-tracker
Version: 0.1.5
Summary: Track AI-generated vs human-made code changes in git repos
Project-URL: Homepage, https://github.com/desplega-ai/ai-toolbox/tree/main/ai-tracker
Project-URL: Repository, https://github.com/desplega-ai/ai-toolbox
Author: desplega-ai
License-Expression: MIT
Keywords: ai,analytics,claude,code-tracking,developer-tools,git
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Version Control :: Git
Requires-Python: >=3.11
Requires-Dist: click>=8.0.0
Requires-Dist: plotext>=5.0.0
Requires-Dist: rich>=13.0.0
Description-Content-Type: text/markdown

# AI Tracker

Track what percentage of code changes in git repos are AI-generated (via Claude Code) vs human-made.

## Installation

### Option 1: uvx (recommended)

No installation needed - runs directly from PyPI:

```bash
uvx cc-ai-tracker stats
```

### Option 2: Local install

Install globally with uv:

```bash
uv tool install cc-ai-tracker
```

Or install from source:

```bash
cd ai-tracker
uv tool install .
```

Then run directly:

```bash
ai-tracker stats
```

## Setup

After installation, set up the hooks to start tracking:

```bash
ai-tracker install    # Install all hooks (Claude Code + git)
```

Or with uvx:
```bash
uvx cc-ai-tracker install
```

## Usage

**With uvx:**
```bash
uvx cc-ai-tracker stats           # All-time stats
uvx cc-ai-tracker stats --graph   # Stats + chart for last 7 days
uvx cc-ai-tracker stats --chart --days 14  # Custom chart period
```

**With local install:**
```bash
ai-tracker stats           # All-time stats
ai-tracker stats --graph   # Stats + chart for last 7 days
ai-tracker stats --chart --days 14  # Custom chart period
ai-tracker stats --repo my-project  # Filter by repo
```

## How It Works

1. **Claude Code Hooks** (`PostToolUse`) - Logs every Edit/Write operation with line-level counts
2. **Git Post-commit Hook** - Attributes committed changes to AI or human based on the edit log
3. **CLI Stats** - Queries SQLite database and displays statistics with Rich formatting

## Architecture

```
~/.config/ai-tracker/
├── tracker.db          # SQLite database (WAL mode)
├── cache/              # Temporary cache for Write tool pre-capture
└── git-hooks/
    └── post-commit     # Global git hook (delegates to local hooks)
```

## Database

Data is stored in `~/.config/ai-tracker/tracker.db` using SQLite with WAL mode for concurrent access.

Query the database directly:
```bash
# View recent edits
sqlite3 ~/.config/ai-tracker/tracker.db "SELECT * FROM edits ORDER BY timestamp DESC LIMIT 10"

# View commits with attribution
sqlite3 ~/.config/ai-tracker/tracker.db "SELECT * FROM commits ORDER BY timestamp DESC LIMIT 10"
```

## Uninstall

```bash
ai-tracker uninstall    # Remove all hooks (Claude Code + git)
```
