{"id":31526149,"url":"https://github.com/pranavkakde/git-commit-ai","last_synced_at":"2026-04-19T03:01:50.640Z","repository":{"id":313506464,"uuid":"1050918670","full_name":"pranavkakde/git-commit-ai","owner":"pranavkakde","description":"AI based GIT commit message generator. It can be used as a cli and through GIT Hooks.","archived":false,"fork":false,"pushed_at":"2025-09-06T13:22:16.000Z","size":204,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-25T16:07:49.308Z","etag":null,"topics":["ai","cli","commit","git","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pranavkakde.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-05T06:38:56.000Z","updated_at":"2025-09-06T13:22:18.000Z","dependencies_parsed_at":"2025-09-06T15:22:03.837Z","dependency_job_id":"a2bfd300-b440-421c-9d71-534bb72071e3","html_url":"https://github.com/pranavkakde/git-commit-ai","commit_stats":null,"previous_names":["pranavkakde/git-commit-ai"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pranavkakde/git-commit-ai","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pranavkakde%2Fgit-commit-ai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pranavkakde%2Fgit-commit-ai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pranavkakde%2Fgit-commit-ai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pranavkakde%2Fgit-commit-ai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pranavkakde","download_url":"https://codeload.github.com/pranavkakde/git-commit-ai/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pranavkakde%2Fgit-commit-ai/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31992822,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","cli","commit","git","python"],"created_at":"2025-10-03T19:32:15.470Z","updated_at":"2026-04-19T03:01:50.634Z","avatar_url":"https://github.com/pranavkakde.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## git-commit-ai\n\n![git-commit-ai](git-commit-ai-image.png)\n\n### Overview\n**git-commit-ai** generates high‑quality Git commit messages from your staged changes using an LLM. You can use it:\n- **CLI**: run `cli.py` in any repo to print a suggested message\n- **Git hook**: plug into `prepare-commit-msg` to auto‑populate messages\n- **gRPC**: run a local server and call it from the hook or the provided client\n\n### Features\n- **Multiple LLM providers**: Gemini, OpenAI, Anthropic (select via config)\n- **Simple config** via `config.yml` and `.env`\n- **Two integration modes**: direct CLI or gRPC server/client\n- **Windows-friendly** (use Git Bash for the hook script)\n\n---\n\n## Installation\n### Requirements\n- Python \u003e= 3.13\n- Git installed and available on PATH\n- Install [grpcurl](https://github.com/fullstorydev/grpcurl)\n\n### Install dependencies\nFrom the project root:\n\n```bash\npip install -e .\n# or, if you prefer to install deps directly from pyproject\npip install -r \u003c(python - \u003c\u003cPY\nimport tomllib, sys\nwith open('pyproject.toml','rb') as f:\n    print('\\n'.join(tomllib.load(f)['project']['dependencies']))\nPY\n)\n```\n\nNote: The project includes `pyproject.toml` (and `uv.lock` if you use `uv`). Any modern Python package manager (pip/uv/poetry/pdm) will work.\n\n---\n\n## Configuration\n### 1) Environment variables\nCreate a `.env` file in the project root:\n\n```env\nLLM_API_KEY=your_provider_api_key\n```\n\n### 2) `config.yml`\nEdit `config.yml` to select the model provider, model name, your local repo path, and gRPC port:\n\n```yaml\nmodel_config:\n  - model_provider: \"gemini\"   # one of: gemini, openai, anthropic\n  - model_name: \"gemini-2.0-flash\"\ngit_config:\n  - local_git_path: \"C:\\\\path\\\\to\\\\your\\\\repo\"  # used by CLI mode\ngrpc_config:\n  - grpc_server_port: 50051\n```\n\nNotes:\n- `LLM_API_KEY` must match the selected provider (e.g., Gemini/OpenAI/Anthropic key).\n- In CLI mode, the repo at `local_git_path` is read to compute staged diffs.\n- The gRPC client is configured to call `localhost:50051` by default; keep this in sync with `grpc_server_port`.\n\n---\n\n## Usage\n### CLI\nRuns directly against the repo specified in `config.yml` (`git_config.local_git_path`). Prints a suggested commit message to stdout.\n\n```bash\npython cli.py\n```\n\nUnder the hood:\n- Staged changes are collected from `git_stage.get_staged_changes()`\n- A prompt is built in `prompt.get_prompt()`\n- The provider client is chosen in `model_provider.get_model_instance()`\n\n### gRPC Server\nStart the server (default port from `config.yml`):\n\n```bash\npython grpc_server/server.py\n```\n\nThis starts `GITCommitMessageServicer` which exposes `GetCommitMessage`. It accepts a diff string and returns the generated commit message.\n\n### gRPC Client (manual test)\nWith the server running, you can call it using the provided client:\n\n```bash\npython grpc_client/client.py\n```\n\nThe client sends your staged diff (`git diff --cached`) to the server and prints the returned message.\n\n---\n\n## Git Hook Integration (prepare-commit-msg)\nYou can wire the hook to call the gRPC server and auto‑populate your commit message. `prepare-commit-msg` utilizes `grpcurl` to call server to get commit message. If you want to use python script `grpc_client\\client.py` update `prepare-commit-msg` script. \n\n1) Ensure the gRPC server is running:\n```bash\npython grpc_server/server.py\n```\n\n2) Copy the provided hook script into your repo’s `.git/hooks` directory as `prepare-commit-msg`:\n```bash\ncp hook/prepare-commit-msg /path/to/your/repo/.git/hooks/prepare-commit-msg\nchmod +x /path/to/your/repo/.git/hooks/prepare-commit-msg\n```\n\n3) Commit as usual. The hook will call the gRPC client and replace the commit message with the generated one.\n\nNotes:\n- The sample hook is a Bash script. On Windows, use Git Bash.\n- Make sure the client path invoked by the hook matches your setup. The reference implementation here expects the Python client to be reachable and will print the generated message to stdout.\n\n---\n\n## How it works (high level)\n- `cli.py`: Reads staged changes from `git_stage.get_staged_changes()` and prints the generated message\n- `llm_client.py`: Builds the prompt and calls the configured provider client\n- `model_provider.py`: Provider abstraction for Gemini, OpenAI, Anthropic\n- `grpc_server/server.py`: Exposes `GetCommitMessage` via gRPC\n- `grpc_client/client.py`: Sends `git diff --cached` to the server and prints the response\n- `prompt.py`: Prompt template for summarizing diffs into commit messages\n- `config.py` / `config.yml`: Loads and validates runtime configuration\n\n---\n\n## Troubleshooting\n- No output or invalid API key: verify `.env` has `LLM_API_KEY` and matches the provider\n- Empty suggestions: ensure you have staged changes (`git add ...`), and the correct repo path in `config.yml`\n- gRPC errors: confirm the server is running on the configured port and the client points to the same port\n- Hook not firing: verify the script is executable and placed at `.git/hooks/prepare-commit-msg`; use Git Bash on Windows\n\n---\n\n## License\nDistributed under the MIT License. See `LICENSE` for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpranavkakde%2Fgit-commit-ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpranavkakde%2Fgit-commit-ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpranavkakde%2Fgit-commit-ai/lists"}