commitgpt 0.3.1 → 0.3.3
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 +4 -4
- data/bin/aicm +1 -1
- data/commitgpt.gemspec +19 -18
- data/lib/commitgpt/cli.rb +28 -23
- data/lib/commitgpt/commit_ai.rb +126 -127
- data/lib/commitgpt/config_manager.rb +34 -34
- data/lib/commitgpt/provider_presets.rb +12 -12
- data/lib/commitgpt/setup_wizard.rb +87 -84
- data/lib/commitgpt/version.rb +1 -1
- data/lib/commitgpt.rb +2 -2
- metadata +6 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cc31b958101709cf5acae4d52106fd56ede0dea448fbc8332d60f4865315adeb
|
|
4
|
+
data.tar.gz: d60c821b82edd35a28caa2254a72722208af8019af86bb5e6f30d326f6a77845
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ee1adb84767305fb84d0b2371685498ebcb28efaaf50920425483c3db563a7e1917fa69735f08203f6d990d071d3b5c0536c28992cf655f3a75db5b49bb8fb99
|
|
7
|
+
data.tar.gz: 77e6f1cb82eecfe6e30f947fe3dd2fc1a0c4a456f104bee0119f459ae56296297183e16dcb4858bcef2a2857207cc4ecd2d7865df7a57760820e23df6ea21706
|
data/bin/aicm
CHANGED
data/commitgpt.gemspec
CHANGED
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative
|
|
3
|
+
require_relative 'lib/commitgpt/version'
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |spec|
|
|
6
|
-
spec.name =
|
|
6
|
+
spec.name = 'commitgpt'
|
|
7
7
|
spec.version = CommitGpt::VERSION
|
|
8
|
-
spec.authors = [
|
|
9
|
-
spec.email = [
|
|
8
|
+
spec.authors = ['Peng Zhang']
|
|
9
|
+
spec.email = ['zpregister@gmail.com']
|
|
10
10
|
|
|
11
|
-
spec.summary =
|
|
12
|
-
spec.description =
|
|
13
|
-
spec.homepage =
|
|
14
|
-
spec.license =
|
|
15
|
-
spec.required_ruby_version =
|
|
16
|
-
spec.metadata[
|
|
17
|
-
spec.metadata[
|
|
18
|
-
spec.metadata[
|
|
11
|
+
spec.summary = 'A CLI AI that writes git commit messages for you.'
|
|
12
|
+
spec.description = 'A CLI that writes your git commit messages for you with AI. Never write a commit message again.'
|
|
13
|
+
spec.homepage = 'https://github.com/ZPVIP/commitgpt'
|
|
14
|
+
spec.license = 'MIT'
|
|
15
|
+
spec.required_ruby_version = '>= 2.6.0'
|
|
16
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
|
17
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
|
18
|
+
spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/master/CHANGELOG.md"
|
|
19
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
|
19
20
|
|
|
20
21
|
# Specify which files should be added to the gem when it is released.
|
|
21
22
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
22
|
-
spec.files = Dir.glob(
|
|
23
|
+
spec.files = Dir.glob('lib/**/*') + Dir.glob('bin/*') + %w[README.md LICENSE commitgpt.gemspec]
|
|
23
24
|
.reject { |f| File.directory?(f) }
|
|
24
|
-
spec.bindir =
|
|
25
|
+
spec.bindir = 'bin'
|
|
25
26
|
spec.executables = spec.files.grep(%r{\Abin/}) { |f| File.basename(f) }
|
|
26
|
-
spec.require_paths = [
|
|
27
|
+
spec.require_paths = ['lib']
|
|
27
28
|
|
|
28
29
|
# Uncomment to register a new dependency of your gem
|
|
29
|
-
spec.add_dependency "httparty", "~> 0.
|
|
30
|
-
spec.add_dependency "thor", "~> 1.
|
|
31
|
-
spec.add_dependency
|
|
30
|
+
spec.add_dependency "httparty", "~> 0.24"
|
|
31
|
+
spec.add_dependency "thor", "~> 1.4"
|
|
32
|
+
spec.add_dependency 'tty-prompt', '~> 0.23'
|
|
32
33
|
|
|
33
34
|
# For more information and examples about making a new gem, checkout our
|
|
34
35
|
# guide at: https://bundler.io/guides/creating_gem.html
|
data/lib/commitgpt/cli.rb
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require
|
|
4
|
-
require
|
|
5
|
-
require
|
|
3
|
+
require 'thor'
|
|
4
|
+
require 'commitgpt/commit_ai'
|
|
5
|
+
require 'commitgpt/setup_wizard'
|
|
6
6
|
|
|
7
7
|
module CommitGpt
|
|
8
8
|
# CommitGpt CLI
|
|
9
9
|
class CLI < Thor
|
|
10
10
|
default_task :generate
|
|
11
11
|
|
|
12
|
-
desc
|
|
13
|
-
method_option :models, aliases:
|
|
14
|
-
method_option :verbose, aliases:
|
|
15
|
-
method_option :provider, aliases:
|
|
12
|
+
desc 'generate', 'AI commits for you!'
|
|
13
|
+
method_option :models, aliases: '-m', type: :boolean, desc: 'List/Select available models'
|
|
14
|
+
method_option :verbose, aliases: '-v', type: :boolean, desc: 'Show git diff being sent to AI'
|
|
15
|
+
method_option :provider, aliases: '-p', type: :boolean, desc: 'Switch active provider'
|
|
16
16
|
def generate
|
|
17
17
|
if options[:provider]
|
|
18
18
|
CommitGpt::SetupWizard.new.switch_provider
|
|
@@ -23,36 +23,41 @@ module CommitGpt
|
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
desc
|
|
26
|
+
desc 'setup', 'Configure AI provider and settings'
|
|
27
27
|
def setup
|
|
28
28
|
CommitGpt::SetupWizard.new.run
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
# Custom help message
|
|
32
|
-
def self.help(shell,
|
|
33
|
-
shell.say
|
|
34
|
-
shell.say
|
|
35
|
-
shell.say
|
|
36
|
-
shell.say
|
|
37
|
-
shell.say
|
|
38
|
-
shell.say
|
|
39
|
-
shell.say
|
|
40
|
-
shell.say
|
|
41
|
-
shell.say
|
|
42
|
-
shell.say
|
|
32
|
+
def self.help(shell, _subcommand = false)
|
|
33
|
+
shell.say 'Usage:'
|
|
34
|
+
shell.say ' aicm # Generate AI commit message (Default)'
|
|
35
|
+
shell.say ' aicm setup # Configure AI provider and settings'
|
|
36
|
+
shell.say ' aicm help [COMMAND] # Describe available commands'
|
|
37
|
+
shell.say ''
|
|
38
|
+
shell.say 'Options:'
|
|
39
|
+
shell.say ' -m, --models # Interactive model selection'
|
|
40
|
+
shell.say ' -p, --provider # Switch active provider'
|
|
41
|
+
shell.say ' -v, --verbose # Show git diff being sent to AI'
|
|
42
|
+
shell.say ''
|
|
43
43
|
|
|
44
44
|
# Show current configuration
|
|
45
45
|
begin
|
|
46
|
-
require
|
|
47
|
-
require
|
|
46
|
+
require 'commitgpt/config_manager'
|
|
47
|
+
require 'commitgpt/string'
|
|
48
48
|
config = CommitGpt::ConfigManager.get_active_provider_config
|
|
49
49
|
if config
|
|
50
|
-
|
|
50
|
+
require 'commitgpt/version'
|
|
51
|
+
shell.say "CommitGPT v#{CommitGpt::VERSION}"
|
|
52
|
+
shell.say "Bin Path: #{File.realpath($PROGRAM_NAME)}".gray
|
|
53
|
+
shell.say ''
|
|
54
|
+
|
|
55
|
+
shell.say 'Current Configuration:'
|
|
51
56
|
shell.say " Provider: #{config['name'].green}"
|
|
52
57
|
shell.say " Model: #{config['model'].cyan}"
|
|
53
58
|
shell.say " Base URL: #{config['base_url']}"
|
|
54
59
|
shell.say " Diff Len: #{config['diff_len']}"
|
|
55
|
-
shell.say
|
|
60
|
+
shell.say ''
|
|
56
61
|
end
|
|
57
62
|
rescue StandardError
|
|
58
63
|
# Ignore errors during help display if config is missing/invalid
|