Skip to main content

A cross-platform command-line tool for file processing and Git repository analysis with support for commit history tracking, code hotspot detection, and customizable filtering options

Project description

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.

Project details


Download files

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

Source Distribution

codet-1.1.0.tar.gz (48.1 kB view details)

Uploaded Source

Built Distribution

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

codet-1.1.0-py3-none-any.whl (45.5 kB view details)

Uploaded Python 3

File details

Details for the file codet-1.1.0.tar.gz.

File metadata

  • Download URL: codet-1.1.0.tar.gz
  • Upload date:
  • Size: 48.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for codet-1.1.0.tar.gz
Algorithm Hash digest
SHA256 558d911c758e459718e34eb2007a9962508b65862589392468e716bca14d4ae2
MD5 8ed029d69bd0d671ccc39f648e403fb6
BLAKE2b-256 885353dd759fca00729074bb2135c12ba228cd1157e73a51079abdd491036cee

See more details on using hashes here.

File details

Details for the file codet-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: codet-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 45.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for codet-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a3117b827a297cc352afb4154c327c447de925f62d299394a7ed7b965127a5d
MD5 8d312889d9d851a4183e105feab41c46
BLAKE2b-256 e73ee50c740684bf3771f900b3f960d3905d8cbfc9fc4aae8e6b81bb066b102d

See more details on using hashes here.

Supported by

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