docs: 补充永久设置 commit_lang 语言配置说明

This commit is contained in:
unclesam committed 2026-08-22 17:16:36 +08:00
1 parent 01df74b01e
commit a79d5106a0
3 files changed
+90 -24

No files matched your search

+9 -1
View File
@@ -146,6 +146,9 @@ git air config set --provider openai --key "YOUR_KEY" --model gpt-4o-mini
# 13. 自定义 Token 计费费率 (可选:覆盖内置价格表,单位: 美元/1M Tokens) # 13. 自定义 Token 计费费率 (可选:覆盖内置价格表,单位: 美元/1M Tokens)
git air config set --price-input 0.75 --price-output 3.75 git air config set --price-input 0.75 --price-output 3.75
# 14. 永久设置 Commit Message 默认语言 (可选: auto, zh, en, ja, ko)
git air config set --commit-lang en
``` ```
查看当前配置状态(含自定义费率与脱敏 Key): 查看当前配置状态(含自定义费率与脱敏 Key):
@@ -187,13 +190,18 @@ git air msg
# 2. 自动暂存所有改动并生成提交(无需手动 git add) # 2. 自动暂存所有改动并生成提交(无需手动 git add)
git air msg -a git air msg -a
# 3. 指定输出自然语言(支持 auto, zh, en, ja, ko) # 3. 指定单次输出自然语言(支持 auto, zh, en, ja, ko)
git air msg -l en # 生成英文说明(适合 GitHub 开源项目) git air msg -l en # 生成英文说明(适合 GitHub 开源项目)
git air msg -l ja # 生成日语说明 git air msg -l ja # 生成日语说明
git air msg -l ko # 生成韩语说明 git air msg -l ko # 生成韩语说明
# 4. 极速一条龙:自动暂存 + 生成 + 免确认直接提交 # 4. 极速一条龙:自动暂存 + 生成 + 免确认直接提交
git air msg -a -c git air msg -a -c
# 5. 永久修改全局默认提交语言(无需每次加 -l 参数)
git air config set --commit-lang en # 以后永久默认生成英文
git air config set --commit-lang ja # 以后永久默认生成日文
git air config set --commit-lang auto # 恢复自动跟随系统
``` ```
**效果演示:** **效果演示:**
+9 -1
View File
@@ -145,6 +145,9 @@ git air config set --provider openai --key "YOUR_KEY" --model gpt-4o-mini
# 13. Custom Token Pricing (Optional: override default rates, USD/1M tokens) # 13. Custom Token Pricing (Optional: override default rates, USD/1M tokens)
git air config set --price-input 0.75 --price-output 3.75 git air config set --price-input 0.75 --price-output 3.75
# 14. Permanently Set Default Commit Message Language (auto, zh, en, ja, ko)
git air config set --commit-lang en
``` ```
Check current configuration (including masked keys and custom rates): Check current configuration (including masked keys and custom rates):
@@ -186,13 +189,18 @@ git air msg
# 2. Auto-stage all modified files (no need for manual git add) # 2. Auto-stage all modified files (no need for manual git add)
git air msg -a git air msg -a
# 3. Explicitly specify natural language (auto, zh, en, ja, ko) # 3. Explicitly specify natural language for one-off run (auto, zh, en, ja, ko)
git air msg -l en # English (ideal for open-source repos) git air msg -l en # English (ideal for open-source repos)
git air msg -l ja # Japanese git air msg -l ja # Japanese
git air msg -l ko # Korean git air msg -l ko # Korean
# 4. Instant one-liner: auto-stage + generate + direct commit # 4. Instant one-liner: auto-stage + generate + direct commit
git air msg -a -c git air msg -a -c
# 5. Permanently set global default commit language (no need for -l flag)
git air config set --commit-lang en # Default to English forever
git air config set --commit-lang ja # Default to Japanese forever
git air config set --commit-lang auto # Reset to auto-detect system locale
``` ```
**Terminal Preview:** **Terminal Preview:**
+72 -22
View File
@@ -60,37 +60,79 @@ GitHubなどのCI/CD上で動作するボットも優秀ですが、**`git-air`
$ git air $ git air
[git-air] コードレビュー中... (Engine: gemini / gemini-3.7-flash) [git-air] コードレビュー中... (Engine: gemini / gemini-3.7-flash)
───────────────────────────────────────────────────────────────── ────────────────────────────────# 13. カスタム Token 料金設定 (任意:組み込み料金表を上書き、単位: 米ドル/1M Tokens)
#### 変更概要 git air config set --price-input 0.75 --price-output 3.75
ユーザー認証ハンドラーに Redis キャッシュ層を追加し、Context のタイムアウト伝播を修正。
#### 詳細レビュー結果 # 14. コミットメッセージのデフォルト言語を永続設定 (任意: auto, zh, en, ja, ko)
- [BLOCKER] internal/service/user.go:45 - 重大なセキュリティ脆弱性: ループ内で生SQL文字列を直接結合しています。SQLインジェクションのリスクがあります。 git air config set --commit-lang ja
// 推奨修正コード: ```
db.Where("username = ?", inputName).First(&user)
- [WARNING] internal/service/user.go:82 - 潜在的リスク: Redis 接続エラーを握りつぶしています。キャッシュ障害時にDBへ負荷が集中します。 現在の設定を確認(カスタム料金やマスク化Keyを含む):
```bash
- [WARNING] internal/service/user.go:103 - 並行処理の欠陥: 早期リターン時に Mutex の Unlock を忘れています(Mutex Leak)。デッドロックの危険性があります。 git air config get
#### 結論
- 判定: [REJECT]
- スコア: 60 / 100
📊 Token: 入力 1,243 / 出力 412 | ≈ $0.0025
─────────────────────────────────────────────────────────────────
``` ```
--- ---
## 📦 インストール ### 2. よく使うレビューコマンド
### 方法 1: Go Install(推奨)
```bash ```bash
go install github.com/unclesam-ly/git-air@latest # 現在ステージングされた(git add済み)変更をレビュー(デフォルト)
git air
# 直前のコミット内容をレビュー
git air HEAD~1
# ブランチ間の差分をレビュー
git air main..feature-agent
# 特定のファイルのみをレビュー
git air internal/service/chat.go
# 一時的にモデルやProviderを指定して実行
git air --provider deepseek --model deepseek-chat
``` ```
### 方法 2: ソースコードからビルド ---
### 3. AI コミットメッセージ自動生成 (`git air msg`)
コミットメッセージの作成に悩む必要はもうありません。`git-air` がコードの変更差分を分析し、Conventional Commits 準拠のメッセージを**多言語自動適応**と**自動ステージング**で生成します:
```bash
# 1. 基本的な使い方:差分を分析して対話型コミット
git air msg
# 2. 変更ファイルを自動ステージング(git add 不要)
git air msg -a
# 3. 単発で出力言語を指定(auto, zh, en, ja, ko)
git air msg -l en # 英語(オープンソース・国際プロジェクト向け)
git air msg -l ja # 日本語
git air msg -l ko # 韓国語
# 4. 最速ワンライナー:自動ステージング + 生成 + 即座にコミット
git air msg -a -c
# 5. グローバルデフォルト言語を永続設定(毎回 -l を付ける必要がなくなります)
git air config set --commit-lang ja # 今後常に日本語で生成
git air config set --commit-lang en # 今後常に英語で生成
git air config set --commit-lang auto # システム言語への自動追従に戻す
```
**実行イメージ:**
```text
$ git air msg -l ja
[git-air] Conventional Commit Message を生成中... (Language: 日本語 / Engine: gemini-3.7-flash)
─────────────────────────────────────────────────────────────────
feat(auth): Redisキャッシュを追加し、Mutexのデッドロックを修正
- ユーザー認証ハンドラーに Redis トークンキャッシュ層を導入
- 早期リターン時に Mutex の Unlock が漏れる並行処理のバグを修正
─────────────────────────────────────────────────────────────────
? このメッセージで直接 git commit を実行しますか?[Y/n]: y
[SUCCESS] コードのコミットに成功しました!🎉
```スコードからビルド
```bash ```bash
git clone https://github.com/unclesam-ly/git-air.git git clone https://github.com/unclesam-ly/git-air.git
cd git-air cd git-air
@@ -145,6 +187,9 @@ git air config set --provider openai --key "YOUR_KEY" --model gpt-4o-mini
# 13. カスタム Token 料金設定 (任意:組み込み料金表を上書き、単位: 米ドル/1M Tokens) # 13. カスタム Token 料金設定 (任意:組み込み料金表を上書き、単位: 米ドル/1M Tokens)
git air config set --price-input 0.75 --price-output 3.75 git air config set --price-input 0.75 --price-output 3.75
# 14. コミットメッセージのデフォルト言語を永続設定 (任意: auto, zh, en, ja, ko)
git air config set --commit-lang ja
``` ```
現在の設定を確認(カスタム料金やマスク化Keyを含む): 現在の設定を確認(カスタム料金やマスク化Keyを含む):
@@ -186,13 +231,18 @@ git air msg
# 2. 変更ファイルを自動ステージング(git add 不要) # 2. 変更ファイルを自動ステージング(git add 不要)
git air msg -a git air msg -a
# 3. 出力言語を明示的に指定(auto, zh, en, ja, ko) # 3. 単発で出力言語を指定(auto, zh, en, ja, ko)
git air msg -l en # 英語(オープンソース・国際プロジェクト向け) git air msg -l en # 英語(オープンソース・国際プロジェクト向け)
git air msg -l ja # 日本語 git air msg -l ja # 日本語
git air msg -l ko # 韓国語 git air msg -l ko # 韓国語
# 4. 最速ワンライナー:自動ステージング + 生成 + 即座にコミット # 4. 最速ワンライナー:自動ステージング + 生成 + 即座にコミット
git air msg -a -c git air msg -a -c
# 5. グローバルデフォルト言語を永続設定(毎回 -l を付ける必要がなくなります)
git air config set --commit-lang ja # 今後常に日本語で生成
git air config set --commit-lang en # 今後常に英語で生成
git air config set --commit-lang auto # システム言語への自動追従に戻す
``` ```
**実行イメージ:** **実行イメージ:**