{"id":13432974,"url":"https://github.com/Nutlope/aicommits","last_synced_at":"2025-03-17T10:33:02.993Z","repository":{"id":65852451,"uuid":"601399291","full_name":"Nutlope/aicommits","owner":"Nutlope","description":"A CLI that writes your git commit messages for you with AI","archived":false,"fork":false,"pushed_at":"2024-08-15T12:19:44.000Z","size":1933,"stargazers_count":7885,"open_issues_count":78,"forks_count":378,"subscribers_count":29,"default_branch":"develop","last_synced_at":"2024-10-19T22:14:40.297Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/aicommits","language":"TypeScript","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/Nutlope.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},"funding":{"github":"privatenumber"}},"created_at":"2023-02-14T01:23:13.000Z","updated_at":"2024-10-19T09:12:22.000Z","dependencies_parsed_at":"2024-06-19T17:11:07.139Z","dependency_job_id":"b57625b0-d2e3-45da-83cb-ebab11e22c79","html_url":"https://github.com/Nutlope/aicommits","commit_stats":{"total_commits":134,"total_committers":16,"mean_commits":8.375,"dds":0.5223880597014925,"last_synced_commit":"51a8bb0653a9742a1ddb6a0783e30bd65708d29d"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nutlope%2Faicommits","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nutlope%2Faicommits/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nutlope%2Faicommits/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nutlope%2Faicommits/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nutlope","download_url":"https://codeload.github.com/Nutlope/aicommits/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221408617,"owners_count":16815034,"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","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":[],"created_at":"2024-07-31T02:01:19.262Z","updated_at":"2024-10-27T12:31:48.203Z","avatar_url":"https://github.com/Nutlope.png","language":"TypeScript","funding_links":["https://github.com/sponsors/privatenumber"],"categories":["HarmonyOS","TypeScript","CLI tools","CLI","UIs","others","A01_文本生成_文本对话","Develop Tool","开发工具","💻 Shell \u0026 CLI Assistants","🛠 Developer Tools \u0026 Resources","13. Developer Tools \u0026 Integrations"],"sub_categories":["Windows Manager","Examples","Special-purpose","Command-line(shell) interface","Other","大语言对话模型及数据"],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cdiv\u003e\n    \u003cimg src=\".github/screenshot.png\" alt=\"AI Commits\"/\u003e\n    \u003ch1 align=\"center\"\u003eAI Commits\u003c/h1\u003e\n  \u003c/div\u003e\n\t\u003cp\u003eA CLI that writes your git commit messages for you with AI. Never write a commit message again.\u003c/p\u003e\n\t\u003ca href=\"https://www.npmjs.com/package/aicommits\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/aicommits\" alt=\"Current version\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n---\n\n## Setup\n\n\u003e The minimum supported version of Node.js is the latest v14. Check your Node.js version with `node --version`.\n\n1. Install _aicommits_:\n\n   ```sh\n   npm install -g aicommits\n   ```\n\n2. Retrieve your API key from [OpenAI](https://platform.openai.com/account/api-keys)\n\n   \u003e Note: If you haven't already, you'll have to create an account and set up billing.\n\n3. Set the key so aicommits can use it:\n\n   ```sh\n   aicommits config set OPENAI_KEY=\u003cyour token\u003e\n   ```\n\n   This will create a `.aicommits` file in your home directory.\n\n### Upgrading\n\nCheck the installed version with:\n\n```\naicommits --version\n```\n\nIf it's not the [latest version](https://github.com/Nutlope/aicommits/releases/latest), run:\n\n```sh\nnpm update -g aicommits\n```\n\n## Usage\n\n### CLI mode\n\nYou can call `aicommits` directly to generate a commit message for your staged changes:\n\n```sh\ngit add \u003cfiles...\u003e\naicommits\n```\n\n`aicommits` 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\naicommits --all # or -a\n```\n\n\u003e 👉 **Tip:** Use the `aic` alias if `aicommits` is too long for you.\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 \u003ci\u003e` flag, where 'i' is the number of generated messages:\n\n```sh\naicommits --generate \u003ci\u003e # or -g \u003ci\u003e\n```\n\n\u003e 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 `aicommits` to format the commit message according to the Conventional Commits specification:\n\n```sh\naicommits --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 _aicommits_ 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\naicommits hook install\n```\n\n#### Uninstall\n\nIn the Git repository you want to uninstall the hook from:\n\n```sh\naicommits hook uninstall\n```\n\n#### Usage\n\n1. Stage your files and commit:\n\n   ```sh\n   git add \u003cfiles...\u003e\n   git commit # Only generates a message when it's not passed in\n   ```\n\n   \u003e 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. Aicommits 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## Configuration\n\n### Reading a configuration value\n\nTo retrieve a configuration option, use the command:\n\n```sh\naicommits config get \u003ckey\u003e\n```\n\nFor example, to retrieve the API key, you can use:\n\n```sh\naicommits config get OPENAI_KEY\n```\n\nYou can also retrieve multiple configuration options at once by separating them with spaces:\n\n```sh\naicommits config get OPENAI_KEY generate\n```\n\n### Setting a configuration value\n\nTo set a configuration option, use the command:\n\n```sh\naicommits config set \u003ckey\u003e=\u003cvalue\u003e\n```\n\nFor example, to set the API key, you can use:\n\n```sh\naicommits config set OPENAI_KEY=\u003cyour-api-key\u003e\n```\n\nYou can also set multiple configuration options at once by separating them with spaces, like\n\n```sh\naicommits config set OPENAI_KEY=\u003cyour-api-key\u003e 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\naicommits config set proxy=\n```\n\n#### model\n\nDefault: `gpt-3.5-turbo`\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\u003e Tip: If you have access, try upgrading to [`gpt-4`](https://platform.openai.com/docs/models/gpt-4) for next-level code analysis. It can handle double the input size, but comes at a higher cost. Check out OpenAI's website to learn more.\n\n#### timeout\n\nThe timeout for network requests to the OpenAI API in milliseconds.\n\nDefault: `10000` (10 seconds)\n\n```sh\naicommits 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\naicommits 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\naicommits config set type=conventional\n```\n\nYou can clear this option by setting it to an empty string:\n\n```sh\naicommits 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-3, 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- **Hassan El Mghari**: [@Nutlope](https://github.com/Nutlope) [\u003cimg src=\"https://img.shields.io/twitter/follow/nutlope?style=flat\u0026label=nutlope\u0026logo=twitter\u0026color=0bf\u0026logoColor=fff\" align=\"center\"\u003e](https://twitter.com/nutlope)\n\n- **Hiroki Osame**: [@privatenumber](https://github.com/privatenumber) [\u003cimg src=\"https://img.shields.io/twitter/follow/privatenumbr?style=flat\u0026label=privatenumbr\u0026logo=twitter\u0026color=0bf\u0026logoColor=fff\" align=\"center\"\u003e](https://twitter.com/privatenumbr)\n\n## Contributing\n\nIf you want to help fix a bug or implement a feature in [Issues](https://github.com/Nutlope/aicommits/issues), checkout the [Contribution Guide](CONTRIBUTING.md) to learn how to setup and test the project\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNutlope%2Faicommits","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNutlope%2Faicommits","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNutlope%2Faicommits/lists"}