Skip to main content

AI-powered semantic analysis of git commits

Project description

semantic-diff

AI-powered semantic analysis of git commits. Goes beyond git diff to show intent, impact, risk, and review questions.

What it does

Regular git diff shows what changed. semantic-diff shows:

  • ๐ŸŽฏ Intent โ€” What was the developer trying to accomplish? (not what changed, but why)
  • ๐Ÿ—บ๏ธ Impact Map โ€” What parts of the system are affected directly and indirectly?
  • โš ๏ธ Risk Assessment โ€” What could break? Edge cases? Breaking changes?
  • โ“ Review Questions โ€” What should a reviewer ask the author?

Installation

# Clone the repo
git clone git@github.com:tkenaz/semantic_diff.git
cd semantic_diff

# Create virtual environment
python -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate

# Install
pip install -e .

Configuration

Create a .env file:

ANTHROPIC_API_KEY=sk-ant-...
SEMANTIC_DIFF_MODEL=claude-sonnet-4-5-20250929  # or claude-opus-4-5-20251101
SEMANTIC_DIFF_MAX_RETRIES=3  # optional, API retry attempts
SEMANTIC_DIFF_MAX_WAIT=30.0  # optional, max total retry wait time in seconds

Usage

# Analyze HEAD commit in current repo
semantic-diff

# Analyze specific commit
semantic-diff abc123

# Analyze commit in another repo
semantic-diff HEAD --repo /path/to/repo

# Output as JSON (for piping to other tools)
semantic-diff HEAD --json

# Verbose mode
semantic-diff HEAD -v

Example Output

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ๐Ÿ“‹ Semantic Diff Analysis โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Fix authentication bypass in login endpoint                       โ”‚
โ”‚                                                                    โ”‚
โ”‚ abc12345 by developer@example.com                                  โ”‚
โ”‚ 2024-12-22T10:30:00                                                โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ๐ŸŽฏ Intent โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Prevent unauthorized access by validating session tokens  โ”‚
โ”‚ before processing login requests.                         โ”‚
โ”‚                                                            โ”‚
โ”‚ Confidence: [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘] 85%                               โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โš ๏ธ Risk Assessment โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Overall Risk: โšก HIGH                                      โ”‚
โ”‚                                                            โ”‚
โ”‚ โš ๏ธ  BREAKING CHANGES DETECTED                              โ”‚
โ”‚                                                            โ”‚
โ”‚ Identified Risks:                                          โ”‚
โ”‚   โšก [high] Existing sessions may be invalidated           โ”‚
โ”‚      ๐Ÿ’ก Mitigation: Add migration for active sessions      โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black semantic_diff
ruff check semantic_diff

License

MIT โ€” Kenaz GmbH

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

semantic_diff-0.1.0.tar.gz (22.5 kB view details)

Uploaded Source

Built Distribution

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

semantic_diff-0.1.0-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file semantic_diff-0.1.0.tar.gz.

File metadata

  • Download URL: semantic_diff-0.1.0.tar.gz
  • Upload date:
  • Size: 22.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for semantic_diff-0.1.0.tar.gz
Algorithm Hash digest
SHA256 32d86d46a97f24425c2bc06dd5d9d9e67d96c3219a51f565f859cfc9c4854d11
MD5 4859f6885ba029ac3c34a6ea5847ae09
BLAKE2b-256 d3f42f8f495c9a0596470ab90bb905a565acb3cae92359ecac21513c3ec12c4f

See more details on using hashes here.

File details

Details for the file semantic_diff-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: semantic_diff-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for semantic_diff-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 638001d78b7df5ec5f6a8a5277fdfaf2d4f5e331a8d66819f43ad9bc3011d2c8
MD5 d24b5084c4560b34d80179c0e5cac2d8
BLAKE2b-256 b61423b32aba638e645cd83f16b0400ca781d8733e593ba92d795a18d3fa6513

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