Skip to main content

AI git utils is an intelligent Git commit assistant that leverages AI to enhance your Git workflow.

Project description

AI Git Utils: 智能 Git Commit 助手 🚀

PyPI version

AI Git Utils 是一个利用 AI 技术增强您 Git 工作流程的智能化工具。它能够根据您的代码变更自动生成规范、清晰且富有表现力的 Commit Message,并智能推荐相关的 Emoji,显著提升版本控制的效率和体验。

screen


✨ 核心特性

  • 🤖 AI 驱动的 Commit Message 生成: 基于代码 diff,智能生成符合 Conventional Commits 规范的提交信息(包含 type, scope, subject, body)。
  • ✍️ 交互式编辑: 在 AI 生成建议后,提供便捷的交互式编辑界面,允许您轻松修改和确认最终的 Commit Message。
  • 😄 智能 Emoji 选择: 根据 Commit 类型自动推荐合适的 Emoji,让您的提交记录更生动、直观。
  • 🔌 多模型支持与灵活配置:
    • 支持接入多种兼容 OpenAI API 标准的大语言模型 (LLM)。
    • 通过简单的命令行指令即可添加、删除、切换和管理不同的 AI 模型配置。
  • 📜 增强的 Git Log: 使用 aigit log 命令,以美观的表格形式展示提交历史,支持限制数量和时间范围过滤。

🛠️ 安装

确保您已安装 Python 3.8+。然后通过 pip 安装:

pip install ai-git-utils

⚙️ 配置 AI 模型

在使用 aigit commit 功能前,您需要至少配置一个 AI 模型。

  1. 添加模型配置: 运行 aigit model add 并根据提示输入模型信息:

    aigit model add
    # Name: my-gpt4o  (自定义模型名称)
    # Model: gpt-4o  (模型 ID)
    # Base Url: https://api.openai.com/v1 (模型服务 API 地址)
    # Temperature: 0.7 (模型温度参数)
    # Api Key: sk-xxxx (您的 API 密钥)
    

    添加的第一个模型会自动设为当前激活模型。

  2. 管理模型:

    • 列出所有已配置模型: aigit model list
    • 查看当前激活模型的详细配置: aigit model show
    • 激活其他已配置模型: aigit model active (根据提示输入名称)
    • 删除指定模型配置: aigit model remove (根据提示输入名称)

🚀 使用指南

1. 生成 AI Commit Message (核心功能)

在您的 Git 仓库中,当您有暂存的更改 (staged changes) 时,运行:

# 默认使用英文生成
aigit commit

# 指定使用中文生成
aigit commit --lang Chinese

# 只针对特定文件的更改生成 commit message
aigit commit --file path/to/your/file.py

🤝 贡献

欢迎各种形式的贡献!如果您有任何建议、发现 Bug 或想改进功能,请随时:

  1. Fork 本仓库
  2. 创建您的特性分支 (git checkout -b feature/AmazingFeature)
  3. 提交您的更改 (aigit commit 😉)
  4. 推送到分支 (git push origin feature/AmazingFeature)
  5. 提交 Pull Request

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai_git_utils-0.4.0.tar.gz (305.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_git_utils-0.4.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file ai_git_utils-0.4.0.tar.gz.

File metadata

  • Download URL: ai_git_utils-0.4.0.tar.gz
  • Upload date:
  • Size: 305.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.8

File hashes

Hashes for ai_git_utils-0.4.0.tar.gz
Algorithm Hash digest
SHA256 794e5af243b4320970c31f85fd20e2a1c04b87b18a9cb5aebd9ee3cf3a1eae5c
MD5 37c95a23ac2c6a432167c1ddd5654085
BLAKE2b-256 85f4cb4f23c85a900c2538e077bfe7404607f2324f9511868cf370c5f4d8f35e

See more details on using hashes here.

File details

Details for the file ai_git_utils-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: ai_git_utils-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.8

File hashes

Hashes for ai_git_utils-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 80523971ef8769dc48858e2c7d58e84c8ed879817f66f3dd961e0f23a5131058
MD5 978521c90c7279ad2d1ad6e844754114
BLAKE2b-256 22d0615c94b689efd2856d29c5c3308e50705d30fd3e130ef01bf84400e8ae85

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page