rbs_goose 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.env.sample +1 -0
- data/.rspec +3 -0
- data/.rubocop.yml +42 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +20 -0
- data/Gemfile.lock +190 -0
- data/LICENSE.txt +21 -0
- data/README-EN-US.md +78 -0
- data/README.md +78 -0
- data/Rakefile +61 -0
- data/Steepfile +14 -0
- data/assets/logo.svg +1 -0
- data/lib/rbs_goose/configuration.rb +49 -0
- data/lib/rbs_goose/examples/rbs_samples/Steepfile +6 -0
- data/lib/rbs_goose/examples/rbs_samples/lib/email.rb +16 -0
- data/lib/rbs_goose/examples/rbs_samples/lib/person.rb +19 -0
- data/lib/rbs_goose/examples/rbs_samples/lib/phone.rb +22 -0
- data/lib/rbs_goose/examples/rbs_samples/refined/sig/email.rbs +11 -0
- data/lib/rbs_goose/examples/rbs_samples/refined/sig/person.rbs +13 -0
- data/lib/rbs_goose/examples/rbs_samples/refined/sig/phone.rbs +15 -0
- data/lib/rbs_goose/examples/rbs_samples/sig/email.rbs +11 -0
- data/lib/rbs_goose/examples/rbs_samples/sig/person.rbs +13 -0
- data/lib/rbs_goose/examples/rbs_samples/sig/phone.rbs +15 -0
- data/lib/rbs_goose/io/example.rb +27 -0
- data/lib/rbs_goose/io/example_group.rb +45 -0
- data/lib/rbs_goose/io/file.rb +64 -0
- data/lib/rbs_goose/io/target_group.rb +21 -0
- data/lib/rbs_goose/io/typed_ruby.rb +33 -0
- data/lib/rbs_goose/io.rb +12 -0
- data/lib/rbs_goose/templates/default_template.rb +49 -0
- data/lib/rbs_goose/templates.rb +8 -0
- data/lib/rbs_goose/type_inferrer.rb +13 -0
- data/lib/rbs_goose/version.rb +5 -0
- data/lib/rbs_goose.rb +38 -0
- data/rbs_collection.lock.yaml +188 -0
- data/rbs_collection.yaml +19 -0
- data/renovate.json +15 -0
- data/sig/rbs_goose/configuration.rbs +14 -0
- data/sig/rbs_goose/error.rbs +2 -0
- data/sig/rbs_goose/io/example.rbs +9 -0
- data/sig/rbs_goose/io/example_group.rbs +8 -0
- data/sig/rbs_goose/io/file.rbs +19 -0
- data/sig/rbs_goose/io/target_group.rbs +3 -0
- data/sig/rbs_goose/io/typed_ruby.rbs +9 -0
- data/sig/rbs_goose/io.rbs +2 -0
- data/sig/rbs_goose/templates/default_template.rbs +10 -0
- data/sig/rbs_goose/templates.rbs +2 -0
- data/sig/rbs_goose/type_inferrer.rbs +3 -0
- data/sig/rbs_goose.rbs +12 -0
- data/sig_ext/class.rbs +3 -0
- data/sig_ext/langchain/llm.rbs +19 -0
- metadata +128 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cf73d7a4ddd606fd157daf05a360724de91c45167bc05a3e170a5eb0c98630ad
|
4
|
+
data.tar.gz: 62bd3b303be0b22fe0b5c1dfc470035e80e7494072abca2a3c2da460c0edffed
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d011a72db8c5ba4d9823cf5e4af4fd6aa17c72b0fca9e9984da237697329b113d132e87a446f7e988a6858520066a297d008072d4dc82add618008fd89f4350b
|
7
|
+
data.tar.gz: 19e5c359436f5aee963abf6406dac507a6047fd008b045833d688efda26cc681a9ebc759f3a16787850db20de55290dca09325b6ea4ac3fa4704ea100624e353
|
data/.env.sample
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
OPENAI_ACCESS_TOKEN=
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-factory_bot
|
3
|
+
- rubocop-rake
|
4
|
+
- rubocop-rspec
|
5
|
+
|
6
|
+
AllCops:
|
7
|
+
TargetRubyVersion: 3.0
|
8
|
+
NewCops: enable
|
9
|
+
Exclude:
|
10
|
+
- 'lib/rbs_goose/examples/**/*'
|
11
|
+
- 'spec/fixtures/**/*'
|
12
|
+
- 'vendor/bundle/**/*'
|
13
|
+
|
14
|
+
Style/StringLiterals:
|
15
|
+
Enabled: true
|
16
|
+
|
17
|
+
Style/StringLiteralsInInterpolation:
|
18
|
+
Enabled: true
|
19
|
+
|
20
|
+
Layout/LineLength:
|
21
|
+
Max: 120
|
22
|
+
|
23
|
+
Style/Documentation:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
RSpec/NamedSubject:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
RSpec/ExampleWithoutDescription:
|
30
|
+
EnforcedStyle: single_line_only
|
31
|
+
|
32
|
+
RSpec/ExampleLength:
|
33
|
+
Max: 20
|
34
|
+
|
35
|
+
RSpec/MultipleMemoizedHelpers:
|
36
|
+
Max: 10
|
37
|
+
|
38
|
+
RSpec/MultipleExpectations:
|
39
|
+
Max: 5
|
40
|
+
|
41
|
+
FactoryBot/FactoryAssociationWithStrategy:
|
42
|
+
Enabled: false
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.3.0
|
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
8
|
+
|
9
|
+
## Our Standards
|
10
|
+
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
12
|
+
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
18
|
+
|
19
|
+
Examples of unacceptable behavior include:
|
20
|
+
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
22
|
+
advances of any kind
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
+
* Public or private harassment
|
25
|
+
* Publishing others' private information, such as a physical or email
|
26
|
+
address, without their explicit permission
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
+
professional setting
|
29
|
+
|
30
|
+
## Enforcement Responsibilities
|
31
|
+
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
33
|
+
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
35
|
+
|
36
|
+
## Scope
|
37
|
+
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
39
|
+
|
40
|
+
## Enforcement
|
41
|
+
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at kokuyouwind@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
+
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
+
|
46
|
+
## Enforcement Guidelines
|
47
|
+
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
+
|
50
|
+
### 1. Correction
|
51
|
+
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
+
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
+
|
56
|
+
### 2. Warning
|
57
|
+
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
59
|
+
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
+
|
62
|
+
### 3. Temporary Ban
|
63
|
+
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
+
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
+
|
68
|
+
### 4. Permanent Ban
|
69
|
+
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
+
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
|
+
|
74
|
+
## Attribution
|
75
|
+
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
+
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
+
|
81
|
+
[homepage]: https://www.contributor-covenant.org
|
82
|
+
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/Gemfile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in rbs_goose.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem 'dotenv', '~> 2.8.1'
|
9
|
+
gem 'factory_bot', '~> 6.4.5'
|
10
|
+
gem 'orthoses', '~> 1.13.0'
|
11
|
+
gem 'rake', '~> 13.0'
|
12
|
+
gem 'rspec', '~> 3.0'
|
13
|
+
gem 'rubocop', '~> 1.21'
|
14
|
+
gem 'rubocop-factory_bot', '~> 2.25.1'
|
15
|
+
gem 'rubocop-rake', '~> 0.6.0'
|
16
|
+
gem 'rubocop-rspec', '~> 2.22'
|
17
|
+
gem 'ruby-openai', '~> 6.1.0'
|
18
|
+
gem 'steep', '~> 1.6.0'
|
19
|
+
gem 'vcr', '~> 6.2.0'
|
20
|
+
gem 'webmock', '~> 3.18.1'
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,190 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rbs_goose (0.1.0)
|
5
|
+
langchainrb (~> 0.8.2)
|
6
|
+
ruby-openai (~> 6.1.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
abbrev (0.1.2)
|
12
|
+
activesupport (7.1.2)
|
13
|
+
base64
|
14
|
+
bigdecimal
|
15
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
|
+
connection_pool (>= 2.2.5)
|
17
|
+
drb
|
18
|
+
i18n (>= 1.6, < 2)
|
19
|
+
minitest (>= 5.1)
|
20
|
+
mutex_m
|
21
|
+
tzinfo (~> 2.0)
|
22
|
+
addressable (2.8.4)
|
23
|
+
public_suffix (>= 2.0.2, < 6.0)
|
24
|
+
ast (2.4.2)
|
25
|
+
baran (0.1.10)
|
26
|
+
base64 (0.2.0)
|
27
|
+
bigdecimal (3.1.5)
|
28
|
+
colorize (0.8.1)
|
29
|
+
concurrent-ruby (1.2.2)
|
30
|
+
connection_pool (2.4.1)
|
31
|
+
crack (0.4.5)
|
32
|
+
rexml
|
33
|
+
csv (3.2.8)
|
34
|
+
diff-lcs (1.5.0)
|
35
|
+
dotenv (2.8.1)
|
36
|
+
drb (2.2.0)
|
37
|
+
ruby2_keywords
|
38
|
+
event_stream_parser (0.3.0)
|
39
|
+
factory_bot (6.4.5)
|
40
|
+
activesupport (>= 5.0.0)
|
41
|
+
faraday (2.7.9)
|
42
|
+
faraday-net_http (>= 2.0, < 3.1)
|
43
|
+
ruby2_keywords (>= 0.0.4)
|
44
|
+
faraday-multipart (1.0.4)
|
45
|
+
multipart-post (~> 2)
|
46
|
+
faraday-net_http (3.0.2)
|
47
|
+
ffi (1.16.3)
|
48
|
+
fileutils (1.7.2)
|
49
|
+
hashdiff (1.0.1)
|
50
|
+
i18n (1.14.1)
|
51
|
+
concurrent-ruby (~> 1.0)
|
52
|
+
json (2.6.3)
|
53
|
+
json-schema (4.0.0)
|
54
|
+
addressable (>= 2.8)
|
55
|
+
langchainrb (0.8.2)
|
56
|
+
baran (~> 0.1.9)
|
57
|
+
colorize (~> 0.8.1)
|
58
|
+
json-schema (~> 4.0.0)
|
59
|
+
matrix
|
60
|
+
pragmatic_segmenter (~> 0.3.0)
|
61
|
+
tiktoken_ruby (~> 0.0.5)
|
62
|
+
to_bool (~> 2.0.0)
|
63
|
+
zeitwerk (~> 2.5)
|
64
|
+
language_server-protocol (3.17.0.3)
|
65
|
+
listen (3.8.0)
|
66
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
67
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
68
|
+
logger (1.6.0)
|
69
|
+
matrix (0.4.2)
|
70
|
+
minitest (5.21.1)
|
71
|
+
multipart-post (2.3.0)
|
72
|
+
mutex_m (0.2.0)
|
73
|
+
orthoses (1.13.0)
|
74
|
+
rbs (~> 3.0)
|
75
|
+
parallel (1.23.0)
|
76
|
+
parser (3.2.2.3)
|
77
|
+
ast (~> 2.4.1)
|
78
|
+
racc
|
79
|
+
pragmatic_segmenter (0.3.23)
|
80
|
+
unicode
|
81
|
+
public_suffix (5.0.1)
|
82
|
+
racc (1.7.1)
|
83
|
+
rainbow (3.1.1)
|
84
|
+
rake (13.0.6)
|
85
|
+
rb-fsevent (0.11.2)
|
86
|
+
rb-inotify (0.10.1)
|
87
|
+
ffi (~> 1.0)
|
88
|
+
rb_sys (0.9.86)
|
89
|
+
rbs (3.4.1)
|
90
|
+
abbrev
|
91
|
+
regexp_parser (2.8.1)
|
92
|
+
rexml (3.2.5)
|
93
|
+
rspec (3.12.0)
|
94
|
+
rspec-core (~> 3.12.0)
|
95
|
+
rspec-expectations (~> 3.12.0)
|
96
|
+
rspec-mocks (~> 3.12.0)
|
97
|
+
rspec-core (3.12.2)
|
98
|
+
rspec-support (~> 3.12.0)
|
99
|
+
rspec-expectations (3.12.3)
|
100
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
101
|
+
rspec-support (~> 3.12.0)
|
102
|
+
rspec-mocks (3.12.5)
|
103
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
104
|
+
rspec-support (~> 3.12.0)
|
105
|
+
rspec-support (3.12.1)
|
106
|
+
rubocop (1.53.1)
|
107
|
+
json (~> 2.3)
|
108
|
+
language_server-protocol (>= 3.17.0)
|
109
|
+
parallel (~> 1.10)
|
110
|
+
parser (>= 3.2.2.3)
|
111
|
+
rainbow (>= 2.2.2, < 4.0)
|
112
|
+
regexp_parser (>= 1.8, < 3.0)
|
113
|
+
rexml (>= 3.2.5, < 4.0)
|
114
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
115
|
+
ruby-progressbar (~> 1.7)
|
116
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
117
|
+
rubocop-ast (1.29.0)
|
118
|
+
parser (>= 3.2.1.0)
|
119
|
+
rubocop-capybara (2.18.0)
|
120
|
+
rubocop (~> 1.41)
|
121
|
+
rubocop-factory_bot (2.25.1)
|
122
|
+
rubocop (~> 1.41)
|
123
|
+
rubocop-rake (0.6.0)
|
124
|
+
rubocop (~> 1.0)
|
125
|
+
rubocop-rspec (2.22.0)
|
126
|
+
rubocop (~> 1.33)
|
127
|
+
rubocop-capybara (~> 2.17)
|
128
|
+
rubocop-factory_bot (~> 2.22)
|
129
|
+
ruby-openai (6.1.0)
|
130
|
+
event_stream_parser (>= 0.3.0, < 1.0.0)
|
131
|
+
faraday (>= 1)
|
132
|
+
faraday-multipart (>= 1)
|
133
|
+
ruby-progressbar (1.13.0)
|
134
|
+
ruby2_keywords (0.0.5)
|
135
|
+
securerandom (0.3.1)
|
136
|
+
steep (1.6.0)
|
137
|
+
activesupport (>= 5.1)
|
138
|
+
concurrent-ruby (>= 1.1.10)
|
139
|
+
csv (>= 3.0.9)
|
140
|
+
fileutils (>= 1.1.0)
|
141
|
+
json (>= 2.1.0)
|
142
|
+
language_server-protocol (>= 3.15, < 4.0)
|
143
|
+
listen (~> 3.0)
|
144
|
+
logger (>= 1.3.0)
|
145
|
+
parser (>= 3.1)
|
146
|
+
rainbow (>= 2.2.2, < 4.0)
|
147
|
+
rbs (>= 3.1.0)
|
148
|
+
securerandom (>= 0.1)
|
149
|
+
strscan (>= 1.0.0)
|
150
|
+
terminal-table (>= 2, < 4)
|
151
|
+
strscan (3.0.8)
|
152
|
+
terminal-table (3.0.2)
|
153
|
+
unicode-display_width (>= 1.1.1, < 3)
|
154
|
+
tiktoken_ruby (0.0.6)
|
155
|
+
rb_sys (~> 0.9.68)
|
156
|
+
to_bool (2.0.0)
|
157
|
+
tzinfo (2.0.6)
|
158
|
+
concurrent-ruby (~> 1.0)
|
159
|
+
unicode (0.4.4.4)
|
160
|
+
unicode-display_width (2.4.2)
|
161
|
+
vcr (6.2.0)
|
162
|
+
webmock (3.18.1)
|
163
|
+
addressable (>= 2.8.0)
|
164
|
+
crack (>= 0.3.2)
|
165
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
166
|
+
zeitwerk (2.6.12)
|
167
|
+
|
168
|
+
PLATFORMS
|
169
|
+
arm64-darwin-22
|
170
|
+
arm64-darwin-23
|
171
|
+
x86_64-linux
|
172
|
+
|
173
|
+
DEPENDENCIES
|
174
|
+
dotenv (~> 2.8.1)
|
175
|
+
factory_bot (~> 6.4.5)
|
176
|
+
orthoses (~> 1.13.0)
|
177
|
+
rake (~> 13.0)
|
178
|
+
rbs_goose!
|
179
|
+
rspec (~> 3.0)
|
180
|
+
rubocop (~> 1.21)
|
181
|
+
rubocop-factory_bot (~> 2.25.1)
|
182
|
+
rubocop-rake (~> 0.6.0)
|
183
|
+
rubocop-rspec (~> 2.22)
|
184
|
+
ruby-openai (~> 6.1.0)
|
185
|
+
steep (~> 1.6.0)
|
186
|
+
vcr (~> 6.2.0)
|
187
|
+
webmock (~> 3.18.1)
|
188
|
+
|
189
|
+
BUNDLED WITH
|
190
|
+
2.4.10
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 kokuyouwind
|
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-EN-US.md
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
<p align="center">
|
2
|
+
<img src="https://raw.githubusercontent.com/kokuyouwind/rbs_goose/main/assets/logo.svg" alt="RuboCop Logo"/>
|
3
|
+
</p>
|
4
|
+
|
5
|
+
[![en-US README](https://img.shields.io/badge/Multilingual_README-en--US-blue.svg)](/README-EN-US.md)
|
6
|
+
[![en-JP README](https://img.shields.io/badge/Multilingual_README-ja--JP-orangered.svg)](/README.md)
|
7
|
+
|
8
|
+
[![Ruby](https://github.com/kokuyouwind/rbs_goose/actions/workflows/main.yml/badge.svg)](https://github.com/kokuyouwind/rbs_goose/) actions/workflows/main.yml)
|
9
|
+
|
10
|
+
RBS Goose is a tool that uses ChatGPT and other large language models to infer the RBS signature of Ruby code.
|
11
|
+
|
12
|
+
> [!CAUTION].
|
13
|
+
> Currently undergoing technical validation, so you may get little or no output of the appropriate types.
|
14
|
+
> Also, the tool uses ChatGPT API and other tools to infer RBS signatures, so depending on the size of your code, the usage fee may be expensive.
|
15
|
+
|
16
|
+
## Installation
|
17
|
+
|
18
|
+
```bash
|
19
|
+
$ gem install rbs-goose
|
20
|
+
```
|
21
|
+
|
22
|
+
If you use `bundler`, add the following to your `Gemfile` instead.
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
gem 'rbs-goose'.
|
26
|
+
```
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
Currently, the command line tool is not yet available, so please call `RbsGoose.run` directly from `Rakefile` or other sources.
|
31
|
+
|
32
|
+
If you use [OpenAI API](https://openai.com/blog/openai-api), do the following.
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
desc 'refine RBS files in sig directory'
|
36
|
+
task :refine do
|
37
|
+
RbsGoose.configure do |c|
|
38
|
+
c.use_open_ai(ENV.fetch('OPENAI_ACCESS_TOKEN'))
|
39
|
+
end
|
40
|
+
RbsGoose.run
|
41
|
+
end
|
42
|
+
```
|
43
|
+
|
44
|
+
Running this task will reference the Ruby code under `lib` and the RBS signature under `sig` and override the guessed signature.
|
45
|
+
|
46
|
+
To change the target directory, specify the following arguments to `RbsGoose.run`.
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
RbsGoose.run(code_dir: 'app', sig_dir: 'types', base_path: Rails.root)
|
50
|
+
```
|
51
|
+
|
52
|
+
[Langchain.rb](https://github.com/andreibondarev/langchainrb) is used to invoke the large language model.
|
53
|
+
|
54
|
+
To use other large-scale language models, set `llm` directly as follows.
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
RbsGoose.configure do |c|
|
58
|
+
c.llm = Langchain::LLM::GooglePalm.new(api_key: ENV["GOOGLE_PALM_API_KEY"])
|
59
|
+
end
|
60
|
+
```
|
61
|
+
|
62
|
+
## Development
|
63
|
+
|
64
|
+
After checking out the repository, run bin/setup to install the dependencies. Next, run `rake spec` to run the tests. You can also try running `bin/console` as an interactive prompt.
|
65
|
+
|
66
|
+
To install the gem on your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb` and run `bundle exec rake release`. This will create a Git tag for the version, push the Git commit and the created tag, and push the .gem file to rubygems.org.
|
67
|
+
|
68
|
+
## Contributing
|
69
|
+
|
70
|
+
Bug reports and pull requests are accepted on GitHub at https://github.com/kokuyouwind/rbs_goose. The project aims to be a safe and welcoming space for collaborative work, and contributors are expected to follow the [CODE OF CONDUCT](/CODE_OF_CONDUCT.md).
|
71
|
+
|
72
|
+
## License
|
73
|
+
|
74
|
+
This gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
75
|
+
|
76
|
+
## Code of Conduct
|
77
|
+
|
78
|
+
Everyone involved with the RbsGoose project codebase, issue tracker, chat room, and mailing lists is expected to follow the [CODE OF CONDUCT](/CODE_OF_CONDUCT.md).
|
data/README.md
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
<p align="center">
|
2
|
+
<img src="https://raw.githubusercontent.com/kokuyouwind/rbs_goose/main/assets/logo.svg" alt="RuboCop Logo"/>
|
3
|
+
</p>
|
4
|
+
|
5
|
+
[![en-US README](https://img.shields.io/badge/Multilingual_README-en--US-blue.svg)](/README-EN-US.md)
|
6
|
+
[![ja-JP README](https://img.shields.io/badge/Multilingual_README-ja--JP-orangered.svg)](/README.md)
|
7
|
+
|
8
|
+
[![Ruby](https://github.com/kokuyouwind/rbs_goose/actions/workflows/main.yml/badge.svg)](https://github.com/kokuyouwind/rbs_goose/actions/workflows/main.yml)
|
9
|
+
|
10
|
+
RBS Goose は ChatGPT などの大規模言語モデルを利用して、 Ruby コードの RBS シグニチャを推測するツールです。
|
11
|
+
|
12
|
+
> [!CAUTION]
|
13
|
+
> 現在は技術検証中のため、適切な型がほとんど、あるいは全く出力されない可能性があります。
|
14
|
+
> また推測にあたっては ChatGPT API などを利用するため、コード規模によっては利用料が高額になる可能性があります。
|
15
|
+
|
16
|
+
## Installation
|
17
|
+
|
18
|
+
```bash
|
19
|
+
$ gem install rbs-goose
|
20
|
+
```
|
21
|
+
|
22
|
+
`bundler` を利用する場合は、代わりに以下を `Gemfile` に追加してください。
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
gem 'rbs-goose'
|
26
|
+
```
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
現状ではコマンドラインツールが未整備なので、 `Rakefile` などから `RbsGoose.run` を直接呼び出してください。
|
31
|
+
|
32
|
+
[OpenAI API](https://openai.com/blog/openai-api) を利用する場合は以下のようにします。
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
desc 'refine RBS files in sig directory'
|
36
|
+
task :refine do
|
37
|
+
RbsGoose.configure do |c|
|
38
|
+
c.use_open_ai(ENV.fetch('OPENAI_ACCESS_TOKEN'))
|
39
|
+
end
|
40
|
+
RbsGoose.run
|
41
|
+
end
|
42
|
+
```
|
43
|
+
|
44
|
+
このタスクを実行すると、 `lib` 以下の Ruby コードと `sig` 以下の RBS シグニチャを参照し、推測したシグニチャを上書きします。
|
45
|
+
|
46
|
+
対象とするディレクトリを変更する場合、以下のように `RbsGoose.run` の引数を指定してください。
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
RbsGoose.run(code_dir: 'app', sig_dir: 'types', base_path: Rails.root)
|
50
|
+
```
|
51
|
+
|
52
|
+
大規模言語モデルの呼び出しには [Langchain.rb](https://github.com/andreibondarev/langchainrb) を利用しています。
|
53
|
+
|
54
|
+
他の大規模言語モデルを利用する場合は、以下のように `llm` を直接設定してください。
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
RbsGoose.configure do |c|
|
58
|
+
c.llm = Langchain::LLM::GooglePalm.new(api_key: ENV["GOOGLE_PALM_API_KEY"])
|
59
|
+
end
|
60
|
+
```
|
61
|
+
|
62
|
+
## Development
|
63
|
+
|
64
|
+
リポジトリのチェックアウト後、bin/setup を実行して依存関係をインストールします。次に、`rake spec` を実行してテストを実行します。対話型プロンプトとして `bin/console` を実行して試してみることもできます。
|
65
|
+
|
66
|
+
この gem をローカルマシンにインストールするには、`bundle exec rake install` を実行します。新しいバージョンをリリースするには、`version.rb` でバージョン番号を更新してから `bundle exec rake release` を実行します。これにより、バージョンに対する Git タグが作成され、Git のコミットと作成されたタグがプッシュされ、.gem ファイルが rubygems.org にプッシュされます。
|
67
|
+
|
68
|
+
## Contributing
|
69
|
+
|
70
|
+
バグレポートやプルリクエストは GitHub の https://github.com/kokuyouwind/rbs_goose で受け付けています。このプロジェクトは、共同作業のための安全で歓迎すべきスペースを目指しており、貢献者は [行動規範](/CODE_OF_CONDUCT.md) に従うことが求められます。
|
71
|
+
|
72
|
+
## ライセンス
|
73
|
+
|
74
|
+
この gem は [MITライセンス](https://opensource.org/licenses/MIT) の条項に基づいてオープンソースとして利用できます。
|
75
|
+
|
76
|
+
## 行動規範
|
77
|
+
|
78
|
+
RbsGoose プロジェクトのコードベース、課題トラッカー、チャットルーム、およびメーリングリストに関わる全員は、 [行動規範](/CODE_OF_CONDUCT.md) に従うことが求められます。
|
data/Rakefile
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dotenv/load'
|
4
|
+
|
5
|
+
require 'bundler/gem_tasks'
|
6
|
+
require 'rspec/core/rake_task'
|
7
|
+
|
8
|
+
RSpec::Core::RakeTask.new(:spec)
|
9
|
+
|
10
|
+
require 'rubocop/rake_task'
|
11
|
+
|
12
|
+
RuboCop::RakeTask.new
|
13
|
+
|
14
|
+
task default: %i[spec rubocop]
|
15
|
+
|
16
|
+
desc 'Run specs'
|
17
|
+
task :spec do
|
18
|
+
Rake::Task['spec'].invoke
|
19
|
+
end
|
20
|
+
|
21
|
+
desc 'Run specs and record VCR cassettes'
|
22
|
+
task :'spec:record' do
|
23
|
+
ENV['RECORD'] = 'all'
|
24
|
+
Rake::Task['spec'].invoke
|
25
|
+
end
|
26
|
+
|
27
|
+
namespace :sig do # rubocop:disable Metrics/BlockLength
|
28
|
+
desc 'build RBS prototypes to sig directory'
|
29
|
+
task :prototype do
|
30
|
+
require 'orthoses'
|
31
|
+
require_relative 'lib/rbs_goose'
|
32
|
+
|
33
|
+
Orthoses::Builder.new do
|
34
|
+
use Orthoses::CreateFileByName,
|
35
|
+
to: 'sig',
|
36
|
+
rmtree: true
|
37
|
+
# use Orthoses::PP
|
38
|
+
use Orthoses::Filter do |name, _|
|
39
|
+
name.start_with?('RbsGoose')
|
40
|
+
end
|
41
|
+
use Orthoses::Mixin
|
42
|
+
use Orthoses::RBSPrototypeRB, paths: Dir.glob('lib/**/*.rb')
|
43
|
+
run -> {}
|
44
|
+
end.call
|
45
|
+
end
|
46
|
+
|
47
|
+
desc 'refine RBS files in sig directory'
|
48
|
+
task :refine do
|
49
|
+
require_relative 'lib/rbs_goose'
|
50
|
+
|
51
|
+
RbsGoose.configure do |c|
|
52
|
+
c.use_open_ai(
|
53
|
+
ENV.fetch('OPENAI_ACCESS_TOKEN'),
|
54
|
+
default_options: {
|
55
|
+
completion_model_name: 'gpt-3.5-turbo-1106'
|
56
|
+
}
|
57
|
+
)
|
58
|
+
end
|
59
|
+
RbsGoose.run
|
60
|
+
end
|
61
|
+
end
|
data/Steepfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
D = Steep::Diagnostic
|
4
|
+
|
5
|
+
target :lib do
|
6
|
+
check 'lib'
|
7
|
+
signature 'sig', 'sig_ext'
|
8
|
+
ignore(
|
9
|
+
'lib/rbs_goose/examples'
|
10
|
+
)
|
11
|
+
configure_code_diagnostics(D::Ruby.default) do |hash|
|
12
|
+
hash[D::Ruby::BlockTypeMismatch] = :information
|
13
|
+
end
|
14
|
+
end
|