{"id":15750604,"url":"https://github.com/guibranco/dotnet-aicommitmessage","last_synced_at":"2026-04-17T00:03:04.508Z","repository":{"id":257472481,"uuid":"858380211","full_name":"guibranco/dotnet-aicommitmessage","owner":"guibranco","description":"🧠 🤖 This tool generates AI-powered commit messages via Git hooks, automating meaningful message suggestions from OpenAI and others to improve commit quality and efficiency.","archived":false,"fork":false,"pushed_at":"2026-04-01T18:50:48.000Z","size":1240,"stargazers_count":4,"open_issues_count":8,"forks_count":8,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-02T05:49:03.294Z","etag":null,"topics":["ai","ai-powered","api","dotnet-tool","git-commit-messages","git-hooks","hacktoberfest","ia","openai"],"latest_commit_sha":null,"homepage":"http://guilherme.stracini.com.br/dotnet-aicommitmessage/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/guibranco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.MD","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":"2024-09-16T19:45:47.000Z","updated_at":"2026-04-01T18:50:32.000Z","dependencies_parsed_at":"2025-12-15T09:03:15.985Z","dependency_job_id":null,"html_url":"https://github.com/guibranco/dotnet-aicommitmessage","commit_stats":{"total_commits":83,"total_committers":5,"mean_commits":16.6,"dds":0.3975903614457831,"last_synced_commit":"af39d87d52a7cc987bfc4ba0871f58f368b2cd2a"},"previous_names":["guibranco/dotnet-aicommitmessage"],"tags_count":238,"template":false,"template_full_name":null,"purl":"pkg:github/guibranco/dotnet-aicommitmessage","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guibranco%2Fdotnet-aicommitmessage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guibranco%2Fdotnet-aicommitmessage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guibranco%2Fdotnet-aicommitmessage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guibranco%2Fdotnet-aicommitmessage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guibranco","download_url":"https://codeload.github.com/guibranco/dotnet-aicommitmessage/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guibranco%2Fdotnet-aicommitmessage/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31466228,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-06T08:36:52.050Z","status":"ssl_error","status_checked_at":"2026-04-06T08:36:51.267Z","response_time":112,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","ai-powered","api","dotnet-tool","git-commit-messages","git-hooks","hacktoberfest","ia","openai"],"created_at":"2024-10-04T06:41:25.744Z","updated_at":"2026-04-06T09:01:33.052Z","avatar_url":"https://github.com/guibranco.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ![GIT Hooks + OpenAI - Generate GIT commit messages from OpenAI](https://raw.githubusercontent.com/guibranco/dotnet-aicommitmessage/main/docs/images/splash.png)\n\n🧠 🤖 This tool generates AI-powered commit messages via Git hooks, automating meaningful message suggestions from OpenAI and others to improve commit quality and efficiency.\n\n[![GitHub last commit](https://img.shields.io/github/last-commit/guibranco/dotnet-aicommitmessage)](https://wakatime.com/badge/github/guibranco/dotnet-aicommitmessage)\n[![GitHub license](https://img.shields.io/github/license/guibranco/dotnet-aicommitmessage)](https://wakatime.com/badge/github/guibranco/dotnet-aicommitmessage)\n[![time tracker](https://wakatime.com/badge/github/guibranco/dotnet-aicommitmessage.svg)](https://wakatime.com/badge/github/guibranco/dotnet-aicommitmessage)\n\n[![Continuous Integration](https://github.com/guibranco/dotnet-aicommitmessage/actions/workflows/ci.yml/badge.svg)](https://github.com/guibranco/dotnet-aicommitmessage/actions/workflows/ci.yml)\n[![Infisical secrets check](https://github.com/guibranco/dotnet-aicommitmessage/actions/workflows/infisical-secrets-check.yml/badge.svg)](https://github.com/guibranco/dotnet-aicommitmessage/actions/workflows/infisical-secrets-check.yml)\n[![Linter check](https://github.com/guibranco/dotnet-aicommitmessage/actions/workflows/linter.yml/badge.svg?branch=main)](https://github.com/guibranco/dotnet-aicommitmessage/actions/workflows/linter.yml)\n\n---\n\n## What this tool does\n\nGenerates a commit message based on the `git diff` result using the [OpenAI API](https://platform.openai.com/docs/overview).\n\n---\n\n## Requirements\n\n- [OpenAI API key](https://platform.openai.com/api-keys).\n- [.NET 8.0 (or higher) runtime](https://dotnet.microsoft.com/en-us/download/dotnet/8.0).\n- [GIT client](https://git-scm.com/downloads).\n\n---\n\n## Getting started\n\n[![AICommitMessage NuGet Version](https://img.shields.io/nuget/v/AICommitMessage.svg?style=flat)](https://www.nuget.org/packages/AICommitMessage/)\n[![AICommitMessage NuGet Downloads](https://img.shields.io/nuget/dt/AICommitMessage.svg?style=flat)](https://www.nuget.org/packages/AICommitMessage/)\n\nThis repository is available at [NuGet](https://www.nuget.org) under the name [AICommitMessage](https://www.nuget.org/packages/AICommitMessage/).\n\n### Installation\n\n1. Install the tool globally (or per project/repository).\n2. Move to the project folder.\n3. Install the Git hook on the default `hooks` directory.\n\n```ps\ndotnet tool install -g AiCommitMessage\ncd my-project/\ndotnet-aicommitmessage install-hook\ngit add .\ngit commit -m \"\"\n```\n\nUse `git log -1` to review the last commit details and find the automatically generated commit message.\n\n---\n\n### Model Configuration and Settings\n\nTo configure and use models with `dotnet-aicommitmessage`, users need to set their settings once. This setup involves specifying the model, API key, and API URL. These settings will be stored as environment variables for future use.\n\n#### Initial Setup\n\nRun the following commands to configure the model and related settings:\n\n```bash\n# OpenAI GPT-5.1 (flagship model - best quality)\ndotnet-aicommitmessage set-settings -m gpt-5.1 -k {api-key} -u {api-url}\n\n# OpenAI GPT-5 Mini (balanced performance and cost)\ndotnet-aicommitmessage set-settings -m gpt-5-mini -k {api-key} -u {api-url}\n\n# OpenAI GPT-5 Nano (fastest and most cost-effective)\ndotnet-aicommitmessage set-settings -m gpt-5-nano -k {api-key} -u {api-url}\n\n# OpenAI GPT-4o Mini\ndotnet-aicommitmessage set-settings -m gpt-4o-mini -k {api-key} -u {api-url}\n\n# Azure AI Llama\ndotnet-aicommitmessage set-settings -m llama-3-1-405b-instruct -k {api-key} -u {api-url}\n```\n\nReplace `{api-key}` with your API key and `{api-url}` with the URL of your API provider.\n\n#### Switching Models\n\nAfter the initial setup, you can easily switch between models without needing to provide the API key or URL again:\n\n```bash\ndotnet-aicommitmessage set-settings -m gpt-5.1\ndotnet-aicommitmessage set-settings -m gpt-5-mini\ndotnet-aicommitmessage set-settings -m gpt-5-nano\ndotnet-aicommitmessage set-settings -m gpt-4o-mini\ndotnet-aicommitmessage set-settings -m llama-3-1-405b-instruct\n```\n\nThis allows for quick model changes while retaining your previously configured API details.\n\n---\n\n#### Supported Models\n\nThe tool supports the following AI models:\n\n| Model | Provider | Description |\n|-------|----------|-------------|\n| `gpt-5.1` | OpenAI | Flagship GPT-5 model with best quality and capabilities |\n| `gpt-5-mini` | OpenAI | Balanced model offering good performance at lower cost |\n| `gpt-5-nano` | OpenAI | Most cost-effective option with fastest response times |\n| `gpt-4o-mini` | OpenAI | Previous generation model, still highly capable |\n| `llama-3-1-405b-instruct` | Azure AI | Meta's Llama model via Azure AI services |\n\n**Default Model**: `gpt-5.1` (automatically used if no model is specified)\n\n---\n\n## Commit message pattern\n\nThe training model for the AI used is designed using as reference these guidelines:\n\n- [Conventional Commits v1.0.0](https://www.conventionalcommits.org/en/v1.0.0/).\n- [Padrões de Commits](https://github.com/tiagolofi/padroes-de-commits) (in Portuguese).\n- [Conventional Commit Messages](https://gist.github.com/qoomon/5dfcdf8eec66a051ecd85625518cfd13).\n- [Emoji for Conventional Commits](https://gist.github.com/parmentf/359667bf23e08a1bd8241fbf47ecdef0).\n- [conventional-commit-types](https://github.com/pvdlg/conventional-commit-types).\n\n---\n\n## Sequence of Execution\n\nHere's a flow diagram showing the sequence of execution of the `prepare-commit-msg` hook and its integration with `dotnet-aicommitmessage` to generate commit messages using the OpenAI API:\n\n```mermaid\ngraph TD\n    A[Git Commit] --\u003e B[prepare-commit-msg Hook Trigger]\n    B --\u003e C[Invoke dotnet-aicommitmessage Tool]\n    C --\u003e D{API Disabled?}\n    D --\u003e|No| E[Send Data to OpenAI API]\n    D --\u003e|Yes| F[Use Fallback Message Generation]\n    E --\u003e G[Generate Commit Message]\n    F --\u003e G\n    G --\u003e H[Check and append pre-defined commands to Commit Message]\n    H --\u003e I[Return Generated Commit Message]\n    I --\u003e J[Insert Commit Message into Git Commit]\n    J --\u003e K[Finalize Commit]\n```\n\n---\n\n## Commands\n\nThis tool accepts an argument as the command to execute. Here is a list of available commands:\n\n| Command                    | Description                                                                                                     |\n| -------------------------- | --------------------------------------------------------------------------------------------------------------- |\n| `install-hook`             | Installs GIT hooks in the default `.git/hooks` directory or in the custom directory configured in GIT settings. |\n| `generate-message`         | Generates a commit message based on the current changes (`git diff` context).                                   |\n| `set-settings`             | Set the OpenAI settings.                                                                                        |\n| `help`                     | Display information about this program.                                                                         |\n| `version`                  | Display version information.                                                                                    |\n\n---\n\n## Example output\n\nHere is an example of the commit messages generated in a real-world project:\n\n![example](https://raw.githubusercontent.com/guibranco/dotnet-aicommitmessage/main/docs/images/dotnet-aicommitmessage.png)\n\n## Debug\n\nYou can run the message generation manually to debug it, but it will not commit the content to your GIT repository. \nIf you also want to check the OpenAI JSON response, append the `-D` parameter.\n\n### Manually generating the commit message\n\nTo manually generate a commit message without committing the staged changes, run the following command:\n\n```ps\ndotnet-aicommitmessage generate-message -m \".\"\n```\n\n### Saving the OpenAI JSON response\n\nIf you want to persist the OpenAI JSON response, add the `-D` parameter, and a `debug.json` file will be created with the response JSON.\n\n```ps\ndotnet-aicommitmessage generate-message -Dm \".\"\n```\n\nHere is a sample `debug.json` content:\n\n```json\n{\n  \"Value\": {\n    \"CreatedAt\": \"2024-11-20T12:54:03+00:00\",\n    \"FinishReason\": 0,\n    \"ContentTokenLogProbabilities\": [],\n    \"RefusalTokenLogProbabilities\": [],\n    \"Role\": 2,\n    \"Content\": [\n      {\n        \"Kind\": 0,\n        \"Text\": \"feat - add reactivation handling for refunds due today\",\n        \"ImageUri\": null,\n        \"ImageBytes\": null,\n        \"ImageBytesMediaType\": null,\n        \"ImageDetailLevel\": null,\n        \"Refusal\": null\n      }\n    ],\n    \"ToolCalls\": [],\n    \"Refusal\": null,\n    \"FunctionCall\": null,\n    \"Id\": \"chatcmpl-[[REDACTED]]\",\n    \"Model\": \"gpt-4o-mini-2024-07-18\",\n    \"SystemFingerprint\": \"fp-[[REDACTED]]\",\n    \"Usage\": {\n      \"OutputTokenCount\": 10,\n      \"InputTokenCount\": 6229,\n      \"TotalTokenCount\": 6239,\n      \"OutputTokenDetails\": {\n        \"ReasoningTokenCount\": 0\n      }\n    }\n  }\n}\n```\n\n---\n\n## Configuration Options\n\nThe tool supports several configuration options through environment variables:\n\n### Set GIT hooks path\n\nBy default, the GIT hooks path is defined at the repository level as `.git\\hooks\\`.\nIf you want to override, or use the `.githooks` directory at the root level of your project, you will need to configure that.\n\nExecute the following GIT command to set (per repository) the GIT hooks path:\n`git config core.hooksPath '.githooks'`\n\n### Disable API Calls\n\nIn some network environments, the OpenAI API may be blocked due to firewall or proxy restrictions. You can disable API calls entirely by setting the following environment variable:\n\n```bash\nexport DOTNET_AICOMMITMESSAGE_DISABLE_API=true\n```\n\nOr on Windows:\n\n```cmd\nset DOTNET_AICOMMITMESSAGE_DISABLE_API=true\n```\n\nWhen this option is enabled, the tool will:\n- Skip any calls to the OpenAI API\n- Display a warning message indicating that API calls are disabled\n- Use fallback commit message generation (either the provided message or a placeholder)\n- Continue to work with branch name processing and issue number extraction\n\n\n### Contributors\n\n\u003c!-- readme: collaborators,contributors,snyk-bot/-,guistracini-outsurance-ie/-,codefactor-io/- -start --\u003e\n\u003ctable\u003e\n\t\u003ctbody\u003e\n\t\t\u003ctr\u003e\n            \u003ctd align=\"center\"\u003e\n                \u003ca href=\"https://github.com/guibranco\"\u003e\n                    \u003cimg src=\"https://avatars.githubusercontent.com/u/3362854?v=4\" width=\"100;\" alt=\"guibranco\"/\u003e\n                    \u003cbr /\u003e\n                    \u003csub\u003e\u003cb\u003eGuilherme Branco Stracini\u003c/b\u003e\u003c/sub\u003e\n                \u003c/a\u003e\n            \u003c/td\u003e\n            \u003ctd align=\"center\"\u003e\n                \u003ca href=\"https://github.com/krisbiradar\"\u003e\n                    \u003cimg src=\"https://avatars.githubusercontent.com/u/104765390?v=4\" width=\"100;\" alt=\"krisbiradar\"/\u003e\n                    \u003cbr /\u003e\n                    \u003csub\u003e\u003cb\u003eKris\u003c/b\u003e\u003c/sub\u003e\n                \u003c/a\u003e\n            \u003c/td\u003e\n            \u003ctd align=\"center\"\u003e\n                \u003ca href=\"https://github.com/Malay-dev\"\u003e\n                    \u003cimg src=\"https://avatars.githubusercontent.com/u/91375797?v=4\" width=\"100;\" alt=\"Malay-dev\"/\u003e\n                    \u003cbr /\u003e\n                    \u003csub\u003e\u003cb\u003eMalay Kumar\u003c/b\u003e\u003c/sub\u003e\n                \u003c/a\u003e\n            \u003c/td\u003e\n            \u003ctd align=\"center\"\u003e\n                \u003ca href=\"https://github.com/RyanFloresTT\"\u003e\n                    \u003cimg src=\"https://avatars.githubusercontent.com/u/53247675?v=4\" width=\"100;\" alt=\"RyanFloresTT\"/\u003e\n                    \u003cbr /\u003e\n                    \u003csub\u003e\u003cb\u003eRyan Flores\u003c/b\u003e\u003c/sub\u003e\n                \u003c/a\u003e\n            \u003c/td\u003e\n\t\t\u003c/tr\u003e\n\t\u003ctbody\u003e\n\u003c/table\u003e\n\u003c!-- readme: collaborators,contributors,snyk-bot/-,guistracini-outsurance-ie/-,codefactor-io/- -end --\u003e\n\n### Bots\n\n\u003c!-- readme: bots,snyk-bot,codefactor-io -start --\u003e\n\u003ctable\u003e\n\t\u003ctbody\u003e\n\t\t\u003ctr\u003e\n            \u003ctd align=\"center\"\u003e\n                \u003ca href=\"https://github.com/dependabot[bot]\"\u003e\n                    \u003cimg src=\"https://avatars.githubusercontent.com/in/29110?v=4\" width=\"100;\" alt=\"dependabot[bot]\"/\u003e\n                    \u003cbr /\u003e\n                    \u003csub\u003e\u003cb\u003edependabot[bot]\u003c/b\u003e\u003c/sub\u003e\n                \u003c/a\u003e\n            \u003c/td\u003e\n            \u003ctd align=\"center\"\u003e\n                \u003ca href=\"https://github.com/penify-dev[bot]\"\u003e\n                    \u003cimg src=\"https://avatars.githubusercontent.com/in/399279?v=4\" width=\"100;\" alt=\"penify-dev[bot]\"/\u003e\n                    \u003cbr /\u003e\n                    \u003csub\u003e\u003cb\u003epenify-dev[bot]\u003c/b\u003e\u003c/sub\u003e\n                \u003c/a\u003e\n            \u003c/td\u003e\n            \u003ctd align=\"center\"\u003e\n                \u003ca href=\"https://github.com/gitauto-ai[bot]\"\u003e\n                    \u003cimg src=\"https://avatars.githubusercontent.com/in/844909?v=4\" width=\"100;\" alt=\"gitauto-ai[bot]\"/\u003e\n                    \u003cbr /\u003e\n                    \u003csub\u003e\u003cb\u003egitauto-ai[bot]\u003c/b\u003e\u003c/sub\u003e\n                \u003c/a\u003e\n            \u003c/td\u003e\n            \u003ctd align=\"center\"\u003e\n                \u003ca href=\"https://github.com/github-actions[bot]\"\u003e\n                    \u003cimg src=\"https://avatars.githubusercontent.com/in/15368?v=4\" width=\"100;\" alt=\"github-actions[bot]\"/\u003e\n                    \u003cbr /\u003e\n                    \u003csub\u003e\u003cb\u003egithub-actions[bot]\u003c/b\u003e\u003c/sub\u003e\n                \u003c/a\u003e\n            \u003c/td\u003e\n            \u003ctd align=\"center\"\u003e\n                \u003ca href=\"https://github.com/pixeebot[bot]\"\u003e\n                    \u003cimg src=\"https://avatars.githubusercontent.com/in/193111?v=4\" width=\"100;\" alt=\"pixeebot[bot]\"/\u003e\n                    \u003cbr /\u003e\n                    \u003csub\u003e\u003cb\u003epixeebot[bot]\u003c/b\u003e\u003c/sub\u003e\n                \u003c/a\u003e\n            \u003c/td\u003e\n            \u003ctd align=\"center\"\u003e\n                \u003ca href=\"https://github.com/snyk-bot\"\u003e\n                    \u003cimg src=\"https://avatars.githubusercontent.com/u/19733683?v=4\" width=\"100;\" alt=\"snyk-bot\"/\u003e\n                    \u003cbr /\u003e\n                    \u003csub\u003e\u003cb\u003eSnyk bot\u003c/b\u003e\u003c/sub\u003e\n                \u003c/a\u003e\n            \u003c/td\u003e\n\t\t\u003c/tr\u003e\n\t\t\u003ctr\u003e\n            \u003ctd align=\"center\"\u003e\n                \u003ca href=\"https://github.com/codefactor-io\"\u003e\n                    \u003cimg src=\"https://avatars.githubusercontent.com/u/11671095?v=4\" width=\"100;\" alt=\"codefactor-io\"/\u003e\n                    \u003cbr /\u003e\n                    \u003csub\u003e\u003cb\u003eCodeFactor\u003c/b\u003e\u003c/sub\u003e\n                \u003c/a\u003e\n            \u003c/td\u003e\n\t\t\u003c/tr\u003e\n\t\u003ctbody\u003e\n\u003c/table\u003e\n\u003c!-- readme: bots,snyk-bot,codefactor-io -end --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguibranco%2Fdotnet-aicommitmessage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguibranco%2Fdotnet-aicommitmessage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguibranco%2Fdotnet-aicommitmessage/lists"}