定制 mabdulmonem/ai-commits 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mabdulmonem/ai-commits

Composer 安装命令:

composer require mabdulmonem/ai-commits

包简介

AI-powered Git commit assistant for Laravel

README 文档

README

Latest Version Tests License Total Downloads

An intelligent Git commit assistant that automatically generates meaningful, conventional commit messages using AI based on your code changes.

Features

  • 🧠 Multi-AI Support - Works with OpenAI, OpenRouter, and Anthropic Claude
  • 📝 Conventional Commits - Generates properly formatted commit messages
  • 🔍 Smart Diff Analysis - Understands code changes at hunk level
  • 🚀 VCS Integration - GitHub, GitLab, and Bitbucket support
  • Auto-Repo Setup - Initializes Git repos and configures remotes
  • 🔧 Extensible Architecture - Easy to add new AI/VCS providers
  • 🛡️ Error Resilient - Graceful fallbacks and validations

Installation

Install via Composer:

composer require --dev mabdulmonem/ai-commits:dev-main

Publish the configuration file:

php artisan vendor:publish --tag=ai-commits-config

Configuration

Add your API keys to .env:

# AI Providers
OPENAI_API_KEY=your-openai-key
OPENROUTER_API_KEY=your-openrouter-key
ANTHROPIC_API_KEY=your-anthropic-key

# VCS Providers
GITHUB_TOKEN=your-github-token
GITLAB_TOKEN=your-gitlab-token
BITBUCKET_USERNAME=your-bitbucket-username
BITBUCKET_APP_PASSWORD=your-bitbucket-app-password

Usage

Basic Command

php artisan commit

Command Options

Option Description Example
--push Push after committing --push
--model= Specify AI model --model=gpt-4
--provider= Specify AI provider --provider=openai
--vcs= Specify VCS provider --vcs=github
--dry-run Show what would happen --dry-run
--no-ai Skip AI and use simple messages --no-ai
--auto Non-interactive mode --auto

Advanced Examples

Create and push with specific model:

php artisan commit --push --model=claude-2

Dry run with OpenRouter:

php artisan commit --dry-run --provider=openrouter

Initialize new repo and connect to GitHub:

php artisan commit --auto --vcs=github

Workflow Integration

As a Git Hook

Add to .git/hooks/pre-commit:

#!/bin/sh
php artisan commit --auto

In CI/CD Pipelines

Example GitHub Action step:

- name: AI Commit
  run: php artisan commit --auto --no-ai
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Supported AI Models

Provider Supported Models
OpenAI gpt-3.5-turbo, gpt-4, etc.
OpenRouter 100+ models across providers
Anthropic claude-2, claude-instant

Supported VCS Features

Platform Repository Pull Requests Auth Methods
GitHub Token
GitLab Token
Bitbucket App Password

Testing

Run the test suite:

composer test

Generate test coverage:

composer test-coverage

Security

If you discover any security issues, please email security@example.com instead of using the issue tracker.

Contributing

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Changelog

See CHANGELOG.md for recent changes.

License

The MIT License (MIT). See LICENSE.md for more information.

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-21