guanguans / ai-commit
Automagically generate conventional git commit message with AI. - 使用 AI 自动生成约定式 git 提交信息。
Fund package maintenance!
Wechat
Installs: 16 909
Dependents: 16
Suggesters: 0
Security: 0
Stars: 362
Watchers: 6
Forks: 21
Open Issues: 2
Type:project
Requires
- php: >=7.3
- ext-curl: *
- ext-json: *
Requires (Dev)
- bamarni/composer-bin-plugin: ^1.8
- brainmaestro/composer-git-hooks: ^2.8 || ^3.0
- guzzlehttp/guzzle: ^7.9
- illuminate/http: ^8.83 || ^9.0 || ^10.0 || ^11.0
- illuminate/translation: ^8.83 || ^9.0 || ^10.0 || ^11.0
- illuminate/validation: ^8.83 || ^9.0 || ^10.0 || ^11.0
- laminas/laminas-text: ^2.9
- laravel-zero/framework: ^8.10 || ^9.0 || ^10.0 || ^11.0
- laravel-zero/phar-updater: ^1.1
- mockery/mockery: ^1.6
- pestphp/pest: ^1.23 || ^2.0 || ^3.0
- php-mock/php-mock-phpunit: ^2.10
- dev-main / 1.x-dev
- 1.15.3
- 1.15.2
- 1.15.1
- 1.15.0
- 1.14.5
- 1.14.4
- 1.14.3
- 1.14.2
- 1.14.1
- 1.14.0
- 1.13.5
- 1.13.4
- 1.13.3
- 1.13.2
- 1.13.1
- 1.13.0
- 1.12.5
- 1.12.4
- 1.12.3
- 1.12.2
- 1.12.1
- 1.12.0
- 1.11.2
- 1.11.1
- 1.11.0
- 1.10.2
- 1.10.1
- 1.10.0
- 1.9.4
- 1.9.3
- 1.9.2
- 1.9.1
- 1.9.0
- 1.8.6
- 1.8.5
- 1.8.4
- 1.8.3
- 1.8.2
- 1.8.1
- 1.8.0
- 1.7.6
- 1.7.5
- 1.7.4
- 1.7.3
- 1.7.2
- 1.7.1
- 1.7.0
- v1.6.9
- v1.6.8
- v1.6.7
- v1.6.6
- v1.6.5
- v1.6.4
- v1.6.3
- v1.6.2
- v1.6.1
- v1.6.0
- v1.5.3
- v1.5.2
- v1.5.1
- v1.5.0
- v1.4.4
- v1.4.3
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.3
- v1.3.2
- v1.3.1
- v1.3.0
- v1.2.8
- v1.2.7
- v1.2.6
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.5
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- v0.5.0
- v0.4.0
- v0.3.0
- v0.2.5
- v0.2.4
- v0.2.3
- v0.2.2
- v0.2.1
- v0.2.0
- v0.1.0
- dev-dependabot/composer/laminas/laminas-text-2.12.0
- dev-dependabot/github_actions/trufflesecurity/trufflehog-3.84.0
- dev-dependabot/github_actions/codecov/codecov-action-5
- dev-issue-167-AWESOME_PROJECT
- dev-issue-145-接入ChatGLM
- dev-issue-138-希望支持GPT4o
- dev-issue-128-Specify_the_type_of_commit_or_input_key_words
- dev-issue-115-1_10_1_版本的commit_message_格式有问题
- dev-issue-112-增加一个配置,让ai-commit忽略部分文件
- dev-issue-110-400_Request_Exception_when_trying_to_generate_commit
This package is auto-updated.
Last update: 2024-11-22 21:43:43 UTC
README
Automagically generate conventional git commit message with AI. - 使用 AI 自动生成约定式 git 提交信息。
Support
- Bito CLI
- ERNIE-Bot-turbo
- ERNIE-Bot
- GitHub Copilot CLI
- GitHub Models CLI
- Moonshot
- OpenAI Chat
- OpenAI
- ...
Requirement
- PHP >= 7.3
Installation
Download the ai-commit file
curl 'https://raw.githubusercontent.com/guanguans/ai-commit/main/builds/ai-commit' -o ai-commit -#
chmod +x ai-commit
Install via Composer
composer global require guanguans/ai-commit --dev -v # global composer require guanguans/ai-commit --dev -v # local
Usage
Quick start
details
./ai-commit config set generators.bito_cli.binary bito-cli-binary... --global # Config Bito CLI binary(Optional) ./ai-commit config set generators.ernie_bot.api_key api-key... --global # Config Ernie API key ./ai-commit config set generators.ernie_bot_turbo.api_key api-key... --global # Config Ernie API key ./ai-commit config set generators.github_copilot_cli.binary gh-cli-binary... --global # Config Github CLI binary(Optional) ./ai-commit config set generators.github_models_cli.binary gh-cli-binary... --global # Config Github CLI binary(Optional) ./ai-commit config set generators.moonshot.api_key sk-... --global # Config Moonshot API key ./ai-commit config set generators.openai.api_key sk-... --global # Config OpenAI API key ./ai-commit config set generators.openai_chat.api_key sk-... --global # Config OpenAI API key ./ai-commit config set generator openai_chat --global # Config default generator(Optional) ./ai-commit commit # Generate and commit message using the default generator ./ai-commit commit --generator=github_copilot_cli # Generate and commit message using the specified generator
╰─ ./ai-commit commit --generator=bito_cli --no-edit --no-verify --ansi ─╯ 1. Generating commit message: generating... Please choose commit type [Automatically generate commit type]: [auto ] Automatically generate commit type [feat ] A new feature [fix ] A bug fix [docs ] Documentation only changes [style ] Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) [refactor] A code change that neither fixes a bug nor adds a feature [perf ] A code change that improves performance [test ] Adding missing tests or correcting existing tests [build ] Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm) [ci ] Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs) [chore ] Other changes that don't modify src or test files [revert ] Reverts a previous commit > chore RUN 'bito' ERR Model in use: BASIC ERR ERR OUT { OUT "subject": "chore(ai-commit): update tape and gif resources", OUT "body": "- Adjusted width and height settings in ai-commit.tape\n- Changed commit command generator from openai_chat to bito_cli\n- Updated ai-commit-vhs.gif file with new binary data" OUT } OUT OUT RES Command ran successfully 1. Generating commit message: ✔ 2. Confirming commit message: confirming... +-------------------------------------------------+-----------------------------------------------------------------+ | subject | body | +-------------------------------------------------+-----------------------------------------------------------------+ | chore(ai-commit): update tape and gif resources | - Adjusted width and height settings in ai-commit.tape | | | - Changed commit command generator from openai_chat to bito_cli | | | - Updated ai-commit-vhs.gif file with new binary data | +-------------------------------------------------+-----------------------------------------------------------------+ Do you want to commit this message? (yes/no) [yes]: > 2. Confirming commit message: ✔ 3. Committing message: committing... 3. Committing message: ✔ [OK] Successfully generated and committed message.
List commands
details
╰─ ./ai-commit list ─╯ _____ _____ _ _ /\ |_ _| / ____| (_) | / \ | | | | ___ _ __ ___ _ __ ___ _| |_ / /\ \ | | | | / _ \| '_ ` _ \| '_ ` _ \| | __| / ____ \ _| |_ | |___| (_) | | | | | | | | | | | | |_ /_/ \_\_____| \_____\___/|_| |_| |_|_| |_| |_|_|\__| 1.2.5 USAGE: ai-commit <command> [options] [arguments] commit Automagically generate conventional commit message with AI. completion Dump the shell completion script config Manage config options. self-update Allows to self-update a build application thanks Thanks for using this tool.
Operate config
details
./ai-commit config [set, get, unset, reset, list, edit] key value --global ./ai-commit config set key value ./ai-commit config get key ./ai-commit config unset key ./ai-commit config reset key ./ai-commit config list ./ai-commit config edit
Self update
details
╰─ ./ai-commit self-update ─╯
Checking for a new version...
=============================
[OK] Updated from version 1.2.4 to v1.2.5.
Command help
details
╰─ ./ai-commit commit --help ─╯ Description: Automagically generate conventional commit message with AI. Usage: commit [options] [--] [<path>] Arguments: path The working directory [default: "/Users/yaozm/Documents/develop/ai-commit"] Options: --commit-options[=COMMIT-OPTIONS] Append options for the `git commit` command [default: ["--edit"]] (multiple values allowed) --diff-options[=DIFF-OPTIONS] Append options for the `git diff` command [default: [":!*-lock.json",":!*.lock",":!*.sum"]] (multiple values allowed) -g, --generator=GENERATOR Specify generator name [default: "openai_chat"] -p, --prompt=PROMPT Specify prompt name of message generated [default: "conventional"] --no-edit Enable or disable git commit `--no-edit` option --no-verify Enable or disable git commit `--no-verify` option -c, --config[=CONFIG] Specify config file --retry-times=RETRY-TIMES Specify times of retry [default: 3] --retry-sleep=RETRY-SLEEP Specify sleep milliseconds of retry [default: 200] --dry-run Only generate message without commit --diff[=DIFF] Specify diff content -h, --help Display help for the given command. When no command is given display help for the list command -q, --quiet Do not output any message -V, --version Display this application version --ansi|--no-ansi Force (or disable --no-ansi) ANSI output -n, --no-interaction Do not ask any interactive question --env[=ENV] The environment the command should run under -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.