salehhashemi/laravel-intelli-git

为 Laravel 应用程序提供智能 Git 辅助包。它利用 OpenAI 的 GPT 分析您的 Git 仓库,提供基于暂存变更自动生成提交消息等功能。

v0.1.0 2023-05-18 11:13 UTC

This package is auto-updated.

Last update: 2024-09-21 13:15:59 UTC


README

Latest Version on Packagist Total Downloads GitHub Actions StyleCI

使用 OpenAI 生成 git 提交消息的智能 Laravel 包。

Header Image

特性

此包实现了以下命令

  • ai:commit - 使用 AI 生成提交消息和描述

请关注未来的更新,我们将继续扩展 Laravel Intelli Git 包的功能。

安装

  1. 通过 composer 安装包

    composer require salehhashemi/laravel-intelli-git
    
  2. 发布配置文件

    php artisan vendor:publish --provider="Salehhashemi\LaravelIntelliGit\LaravelIntelliGitServiceProvider"
    
  3. 将您的 OpenAI API 密钥添加到 .env 文件中

    OPEN_AI_KEY=your_openai_key
    
  4. 可选地,您可以在 .env 文件中更改 OpenAI 默认模型

    OPEN_AI_MODEL=gpt-4
    

使用方法

ai:commit

php artisan ai:commit

此命令将自动检查您的 git 仓库中暂存和未暂存的变化。如果找到未暂存的变化,它将要求您将其暂存。然后,它将使用 OpenAI 生成提交消息和描述。

示例

ai:commit

以下是命令执行的示例

$ php artisan ai:commit
No staged changes found.
There are unstaged changes. Would you like to stage all changes? (yes/no) [no]:
> yes
All changes have been staged.
Generating commit message with AI, please wait...

Here are the AI-generated commit title and description:
Title
Refactor User model and improve validation
Description
This commit refactors the User model, specifically improving the validation logic by adding custom validation rules. It also includes updates to the relevant tests.

测试

composer test

变更日志

有关最近更改的更多信息,请参阅 CHANGELOG

贡献

有关详细信息,请参阅 CONTRIBUTING

致谢

许可证

MIT 许可证 (MIT)。有关更多信息,请参阅 许可证文件