{"id":17132898,"url":"https://github.com/julianolf/prepare-commit-msg","last_synced_at":"2025-10-06T02:17:30.461Z","repository":{"id":254635039,"uuid":"847112230","full_name":"julianolf/prepare-commit-msg","owner":"julianolf","description":"🤖 An AI-powered Git commit message generator.","archived":false,"fork":false,"pushed_at":"2024-09-21T20:33:12.000Z","size":87,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-13T07:56:12.359Z","etag":null,"topics":["ai","anthropic","cli","git","openai","tools"],"latest_commit_sha":null,"homepage":"","language":"Go","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/julianolf.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}},"created_at":"2024-08-24T22:10:15.000Z","updated_at":"2024-09-21T20:17:07.000Z","dependencies_parsed_at":"2024-08-24T23:26:36.452Z","dependency_job_id":"5f3c6273-d847-43f6-8dbf-e18a89c51b4d","html_url":"https://github.com/julianolf/prepare-commit-msg","commit_stats":null,"previous_names":["julianolf/prepare-commit-msg"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/julianolf/prepare-commit-msg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julianolf%2Fprepare-commit-msg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julianolf%2Fprepare-commit-msg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julianolf%2Fprepare-commit-msg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julianolf%2Fprepare-commit-msg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/julianolf","download_url":"https://codeload.github.com/julianolf/prepare-commit-msg/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julianolf%2Fprepare-commit-msg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278547830,"owners_count":26004776,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"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","anthropic","cli","git","openai","tools"],"created_at":"2024-10-14T19:28:44.949Z","updated_at":"2025-10-06T02:17:30.432Z","avatar_url":"https://github.com/julianolf.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# prepare-commit-msg\n\n\u003e An AI-powered Git commit message generator.\n\nThis tool automatically generates commit messages based on the staged changes in your Git repository.\n\nIf a message is passed to the git-commit command with the `-m` or `-F` flags, the tool will perform a spelling and grammar check, fixing any issues found and making minor improvements for clarity.\n\nIt is designed to be used as a Git hook but can also function as a command-line program. When used from the command line, it can either output the generated message to standard output or save it to a file if an argument is provided.\n\n## AI Support\n\nCurrently, this tool supports the [Anthropic](https://docs.anthropic.com) (Claude 3.5) and [OpenAI](https://platform.openai.com) (GPT-4) models.\n\n## Installation\n\n**Requirements:** [Go](https://go.dev) 1.16+.\n\nTo install, run:\n\n```sh\ngo install github.com/julianolf/prepare-commit-msg@latest\n```\n\n## Configuration\n\nTo access the AI models, you need an API key, which can be generated on the providers' pages:\n- Anthropic: [console](https://console.anthropic.com/settings/keys)\n- OpenAI: [dashboard](https://platform.openai.com/api-keys)\n\nAfter obtaining your API key, export it as an environment variable:\n\n```sh\nexport ANTHROPIC_API_KEY='xyzabc123'\n```\nor\n```sh\nexport OPENAI_API_KEY='xyzabc123'\n```\n\nYou can add this to your `.rc` file so it is automatically exported when you start a new shell.\n\n### Configuration File\n\nConfigurations can be defined using a JSON file. The following configurations are supported:\n- `AI`: Specifies the AI model to use (anthropic or openai).\n- `APIKey`: Specifies the API key to use when accessing the AI model.\n- `System`: Specifies the system prompts to provide instructions to the AI. There are two different prompts that can be defined:\n  - `GenMsg`: Used when generating commit messages from staged changes.\n  - `FixMsg`: Used when improving a message provided as input.\n\n```json\n{\n  \"AI\": \"openai\",\n  \"APIKey\": \"xyzabc123\",\n  \"System\": {\n    \"GenMsg\": \"Detailed instructions on how to generate the message\",\n    \"FixMsg\": \"Detailed instructions on how to improve the message\"\n  }\n}\n```\n\n**Notes:**\n1. The keys are case-sensitive.\n2. All configurations are optional; if a configuration is missing, default values are assumed.\n\nThe default location for the configuration file is different depending on the operating system.\n\nOn Unix systems, the default location is `$XDG_CONFIG_HOME/prepare-commit-msg/config.json` if the environment variable _XDG_CONFIG_HOME_ is defined, or `$HOME/.config/prepare-commit-msg/config.json` otherwise.\n\nOn macOS, it's located at `$HOME/Library/Application Support/prepare-commit-msg/config.json`.\n\nOn Windows, it's `%AppData%\\prepare-commit-msg\\config.json`.\n\nYou can explicitly pass a configuration file when running the program by using an argument flag:\n```sh\nprepare-commit-msg -config=my-config.json\n```\n\n### Git Hook\n\nFor details on how to configure it as a Git hook, refer to the documentation:\n- Git hooks: [prepare-commit-msg](https://git-scm.com/docs/githooks#_prepare_commit_msg)\n- Git config: [core.hooksPath](https://git-scm.com/docs/git-config#Documentation/git-config.txt-corehooksPath)\n\n## Usage\n\nFor usage, run:\n\n```sh\nprepare-commit-msg -h\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjulianolf%2Fprepare-commit-msg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjulianolf%2Fprepare-commit-msg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjulianolf%2Fprepare-commit-msg/lists"}