prreview 0.4.0 → 0.5.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/README.md +4 -3
- data/lib/prreview/version.rb +1 -1
- data/lib/prreview.rb +17 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30200431f3796fe13f702beef779421ce9eb7cbb759bf05a781374d39dc4082b
|
4
|
+
data.tar.gz: cc6bbba926af7d7632a97d17551c045ead9b95b5e6682d988de20eef46d1f06b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44622bc990c7059044df282588707f489814ab86c6b47eff1d64379809430061de7851d7f6455212a0f5155b76331538d0fc8fe366f9f18a56cf913e2487f9a0
|
7
|
+
data.tar.gz: e5281db6c13f7b36532e663cda11eeddc0bd540a598327e7e8e4a256b24addb1879f9758f4b2150c18a86e172a3e28e4c4989c31277c4297a3577dcc40e280bf
|
data/README.md
CHANGED
@@ -11,14 +11,14 @@ gem install prreview
|
|
11
11
|
Run this command with a PR URL:
|
12
12
|
|
13
13
|
```sh
|
14
|
-
prreview
|
14
|
+
prreview https://github.com/owner/repo/pull/123
|
15
15
|
```
|
16
16
|
|
17
17
|
Or use more options:
|
18
18
|
|
19
19
|
```
|
20
20
|
prreview --help
|
21
|
-
prreview
|
21
|
+
prreview https://github.com/owner/repo/pull/123 --all-content --prompt "Are there any security issues?"
|
22
22
|
```
|
23
23
|
|
24
24
|
Now, just paste the PR details into ChatGPT, Claude, or any LLM for review.
|
@@ -57,7 +57,8 @@ However, in the future we might add some optional integrations.
|
|
57
57
|
## Requirements
|
58
58
|
|
59
59
|
- Ruby
|
60
|
-
- `GITHUB_TOKEN` environment
|
60
|
+
- `GITHUB_TOKEN` environment
|
61
|
+
variable. [GitHub Docs](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)
|
61
62
|
|
62
63
|
## License
|
63
64
|
|
data/lib/prreview/version.rb
CHANGED
data/lib/prreview.rb
CHANGED
@@ -37,8 +37,14 @@ module Prreview
|
|
37
37
|
|
38
38
|
def process
|
39
39
|
load_optional_files
|
40
|
-
|
41
|
-
|
40
|
+
begin
|
41
|
+
fetch_pull_request
|
42
|
+
fetch_linked_issues
|
43
|
+
rescue Octokit::Unauthorized
|
44
|
+
abort 'Error: Invalid GITHUB_TOKEN.'
|
45
|
+
rescue Octokit::NotFound
|
46
|
+
abort 'Error: Pull request not found.'
|
47
|
+
end
|
42
48
|
build_xml
|
43
49
|
copy_result_to_clipboard
|
44
50
|
end
|
@@ -54,9 +60,13 @@ module Prreview
|
|
54
60
|
ARGV << '--help' if ARGV.empty?
|
55
61
|
|
56
62
|
OptionParser.new do |parser|
|
57
|
-
parser.banner =
|
63
|
+
parser.banner = <<~BAN
|
64
|
+
Usage: #{File.basename($PROGRAM_NAME)} URL [options]
|
65
|
+
|
66
|
+
Pull request URL example: https://github.com/owner/repo/pull/1
|
67
|
+
|
68
|
+
BAN
|
58
69
|
|
59
|
-
parser.on('-u', '--url URL', 'Pull‑request URL (https://github.com/owner/repo/pull/1)') { |v| @url = v }
|
60
70
|
parser.on('-p', '--prompt PROMPT', 'Custom LLM prompt') { |v| @prompt = v }
|
61
71
|
parser.on('-a', '--all-content', 'Include full file contents') { @include_content = true }
|
62
72
|
parser.on('-l', '--limit LIMIT', Integer, "Limit number of issues fetched (default: #{DEFAULT_LINKED_ISSUES_LIMIT})") { |v| @linked_issues_limit = v }
|
@@ -73,10 +83,12 @@ module Prreview
|
|
73
83
|
end
|
74
84
|
parser.parse!
|
75
85
|
end
|
86
|
+
|
87
|
+
@url = ARGV.first
|
76
88
|
end
|
77
89
|
|
78
90
|
def parse_url!
|
79
|
-
abort 'Error: Pull
|
91
|
+
abort 'Error: Pull request URL missing.' if @url.to_s.empty?
|
80
92
|
|
81
93
|
match = @url.match(URL_REGEX)
|
82
94
|
abort 'Error: Invalid URL format. See --help for usage.' unless match
|
@@ -92,8 +104,6 @@ module Prreview
|
|
92
104
|
abort 'Error: GITHUB_TOKEN is not set.' if access_token.to_s.empty?
|
93
105
|
|
94
106
|
@client = Octokit::Client.new(access_token:, auto_paginate: true)
|
95
|
-
rescue Octokit::Unauthorized
|
96
|
-
abort 'Error: Invalid GITHUB_TOKEN.'
|
97
107
|
end
|
98
108
|
|
99
109
|
def fetch_pull_request
|