mitch-ai 0.2.0 → 0.4.0
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/.github/dependabot.yml +9 -0
- data/.github/workflows/main.yml +12 -58
- data/.markdownlint.json +5 -0
- data/.rubocop.yml +11 -0
- data/CHANGELOG.md +40 -1
- data/Gemfile.lock +5 -1
- data/README.md +5 -4
- data/exe/mitch-ai +15 -0
- data/lib/mitch_ai/ai_providers/openai_provider.rb +2 -0
- data/lib/mitch_ai/analyzers/file_analyzer.rb +19 -0
- data/lib/mitch_ai/cli.rb +16 -13
- data/lib/mitch_ai/configuration.rb +2 -0
- data/lib/mitch_ai/version.rb +1 -1
- data/mitch_ai.gemspec +3 -2
- metadata +20 -4
- data/exe/mitch_ai +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3204ae0864f587c1b2f8294d9b6b85f86515038fff92853c621ed5699c86b964
|
4
|
+
data.tar.gz: d70f16d762e4ff3e97a93407d57269c96f4cf963e1046e92a1d15f8fc7464607
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29214ba35f357eeb139840cbb908098a8ed59ba057e6ce0ff8bc87ba1dc45c2a38080f88d008a8439c759ea7c402f0d682d6932d8c0498f30dc2299af43e9cfa
|
7
|
+
data.tar.gz: 01d3b30c04f61a991fab3741dd28289babfc2f49af26fe8cfe85a0f98669886167eaa2ffe61d27f79529c80283e344d78853b4188e6d7961c3716f5c3ee54e79
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# Please see the documentation for all configuration options:
|
2
|
+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
3
|
+
|
4
|
+
version: 2
|
5
|
+
updates:
|
6
|
+
- package-ecosystem: "bundler"
|
7
|
+
directory: "/"
|
8
|
+
schedule:
|
9
|
+
interval: "weekly"
|
data/.github/workflows/main.yml
CHANGED
@@ -1,73 +1,27 @@
|
|
1
|
-
name: Ruby
|
1
|
+
name: Ruby
|
2
2
|
|
3
3
|
on:
|
4
4
|
push:
|
5
|
-
branches:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
|
6
8
|
pull_request:
|
7
|
-
branches: ["main"]
|
8
9
|
|
9
10
|
jobs:
|
10
|
-
|
11
|
+
build:
|
11
12
|
runs-on: ubuntu-latest
|
12
|
-
|
13
|
+
name: Ruby ${{ matrix.ruby }}
|
13
14
|
strategy:
|
14
15
|
matrix:
|
15
|
-
ruby
|
16
|
+
ruby:
|
17
|
+
- "3.4.2"
|
16
18
|
|
17
19
|
steps:
|
18
|
-
- uses: actions/checkout@
|
19
|
-
|
20
|
-
- name: Set up Ruby
|
21
|
-
uses: ruby/setup-ruby@v1
|
22
|
-
with:
|
23
|
-
ruby-version: ${{ matrix.ruby-version }}
|
24
|
-
bundler-cache: true # runs 'bundle install' and caches installed gems
|
25
|
-
|
26
|
-
- name: Run RSpec
|
27
|
-
run: bundle exec rspec
|
28
|
-
|
29
|
-
- name: Run Rubocop
|
30
|
-
run: bundle exec rubocop
|
31
|
-
|
32
|
-
code-quality:
|
33
|
-
runs-on: ubuntu-latest
|
34
|
-
|
35
|
-
steps:
|
36
|
-
- uses: actions/checkout@v3
|
37
|
-
|
20
|
+
- uses: actions/checkout@v4
|
38
21
|
- name: Set up Ruby
|
39
22
|
uses: ruby/setup-ruby@v1
|
40
23
|
with:
|
41
|
-
ruby-version:
|
24
|
+
ruby-version: ${{ matrix.ruby }}
|
42
25
|
bundler-cache: true
|
43
|
-
|
44
|
-
|
45
|
-
uses: codecov/codecov-action@v3
|
46
|
-
with:
|
47
|
-
fail_ci_if_error: true
|
48
|
-
|
49
|
-
publish:
|
50
|
-
needs: [test, code-quality]
|
51
|
-
runs-on: ubuntu-latest
|
52
|
-
|
53
|
-
steps:
|
54
|
-
- uses: actions/checkout@v3
|
55
|
-
|
56
|
-
- name: Set up Ruby
|
57
|
-
uses: ruby/setup-ruby@v1
|
58
|
-
with:
|
59
|
-
ruby-version: "3.2"
|
60
|
-
|
61
|
-
- name: Build Gem
|
62
|
-
run: gem build *.gemspec
|
63
|
-
|
64
|
-
- name: Publish to RubyGems
|
65
|
-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
66
|
-
run: |
|
67
|
-
mkdir -p ~/.gem
|
68
|
-
touch ~/.gem/credentials
|
69
|
-
chmod 0600 ~/.gem/credentials
|
70
|
-
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > ~/.gem/credentials
|
71
|
-
gem push *.gem
|
72
|
-
env:
|
73
|
-
GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
|
26
|
+
- name: Run tests
|
27
|
+
run: bundle exec rspec --format documentation -v
|
data/.markdownlint.json
ADDED
data/.rubocop.yml
CHANGED
@@ -19,3 +19,14 @@ Layout/LineLength:
|
|
19
19
|
Style/StringLiterals:
|
20
20
|
Enabled: true
|
21
21
|
EnforcedStyle: single_quotes
|
22
|
+
|
23
|
+
Layout/TrailingEmptyLines:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
Naming/FileName:
|
27
|
+
Exclude:
|
28
|
+
- "exe/*"
|
29
|
+
|
30
|
+
Layout/LeadingCommentSpace:
|
31
|
+
Exclude:
|
32
|
+
- "exe/*"
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,44 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
1
8
|
## [Unreleased]
|
2
9
|
|
10
|
+
## [0.4.0] - 2025-05-23
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
|
14
|
+
- Fixed bundler setup issue that prevented gem from running outside development directory
|
15
|
+
- Fixed spinner execution in standalone executable mode
|
16
|
+
- Corrected load path configuration for proper gem installation
|
17
|
+
|
18
|
+
### Changed
|
19
|
+
|
20
|
+
- Improved executable reliability across different Ruby environments
|
21
|
+
- Added support for more languages
|
22
|
+
|
23
|
+
## [0.3.0] - 2025-04-15
|
24
|
+
|
25
|
+
### Added
|
26
|
+
|
27
|
+
- TTY spinner for better user experience during code analysis
|
28
|
+
- Visual feedback with loading indicators and completion status
|
29
|
+
|
30
|
+
## [0.2.0] - 2025-03-27
|
31
|
+
|
32
|
+
### Changed
|
33
|
+
|
34
|
+
- Updated versioning scheme for better release management
|
35
|
+
|
3
36
|
## [0.1.0] - 2025-03-27
|
4
37
|
|
5
|
-
|
38
|
+
### Added
|
39
|
+
|
40
|
+
- Initial release with basic AI-powered code review functionality
|
41
|
+
- Support for multiple programming languages
|
42
|
+
- CLI interface with Thor
|
43
|
+
- OpenAI integration for code analysis
|
44
|
+
- JSON and terminal output formats
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mitch-ai (0.
|
4
|
+
mitch-ai (0.4.0)
|
5
5
|
ruby-openai (~> 3.7)
|
6
6
|
thor (~> 1.2)
|
7
|
+
tty-spinner (~> 0.9.3)
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: https://rubygems.org/
|
@@ -152,6 +153,9 @@ GEM
|
|
152
153
|
terminal-table (4.0.0)
|
153
154
|
unicode-display_width (>= 1.1.1, < 4)
|
154
155
|
thor (1.3.2)
|
156
|
+
tty-cursor (0.7.1)
|
157
|
+
tty-spinner (0.9.3)
|
158
|
+
tty-cursor (~> 0.7)
|
155
159
|
tzinfo (2.0.6)
|
156
160
|
concurrent-ruby (~> 1.0)
|
157
161
|
unicode-display_width (3.1.4)
|
data/README.md
CHANGED
@@ -27,22 +27,23 @@ catch potential issues, and receive actionable insights.
|
|
27
27
|
## 🛠️ Installation
|
28
28
|
|
29
29
|
```bash
|
30
|
-
gem install
|
30
|
+
gem install mitch-ai
|
31
31
|
```
|
32
32
|
|
33
33
|
## 💡 Usage
|
34
34
|
|
35
35
|
```bash
|
36
36
|
# Review a single file
|
37
|
-
|
37
|
+
mitch-ai review ./path/to/file.rb
|
38
|
+
mitch-ai review ./path/to/file.tsx
|
38
39
|
|
39
40
|
# Review entire project directory
|
40
|
-
|
41
|
+
mitch-ai review ./project
|
41
42
|
```
|
42
43
|
|
43
44
|
## 🤝 Contributing
|
44
45
|
|
45
|
-
Contributions are welcome! Please check out
|
46
|
+
Contributions are welcome! Please check out [Contributing Guidelines](CONTRIBUTING.md).
|
46
47
|
|
47
48
|
1. Fork the repository
|
48
49
|
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
data/exe/mitch-ai
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
gem_root = File.expand_path('..', File.dirname(__FILE__))
|
4
|
+
lib_path = File.join(gem_root, 'lib')
|
5
|
+
|
6
|
+
$LOAD_PATH.unshift(lib_path) unless $LOAD_PATH.include?(lib_path)
|
7
|
+
|
8
|
+
begin
|
9
|
+
require 'mitch_ai'
|
10
|
+
rescue LoadError => e
|
11
|
+
puts "Failed to load: #{e.message}"
|
12
|
+
exit 1
|
13
|
+
end
|
14
|
+
|
15
|
+
MitchAI::CLI.start(ARGV)
|
@@ -10,6 +10,7 @@ module MitchAI
|
|
10
10
|
@client = OpenAI::Client.new(access_token: @api_key)
|
11
11
|
end
|
12
12
|
|
13
|
+
# rubocop:disable Metrics/MethodLength, Layout/LineLength
|
13
14
|
def analyze_code(code, language)
|
14
15
|
response = @client.chat(
|
15
16
|
parameters: {
|
@@ -30,6 +31,7 @@ module MitchAI
|
|
30
31
|
|
31
32
|
parse_review_response(response)
|
32
33
|
end
|
34
|
+
# rubocop:enable Metrics/MethodLength, Layout/LineLength
|
33
35
|
|
34
36
|
private
|
35
37
|
|
@@ -13,12 +13,31 @@ module MitchAI
|
|
13
13
|
'.java' => 'Java',
|
14
14
|
'.c' => 'C',
|
15
15
|
'.cpp' => 'C++',
|
16
|
+
'.cc' => 'C++',
|
17
|
+
'.cxx' => 'C++',
|
18
|
+
'.h' => 'C/C++ Header',
|
19
|
+
'.hpp' => 'C++ Header',
|
20
|
+
'.cs' => 'C#',
|
16
21
|
'.php' => 'PHP',
|
17
22
|
'.go' => 'Go',
|
18
23
|
'.rs' => 'Rust',
|
19
24
|
'.ts' => 'TypeScript',
|
20
25
|
'.jsx' => 'React JSX',
|
21
26
|
'.tsx' => 'React TSX',
|
27
|
+
'.swift' => 'Swift',
|
28
|
+
'.kt' => 'Kotlin',
|
29
|
+
'.scala' => 'Scala',
|
30
|
+
'.sh' => 'Shell Script',
|
31
|
+
'.bash' => 'Bash',
|
32
|
+
'.zsh' => 'Zsh',
|
33
|
+
'.sql' => 'SQL',
|
34
|
+
'.yml' => 'YAML',
|
35
|
+
'.yaml' => 'YAML',
|
36
|
+
'.json' => 'JSON',
|
37
|
+
'.xml' => 'XML',
|
38
|
+
'.dart' => 'Dart',
|
39
|
+
'.vue' => 'Vue.js',
|
40
|
+
'.svelte' => 'Svelte'
|
22
41
|
}
|
23
42
|
|
24
43
|
def initialize(file_path)
|
data/lib/mitch_ai/cli.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'thor'
|
4
|
-
# Remove require 'linguist'
|
5
4
|
require 'json'
|
5
|
+
require 'tty-spinner'
|
6
6
|
require_relative 'configuration'
|
7
7
|
require_relative 'analyzers/file_analyzer'
|
8
8
|
|
@@ -13,6 +13,7 @@ module MitchAI
|
|
13
13
|
option :provider, default: 'openai', desc: 'AI provider to use'
|
14
14
|
option :verbose, type: :boolean, default: false, desc: 'Show verbose output'
|
15
15
|
|
16
|
+
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
|
16
17
|
def review(path)
|
17
18
|
# Validate API key is configured
|
18
19
|
ensure_api_key_configured
|
@@ -24,28 +25,30 @@ module MitchAI
|
|
24
25
|
[path]
|
25
26
|
end
|
26
27
|
|
27
|
-
# Analyze each file - let FileAnalyzer handle language detection
|
28
|
-
# Analyze each file
|
29
28
|
results = paths.map do |file_path|
|
30
|
-
|
29
|
+
spinner = TTY::Spinner.new("[:spinner] Analyzing #{file_path}...", format: :dots)
|
30
|
+
spinner.auto_spin
|
31
|
+
|
31
32
|
analyzer = Analyzers::FileAnalyzer.new(file_path)
|
32
|
-
puts 'Analyzer initialized successfully'
|
33
33
|
result = analyzer.analyze
|
34
|
-
|
34
|
+
spinner.success('✅ Done')
|
35
35
|
result
|
36
36
|
rescue StandardError => e
|
37
|
-
puts "Error
|
38
|
-
puts e.backtrace[0..5] if options[:verbose]
|
37
|
+
puts "❌ Error: #{e.message}"
|
39
38
|
nil
|
40
39
|
end.compact
|
41
|
-
puts "
|
40
|
+
puts "\nFound #{results.length} files to analyze\n\n"
|
42
41
|
|
43
42
|
# Output results
|
44
43
|
output_results(results, options[:format])
|
45
44
|
rescue StandardError => e
|
46
|
-
|
47
|
-
|
45
|
+
# Stop the spinner with error message if there's an exception
|
46
|
+
spinner.error('(Error!)') if defined?(spinner) && spinner
|
47
|
+
puts "Error during analysis: #{e.class}: #{e.message}"
|
48
|
+
puts e.backtrace[0..5] if options[:verbose]
|
49
|
+
nil
|
48
50
|
end
|
51
|
+
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
|
49
52
|
|
50
53
|
private
|
51
54
|
|
@@ -54,8 +57,8 @@ module MitchAI
|
|
54
57
|
return unless config.api_key.nil?
|
55
58
|
|
56
59
|
puts '❌ No API key configured. Please run:'
|
57
|
-
puts '
|
58
|
-
exit 1
|
60
|
+
puts ' mitch-ai configure'
|
61
|
+
exit 1 unless ENV['RSPEC_RUNNING']
|
59
62
|
end
|
60
63
|
|
61
64
|
def output_results(results, format)
|
@@ -42,6 +42,7 @@ module MitchAI
|
|
42
42
|
# Don't override default provider if not needed
|
43
43
|
end
|
44
44
|
|
45
|
+
# rubocop:disable Metrics/MethodLength
|
45
46
|
def save_api_key(provider, api_key)
|
46
47
|
# Ensure config directory exists
|
47
48
|
FileUtils.mkdir_p(File.dirname(CONFIG_FILE))
|
@@ -66,6 +67,7 @@ module MitchAI
|
|
66
67
|
# Update current instance
|
67
68
|
@api_key = api_key
|
68
69
|
end
|
70
|
+
# rubocop:enable Metrics/MethodLength
|
69
71
|
|
70
72
|
def symbolize_keys(hash)
|
71
73
|
hash.each_with_object({}) do |(key, value), result|
|
data/lib/mitch_ai/version.rb
CHANGED
data/mitch_ai.gemspec
CHANGED
@@ -22,13 +22,14 @@ Gem::Specification.new do |spec|
|
|
22
22
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
23
23
|
end
|
24
24
|
|
25
|
-
spec.bindir
|
26
|
-
spec.executables
|
25
|
+
spec.bindir = 'exe'
|
26
|
+
spec.executables = ['mitch-ai']
|
27
27
|
spec.require_paths = ['lib']
|
28
28
|
|
29
29
|
# Dependencies
|
30
30
|
spec.add_dependency 'thor', '~> 1.2'
|
31
31
|
spec.add_dependency 'ruby-openai', '~> 3.7'
|
32
|
+
spec.add_dependency 'tty-spinner', '~> 0.9.3'
|
32
33
|
|
33
34
|
# Development dependencies
|
34
35
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mitch-ai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Cook
|
@@ -37,6 +37,20 @@ dependencies:
|
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '3.7'
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: tty-spinner
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.9.3
|
47
|
+
type: :runtime
|
48
|
+
prerelease: false
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.9.3
|
40
54
|
- !ruby/object:Gem::Dependency
|
41
55
|
name: bundler
|
42
56
|
requirement: !ruby/object:Gem::Requirement
|
@@ -155,12 +169,14 @@ description: MitchAI is an intelligent CLI tool that leverages artificial intell
|
|
155
169
|
email:
|
156
170
|
- stevorevo@duck.com
|
157
171
|
executables:
|
158
|
-
-
|
172
|
+
- mitch-ai
|
159
173
|
extensions: []
|
160
174
|
extra_rdoc_files: []
|
161
175
|
files:
|
176
|
+
- ".github/dependabot.yml"
|
162
177
|
- ".github/workflows/main.yml"
|
163
178
|
- ".gitignore"
|
179
|
+
- ".markdownlint.json"
|
164
180
|
- ".rspec"
|
165
181
|
- ".rubocop.yml"
|
166
182
|
- ".rubocop_todo.yml"
|
@@ -175,7 +191,7 @@ files:
|
|
175
191
|
- Steep
|
176
192
|
- bin/console
|
177
193
|
- bin/setup
|
178
|
-
- exe/
|
194
|
+
- exe/mitch-ai
|
179
195
|
- lib/mitch_ai.rb
|
180
196
|
- lib/mitch_ai/ai_providers/openai_provider.rb
|
181
197
|
- lib/mitch_ai/analyzers/file_analyzer.rb
|
@@ -203,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
203
219
|
- !ruby/object:Gem::Version
|
204
220
|
version: '0'
|
205
221
|
requirements: []
|
206
|
-
rubygems_version: 3.6.
|
222
|
+
rubygems_version: 3.6.9
|
207
223
|
specification_version: 4
|
208
224
|
summary: AI-powered code review assistant
|
209
225
|
test_files: []
|