docs: 优化 README 文档结构和内容表述
This commit is contained in:
parent
ab343c6ca7
commit
77ca26c129
130
README.md
130
README.md
|
|
@ -1,104 +1,127 @@
|
||||||
AutoCommit
|
# AutoCommit
|
||||||
|
|
||||||
一个智能的 Git 提交助手,使用 LLM 自动生成规范的提交消息并提交暂存的文件。
|
> 一个智能的 Git 提交助手,使用 LLM 自动生成规范的提交消息并提交暂存的文件。
|
||||||
|
|
||||||
✨ 特性
|
## ✨ 特性
|
||||||
|
|
||||||
- 智能生成:使用大语言模型自动分析代码变更,生成专业、规范的提交消息
|
- **智能生成**:使用大语言模型自动分析代码变更,生成专业、规范的提交消息
|
||||||
- 🔧 高度可配置:支持多种 LLM 提供商(OpenAI 兼容 API)
|
- **🔧 高度可配置**:支持多种 LLM 提供商(OpenAI 兼容 API)
|
||||||
- 🎯 规范遵循:自动生成符合 Conventional Commits 规范的消息
|
- **🎯 规范遵循**:自动生成符合 [Conventional Commits](https://www.conventionalcommits.org/) 规范的消息
|
||||||
- ⚡ 快速便捷:一键生成并提交,提升开发效率
|
- **⚡ 快速便捷**:一键生成并提交,提升开发效率
|
||||||
- 🔍 安全检查:内置配置检查和连接测试
|
- **🔍 安全检查**:内置配置检查和连接测试
|
||||||
- 🎨 美观界面:使用 Rich 库提供美观的命令行界面
|
- **🎨 美观界面**:使用 Rich 库提供美观的命令行界面
|
||||||
- 🔄 异步支持:支持异步操作,响应快速
|
- **🔄 异步支持**:支持异步操作,响应快速
|
||||||
|
|
||||||
📦 安装
|
---
|
||||||
|
|
||||||
git clone
|
## 📦 安装
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone <repository-url>
|
||||||
cd autocommit
|
cd autocommit
|
||||||
pip install -e .
|
pip install -e .
|
||||||
|
```
|
||||||
|
|
||||||
🚀 快速开始
|
---
|
||||||
|
|
||||||
1. 配置(推荐交互式)
|
## 🚀 快速开始
|
||||||
|
|
||||||
交互式配置向导
|
### 1. 配置(推荐交互式)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 交互式配置向导
|
||||||
autocommit config interactive
|
autocommit config interactive
|
||||||
|
|
||||||
或直接设置
|
# 或直接设置
|
||||||
autocommit config set --api-key "sk-your-api-key" --model "qwen3-14b"
|
autocommit config set --api-key "sk-your-api-key" --model "qwen3-14b"
|
||||||
|
```
|
||||||
|
|
||||||
2. 测试连接
|
### 2. 测试连接
|
||||||
|
|
||||||
|
```bash
|
||||||
autocommit check
|
autocommit check
|
||||||
|
```
|
||||||
|
|
||||||
3. 使用 AutoCommit
|
### 3. 使用 AutoCommit
|
||||||
|
|
||||||
1. 先将文件添加到暂存区
|
```bash
|
||||||
|
# 1. 先将文件添加到暂存区
|
||||||
git add .
|
git add .
|
||||||
|
|
||||||
2. 使用 AutoCommit 生成提交消息并提交
|
# 2. 使用 AutoCommit 生成提交消息并提交
|
||||||
autocommit
|
autocommit
|
||||||
|
|
||||||
3. 或者仅生成消息,不自动提交(预览模式)
|
# 3. 或者仅生成消息,不自动提交(预览模式)
|
||||||
autocommit --dry-run
|
autocommit --dry-run
|
||||||
|
```
|
||||||
|
|
||||||
📖 详细使用说明
|
---
|
||||||
|
|
||||||
基本使用流程
|
## 📖 详细使用说明
|
||||||
|
|
||||||
完整工作流示例
|
### 基本使用流程
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 完整工作流示例
|
||||||
git add .
|
git add .
|
||||||
autocommit
|
autocommit
|
||||||
|
```
|
||||||
|
|
||||||
命令行选项
|
### 命令行选项
|
||||||
|
|
||||||
显示帮助信息
|
```bash
|
||||||
|
# 显示帮助信息
|
||||||
autocommit --help
|
autocommit --help
|
||||||
|
|
||||||
仅生成消息,不实际提交(预览模式)
|
# 仅生成消息,不实际提交(预览模式)
|
||||||
autocommit --dry-run
|
autocommit --dry-run
|
||||||
|
|
||||||
指定模型生成
|
# 指定模型生成
|
||||||
autocommit --model "qwen3-14b"
|
autocommit --model "qwen3-14b"
|
||||||
|
|
||||||
检查工具状态
|
# 检查工具状态
|
||||||
autocommit check
|
autocommit check
|
||||||
|
|
||||||
测试消息生成
|
# 测试消息生成
|
||||||
autocommit check --test
|
autocommit check --test
|
||||||
|
```
|
||||||
|
|
||||||
⚙️ 配置管理
|
---
|
||||||
|
|
||||||
显示当前配置
|
## ⚙️ 配置管理
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 显示当前配置
|
||||||
autocommit config show
|
autocommit config show
|
||||||
|
|
||||||
交互式配置向导
|
# 交互式配置向导
|
||||||
autocommit config interactive
|
autocommit config interactive
|
||||||
|
|
||||||
设置特定配置项
|
# 设置特定配置项
|
||||||
autocommit config set \
|
autocommit config set \
|
||||||
--api-key "sk-your-key" \
|
--api-key "sk-your-key" \
|
||||||
--base-url "https://your-api-endpoint.com/v1" \
|
--base-url "https://your-api-endpoint.com/v1" \
|
||||||
--model "qwen3-14b" \
|
--model "qwen3-14b" \
|
||||||
--timeout 30
|
--timeout 30
|
||||||
|
|
||||||
清除所有配置
|
# 清除所有配置
|
||||||
autocommit config clear
|
autocommit config clear
|
||||||
|
```
|
||||||
|
|
||||||
配置说明
|
### 配置说明
|
||||||
|
|
||||||
支持的 LLM 提供商
|
#### 支持的 LLM 提供商
|
||||||
- OpenAI
|
- OpenAI
|
||||||
- DashScope(通义千问)
|
- DashScope(通义千问)
|
||||||
- Ollama
|
- Ollama
|
||||||
- 其他兼容 OpenAI API 的服务
|
- **其他兼容 OpenAI API 的服务**
|
||||||
|
|
||||||
配置文件位置
|
#### 配置文件位置
|
||||||
~/.config/autocommit/config.yaml
|
`~/.config/autocommit/config.yaml`
|
||||||
|
|
||||||
示例配置
|
#### 示例配置
|
||||||
|
|
||||||
|
```yaml
|
||||||
llm:
|
llm:
|
||||||
api_key: "sk-your-api-key"
|
api_key: "sk-your-api-key"
|
||||||
base_url: "https://dashscope.aliyuncs.com/compatible-mode/v1"
|
base_url: "https://dashscope.aliyuncs.com/compatible-mode/v1"
|
||||||
|
|
@ -113,25 +136,32 @@ llm:
|
||||||
要求:50字以内,不要解释,不要引号,只输出 message 本身。
|
要求:50字以内,不要解释,不要引号,只输出 message 本身。
|
||||||
diff:
|
diff:
|
||||||
auto_save: true
|
auto_save: true
|
||||||
|
```
|
||||||
|
|
||||||
💡 示例代码变更:
|
> 💡 示例代码变更:
|
||||||
def hello_world():
|
> ```python
|
||||||
- print("Hello, World!")
|
> def hello_world():
|
||||||
+ print("Hello, OpenAI!")
|
> - print("Hello, World!")
|
||||||
生成的提交消息:feat: update greeting message
|
> + print("Hello, OpenAI!")
|
||||||
|
> ```
|
||||||
|
> 生成的提交消息:`feat: update greeting message`
|
||||||
|
|
||||||
🔧 高级功能
|
---
|
||||||
|
|
||||||
自定义提示词
|
## 🔧 高级功能
|
||||||
|
|
||||||
|
### 自定义提示词
|
||||||
|
|
||||||
你可以修改系统提示词以适应特定需求:
|
你可以修改系统提示词以适应特定需求:
|
||||||
|
|
||||||
|
```bash
|
||||||
autocommit config set --system-prompt "你是一个前端开发者,请根据代码变更生成提交消息,重点描述 UI 变化。"
|
autocommit config set --system-prompt "你是一个前端开发者,请根据代码变更生成提交消息,重点描述 UI 变化。"
|
||||||
|
```
|
||||||
|
|
||||||
异步模式
|
### 异步模式
|
||||||
|
|
||||||
对于大量文件或复杂的代码库,工具会自动使用异步模式提高性能。
|
对于大量文件或复杂的代码库,工具会自动使用异步模式提高性能。
|
||||||
|
|
||||||
多语言支持
|
### 多语言支持
|
||||||
|
|
||||||
通过修改系统提示词,可以支持多种语言的提交消息(如英文、中文、日文等)。
|
通过修改系统提示词,可以支持多种语言的提交消息(如英文、中文、日文等)。
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue