Skip to main content

Codet

PyPI version License: MIT CI

A cross-platform command-line tool for Git repository analysis. Profile commit history, detect code hotspots, generate diff reports, and optionally leverage AI for deeper insights. The generated git diff files integrate seamlessly with Cursor for collaborative development.

Features

  • Commit history analysis - browse and filter recent commits by time range, author, email, keyword, or commit hash
  • Code hotspot detection - identify frequently modified files and directories to spot active areas
  • Flexible search modes - union (match any condition) or intersection (match all conditions)
  • Diff report generation - produce aggregated .diff report files for review in Cursor or other tools
  • AI-powered analysis - optional OpenAI / Azure OpenAI integration for automated commit summarization
  • Interactive dashboard - Plotly Dash visualization via the codet-dash command
  • JSON export - structured per-commit JSON output for downstream pipelines (-oj)
  • Cross-platform - works on Windows, macOS, and Linux

Installation

From PyPI

pip install codet

From source

git clone https://github.com/host452b/codet.git
cd codet
pip install -e .

Development dependencies

pip install -e ".[dev]"

Quick Start

# analyze the current repo, last 7 days, with hotspot analysis
codet -d 7 -s

# search for keywords "Triton" and "cuda" in a cloned repo
git clone https://github.com/pytorch/pytorch.git
codet -d 7 -k Triton -k cuda -s -p pytorch

# filter by author email
codet -d 14 -e alice@example.com

# filter by commit hash (supports partial match)
codet -c abc1234

# intersection mode: must match ALL conditions
codet -d 7 -k feature -e dev@example.com -m intersection

CLI Reference

usage: codet [-h] [--version] [-d DAYS] [-e EMAIL] [-u USER] [-k KEYWORD]
             [-c COMMIT] [-g] [-r] [-p PATH] [-s] [-m {union,intersection}]
             [-mo MODEL] [-to API_TOKEN] [-oe OPENAI_ENDPOINT]
             [-cp CUSTOM_PROMPT] [-f INPUT_FILE] [-oj]

Basic Options

Flag Description Default
-d, --days Look back N days for commits 30
-e, --email Filter by author email (repeatable) —
-u, --user Filter by author name (repeatable) —
-k, --keyword Search keyword in commit diffs (repeatable) —
-c, --commit Filter by commit hash, supports partial match (repeatable) —
-g, --debug Enable debug logging False
-r, --recursive Recursively scan subdirectories for git repos True
-p, --path Path to analyze current directory
-s, --hotspot Enable code hotspot analysis True
-m, --mode Search mode: union or intersection union

AI Options

Codet works with any OpenAI-compatible API — just pass the endpoint and model name:

Flag Description Default
-mo, --model Model name as required by your provider (e.g., gpt-4.1, openai/openai/gpt-5-nano, llama3) —
-to, --api-token Bearer token (or set AI_API_TOKEN env var). If not set, AI analysis is skipped —
-oe, --openai-endpoint Base URL of the API (/v1 is appended automatically if missing) —
-cp, --custom-prompt Custom prompt appended to AI analysis —
-f, --input-file Additional file to include in AI analysis —
-oj, --output-cook-json Export per-commit JSON reports to json_cook/ False

Examples with different providers:

# Standard OpenAI
codet -d 10 -s -to $OPENAI_KEY -oe "https://api.openai.com/v1" -mo "gpt-4.1"

# Local Ollama
codet -d 10 -s -to ollama -oe "http://localhost:11434/v1" -mo "llama3"

Dashboard

Codet includes an interactive Plotly Dash dashboard for visualizing analysis results.

# launch dashboard with JSON data directory
codet-dash --json-path json_cook/

Output

Diff Report

Each run generates a git_patch_report_<timestamp>.diff file containing aggregated patches with contextual metadata. Open it directly in Cursor for AI-assisted code review.

JSON Export

With -oj, per-commit JSON files are written to json_cook/<repo_name>/, each containing commit metadata, changed files, and optional AI summaries.

Development

git clone https://github.com/host452b/codet.git
cd codet
pip install -e ".[dev]"

# lint
flake8 . --max-line-length=127

# format
black .
isort .

# test
pytest

License

MIT License. See LICENSE for details.

Metadata

Release files for codet 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for codet 1.1.0
File Size Uploaded
codet-1.1.0.tar.gz 48.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for codet 1.1.0
File Interpreter ABI Platform
codet-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 93.6 kB

Release files / codet-1.1.0.tar.gz

Download URL codet-1.1.0.tar.gz
Size 48.1 kB
Tags Source
SHA-256 checksum
How to use checksums
558d911c758e459718e34eb2007a9962508b65862589392468e716bca14d4ae2
BLAKE2b-256 checksum
How to use checksums
885353dd759fca00729074bb2135c12ba228cd1157e73a51079abdd491036cee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release files / codet-1.1.0-py3-none-any.whl

Download URL codet-1.1.0-py3-none-any.whl
Size 45.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a3117b827a297cc352afb4154c327c447de925f62d299394a7ed7b965127a5d
BLAKE2b-256 checksum
How to use checksums
e73ee50c740684bf3771f900b3f960d3905d8cbfc9fc4aae8e6b81bb066b102d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.9

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.9.9

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page