AI-powered Git commit assistant and PR analyzer.
Project description
PromptGitX
PromptGitX is an AI-powered Git commit assistant built as a Python CLI. It is intended to help generate clean commit messages, review staged changes, and manage LLM provider configuration from the terminal.
Features
- Interactive CLI built with Typer
- Rich terminal welcome screen
- LLM provider configuration for Groq, OpenAI, Anthropic, Gemini, and Ollama
- AI review reports for commits, commit ranges, pull requests, and staged changes
- LangGraph-based review workflow
- Hunk-based splitting for large file diffs instead of silent trimming
- Verified changed-line references from Git diff hunks
- Terminal, JSON, TXT, DOCX, and PDF report output
Project Structure
pyproject.toml # PyPI/build metadata
src/
promptgitx/
main.py # CLI entry point
ai/ # AI review/report helpers
prompts/ # LangChain prompt templates
config/ # LLM provider configuration helpers
gitcodes/ # Git diff and repository helpers
misc/ # Rich/figlet terminal UI helpers
Setup
- Create and activate a virtual environment:
python -m venv .venv
source .venv/bin/activate
- Install dependencies:
pip install -r requirements.txt
For package-style local development, install the project in editable mode:
pip install -e .
- Configure your LLM provider:
promptgitx config
How To Run
Recommended local development command after pip install -e .:
promptgitx
View available commands:
promptgitx --help
Show the installed version:
promptgitx --version
You can also run directly from source without installing:
python3 src/promptgitx/main.py
Or run it as a package module:
PYTHONPATH=src python3 -m promptgitx.main
Commands
Configure an LLM provider interactively:
promptgitx config
Configure a provider with CLI options:
promptgitx config --provider ollama --models llama3
promptgitx config --provider openai --models gpt-4o-mini --api-key YOUR_API_KEY
Reset configuration:
promptgitx config --reset
Start the chat command:
promptgitx chat
Generate a review report:
promptgitx analyze
Analyze examples:
promptgitx analyze --staged
promptgitx analyze --last
promptgitx analyze --last-n 3
promptgitx analyze --commit COMMIT_HASH
promptgitx analyze --compare main..feature-branch
promptgitx analyze --pr 123
Output modes:
promptgitx analyze --last --summary
promptgitx analyze --last --json
promptgitx analyze --last --save report.txt
promptgitx analyze --last --save report.json
promptgitx analyze --last --save report.docx
promptgitx analyze --last --save report.pdf
If --save is not passed, PromptGitX asks whether you want to save the report after displaying it.
Use only one review target per command, such as --last or --staged, not both.
--json prints raw JSON without the welcome banner so it can be used in scripts.
CLI Option Reference
Global options:
| Long option | Short option | Description |
|---|---|---|
--version |
none | Show the installed PromptGitX version and exit. |
--help |
none | Show CLI help. |
promptgitx config options:
| Long option | Short option | Description |
|---|---|---|
--provider |
-p |
LLM provider to configure: groq, openai, anthropic, gemini, or ollama. |
--models |
-m |
Comma-separated list of up to five model names. |
--api-key |
none | API key for cloud providers. |
--base-url |
none | Base URL for local providers like Ollama. |
--use |
-u |
Switch to an already configured provider. |
--reset |
-r |
Reset saved configuration. |
promptgitx analyze target options:
| Long option | Short option | Description |
|---|---|---|
--commit |
-c |
Review one specific commit. |
--commits |
-C |
Review multiple commits. Can be provided more than once. |
--compare |
-p |
Review a comparison such as main..feature-branch. |
--pr |
-P |
Review a GitHub pull request by number. Requires GitHub CLI. |
--last |
-l |
Review the latest commit. |
--last-n |
-n |
Review the last N commits. |
--staged |
-s |
Review staged changes. |
promptgitx analyze output options:
| Long option | Short option | Description |
|---|---|---|
--json |
none | Print the raw structured JSON report. |
--summary |
none | Print only the short review summary. |
--save |
none | Save the report to .txt, .json, .docx, or .pdf. |
Configuration
PromptGitX supports the following providers:
- Groq
- OpenAI
- Anthropic
- Gemini
- Ollama
The config command writes provider settings to ~/.promptgitx/.env, including the current provider, API key or base URL, and up to five model names. This keeps PromptGitX configuration stable no matter which project directory you run the CLI from.
If you intentionally want a different config file, set PROMPTGITX_ENV_PATH to an explicit path before running PromptGitX.
The welcome screen displays the active model as:
Model: <PROVIDER> | <MODEL_NAME>
PromptGitX uses the first configured model for the active provider first. During one analyze run, if a model call fails, PromptGitX advances to the next configured model and keeps using that model for later chunks in the same run.
Analyze Workflow
The analyze command uses a LangGraph workflow:
load_diff
-> parse_diff
-> split_large_chunks
-> review_chunks
-> merge_file_reviews
-> final_report
Workflow details:
load_diffcollects the requested Git diff usinggitorgh.parse_diffconverts the raw diff into file-level chunks and computes changed-line references from diff hunk headers.split_large_chunkssplits oversized file chunks into hunk-based review chunks without dropping diff data.review_chunkssends each review chunk to the configured LLM and validates returned references.merge_file_reviewscombines subchunk reviews back into one review per file.final_reportbuilds the structured report with risk, recommendation, grouped issues, and output-ready data.
Large diffs are split by hunks instead of being cut at an arbitrary character limit. If a single hunk is very large, PromptGitX keeps that hunk intact to avoid corrupting line references.
The final report is mostly built by deterministic Python logic. The LLM reviews individual chunks; Python then normalizes issues, validates references, merges file reviews, calculates risk, and formats the final outputs.
Build For Upload
Build source and wheel distributions:
python3 -m build --sdist --wheel
The files will be created in:
dist/
Status
This project is in early development. The review report workflow is functional, including saved TXT, JSON, DOCX, and PDF outputs. The chat command is still a placeholder.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file promptgitx-0.7.0.tar.gz.
File metadata
- Download URL: promptgitx-0.7.0.tar.gz
- Upload date:
- Size: 43.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0465f2d63b318fb452ce71c00f139fb8f292825d2dd6ad3d57a421987d2e2bb0
|
|
| MD5 |
79239e8d071c3812db5a90a3c416743d
|
|
| BLAKE2b-256 |
49c2ef13318b6c02387f5607f44c9215c0bdbe4134e0141c4d51104d8a700055
|
File details
Details for the file promptgitx-0.7.0-py3-none-any.whl.
File metadata
- Download URL: promptgitx-0.7.0-py3-none-any.whl
- Upload date:
- Size: 51.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0f82b8fdc0a576457378ec4bf54689d51fc71a21060db55c0557c36abcd21b5
|
|
| MD5 |
4e5ccdeaff29509927d494ecd4f26b58
|
|
| BLAKE2b-256 |
2b689f4334587c0d4a641c9f8e06ef875dba529c0a3bda1c0448442a8f15df8f
|