{"id":51343082,"url":"https://github.com/henriquecarv/git-ai-commit","last_synced_at":"2026-07-02T09:30:40.305Z","repository":{"id":365025433,"uuid":"1260098319","full_name":"henriquecarv/git-ai-commit","owner":"henriquecarv","description":"Generate Conventional Commit messages via Cursor Agent","archived":false,"fork":false,"pushed_at":"2026-06-15T13:49:11.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-15T15:25:27.254Z","etag":null,"topics":["ai","cursor","cursor-ai","git","homebrew","homebrew-tap","linux","macos","windows"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/henriquecarv.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":"2026-06-05T06:44:42.000Z","updated_at":"2026-06-15T13:49:31.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/henriquecarv/git-ai-commit","commit_stats":null,"previous_names":["henriquecarv/git-ai-commit"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/henriquecarv/git-ai-commit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henriquecarv%2Fgit-ai-commit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henriquecarv%2Fgit-ai-commit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henriquecarv%2Fgit-ai-commit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henriquecarv%2Fgit-ai-commit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/henriquecarv","download_url":"https://codeload.github.com/henriquecarv/git-ai-commit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henriquecarv%2Fgit-ai-commit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35041995,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-02T02:00:06.368Z","response_time":173,"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","cursor","cursor-ai","git","homebrew","homebrew-tap","linux","macos","windows"],"created_at":"2026-07-02T09:30:39.267Z","updated_at":"2026-07-02T09:30:40.296Z","avatar_url":"https://github.com/henriquecarv.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Git AI Commit\n\nGenerate a **Conventional Commits** message from your staged diff using the [Cursor](https://cursor.com) Agent, then open your Git editor for review before committing.\n\nWorks on **macOS**, **Linux**, and **Windows** (via [Git for Windows](https://git-scm.com/download/win) Bash, MSYS2, or WSL).\n\n## Features\n\n- Summarizes **staged** changes only (lockfiles excluded)\n- Conventional Commits format (subject + body + optional footers)\n- Wraps body lines to 100 characters\n- Optional issue reference on the subject line (`AB#12345`)\n- Always opens your editor (`git commit -ve`) — nothing is committed without your approval\n\n## Platform support\n\n| Platform    | Supported terminal                                                       | Install location                                   |\n| ----------- | ------------------------------------------------------------------------ | -------------------------------------------------- |\n| **macOS**   | Terminal, iTerm, etc.                                                    | `$(brew --prefix)/bin/git-ai-commit` (Homebrew)    |\n| **Linux**   | Any POSIX shell                                                          | `$(brew --prefix)/bin/git-ai-commit` (Homebrew)    |\n| **Windows** | **Git Bash**, MSYS2, or **WSL** (not plain `cmd.exe` / PowerShell alone) | `%USERPROFILE%\\.config\\git\\git-ai-commit` (manual) |\n\n`git-ai-commit` is a POSIX `sh` script. On Windows, run `git ai-commit` from **Git Bash** or WSL so Git can invoke `sh` and the script's utilities (`mktemp`, `fold`, etc.).\n\n## Prerequisites\n\n| Requirement        | Notes                                                            |\n| ------------------ | ---------------------------------------------------------------- |\n| **Git** 2.x+       | Alias support required                                           |\n| **POSIX shell**    | Provided by macOS/Linux natively; on Windows use Git Bash or WSL |\n| **Cursor CLI**     | `cursor` on `PATH`; `cursor agent` must work (logged in)         |\n| **Staged changes** | Run `git add` before `git ai-commit`                             |\n\nVerify the CLI (same on all platforms):\n\n```bash\ncursor --version\ncursor agent --help\n```\n\n## Installation\n\n### Homebrew (macOS and Linux — recommended)\n\nThis repository is a Homebrew tap. Add it once, then install with the standard command:\n\n```bash\nbrew tap henriquecarv/git-ai-commit https://github.com/henriquecarv/git-ai-commit.git\nbrew install git-ai-commit\ngit-ai-commit setup\n```\n\n**`git-ai-commit setup`** interactively asks for your default Git editor and issue tracker prefix, and configures `~/.gitconfig`:\n\n- `core.editor` — e.g. `vim`, `nano`, `code --wait`, `cursor --wait`\n- `ai-commit.issue-prefix` — e.g. `AB#`, `JIRA-`, `GH-` (optional; leave blank for none)\n- `alias.ai-commit` — `!git-ai-commit`\n\nAfter setup, use `git ai-commit` in any repository.\n\n**Upgrade**\n\n```bash\nbrew upgrade git-ai-commit\n```\n\nRe-run `git-ai-commit setup` only if you want to change your editor, issue prefix, or refresh the alias.\n\nSee [TAP.md](TAP.md) for local tap development and maintainer release notes.\n\n---\n\n### Manual installation (alternative — macOS, Linux, Windows)\n\nUse this path if you do not use Homebrew (required on Windows).\n\n#### Install path\n\n| OS           | Script directory                           |\n| ------------ | ------------------------------------------ |\n| macOS, Linux | `~/.config/git/git-ai-commit/`             |\n| Windows      | `%USERPROFILE%\\.config\\git\\git-ai-commit\\` |\n\nGlobal Git config file:\n\n| OS           | File                       |\n| ------------ | -------------------------- |\n| macOS, Linux | `~/.gitconfig`             |\n| Windows      | `%USERPROFILE%\\.gitconfig` |\n\n#### 1. Clone this repository\n\n**macOS / Linux / Git Bash**\n\n```bash\nmkdir -p ~/.config/git\ngit clone https://github.com/henriquecarv/git-ai-commit.git ~/.config/git/git-ai-commit\n```\n\nSSH alternative:\n\n```bash\ngit clone git@github.com:henriquecarv/git-ai-commit.git ~/.config/git/git-ai-commit\n```\n\n**Windows (PowerShell — clone only)**\n\n```powershell\nNew-Item -ItemType Directory -Force -Path \"$env:USERPROFILE\\.config\\git\"\ngit clone https://github.com/henriquecarv/git-ai-commit.git \"$env:USERPROFILE\\.config\\git\\git-ai-commit\"\n```\n\nContinue setup from **Git Bash** (see below).\n\n#### 2. Make scripts executable\n\nRun from **Git Bash** on Windows, or any terminal on macOS/Linux:\n\n```bash\nchmod +x ~/.config/git/git-ai-commit/git-ai-commit\nchmod +x ~/.config/git/git-ai-commit/setup\n```\n\n#### 3. Configure Git (automated setup)\n\nRun either command:\n\n```bash\n~/.config/git/git-ai-commit/git-ai-commit setup\n```\n\nOr invoke the setup script directly:\n\n```bash\n~/.config/git/git-ai-commit/setup\n```\n\nThis interactively sets `core.editor`, `ai-commit.issue-prefix`, and `alias.ai-commit` in `~/.gitconfig`. The alias uses the full path to `git-ai-commit` when it is not on `PATH`.\n\nAfter setup, use `git ai-commit` in any repository.\n\n#### 4. Configure Git manually (without setup script)\n\nEdit `~/.gitconfig` (or `%USERPROFILE%\\.gitconfig` on Windows) and add:\n\n**macOS / Linux / Git Bash**\n\n```ini\n[core]\n    editor = vim\n\n[ai-commit]\n    issue-prefix = AB#\n\n[alias]\n    ai-commit = \"!$HOME/.config/git/git-ai-commit/git-ai-commit\"\n```\n\nReplace `editor` with your preferred editor, for example:\n\n- `vim` or `nano`\n- `code --wait` (VS Code)\n- `cursor --wait` (Cursor)\n- `notepad` (Windows Git Bash)\n\nThe `ai-commit` alias must point at the cloned `git-ai-commit` script. Adjust the path if you installed elsewhere.\n\n#### 5. Update later\n\n```bash\ncd ~/.config/git/git-ai-commit \u0026\u0026 git pull\n```\n\n---\n\n#### Windows notes\n\n- Run `git ai-commit` from **Git Bash** or WSL, not plain `cmd.exe` / PowerShell.\n- `$HOME` inside Git Bash is your Windows user profile (same as `%USERPROFILE%`).\n- **WSL**: treat as Linux — use Homebrew inside WSL, or follow the manual steps above under the WSL home directory.\n- Install the **Cursor CLI** in the same environment where you run Git.\n\n---\n\n### Optional: verbose commit editor (all platforms)\n\n```ini\n[commit]\n    verbose = true\n```\n\nThe script already passes `-v` to `git commit`; this setting keeps verbose commits consistent for manual commits too.\n\n## Usage\n\nRun from a repository terminal that supports the alias (Git Bash on Windows):\n\n```bash\n# Stage your changes\ngit add -p\n\n# Generate message and open editor\ngit ai-commit\n\n# Append issue ref to subject: \"fix: foo (AB#12345)\"\ngit ai-commit 12345\ngit ai-commit AB#12345\n```\n\n**Workflow**\n\n1. `git ai-commit` runs the agent (spinner on stderr: `Loading commit message...`)\n2. Your configured editor opens with the proposed message and staged diff\n3. Edit, save, and quit to commit; close without saving to abort\n\n**Excluded from the diff sent to the agent**\n\n- `package-lock.json`\n- `yarn.lock`\n- `pnpm-lock.yaml`\n\n## Customization\n\nEdit `git-ai-commit` locally or fork this repository:\n\n| Setting / variable | Default      | Purpose                                 |\n| ------------------ | ------------ | --------------------------------------- |\n| `ai-commit.issue-prefix` (git config) | _(empty)_ | Tracker prefix for `git ai-commit \u003cid\u003e`; set via `git-ai-commit setup` |\n| `BODY_LINE_LENGTH` | `100`        | Max width for body lines (`fold`)       |\n| `AGENT_PROMPT`     | _(built-in)_ | Instructions passed to the Cursor agent |\n\nThe agent is invoked as:\n\n```sh\ncursor agent -p --trust --mode ask --model auto \"$prompt\"\n```\n\n## Troubleshooting\n\n| Symptom                                    | What to do                                                                                                           |\n| ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------- |\n| `git: 'ai-commit' is not a git command`    | Run `git-ai-commit setup`, or confirm `[alias]` in global config                                                     |\n| `git-ai-commit: command not found`         | Run `brew install git-ai-commit`, or confirm Homebrew `bin` is on `PATH`                                             |\n| `Permission denied` (macOS/Linux/Git Bash) | `chmod +x` on `git-ai-commit` and `setup`                                                                            |\n| `sh: ...: not found` (Windows)             | Use **Git Bash** or WSL; avoid `cmd.exe` / PowerShell for `git ai-commit`                                            |\n| `cursor: command not found`                | Install Cursor CLI; restart terminal; ensure `cursor` is on `PATH` in the same shell you use for Git                 |\n| `no staged changes to summarize`           | Stage files with `git add`; lockfiles alone are ignored                                                              |\n| `cursor agent failed`                      | Log in to Cursor CLI; run `cursor agent` manually in the repo                                                        |\n| `empty message from agent`                 | Retry or reduce diff size                                                                                            |\n| Editor does not open                       | Run `git-ai-commit setup`, or set `core.editor` (e.g. `vim`, `code --wait`, `notepad`)                               |\n| Script errors after clone on Windows       | Run `git config --global core.autocrlf input` in Git Bash, or re-clone with `git clone --config core.autocrlf=input` |\n\n**Debug (macOS / Linux / Git Bash)**\n\n```bash\ngit config --global alias.ai-commit\ngit config --global core.editor\ngit config --global ai-commit.issue-prefix\nwhich git-ai-commit sh cursor\ngit-ai-commit --help\n```\n\n**Debug (Windows PowerShell — paths only)**\n\n```powershell\ngit config --global alias.ai-commit\ngit config --global core.editor\ngit config --global ai-commit.issue-prefix\nTest-Path \"$env:USERPROFILE\\.config\\git\\git-ai-commit\\git-ai-commit\"\n```\n\n## Security\n\n- The **full staged diff** is sent to Cursor's agent. Do not stage secrets (`.env`, keys, tokens).\n- `--trust` is used so the agent can run in your repo; use only in repositories you trust.\n- Always review the generated message in your editor before committing.\n\n## Quick checklist\n\n- [ ] Cursor CLI installed; `cursor agent` works in your terminal\n- [ ] macOS/Linux: `brew install git-ai-commit` and `git-ai-commit setup`\n- [ ] Windows: repository cloned; `chmod +x` on both scripts; `git-ai-commit setup` run from Git Bash\n- [ ] `ai-commit` alias, `core.editor`, and `ai-commit.issue-prefix` in global `.gitconfig`\n- [ ] Test: stage a small change → `git ai-commit`\n\n## Files\n\n| File                       | Description                                  |\n| -------------------------- | -------------------------------------------- |\n| `git-ai-commit`            | Commit CLI (`git ai-commit` target)          |\n| `setup`                    | Git config setup (via `git-ai-commit setup`) |\n| `Formula/git-ai-commit.rb` | Homebrew formula                             |\n| `TAP.md`                   | Tap and release notes                        |\n| `README.md`                | This document                                |\n| `LICENSE`                  | MIT license                                  |\n\n## License\n\n[MIT](LICENSE). Review all AI-generated commit messages before pushing.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhenriquecarv%2Fgit-ai-commit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhenriquecarv%2Fgit-ai-commit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhenriquecarv%2Fgit-ai-commit/lists"}