{"_id":"comai","_rev":"31-20a65c9a9011dda94e850dfd0860f8ac","name":"comai","dist-tags":{"latest":"2.3.0"},"versions":{"2.0.0":{"name":"comai","version":"2.0.0","keywords":["ai","git","commit"],"author":{"url":"@ryandavogel","name":"Ryan Vogel"},"license":"MIT","_id":"comai@2.0.0","maintainers":[{"name":"mandarin3d","email":"ryan@mandarin3d.com"}],"homepage":"https://github.com/R44VC0RP/comai#readme","bugs":{"url":"https://github.com/R44VC0RP/comai/issues"},"bin":{"comai":"dist/cli.mjs"},"dist":{"shasum":"e10a4da72d13c3abd6405d18d58ea74cee6a21d9","tarball":"https://registry.npmjs.org/comai/-/comai-2.0.0.tgz","fileCount":4,"integrity":"sha512-XMwzuYu3HSyCylUANOv/VQUJQc4uLTCtU5e4TaDKjp2VtHxWbedueBpVeg3k47WVt6yJrnFx9NMkYPlLRrY+KA==","signatures":[{"sig":"MEUCIQD2VqudydP+SyQ9lj1nip12q8yJu7b4Devb4P6Y137gvAIgXKnfJF2H3xWTGRm2z+Ne61SZ3mwUIrQT9jo7EO6ghQY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":136688},"type":"module","gitHead":"52df30111e3ed75afad5d720b3008ab11793093f","_npmUser":{"name":"mandarin3d","email":"ryan@mandarin3d.com"},"repository":{"url":"git+https://github.com/R44VC0RP/comai.git","type":"git"},"_npmVersion":"11.4.2","description":"Writes your git commit messages for you with AI","directories":{},"_nodeVersion":"24.3.0","dependencies":{"@dqbd/tiktoken":"^1.0.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/comai_2.0.0_1757120901292_0.44790834681420466","host":"s3://npm-registry-packages-npm-production"}},"2.2.0":{"name":"comai","version":"2.2.0","keywords":["ai","git","commit"],"author":{"url":"@ryandavogel","name":"Ryan Vogel"},"license":"MIT","_id":"comai@2.2.0","maintainers":[{"name":"mandarin3d","email":"ryan@mandarin3d.com"}],"homepage":"https://github.com/R44VC0RP/comai#readme","bugs":{"url":"https://github.com/R44VC0RP/comai/issues"},"bin":{"comai":"dist/cli.mjs"},"dist":{"shasum":"20678ebaa4c78be77277005b4a4432a66df5a729","tarball":"https://registry.npmjs.org/comai/-/comai-2.2.0.tgz","fileCount":4,"integrity":"sha512-xb6Ji2fUSSkfr0u/NIxdUpCyyn4RidNttqkQShH5IVTw4pZI4elRfpYb2V/dCiS4a8LFId/8SBDAZ3klrn0exQ==","signatures":[{"sig":"MEUCIHWD3ZtvZfpcQgui4tr37y1za8Il9j3kpfYyOXreMmIjAiEAgNwSAzMJJfRoQkKjf/v21lYsvZfF/vbVUnVFZEWq1ac=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":140480},"type":"module","gitHead":"6357f106c334734bfc8a7fa5cd9827421efdaffe","_npmUser":{"name":"mandarin3d","email":"ryan@mandarin3d.com"},"repository":{"url":"git+https://github.com/R44VC0RP/comai.git","type":"git"},"_npmVersion":"11.4.2","description":"Writes your git commit messages for you with AI","directories":{},"_nodeVersion":"24.3.0","dependencies":{"@dqbd/tiktoken":"^1.0.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/comai_2.2.0_1757122827699_0.6626220185323781","host":"s3://npm-registry-packages-npm-production"}},"2.3.0":{"name":"comai","version":"2.3.0","description":"Writes your git commit messages for you with AI","keywords":["ai","git","commit"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/R44VC0RP/comai.git"},"author":{"name":"Ryan Vogel","url":"@ryandavogel"},"type":"module","bin":{"comai":"dist/cli.mjs"},"dependencies":{"@dqbd/tiktoken":"^1.0.2","openai":"^5.19.1"},"_id":"comai@2.3.0","gitHead":"bcf346fa7c97d9f1c63b63697c89deba522ac08e","bugs":{"url":"https://github.com/R44VC0RP/comai/issues"},"homepage":"https://github.com/R44VC0RP/comai#readme","_nodeVersion":"24.3.0","_npmVersion":"11.4.2","dist":{"integrity":"sha512-T11NoOFtci1pb+aMrdxWUou6T8PvLse3OjZ2oQVwQpZ5GE9udWKBLT+pu+d7UDdPR2gIBju3eCAfOyuVjnzN3g==","shasum":"b6684e44aed4dc00b7b1b9b396f3b0b31a9f59fe","tarball":"https://registry.npmjs.org/comai/-/comai-2.3.0.tgz","fileCount":10,"unpackedSize":403292,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGzPrIeabMRiyWMIoDyNXkhtFaN2WjwcEaihmAm+nGMgAiBZqtGPTJH12pN0YgCxR7mJZml8TTOgWvzayno5Xg7z2g=="}]},"_npmUser":{"name":"mandarin3d","email":"ryan@mandarin3d.com"},"directories":{},"maintainers":[{"name":"mandarin3d","email":"ryan@mandarin3d.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/comai_2.3.0_1757123590871_0.10391146068445134"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-06T01:08:21.291Z","modified":"2025-09-06T01:53:11.302Z","1.0.0":"2025-02-12T21:39:49.062Z","1.0.1":"2025-02-12T21:47:47.586Z","1.0.4":"2025-02-12T21:51:04.439Z","1.0.6":"2025-02-12T21:58:21.414Z","1.0.7":"2025-02-12T22:07:21.308Z","1.0.8":"2025-02-12T22:13:45.225Z","1.1.0":"2025-02-12T22:35:14.231Z","1.1.1":"2025-02-12T22:39:30.882Z","1.1.2":"2025-02-12T22:48:03.030Z","1.1.3":"2025-02-12T22:50:37.640Z","1.1.4":"2025-02-13T14:07:07.767Z","1.2.0":"2025-02-13T19:44:54.345Z","1.2.1":"2025-02-13T19:52:20.652Z","1.2.2":"2025-02-13T20:06:57.375Z","1.2.3":"2025-02-13T20:16:01.754Z","1.3.0":"2025-02-14T22:51:39.563Z","1.3.1":"2025-02-14T22:57:06.069Z","1.4.0":"2025-02-14T23:10:13.351Z","1.4.1":"2025-02-14T23:22:11.999Z","1.4.2":"2025-02-14T23:46:22.233Z","1.4.3":"2025-02-15T17:42:41.343Z","1.4.4":"2025-02-15T17:46:24.604Z","1.6.0":"2025-02-15T18:17:28.513Z","1.7.1":"2025-02-15T18:52:03.095Z","1.8.0":"2025-02-15T19:16:04.459Z","1.8.1":"2025-02-15T19:31:30.932Z","1.9.1":"2025-02-15T21:19:47.338Z","2.0.0":"2025-09-06T01:08:21.467Z","2.2.0":"2025-09-06T01:40:27.895Z","2.3.0":"2025-09-06T01:53:11.121Z"},"bugs":{"url":"https://github.com/R44VC0RP/comai/issues"},"author":{"name":"Ryan Vogel","url":"@ryandavogel"},"license":"MIT","homepage":"https://github.com/R44VC0RP/comai#readme","keywords":["ai","git","commit"],"repository":{"type":"git","url":"git+https://github.com/R44VC0RP/comai.git"},"description":"Writes your git commit messages for you with AI","maintainers":[{"name":"mandarin3d","email":"ryan@mandarin3d.com"}],"readme":"<div align=\"center\">\n  <div>\n    <img src=\".github/screenshot.png\" alt=\"AI Commits\"/>\n\t<h1 align=\"center\">ComAI</h1>\n  </div>\n\t<p>A CLI that writes your git commit messages for you with AI. Never write a commit message again.</p>\n\t<a href=\"https://www.npmjs.com/package/comai\"><img src=\"https://img.shields.io/npm/v/comai\" alt=\"Current version\"></a>\n</div>\n\n---\n\n(thanks to Nutlopes for developing most of this, but I wanted to keep it updated with newer models and some quality of life changes)\n\n## Setup\n\n> The minimum supported version of Node.js is the latest v14. Check your Node.js version with `node --version`.\n\n1. Install _comai_:\n\n   ```sh\n   npm install -g comai\n   ```\n\n2. Retrieve your API key from [OpenAI](https://platform.openai.com/account/api-keys)\n\n   > Note: If you haven't already, you'll have to create an account and set up billing.\n\n3. Set the key so comai can use it:\n\n   ```sh\n   comai config set OPENAI_KEY=<your token>\n   ```\n\n   This will create a `.comai` file in your home directory.\n\n### Upgrading\n\nCheck the installed version with:\n\n```\ncomai --version\n```\n\nIf it's not the [latest version](https://github.com/R44VC0RP/comai/releases/latest), run:\n\n```sh\nnpm update -g comai\n```\n\n## Usage\n\n### CLI mode\n\nYou can call `comai` directly to generate a commit message for your staged changes:\n\n```sh\ngit add <files...>\ncomai\n```\n\n`comai` passes down unknown flags to `git commit`, so you can pass in [`commit` flags](https://git-scm.com/docs/git-commit).\n\nFor example, you can stage all changes in tracked files with as you commit:\n\n```sh\ncomai --all # or -a\n```\n\n#### Generate multiple recommendations\n\nSometimes the recommended commit message isn't the best so you want it to generate a few to pick from. You can generate multiple commit messages at once by passing in the `--generate <i>` flag, where 'i' is the number of generated messages:\n\n```sh\ncomai --generate <i> # or -g <i>\n```\n\n> Warning: this uses more tokens, meaning it costs more.\n\n#### Generating Conventional Commits\n\nIf you'd like to generate [Conventional Commits](https://conventionalcommits.org/), you can use the `--type` flag followed by `conventional`. This will prompt `comai` to format the commit message according to the Conventional Commits specification:\n\n```sh\ncomai --type conventional # or -t conventional\n```\n\nThis feature can be useful if your project follows the Conventional Commits standard or if you're using tools that rely on this commit format.\n\n### Git hook\n\nYou can also integrate _comai_ with Git via the [`prepare-commit-msg`](https://git-scm.com/docs/githooks#_prepare_commit_msg) hook. This lets you use Git like you normally would, and edit the commit message before committing.\n\n#### Install\n\nIn the Git repository you want to install the hook in:\n\n```sh\ncomai hook install\n```\n\n#### Uninstall\n\nIn the Git repository you want to uninstall the hook from:\n\n```sh\ncomai hook uninstall\n```\n\n#### Usage\n\n1. Stage your files and commit:\n\n   ```sh\n   git add <files...>\n   git commit # Only generates a message when it's not passed in\n   ```\n\n   > If you ever want to write your own message instead of generating one, you can simply pass one in: `git commit -m \"My message\"`\n\n2. Comai will generate the commit message for you and pass it back to Git. Git will open it with the [configured editor](https://docs.github.com/en/get-started/getting-started-with-git/associating-text-editors-with-git) for you to review/edit it.\n\n3. Save and close the editor to commit!\n\n## CLI Options\n\nYou can set persistent CLI options so you don't have to specify flags every time you run `comai`.\n\n### Managing CLI Options\n\n#### Show current options\n```sh\ncomai options\n# or\ncomai options show\n```\n\n#### Set options\n```sh\ncomai options set all=true\ncomai options set generate=3\ncomai options set type=conventional\ncomai options set exclude=package-lock.json,dist/\n```\n\n#### Get specific options\n```sh\ncomai options get all\ncomai options get generate\n```\n\n#### Clear options\n```sh\ncomai options clear all\ncomai options clear generate\n```\n\n### Available Options\n\n- **all**: `true|false` - Automatically stage all tracked files (equivalent to `--all` flag)\n- **exclude**: `file1,file2` - Comma-separated list of files to exclude (equivalent to `--exclude` flag)\n- **generate**: `1-5` - Number of commit messages to generate (equivalent to `--generate` flag)\n- **type**: `conventional` - Type of commit message format (equivalent to `--type` flag)\n\n### How it works\n\nOnce you set options, `comai` will use them as defaults every time you run it. CLI flags will always override stored options.\n\nFor example:\n```sh\n# Set preferences\ncomai options set all=true generate=2\n\n# This will use your stored preferences\ncomai\n\n# This will override the stored generate setting for this run only\ncomai --generate 5\n```\n\n## Configuration\n\n### Reading a configuration value\n\nTo retrieve a configuration option, use the command:\n\n```sh\ncomai config get <key>\n```\n\nFor example, to retrieve the API key, you can use:\n\n```sh\ncomai config get OPENAI_KEY\n```\n\nYou can also retrieve multiple configuration options at once by separating them with spaces:\n\n```sh\ncomai config get OPENAI_KEY generate\n```\n\n### Setting a configuration value\n\nTo set a configuration option, use the command:\n\n```sh\ncomai config set <key>=<value>\n```\n\nFor example, to set the API key, you can use:\n\n```sh\ncomai config set OPENAI_KEY=<your-api-key>\n```\n\nYou can also set multiple configuration options at once by separating them with spaces, like\n\n```sh\ncomai config set OPENAI_KEY=<your-api-key> generate=3 locale=en\n```\n\n### Options\n\n#### OPENAI_KEY\n\nRequired\n\nThe OpenAI API key. You can retrieve it from [OpenAI API Keys page](https://platform.openai.com/account/api-keys).\n\n#### locale\n\nDefault: `en`\n\nThe locale to use for the generated commit messages. Consult the list of codes in: https://wikipedia.org/wiki/List_of_ISO_639-1_codes.\n\n#### generate\n\nDefault: `1`\n\nThe number of commit messages to generate to pick from.\n\nNote, this will use more tokens as it generates more results.\n\n#### proxy\n\nSet a HTTP/HTTPS proxy to use for requests.\n\nTo clear the proxy option, you can use the command (note the empty value after the equals sign):\n\n```sh\ncomai config set proxy=\n```\n\n#### model\n\nDefault: `gpt-5`\n\nThe Chat Completions (`/v1/chat/completions`) model to use. Consult the list of models available in the [OpenAI Documentation](https://platform.openai.com/docs/models/model-endpoint-compatibility).\n\n> Tip: The default model is now `gpt-5`. You can also use [`gpt-4`](https://platform.openai.com/docs/models/gpt-4) or other models if needed. Check out OpenAI's website to learn more about model capabilities and pricing.\n\n#### timeout\n\nThe timeout for network requests to the OpenAI API in milliseconds.\n\nDefault: `10000` (10 seconds)\n\n```sh\ncomai config set timeout=20000 # 20s\n```\n\n#### max-length\n\nThe maximum character length of the generated commit message.\n\nDefault: `50`\n\n```sh\ncomai config set max-length=100\n```\n\n#### type\n\nDefault: `\"\"` (Empty string)\n\nThe type of commit message to generate. Set this to \"conventional\" to generate commit messages that follow the Conventional Commits specification:\n\n```sh\ncomai config set type=conventional\n```\n\nYou can clear this option by setting it to an empty string:\n\n```sh\ncomai config set type=\n```\n\n## How it works\n\nThis CLI tool runs `git diff` to grab all your latest code changes, sends them to OpenAI's GPT-5, then returns the AI generated commit message.\n\nVideo coming soon where I rebuild it from scratch to show you how to easily build your own CLI tools powered by AI.\n\n## Maintainers\n\n- **Ryan Vogel**: [@R44VC0RP](https://github.com/R44VC0RP)\n\n\n## Contributing\n\nIf you want to help fix a bug or implement a feature in [Issues](https://github.com/R44VC0RP/comai/issues), checkout the [Contribution Guide](CONTRIBUTING.md) to learn how to setup and test the project\n","readmeFilename":"README.md"}