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.0.9.tar.gz (48.0 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.0.9-py3-none-any.whl (45.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for codet-1.0.9.tar.gz
Algorithm Hash digest
SHA256 ee420d87c25247e3022809471c2d2cb77c105f3d3f2679b0927e34a20d2ff11a
MD5 1bcabe99b8fb45c3ecd3bc2697765528
BLAKE2b-256 beedab514a677c70c476c60184c3c67f2ddeb1984f0633b3ea3f18affdfcee55

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codet-1.0.9-py3-none-any.whl
  • Upload date:
  • Size: 45.4 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.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 caca4c929f1774efd7b2a6674b0029d2a0bc9085bcc0f54a0e34e2fb22d642e7
MD5 af4e161ab1fa58c463d14feef857af50
BLAKE2b-256 9e799ad3394dfb42ee87c65948411b1c3dbfba3a7af210a221c87c331b67e429

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