prreview 0.1.0 → 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 +4 -4
- data/.rspec +3 -0
- data/.ruby-version +1 -1
- data/README.md +31 -3
- data/lib/prreview/version.rb +1 -1
- data/lib/prreview.rb +31 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 700fa5c2803277c3047957a7ed81f605baaa2efebacb99c367331e3f88f866c5
|
4
|
+
data.tar.gz: 1bdf5fe31c583de5a81dd8a0fccbd5f7a5e02640a6c18ba8697c92bf086f8309
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e4e769b47652d76c065185661d6593507d1225282ab713e3145a0dcfb6ec6160dec0410a78df1c3ecd7e049a799f673a29651959ff755b95e54f34d5281ce79
|
7
|
+
data.tar.gz: ab68d24845e6ac8677383bfdc971fea1b957942327ddf7b503f9558dec5593235d7e74391d986ce9698c4102409064e9b505ac6e3c9b7b0426dd9dfe019aef9c
|
data/.rspec
ADDED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.4.
|
1
|
+
3.4.3
|
data/README.md
CHANGED
@@ -1,11 +1,22 @@
|
|
1
1
|
## How to use
|
2
2
|
|
3
|
+
Install:
|
4
|
+
|
5
|
+
```sh
|
6
|
+
gem install prreview
|
7
|
+
```
|
8
|
+
|
3
9
|
Run this command with a PR URL:
|
4
10
|
|
5
11
|
```sh
|
6
|
-
|
7
|
-
|
8
|
-
|
12
|
+
prreview -u https://github.com/owner/repo/pull/123
|
13
|
+
```
|
14
|
+
|
15
|
+
Or use more options:
|
16
|
+
|
17
|
+
```
|
18
|
+
prreview --help
|
19
|
+
prreview --url https://github.com/owner/repo/pull/123 --all-content --prompt "Are there any security issues?"
|
9
20
|
```
|
10
21
|
|
11
22
|
Now, just paste the PR details into ChatGPT, Claude, or any LLM for review.
|
@@ -21,6 +32,23 @@ PrReview collects key details about a PR, including:
|
|
21
32
|
|
22
33
|
It then copies everything to your clipboard.
|
23
34
|
|
35
|
+
## Why prompt
|
36
|
+
|
37
|
+
Advantages over LLM integrations:
|
38
|
+
|
39
|
+
- You're free to use the LLM of your choice
|
40
|
+
- You can continue the conversation with the LLM right in the chat, asking to pay attention to a specific part of the PR
|
41
|
+
- The gem is simpler
|
42
|
+
|
43
|
+
However, in the future we might add some optional integrations.
|
44
|
+
|
45
|
+
## Tips
|
46
|
+
|
47
|
+
- Run `prreview` after you've thoroughly reviewed the PR. It works best when you understand the changes well.
|
48
|
+
- Don't hesitate to try different LLMs or refresh the response to see if something new comes up.
|
49
|
+
- Use `--all-content` and other extra options — they can significantly improve results for some PRs.
|
50
|
+
- After the LLM responds, ask "Anything else?" to potentially uncover more issues.
|
51
|
+
|
24
52
|
## Requirements
|
25
53
|
|
26
54
|
- Ruby
|
data/lib/prreview/version.rb
CHANGED
data/lib/prreview.rb
CHANGED
@@ -38,6 +38,7 @@ module Prreview
|
|
38
38
|
def process
|
39
39
|
fetch_pull_request
|
40
40
|
fetch_issues
|
41
|
+
load_optional_files
|
41
42
|
build_xml
|
42
43
|
copy_result_to_clipboard
|
43
44
|
end
|
@@ -48,6 +49,7 @@ module Prreview
|
|
48
49
|
@prompt = DEFAULT_PROMPT
|
49
50
|
@include_content = false
|
50
51
|
@issues_limit = DEFAULT_ISSUES_LIMIT
|
52
|
+
@optional_files = []
|
51
53
|
|
52
54
|
parser = OptionParser.new do |opts|
|
53
55
|
opts.banner = "Usage: #{File.basename($PROGRAM_NAME)} -u URL [options]"
|
@@ -56,6 +58,9 @@ module Prreview
|
|
56
58
|
opts.on('-p', '--prompt PROMPT', 'Custom LLM prompt') { |v| @prompt = v }
|
57
59
|
opts.on('-a', '--all-content', 'Include full file contents') { @include_content = true }
|
58
60
|
opts.on('-l', '--limit LIMIT', Integer, "Limit number of issues fetched (default: #{DEFAULT_ISSUES_LIMIT})") { |v| @issues_limit = v }
|
61
|
+
opts.on('-o', '--optional PATHS', 'Comma‑separated paths to local files (relative or absolute, e.g. docs/description.md,/etc/hosts)') do |v|
|
62
|
+
@optional_files = v.split(',').map(&:strip)
|
63
|
+
end
|
59
64
|
opts.on('-h', '--help', 'Show help') do
|
60
65
|
puts opts
|
61
66
|
exit
|
@@ -137,6 +142,21 @@ module Prreview
|
|
137
142
|
puts "Fetched #{@issues.length} issues (limit: #{@issues_limit})"
|
138
143
|
end
|
139
144
|
|
145
|
+
def load_optional_files
|
146
|
+
@optional_file_contents = @optional_files.filter_map do |path|
|
147
|
+
if File.exist?(path)
|
148
|
+
content = File.read(path)
|
149
|
+
{ filename: path, content: content }
|
150
|
+
else
|
151
|
+
warn "File #{path} not found, skipping"
|
152
|
+
nil
|
153
|
+
end
|
154
|
+
rescue StandardError => e
|
155
|
+
warn "Error reading file #{path}: #{e.message}"
|
156
|
+
nil
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
140
160
|
def extract_refs(text, pattern)
|
141
161
|
text.to_enum(:scan, pattern).filter_map do
|
142
162
|
m = Regexp.last_match
|
@@ -203,6 +223,17 @@ module Prreview
|
|
203
223
|
end
|
204
224
|
end
|
205
225
|
|
226
|
+
unless @optional_file_contents.empty?
|
227
|
+
x.local_context_files do
|
228
|
+
@optional_file_contents.each do |file|
|
229
|
+
x.file do
|
230
|
+
x.filename file[:filename]
|
231
|
+
x.content file[:content]
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
206
237
|
x.task @prompt
|
207
238
|
end
|
208
239
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prreview
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evgenii Morozov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
- Quint
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: base64
|
@@ -93,6 +93,7 @@ executables:
|
|
93
93
|
extensions: []
|
94
94
|
extra_rdoc_files: []
|
95
95
|
files:
|
96
|
+
- ".rspec"
|
96
97
|
- ".rubocop.yml"
|
97
98
|
- ".ruby-version"
|
98
99
|
- LICENSE
|
@@ -121,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
122
|
- !ruby/object:Gem::Version
|
122
123
|
version: '0'
|
123
124
|
requirements: []
|
124
|
-
rubygems_version: 3.6.
|
125
|
+
rubygems_version: 3.6.7
|
125
126
|
specification_version: 4
|
126
127
|
summary: A CLI tool that formats GitHub PRs for LLM code reviews.
|
127
128
|
test_files: []
|