mitch-ai 0.2.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 +7 -0
- data/.github/workflows/main.yml +73 -0
- data/.gitignore +14 -0
- data/.rspec +3 -0
- data/.rubocop.yml +21 -0
- data/.rubocop_todo.yml +84 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +29 -0
- data/CONTRIBUTING.md +69 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +179 -0
- data/LICENSE.txt +21 -0
- data/README.md +86 -0
- data/Rakefile +32 -0
- data/Steep +4 -0
- data/bin/console +11 -0
- data/bin/setup +8 -0
- data/exe/mitch_ai +6 -0
- data/lib/mitch_ai/ai_providers/openai_provider.rb +44 -0
- data/lib/mitch_ai/analyzers/file_analyzer.rb +68 -0
- data/lib/mitch_ai/cli.rb +84 -0
- data/lib/mitch_ai/configuration.rb +103 -0
- data/lib/mitch_ai/version.rb +5 -0
- data/lib/mitch_ai.rb +11 -0
- data/mitch-ai-logo.svg +35 -0
- data/mitch_ai.gemspec +43 -0
- data/sig/mitch_ai.rbs +37 -0
- metadata +209 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 43cece7d46ccb8562b4e59077d3410c65b6a7dca8bea53bce56ad9faba217627
|
4
|
+
data.tar.gz: 9a03e757842974408b2252e037321525ae97dd2d95c4ef0fcc30a78a9a7f082d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: dcbfe671a3e72397a1b63fcd51d4e07849cdf9c2858c8b2981e631e36c4d15ead3205f85cfe7830aca16e44d93c8b89a56925820ed66ea227199a192dc87cd8a
|
7
|
+
data.tar.gz: 29b6d4defc8913201b5aba6b30f70f5d9189325b28fc35d859ee3d8bb36cd4d15694e5f21dd1b16b6fa4e3d4f4db6722b5892bc27ee034ecaab55fe635278f24
|
@@ -0,0 +1,73 @@
|
|
1
|
+
name: Ruby CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: ["main"]
|
6
|
+
pull_request:
|
7
|
+
branches: ["main"]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
|
13
|
+
strategy:
|
14
|
+
matrix:
|
15
|
+
ruby-version: ["3.0", "3.1", "3.2"]
|
16
|
+
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v3
|
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
|
+
|
38
|
+
- name: Set up Ruby
|
39
|
+
uses: ruby/setup-ruby@v1
|
40
|
+
with:
|
41
|
+
ruby-version: "3.2"
|
42
|
+
bundler-cache: true
|
43
|
+
|
44
|
+
- name: Code Coverage
|
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}}
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
TargetRubyVersion: 3.2
|
5
|
+
NewCops: enable
|
6
|
+
Exclude:
|
7
|
+
- "sig/**/*.rbs"
|
8
|
+
|
9
|
+
Style/Documentation:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
Metrics/BlockLength:
|
13
|
+
Exclude:
|
14
|
+
- "spec/**/*"
|
15
|
+
|
16
|
+
Layout/LineLength:
|
17
|
+
Max: 120
|
18
|
+
|
19
|
+
Style/StringLiterals:
|
20
|
+
Enabled: true
|
21
|
+
EnforcedStyle: single_quotes
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2025-03-27 20:43:23 UTC using RuboCop version 1.75.1.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 6
|
10
|
+
# Configuration parameters: EnforcedStyle, AllowedGems, Include.
|
11
|
+
# SupportedStyles: Gemfile, gems.rb, gemspec
|
12
|
+
# Include: **/*.gemspec, **/Gemfile, **/gems.rb
|
13
|
+
Gemspec/DevelopmentDependencies:
|
14
|
+
Exclude:
|
15
|
+
- "mitch_ai.gemspec"
|
16
|
+
|
17
|
+
# Offense count: 2
|
18
|
+
# This cop supports safe autocorrection (--autocorrect).
|
19
|
+
# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
|
20
|
+
# Include: **/*.gemspec
|
21
|
+
Gemspec/OrderedDependencies:
|
22
|
+
Exclude:
|
23
|
+
- "mitch_ai.gemspec"
|
24
|
+
|
25
|
+
# Offense count: 1
|
26
|
+
# This cop supports safe autocorrection (--autocorrect).
|
27
|
+
# Configuration parameters: Severity, Include.
|
28
|
+
# Include: **/*.gemspec
|
29
|
+
Gemspec/RequireMFA:
|
30
|
+
Exclude:
|
31
|
+
- "mitch_ai.gemspec"
|
32
|
+
|
33
|
+
# Offense count: 1
|
34
|
+
# Configuration parameters: Severity, Include.
|
35
|
+
# Include: **/*.gemspec
|
36
|
+
Gemspec/RequiredRubyVersion:
|
37
|
+
Exclude:
|
38
|
+
- "mitch_ai.gemspec"
|
39
|
+
|
40
|
+
# Offense count: 2
|
41
|
+
# This cop supports safe autocorrection (--autocorrect).
|
42
|
+
# Configuration parameters: AllowInHeredoc.
|
43
|
+
Layout/TrailingWhitespace:
|
44
|
+
Exclude:
|
45
|
+
- "lib/mitch_ai/analyzers/file_analyzer.rb"
|
46
|
+
|
47
|
+
# Offense count: 1
|
48
|
+
# Configuration parameters: AllowComments.
|
49
|
+
Lint/EmptyFile:
|
50
|
+
Exclude:
|
51
|
+
- "spec/support/simplecov.rb"
|
52
|
+
|
53
|
+
# Offense count: 2
|
54
|
+
# This cop supports safe autocorrection (--autocorrect).
|
55
|
+
Style/ExpandPathArguments:
|
56
|
+
Exclude:
|
57
|
+
- "mitch_ai.gemspec"
|
58
|
+
|
59
|
+
# Offense count: 3
|
60
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
61
|
+
# Configuration parameters: EnforcedStyle.
|
62
|
+
# SupportedStyles: always, always_true, never
|
63
|
+
Style/FrozenStringLiteralComment:
|
64
|
+
Exclude:
|
65
|
+
- "**/*.arb"
|
66
|
+
- "lib/mitch_ai/analyzers/file_analyzer.rb"
|
67
|
+
- "mitch_ai.gemspec"
|
68
|
+
- "spec/mitch_ai/configuration_spec.rb"
|
69
|
+
|
70
|
+
# Offense count: 1
|
71
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
72
|
+
# Configuration parameters: EnforcedStyle.
|
73
|
+
# SupportedStyles: literals, strict
|
74
|
+
Style/MutableConstant:
|
75
|
+
Exclude:
|
76
|
+
- "lib/mitch_ai/analyzers/file_analyzer.rb"
|
77
|
+
|
78
|
+
# Offense count: 1
|
79
|
+
# This cop supports safe autocorrection (--autocorrect).
|
80
|
+
# Configuration parameters: EnforcedStyleForMultiline.
|
81
|
+
# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
|
82
|
+
Style/TrailingCommaInHashLiteral:
|
83
|
+
Exclude:
|
84
|
+
- "lib/mitch_ai/analyzers/file_analyzer.rb"
|
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
I am committed to providing a friendly, safe, and welcoming environment for all
|
6
|
+
contributors.
|
7
|
+
|
8
|
+
## Standards
|
9
|
+
|
10
|
+
### Positive Behavior Includes
|
11
|
+
|
12
|
+
- Being kind and empathetic
|
13
|
+
- Respecting different viewpoints
|
14
|
+
- Giving and gracefully accepting constructive feedback
|
15
|
+
- Focusing on what is best for the community
|
16
|
+
|
17
|
+
### Unacceptable Behavior
|
18
|
+
|
19
|
+
- Harassment, discrimination, or offensive comments
|
20
|
+
- Personal or political attacks
|
21
|
+
- Public or private harassment
|
22
|
+
- Publishing others' private information without permission
|
23
|
+
|
24
|
+
## Attribution
|
25
|
+
|
26
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
27
|
+
version 2.0.
|
28
|
+
|
29
|
+
[homepage]: https://www.contributor-covenant.org
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# Contributing to MitchAI
|
2
|
+
|
3
|
+
First off, thank you for considering contributing to MitchAI! 🎉
|
4
|
+
|
5
|
+
## 🛠 Development Setup
|
6
|
+
|
7
|
+
1. Fork the repository
|
8
|
+
2. Clone your fork
|
9
|
+
3. Create a new branch for your feature
|
10
|
+
4. Make your changes
|
11
|
+
5. Run tests and linter
|
12
|
+
6. Submit a pull request
|
13
|
+
|
14
|
+
### Prerequisites
|
15
|
+
|
16
|
+
- Ruby 3.0+
|
17
|
+
- Bundler
|
18
|
+
- OpenAI API Key (for testing)
|
19
|
+
|
20
|
+
### Local Development
|
21
|
+
|
22
|
+
```bash
|
23
|
+
# Install dependencies
|
24
|
+
bundle install
|
25
|
+
|
26
|
+
# Run tests
|
27
|
+
bundle exec rspec
|
28
|
+
|
29
|
+
# Run linter
|
30
|
+
bundle exec rubocop
|
31
|
+
```
|
32
|
+
|
33
|
+
## 🤝 How to Contribute
|
34
|
+
|
35
|
+
### Reporting Bugs
|
36
|
+
|
37
|
+
- Use the GitHub Issues section
|
38
|
+
- Provide a clear and descriptive title
|
39
|
+
- Describe the expected behavior and actual behavior
|
40
|
+
- Include steps to reproduce the issue
|
41
|
+
- Provide your Ruby version and system details
|
42
|
+
|
43
|
+
### Suggesting Enhancements
|
44
|
+
|
45
|
+
- Open a GitHub Issue
|
46
|
+
- Clearly describe the enhancement
|
47
|
+
- Provide context and potential implementation details
|
48
|
+
|
49
|
+
### Pull Request Process
|
50
|
+
|
51
|
+
1. Ensure all tests pass
|
52
|
+
2. Update documentation if necessary
|
53
|
+
3. Add tests for new features
|
54
|
+
4. Ensure code follows RuboCop style guidelines
|
55
|
+
|
56
|
+
## 🌟 Code of Conduct
|
57
|
+
|
58
|
+
Be respectful, inclusive, and constructive. I welcome contributions from everyone!
|
59
|
+
|
60
|
+
## 📝 Code Style
|
61
|
+
|
62
|
+
- Follow RuboCop guidelines
|
63
|
+
- Write clear, concise comments
|
64
|
+
- Keep methods small and focused
|
65
|
+
- Write tests for new features
|
66
|
+
|
67
|
+
## 🏆 Recognition
|
68
|
+
|
69
|
+
Contributors will be acknowledged in the README and project documentation.
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,179 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
mitch-ai (0.1.0)
|
5
|
+
ruby-openai (~> 3.7)
|
6
|
+
thor (~> 1.2)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activesupport (8.0.2)
|
12
|
+
base64
|
13
|
+
benchmark (>= 0.3)
|
14
|
+
bigdecimal
|
15
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
16
|
+
connection_pool (>= 2.2.5)
|
17
|
+
drb
|
18
|
+
i18n (>= 1.6, < 2)
|
19
|
+
logger (>= 1.4.2)
|
20
|
+
minitest (>= 5.1)
|
21
|
+
securerandom (>= 0.3)
|
22
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
23
|
+
uri (>= 0.13.1)
|
24
|
+
ast (2.4.3)
|
25
|
+
base64 (0.2.0)
|
26
|
+
benchmark (0.4.0)
|
27
|
+
bigdecimal (3.1.9)
|
28
|
+
byebug (11.1.3)
|
29
|
+
codecov (0.6.0)
|
30
|
+
simplecov (>= 0.15, < 0.22)
|
31
|
+
coderay (1.1.3)
|
32
|
+
concurrent-ruby (1.3.5)
|
33
|
+
connection_pool (2.5.0)
|
34
|
+
csv (3.3.3)
|
35
|
+
date (3.4.1)
|
36
|
+
diff-lcs (1.6.1)
|
37
|
+
docile (1.4.1)
|
38
|
+
drb (2.2.1)
|
39
|
+
ffi (1.17.1)
|
40
|
+
ffi (1.17.1-arm64-darwin)
|
41
|
+
fileutils (1.7.3)
|
42
|
+
httparty (0.23.0)
|
43
|
+
csv
|
44
|
+
mini_mime (>= 1.0.0)
|
45
|
+
multi_xml (>= 0.5.2)
|
46
|
+
i18n (1.14.7)
|
47
|
+
concurrent-ruby (~> 1.0)
|
48
|
+
io-console (0.8.0)
|
49
|
+
irb (1.15.1)
|
50
|
+
pp (>= 0.6.0)
|
51
|
+
rdoc (>= 4.0.0)
|
52
|
+
reline (>= 0.4.2)
|
53
|
+
json (2.10.2)
|
54
|
+
language_server-protocol (3.17.0.4)
|
55
|
+
lint_roller (1.1.0)
|
56
|
+
listen (3.9.0)
|
57
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
58
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
59
|
+
logger (1.7.0)
|
60
|
+
method_source (1.1.0)
|
61
|
+
mini_mime (1.1.5)
|
62
|
+
minitest (5.25.5)
|
63
|
+
multi_xml (0.7.1)
|
64
|
+
bigdecimal (~> 3.1)
|
65
|
+
mutex_m (0.3.0)
|
66
|
+
parallel (1.26.3)
|
67
|
+
parser (3.3.7.3)
|
68
|
+
ast (~> 2.4.1)
|
69
|
+
racc
|
70
|
+
pp (0.6.2)
|
71
|
+
prettyprint
|
72
|
+
prettyprint (0.2.0)
|
73
|
+
prism (1.4.0)
|
74
|
+
pry (0.14.2)
|
75
|
+
coderay (~> 1.1)
|
76
|
+
method_source (~> 1.0)
|
77
|
+
pry-byebug (3.10.1)
|
78
|
+
byebug (~> 11.0)
|
79
|
+
pry (>= 0.13, < 0.15)
|
80
|
+
psych (5.2.3)
|
81
|
+
date
|
82
|
+
stringio
|
83
|
+
racc (1.8.1)
|
84
|
+
rainbow (3.1.1)
|
85
|
+
rake (13.2.1)
|
86
|
+
rb-fsevent (0.11.2)
|
87
|
+
rb-inotify (0.11.1)
|
88
|
+
ffi (~> 1.0)
|
89
|
+
rbs (3.9.1)
|
90
|
+
logger
|
91
|
+
rdoc (6.13.0)
|
92
|
+
psych (>= 4.0.0)
|
93
|
+
regexp_parser (2.10.0)
|
94
|
+
reline (0.6.0)
|
95
|
+
io-console (~> 0.5)
|
96
|
+
rspec (3.13.0)
|
97
|
+
rspec-core (~> 3.13.0)
|
98
|
+
rspec-expectations (~> 3.13.0)
|
99
|
+
rspec-mocks (~> 3.13.0)
|
100
|
+
rspec-core (3.13.3)
|
101
|
+
rspec-support (~> 3.13.0)
|
102
|
+
rspec-expectations (3.13.3)
|
103
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
104
|
+
rspec-support (~> 3.13.0)
|
105
|
+
rspec-mocks (3.13.2)
|
106
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
107
|
+
rspec-support (~> 3.13.0)
|
108
|
+
rspec-support (3.13.2)
|
109
|
+
rubocop (1.75.1)
|
110
|
+
json (~> 2.3)
|
111
|
+
language_server-protocol (~> 3.17.0.2)
|
112
|
+
lint_roller (~> 1.1.0)
|
113
|
+
parallel (~> 1.10)
|
114
|
+
parser (>= 3.3.0.2)
|
115
|
+
rainbow (>= 2.2.2, < 4.0)
|
116
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
117
|
+
rubocop-ast (>= 1.43.0, < 2.0)
|
118
|
+
ruby-progressbar (~> 1.7)
|
119
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
120
|
+
rubocop-ast (1.43.0)
|
121
|
+
parser (>= 3.3.7.2)
|
122
|
+
prism (~> 1.4)
|
123
|
+
ruby-openai (3.7.0)
|
124
|
+
httparty (>= 0.18.1)
|
125
|
+
ruby-progressbar (1.13.0)
|
126
|
+
securerandom (0.4.1)
|
127
|
+
simplecov (0.21.2)
|
128
|
+
docile (~> 1.1)
|
129
|
+
simplecov-html (~> 0.11)
|
130
|
+
simplecov_json_formatter (~> 0.1)
|
131
|
+
simplecov-html (0.13.1)
|
132
|
+
simplecov_json_formatter (0.1.4)
|
133
|
+
steep (1.10.0)
|
134
|
+
activesupport (>= 5.1)
|
135
|
+
concurrent-ruby (>= 1.1.10)
|
136
|
+
csv (>= 3.0.9)
|
137
|
+
fileutils (>= 1.1.0)
|
138
|
+
json (>= 2.1.0)
|
139
|
+
language_server-protocol (>= 3.17.0.4, < 4.0)
|
140
|
+
listen (~> 3.0)
|
141
|
+
logger (>= 1.3.0)
|
142
|
+
mutex_m (>= 0.3.0)
|
143
|
+
parser (>= 3.1)
|
144
|
+
rainbow (>= 2.2.2, < 4.0)
|
145
|
+
rbs (~> 3.9)
|
146
|
+
securerandom (>= 0.1)
|
147
|
+
strscan (>= 1.0.0)
|
148
|
+
terminal-table (>= 2, < 5)
|
149
|
+
uri (>= 0.12.0)
|
150
|
+
stringio (3.1.6)
|
151
|
+
strscan (3.1.2)
|
152
|
+
terminal-table (4.0.0)
|
153
|
+
unicode-display_width (>= 1.1.1, < 4)
|
154
|
+
thor (1.3.2)
|
155
|
+
tzinfo (2.0.6)
|
156
|
+
concurrent-ruby (~> 1.0)
|
157
|
+
unicode-display_width (3.1.4)
|
158
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
159
|
+
unicode-emoji (4.0.4)
|
160
|
+
uri (1.0.3)
|
161
|
+
|
162
|
+
PLATFORMS
|
163
|
+
arm64-darwin-24
|
164
|
+
ruby
|
165
|
+
|
166
|
+
DEPENDENCIES
|
167
|
+
bundler (~> 2.0)
|
168
|
+
codecov (~> 0.6.0)
|
169
|
+
irb
|
170
|
+
mitch-ai!
|
171
|
+
pry-byebug (~> 3.10)
|
172
|
+
rake (~> 13.0)
|
173
|
+
rspec (~> 3.0)
|
174
|
+
rubocop (~> 1.21)
|
175
|
+
simplecov (~> 0.21.2)
|
176
|
+
steep (~> 1.5)
|
177
|
+
|
178
|
+
BUNDLED WITH
|
179
|
+
2.6.6
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2025 Steve Cook
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
<div align="center">
|
2
|
+
<img src="mitch-ai-logo.svg" alt="MitchAI" width="500">
|
3
|
+
</div>
|
4
|
+
|
5
|
+
# MitchAI
|
6
|
+
|
7
|
+
## AI-Powered Code Review Assistant
|
8
|
+
|
9
|
+
<!-- [](https://badge.fury.io/rb/mitch_ai) -->
|
10
|
+
<!-- [](https://github.com/scookdev/mitch_ai/actions) -->
|
11
|
+
<!-- [](https://codecov.io/gh/scookdev/mitch_ai) -->
|
12
|
+
<!-- [](https://github.com/rubocop/rubocop) -->
|
13
|
+
|
14
|
+
## 🚀 Overview
|
15
|
+
|
16
|
+
MitchAI is an intelligent CLI tool that leverages artificial intelligence to
|
17
|
+
provide comprehensive code reviews, helping developers improve code quality,
|
18
|
+
catch potential issues, and receive actionable insights.
|
19
|
+
|
20
|
+
## ✨ Features
|
21
|
+
|
22
|
+
- 🔍 Local code file analysis
|
23
|
+
- 🤖 AI-powered intelligent suggestions
|
24
|
+
- 📊 Multi-language support
|
25
|
+
- 🚨 Potential bug and security issue detection
|
26
|
+
|
27
|
+
## 🛠️ Installation
|
28
|
+
|
29
|
+
```bash
|
30
|
+
gem install mitch_ai
|
31
|
+
```
|
32
|
+
|
33
|
+
## 💡 Usage
|
34
|
+
|
35
|
+
```bash
|
36
|
+
# Review a single file
|
37
|
+
mitch_ai review file.rb
|
38
|
+
|
39
|
+
# Review entire project directory
|
40
|
+
mitch_ai review ./project
|
41
|
+
```
|
42
|
+
|
43
|
+
## 🤝 Contributing
|
44
|
+
|
45
|
+
Contributions are welcome! Please check out our [Contributing Guidelines](CONTRIBUTING.md).
|
46
|
+
|
47
|
+
1. Fork the repository
|
48
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
49
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
50
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
51
|
+
5. Open a Pull Request
|
52
|
+
|
53
|
+
## 📋 Requirements
|
54
|
+
|
55
|
+
- Ruby 3.0+
|
56
|
+
- OpenAI API Key
|
57
|
+
|
58
|
+
## 🧪 Development
|
59
|
+
|
60
|
+
```bash
|
61
|
+
# Clone the repository
|
62
|
+
git clone https://github.com/scookdev/mitch_ai.git
|
63
|
+
|
64
|
+
# Install dependencies
|
65
|
+
bundle install
|
66
|
+
|
67
|
+
# Run tests
|
68
|
+
bundle exec rspec
|
69
|
+
|
70
|
+
# Run linter
|
71
|
+
bundle exec rubocop
|
72
|
+
```
|
73
|
+
|
74
|
+
## 📄 License
|
75
|
+
|
76
|
+
This project is licensed under the MIT License - see the [LICENSE](./LICENSE.txt)
|
77
|
+
file for details.
|
78
|
+
|
79
|
+
## 🙌 Acknowledgments
|
80
|
+
|
81
|
+
- Powered by OpenAI
|
82
|
+
- Inspired by the need for intelligent code reviews
|
83
|
+
|
84
|
+
## 💬 Support
|
85
|
+
|
86
|
+
If you encounter any problems or have suggestions, please [open an issue](https://github.com/scookdev/mitch_ai/issues).
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
6
|
+
require 'rubocop/rake_task'
|
7
|
+
RuboCop::RakeTask.new
|
8
|
+
|
9
|
+
task default: %i[spec rubocop]
|
10
|
+
|
11
|
+
# Add a console task for interactive testing
|
12
|
+
desc 'Open an interactive console with the gem loaded'
|
13
|
+
task :console do
|
14
|
+
require 'irb'
|
15
|
+
require 'irb/completion'
|
16
|
+
require 'mitch_ai'
|
17
|
+
ARGV.clear
|
18
|
+
IRB.start
|
19
|
+
end
|
20
|
+
|
21
|
+
# Add a task to run the CLI tool directly
|
22
|
+
desc 'Run the MitchAI tool'
|
23
|
+
task :run, [:command, :args] do |_t, args|
|
24
|
+
command = args[:command] || 'help'
|
25
|
+
cli_args = args[:args] || ''
|
26
|
+
|
27
|
+
# Add lib to load path
|
28
|
+
$LOAD_PATH.unshift(File.expand_path('lib', __dir__))
|
29
|
+
require 'mitch_ai'
|
30
|
+
|
31
|
+
system "ruby -Ilib exe/mitch_ai #{command} #{cli_args}"
|
32
|
+
end
|
data/Steep
ADDED
data/bin/console
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'mitch_ai'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
require 'irb'
|
11
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/exe/mitch_ai
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'openai'
|
4
|
+
|
5
|
+
module MitchAI
|
6
|
+
module AIProviders
|
7
|
+
class OpenAIProvider
|
8
|
+
def initialize(api_key = nil)
|
9
|
+
@api_key = api_key || ENV.fetch('OPENAI_API_KEY', nil)
|
10
|
+
@client = OpenAI::Client.new(access_token: @api_key)
|
11
|
+
end
|
12
|
+
|
13
|
+
def analyze_code(code, language)
|
14
|
+
response = @client.chat(
|
15
|
+
parameters: {
|
16
|
+
model: 'gpt-3.5-turbo',
|
17
|
+
messages: [
|
18
|
+
{
|
19
|
+
role: 'system',
|
20
|
+
content: "You are a senior software engineer doing a code review. Analyze the following #{language} code and provide constructive feedback."
|
21
|
+
},
|
22
|
+
{
|
23
|
+
role: 'user',
|
24
|
+
content: "Please review this code and highlight:\n1. Potential bugs\n2. Performance improvements\n3. Best practice violations\n4. Suggested refactoring\n\nCode:\n#{code}"
|
25
|
+
}
|
26
|
+
],
|
27
|
+
max_tokens: 500
|
28
|
+
}
|
29
|
+
)
|
30
|
+
|
31
|
+
parse_review_response(response)
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def parse_review_response(response)
|
37
|
+
{
|
38
|
+
suggestions: response.dig('choices', 0, 'message', 'content'),
|
39
|
+
raw_response: response
|
40
|
+
}
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MitchAI
|
4
|
+
module Analyzers
|
5
|
+
class FileAnalyzer
|
6
|
+
# Simple mapping of file extensions to languages
|
7
|
+
LANGUAGE_MAP = {
|
8
|
+
'.rb' => 'Ruby',
|
9
|
+
'.py' => 'Python',
|
10
|
+
'.js' => 'JavaScript',
|
11
|
+
'.html' => 'HTML',
|
12
|
+
'.css' => 'CSS',
|
13
|
+
'.java' => 'Java',
|
14
|
+
'.c' => 'C',
|
15
|
+
'.cpp' => 'C++',
|
16
|
+
'.php' => 'PHP',
|
17
|
+
'.go' => 'Go',
|
18
|
+
'.rs' => 'Rust',
|
19
|
+
'.ts' => 'TypeScript',
|
20
|
+
'.jsx' => 'React JSX',
|
21
|
+
'.tsx' => 'React TSX',
|
22
|
+
}
|
23
|
+
|
24
|
+
def initialize(file_path)
|
25
|
+
@file_path = file_path
|
26
|
+
@ai_provider = MitchAI::AIProviders::OpenAIProvider.new
|
27
|
+
end
|
28
|
+
|
29
|
+
def analyze
|
30
|
+
# Read file contents
|
31
|
+
code_content = File.read(@file_path)
|
32
|
+
# Perform AI analysis
|
33
|
+
ai_review = @ai_provider.analyze_code(code_content, language)
|
34
|
+
|
35
|
+
# Construct result
|
36
|
+
{
|
37
|
+
file_path: @file_path,
|
38
|
+
language: language,
|
39
|
+
suggestions: parse_suggestions(ai_review[:suggestions])
|
40
|
+
}
|
41
|
+
rescue Errno::ENOENT => e
|
42
|
+
# Wrap the low-level error in a more user-friendly message
|
43
|
+
raise "Error reading file: #{e.message}"
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def extension
|
50
|
+
File.extname(@file_path).downcase
|
51
|
+
end
|
52
|
+
|
53
|
+
def language
|
54
|
+
LANGUAGE_MAP[extension] || 'Unknown'
|
55
|
+
end
|
56
|
+
|
57
|
+
def parse_suggestions(raw_suggestions)
|
58
|
+
# Handle both string and array formats
|
59
|
+
return raw_suggestions if raw_suggestions.is_a?(Array)
|
60
|
+
|
61
|
+
# Otherwise parse the string as before
|
62
|
+
raw_suggestions.to_s.split("\n").select do |suggestion|
|
63
|
+
suggestion.strip.length > 10
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
data/lib/mitch_ai/cli.rb
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'thor'
|
4
|
+
# Remove require 'linguist'
|
5
|
+
require 'json'
|
6
|
+
require_relative 'configuration'
|
7
|
+
require_relative 'analyzers/file_analyzer'
|
8
|
+
|
9
|
+
module MitchAI
|
10
|
+
class CLI < Thor
|
11
|
+
desc 'review PATH', 'Analyze code at the specified path'
|
12
|
+
option :format, default: 'terminal', desc: 'Output format (terminal, json)'
|
13
|
+
option :provider, default: 'openai', desc: 'AI provider to use'
|
14
|
+
option :verbose, type: :boolean, default: false, desc: 'Show verbose output'
|
15
|
+
|
16
|
+
def review(path)
|
17
|
+
# Validate API key is configured
|
18
|
+
ensure_api_key_configured
|
19
|
+
|
20
|
+
# Determine if path is file or directory
|
21
|
+
paths = if File.directory?(path)
|
22
|
+
Dir.glob("#{path}/**/*").select { |f| File.file?(f) }
|
23
|
+
else
|
24
|
+
[path]
|
25
|
+
end
|
26
|
+
|
27
|
+
# Analyze each file - let FileAnalyzer handle language detection
|
28
|
+
# Analyze each file
|
29
|
+
results = paths.map do |file_path|
|
30
|
+
puts "Trying to analyze #{file_path}"
|
31
|
+
analyzer = Analyzers::FileAnalyzer.new(file_path)
|
32
|
+
puts 'Analyzer initialized successfully'
|
33
|
+
result = analyzer.analyze
|
34
|
+
puts "Analysis complete for #{file_path}"
|
35
|
+
result
|
36
|
+
rescue StandardError => e
|
37
|
+
puts "Error during analysis: #{e.class}: #{e.message}"
|
38
|
+
puts e.backtrace[0..5] if options[:verbose]
|
39
|
+
nil
|
40
|
+
end.compact
|
41
|
+
puts "Found #{results.length} files to analyze"
|
42
|
+
|
43
|
+
# Output results
|
44
|
+
output_results(results, options[:format])
|
45
|
+
rescue StandardError => e
|
46
|
+
puts "Error: #{e.message}"
|
47
|
+
exit 1
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def ensure_api_key_configured
|
53
|
+
config = Configuration.new
|
54
|
+
return unless config.api_key.nil?
|
55
|
+
|
56
|
+
puts '❌ No API key configured. Please run:'
|
57
|
+
puts ' mitch_ai configure'
|
58
|
+
exit 1
|
59
|
+
end
|
60
|
+
|
61
|
+
def output_results(results, format)
|
62
|
+
case format
|
63
|
+
when 'terminal'
|
64
|
+
print_terminal_results(results)
|
65
|
+
when 'json'
|
66
|
+
puts JSON.pretty_generate(results)
|
67
|
+
else
|
68
|
+
raise "Unsupported format: #{format}"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def print_terminal_results(results)
|
73
|
+
results.each do |result|
|
74
|
+
puts "🔍 File: #{result[:file_path]}"
|
75
|
+
puts "Language: #{result[:language]}"
|
76
|
+
puts 'Suggestions:'
|
77
|
+
result[:suggestions].each do |suggestion|
|
78
|
+
puts "- #{suggestion}"
|
79
|
+
end
|
80
|
+
puts "\n"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'thor'
|
6
|
+
|
7
|
+
module MitchAI
|
8
|
+
class Configuration
|
9
|
+
CONFIG_FILE = File.expand_path('~/.mitch_ai.yml')
|
10
|
+
|
11
|
+
attr_accessor :api_key, :provider, :languages
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
@provider = :openai
|
15
|
+
@languages = %i[ruby python javascript]
|
16
|
+
@api_key = ENV.fetch('OPENAI_API_KEY', nil) # Check environment variable first
|
17
|
+
load_config unless @api_key # Only load from config if not already set
|
18
|
+
end
|
19
|
+
|
20
|
+
def configure_api_key(provider)
|
21
|
+
print "Enter your #{provider.upcase} API key: "
|
22
|
+
api_key = ask_securely
|
23
|
+
|
24
|
+
# Validate API key (basic check)
|
25
|
+
if valid_api_key?(api_key)
|
26
|
+
save_api_key(provider, api_key)
|
27
|
+
puts 'API key saved successfully!'
|
28
|
+
else
|
29
|
+
puts 'Invalid API key. Please try again.'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def load_config
|
36
|
+
return unless File.exist?(CONFIG_FILE)
|
37
|
+
|
38
|
+
config = YAML.load_file(CONFIG_FILE)
|
39
|
+
config = symbolize_keys(config) if config.is_a?(Hash)
|
40
|
+
|
41
|
+
@api_key = config.dig(:openai, :api_key)
|
42
|
+
# Don't override default provider if not needed
|
43
|
+
end
|
44
|
+
|
45
|
+
def save_api_key(provider, api_key)
|
46
|
+
# Ensure config directory exists
|
47
|
+
FileUtils.mkdir_p(File.dirname(CONFIG_FILE))
|
48
|
+
|
49
|
+
# Save to config file
|
50
|
+
config = begin
|
51
|
+
yaml_config = YAML.load_file(CONFIG_FILE)
|
52
|
+
symbolize_keys(yaml_config) if yaml_config.is_a?(Hash)
|
53
|
+
rescue StandardError
|
54
|
+
{}
|
55
|
+
end
|
56
|
+
|
57
|
+
provider_sym = provider.to_sym
|
58
|
+
config[provider_sym] ||= {}
|
59
|
+
config[provider_sym][:api_key] = api_key
|
60
|
+
|
61
|
+
File.write(CONFIG_FILE, config.to_yaml)
|
62
|
+
|
63
|
+
# Set secure permissions
|
64
|
+
File.chmod(0o600, CONFIG_FILE)
|
65
|
+
|
66
|
+
# Update current instance
|
67
|
+
@api_key = api_key
|
68
|
+
end
|
69
|
+
|
70
|
+
def symbolize_keys(hash)
|
71
|
+
hash.each_with_object({}) do |(key, value), result|
|
72
|
+
new_key = key.is_a?(String) ? key.to_sym : key
|
73
|
+
new_value = value.is_a?(Hash) ? symbolize_keys(value) : value
|
74
|
+
result[new_key] = new_value
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def valid_api_key?(key)
|
79
|
+
# Basic validation - can be expanded
|
80
|
+
key && key.length > 20
|
81
|
+
end
|
82
|
+
|
83
|
+
def ask_securely
|
84
|
+
# Use system's secure input method
|
85
|
+
`stty -echo`
|
86
|
+
print 'API Key: '
|
87
|
+
api_key = $stdin.gets.chomp
|
88
|
+
`stty echo`
|
89
|
+
puts "\n"
|
90
|
+
api_key
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
# CLI integration
|
96
|
+
class CLI < Thor
|
97
|
+
desc 'configure', 'Configure API credentials'
|
98
|
+
option :provider, default: 'openai', desc: 'AI provider to configure'
|
99
|
+
def configure
|
100
|
+
config = CodeReviewAI::Configuration.new
|
101
|
+
config.configure_api_key(options[:provider])
|
102
|
+
end
|
103
|
+
end
|
data/lib/mitch_ai.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'mitch_ai/version'
|
4
|
+
require_relative 'mitch_ai/configuration'
|
5
|
+
require_relative 'mitch_ai/ai_providers/openai_provider'
|
6
|
+
require_relative 'mitch_ai/analyzers/file_analyzer'
|
7
|
+
require_relative 'mitch_ai/cli'
|
8
|
+
|
9
|
+
module MitchAI
|
10
|
+
class Error < StandardError; end
|
11
|
+
end
|
data/mitch-ai-logo.svg
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="95 45 310 110">
|
2
|
+
<!-- Background gradient -->
|
3
|
+
<defs>
|
4
|
+
<linearGradient id="bgGradient" x1="0%" y1="0%" x2="100%" y2="100%">
|
5
|
+
<stop offset="0%" stop-color="#4A00E0" />
|
6
|
+
<stop offset="100%" stop-color="#8E2DE2" />
|
7
|
+
</linearGradient>
|
8
|
+
</defs>
|
9
|
+
|
10
|
+
<!-- Main logo shape - rounded rectangle -->
|
11
|
+
<rect x="100" y="50" width="300" height="100" rx="20" ry="20" fill="url(#bgGradient)" />
|
12
|
+
|
13
|
+
<!-- Tech nodes/dots - moved up between text and top -->
|
14
|
+
<circle cx="130" cy="67" r="4" fill="#ffffff" />
|
15
|
+
<circle cx="145" cy="67" r="4" fill="#ffffff" />
|
16
|
+
<circle cx="160" cy="67" r="4" fill="#ffffff" />
|
17
|
+
|
18
|
+
<!-- Name: MitchAI -->
|
19
|
+
<text x="140" y="110" font-family="'Arial', sans-serif" font-weight="700" font-size="40" fill="#ffffff">Mitch<tspan fill="#64FFDA">AI</tspan></text>
|
20
|
+
|
21
|
+
<!-- Slogan -->
|
22
|
+
<text x="155" y="135" font-family="'Arial', sans-serif" font-size="14" fill="#ffffff" font-style="italic">Intelligent Code Reviews</text>
|
23
|
+
|
24
|
+
<!-- Robot icon -->
|
25
|
+
<g transform="translate(355, 100) scale(0.3)">
|
26
|
+
<circle cx="0" cy="-30" r="30" fill="#64FFDA" />
|
27
|
+
<rect x="-25" y="5" width="50" height="40" rx="5" ry="5" fill="#64FFDA" />
|
28
|
+
<rect x="-35" y="0" width="70" height="30" rx="10" ry="10" fill="#64FFDA" />
|
29
|
+
<circle cx="-15" cy="-20" r="5" fill="#4A00E0" />
|
30
|
+
<circle cx="15" cy="-20" r="5" fill="#4A00E0" />
|
31
|
+
<rect x="-10" y="-5" width="20" height="2" rx="1" ry="1" fill="#4A00E0" />
|
32
|
+
<rect x="-20" y="45" width="10" height="20" fill="#64FFDA" />
|
33
|
+
<rect x="10" y="45" width="10" height="20" fill="#64FFDA" />
|
34
|
+
</g>
|
35
|
+
</svg>
|
data/mitch_ai.gemspec
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'mitch_ai/version'
|
6
|
+
|
7
|
+
# rubocop:disable Metrics/BlockLength
|
8
|
+
Gem::Specification.new do |spec|
|
9
|
+
spec.name = 'mitch-ai'
|
10
|
+
spec.version = MitchAI::VERSION
|
11
|
+
spec.authors = ['Steve Cook']
|
12
|
+
spec.email = ['stevorevo@duck.com']
|
13
|
+
|
14
|
+
spec.summary = 'AI-powered code review assistant'
|
15
|
+
spec.description = 'MitchAI is an intelligent CLI tool that leverages artificial intelligence to ' \
|
16
|
+
'provide comprehensive code reviews, helping developers improve code quality, ' \
|
17
|
+
'catch potential issues, and receive actionable insights.'
|
18
|
+
spec.homepage = 'https://github.com/scookdev/mitch_ai'
|
19
|
+
spec.license = 'MIT'
|
20
|
+
|
21
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
22
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.bindir = 'exe'
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ['lib']
|
28
|
+
|
29
|
+
# Dependencies
|
30
|
+
spec.add_dependency 'thor', '~> 1.2'
|
31
|
+
spec.add_dependency 'ruby-openai', '~> 3.7'
|
32
|
+
|
33
|
+
# Development dependencies
|
34
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
35
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
36
|
+
spec.add_development_dependency 'rspec', '~> 3.12'
|
37
|
+
spec.add_development_dependency 'rubocop', '~> 1.50'
|
38
|
+
spec.add_development_dependency 'simplecov', '~> 0.21.2'
|
39
|
+
spec.add_development_dependency 'codecov', '~> 0.6.0'
|
40
|
+
spec.add_development_dependency 'steep', '~> 1.5'
|
41
|
+
spec.add_development_dependency 'pry-byebug', '~> 3.10'
|
42
|
+
end
|
43
|
+
# rubocop:enable Metrics/BlockLength
|
data/sig/mitch_ai.rbs
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Type signatures for MitchAI gem
|
2
|
+
|
3
|
+
module MitchAI
|
4
|
+
VERSION: String
|
5
|
+
|
6
|
+
class Error < StandardError
|
7
|
+
end
|
8
|
+
|
9
|
+
class Configuration
|
10
|
+
attr_accessor api_key: String?
|
11
|
+
attr_accessor provider: Symbol
|
12
|
+
attr_accessor languages: Array[Symbol]
|
13
|
+
attr_accessor log_level: Integer
|
14
|
+
|
15
|
+
def initialize: () -> void
|
16
|
+
end
|
17
|
+
|
18
|
+
module AIProviders
|
19
|
+
class OpenAIProvider
|
20
|
+
def initialize: (?api_key: String?) -> void
|
21
|
+
def analyze_code: (String code, String language) -> Hash[Symbol, untyped]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
module Analyzers
|
26
|
+
class FileAnalyzer
|
27
|
+
LANGUAGE_MAP: Hash[String, String]
|
28
|
+
|
29
|
+
def initialize: (String file_path) -> void
|
30
|
+
def analyze: () -> Hash[Symbol, untyped]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class CLI < Thor
|
35
|
+
def review: (String path) -> void
|
36
|
+
end
|
37
|
+
end
|
metadata
ADDED
@@ -0,0 +1,209 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mitch-ai
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Steve Cook
|
8
|
+
bindir: exe
|
9
|
+
cert_chain: []
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
|
+
dependencies:
|
12
|
+
- !ruby/object:Gem::Dependency
|
13
|
+
name: thor
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - "~>"
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '1.2'
|
19
|
+
type: :runtime
|
20
|
+
prerelease: false
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - "~>"
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '1.2'
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: ruby-openai
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3.7'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '3.7'
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: bundler
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '2.0'
|
47
|
+
type: :development
|
48
|
+
prerelease: false
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '2.0'
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: rake
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '13.0'
|
61
|
+
type: :development
|
62
|
+
prerelease: false
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '13.0'
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
name: rspec
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '3.12'
|
75
|
+
type: :development
|
76
|
+
prerelease: false
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '3.12'
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: rubocop
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '1.50'
|
89
|
+
type: :development
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '1.50'
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: simplecov
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 0.21.2
|
103
|
+
type: :development
|
104
|
+
prerelease: false
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 0.21.2
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: codecov
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: 0.6.0
|
117
|
+
type: :development
|
118
|
+
prerelease: false
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - "~>"
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: 0.6.0
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: steep
|
126
|
+
requirement: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - "~>"
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '1.5'
|
131
|
+
type: :development
|
132
|
+
prerelease: false
|
133
|
+
version_requirements: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - "~>"
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '1.5'
|
138
|
+
- !ruby/object:Gem::Dependency
|
139
|
+
name: pry-byebug
|
140
|
+
requirement: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - "~>"
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '3.10'
|
145
|
+
type: :development
|
146
|
+
prerelease: false
|
147
|
+
version_requirements: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - "~>"
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '3.10'
|
152
|
+
description: MitchAI is an intelligent CLI tool that leverages artificial intelligence
|
153
|
+
to provide comprehensive code reviews, helping developers improve code quality,
|
154
|
+
catch potential issues, and receive actionable insights.
|
155
|
+
email:
|
156
|
+
- stevorevo@duck.com
|
157
|
+
executables:
|
158
|
+
- mitch_ai
|
159
|
+
extensions: []
|
160
|
+
extra_rdoc_files: []
|
161
|
+
files:
|
162
|
+
- ".github/workflows/main.yml"
|
163
|
+
- ".gitignore"
|
164
|
+
- ".rspec"
|
165
|
+
- ".rubocop.yml"
|
166
|
+
- ".rubocop_todo.yml"
|
167
|
+
- CHANGELOG.md
|
168
|
+
- CODE_OF_CONDUCT.md
|
169
|
+
- CONTRIBUTING.md
|
170
|
+
- Gemfile
|
171
|
+
- Gemfile.lock
|
172
|
+
- LICENSE.txt
|
173
|
+
- README.md
|
174
|
+
- Rakefile
|
175
|
+
- Steep
|
176
|
+
- bin/console
|
177
|
+
- bin/setup
|
178
|
+
- exe/mitch_ai
|
179
|
+
- lib/mitch_ai.rb
|
180
|
+
- lib/mitch_ai/ai_providers/openai_provider.rb
|
181
|
+
- lib/mitch_ai/analyzers/file_analyzer.rb
|
182
|
+
- lib/mitch_ai/cli.rb
|
183
|
+
- lib/mitch_ai/configuration.rb
|
184
|
+
- lib/mitch_ai/version.rb
|
185
|
+
- mitch-ai-logo.svg
|
186
|
+
- mitch_ai.gemspec
|
187
|
+
- sig/mitch_ai.rbs
|
188
|
+
homepage: https://github.com/scookdev/mitch_ai
|
189
|
+
licenses:
|
190
|
+
- MIT
|
191
|
+
metadata: {}
|
192
|
+
rdoc_options: []
|
193
|
+
require_paths:
|
194
|
+
- lib
|
195
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
196
|
+
requirements:
|
197
|
+
- - ">="
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: '0'
|
200
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
201
|
+
requirements:
|
202
|
+
- - ">="
|
203
|
+
- !ruby/object:Gem::Version
|
204
|
+
version: '0'
|
205
|
+
requirements: []
|
206
|
+
rubygems_version: 3.6.8
|
207
|
+
specification_version: 4
|
208
|
+
summary: AI-powered code review assistant
|
209
|
+
test_files: []
|