commitgpt 0.3.6 → 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a1e1fcc474c778dff2c10f370b5a291483793d0ded5c8d43beaab1b7e377b4ff
4
- data.tar.gz: 17ec9d1daaf3ad085adbd8566173411db284995188b4c97d5eaf4d69a634763d
3
+ metadata.gz: 5087467607c5fa8e321e66d9515ac5ebd4a65ef513a1cb0dc9a5819db4e72601
4
+ data.tar.gz: 3e33525a45b3892e4811671dde772df60e230d22b1b011019f3906ab4752ff1e
5
5
  SHA512:
6
- metadata.gz: 91ab99f89df2861a5731a3692e88d989b733a5e88edbd55ccdb654e109778b778f02dfc2af547ee6d12dcb8da8858ade012fd3150df381a6a771eecc036b04f1
7
- data.tar.gz: aee42f5617f25c523aa9ed3c134eaae5b92c3e9d1e7d19cb9e7de089d79c010d792c4eb12c836db138160076f787dbe30e4219c104476e0c806f2de8135085bb
6
+ metadata.gz: c78638efe575fd73035cffee4bd8779eace5552315beb8c5400a6223d99410dd4981fef26c755156920fd65206f99b9c4bdb3530b638afdf2dfbb3bd76e5190c
7
+ data.tar.gz: f40cc753a3b6849df45d2b8a11b19d008ad20661f4461d5ba61f54a20ce8234592fa6432b64354a7e27bbfd0ffda1dde82fb2f5385bd34dec76fab6bc3012f75
data/README.md CHANGED
@@ -216,7 +216,6 @@ $ gem update commitgpt
216
216
  We support any OpenAI-compatible API. Presets available for:
217
217
  - **Cerebras** (Fast & Recommended)
218
218
  - **OpenAI** (Official)
219
- - **Apple** (Local via apple-to-openai)
220
219
  - **Ollama** (Local)
221
220
  - **Groq**
222
221
  - **DeepSeek**
@@ -224,7 +223,8 @@ We support any OpenAI-compatible API. Presets available for:
224
223
  - **Google AI (Gemini)**
225
224
  - **Mistral**
226
225
  - **OpenRouter**
227
- - **Local setups** (LM Studio, LLaMa.cpp, Llamafile)
226
+ - **AMD Radeon (China)**
227
+ - **Local setups** (Apple via apple-to-openai, LM Studio, LLaMa.cpp, Llamafile)
228
228
 
229
229
  ### Recommended Providers
230
230
 
@@ -234,11 +234,16 @@ gpt-4o
234
234
  gpt-4o-mini
235
235
  ```
236
236
 
237
- **Cerebras** ([https://cloud.cerebras.ai](https://cloud.cerebras.ai)) ⭐ Recommended
237
+ **Apple Local Models** (via [apple-to-openai](https://github.com/ZPVIP/apple-to-openai)) ⭐ Recommended, Free, fast, privacy-focused
238
238
  ```
239
- zai-glm-4.7 # Best for commit messages - fast & accurate
240
- llama3.1-8b
241
- llama-3.3-70b
239
+ apple-intelligence # Max Context Length: 4,096 tokens
240
+ ```
241
+ > **Note**: Due to the context window limits of Apple's local models, it is highly recommended to set your max diff length (`diff_len`) to `10000` during setup. When prompted for large diffs, select the **Smart chunked mode** to avoid context window overflow.
242
+
243
+ **Cerebras** ([https://cloud.cerebras.ai](https://cloud.cerebras.ai))
244
+ ```
245
+ llama3.1-8b # Max Context Length: 8,192 tokens
246
+ gpt-oss-120b # Max Context Length: 65,536 tokens
242
247
  ```
243
248
 
244
249
  **Groq** ([https://console.groq.com](https://console.groq.com))
@@ -247,9 +252,18 @@ llama-3.3-70b-versatile
247
252
  llama-3.1-8b-instant
248
253
  ```
249
254
 
250
- **Apple Local Models** (via [apple-to-openai](https://github.com/ZPVIP/apple-to-openai))
255
+ **AMD Radeon (China)** free OpenAI-compatible API
256
+
257
+ Get an API key at [https://developer.amd.com.cn/radeon/tokenfactory](https://developer.amd.com.cn/radeon/tokenfactory)
251
258
 
252
- > **Note**: Due to the context window limits of Apple's local models, it is highly recommended to set your max diff length (`diff_len`) to `10000` during setup. When prompted for large diffs, select the **Smart chunked mode** to avoid errors.
259
+ > **Note**: Registration requires **both an email address and a Chinese (+86) mobile phone number**. Without a Chinese phone number you cannot complete sign-up, so this provider is only usable if you have one.
260
+
261
+ ```
262
+ DeepSeek-V4-Flash
263
+ Qwen3.6-35B-A3B
264
+ MiniCPM5-1B
265
+ MiniCPM-V46
266
+ ```
253
267
 
254
268
  ## How It Works
255
269
  This CLI tool runs a `git diff` command to grab all staged changes, sends this to OpenAI's GPT API (or compatible endpoint), and returns an AI-generated commit message. The tool uses the `/v1/chat/completions` endpoint with optimized prompts/system instructions for generating conventional commit messages.
@@ -120,7 +120,15 @@ module CommitGpt
120
120
  # Update main config
121
121
  main_config = YAML.load_file(main_config_path)
122
122
  provider = main_config['providers'].find { |p| p['name'] == provider_name }
123
- provider&.merge!(main_attrs)
123
+ if provider
124
+ provider.merge!(main_attrs)
125
+ else
126
+ # Preset added after this config file was generated
127
+ preset = PROVIDER_PRESETS.find { |p| p[:value] == provider_name }
128
+ defaults = { 'name' => provider_name, 'model' => '', 'diff_len' => 32_768 }
129
+ defaults['base_url'] = preset[:base_url] if preset
130
+ main_config['providers'] << defaults.merge(main_attrs)
131
+ end
124
132
  save_main_config(main_config)
125
133
 
126
134
  # Update local config
@@ -3,6 +3,7 @@
3
3
  module CommitGpt
4
4
  # Provider presets for common AI providers
5
5
  PROVIDER_PRESETS = [
6
+ { label: 'AMD Radeon (China)', value: 'amd', base_url: 'https://developer.amd.com.cn/radeon/api/v1' },
6
7
  { label: 'Anthropic Claude', value: 'anthropic', base_url: 'https://api.anthropic.com/v1' },
7
8
  { label: 'Cerebras', value: 'cerebras', base_url: 'https://api.cerebras.ai/v1' },
8
9
  { label: 'DeepSeek', value: 'deepseek', base_url: 'https://api.deepseek.com' },
@@ -10,6 +10,9 @@ require_relative 'string'
10
10
  module CommitGpt
11
11
  # Interactive setup wizard for configuring AI providers
12
12
  class SetupWizard
13
+ # Seconds to wait when fetching the provider's model list
14
+ MODEL_FETCH_TIMEOUT = 30
15
+
13
16
  def initialize
14
17
  @prompt = TTY::Prompt.new
15
18
  end
@@ -251,7 +254,7 @@ module CommitGpt
251
254
 
252
255
  models = nil
253
256
  begin
254
- Timeout.timeout(5) do
257
+ Timeout.timeout(MODEL_FETCH_TIMEOUT) do
255
258
  headers = {
256
259
  'Content-Type' => 'application/json',
257
260
  'User-Agent' => "Ruby/#{RUBY_VERSION}"
@@ -269,7 +272,7 @@ module CommitGpt
269
272
  end
270
273
  end
271
274
  rescue Timeout::Error
272
- puts '✖ Connection timeout (5s). Please check your network, base_url, and api_key.'.red
275
+ puts "✖ Connection timeout (#{MODEL_FETCH_TIMEOUT}s). Please check your network, base_url, and api_key.".red
273
276
  exit(0)
274
277
  rescue StandardError => e
275
278
  puts "✖ Error fetching models: #{e.message}".red
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CommitGpt
4
- VERSION = '0.3.6'
4
+ VERSION = '0.3.8'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commitgpt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peng Zhang