prreview 0.2.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 700fa5c2803277c3047957a7ed81f605baaa2efebacb99c367331e3f88f866c5
4
- data.tar.gz: 1bdf5fe31c583de5a81dd8a0fccbd5f7a5e02640a6c18ba8697c92bf086f8309
3
+ metadata.gz: af7fe1f1ccb8ef35c2eeec1252123861705106dc5439725923915ee20aa21fc6
4
+ data.tar.gz: 97c37aa978ee7df44aff01eaa890acc5bb2a60eacd17fceb7ad5cc4319f8aa1a
5
5
  SHA512:
6
- metadata.gz: 3e4e769b47652d76c065185661d6593507d1225282ab713e3145a0dcfb6ec6160dec0410a78df1c3ecd7e049a799f673a29651959ff755b95e54f34d5281ce79
7
- data.tar.gz: ab68d24845e6ac8677383bfdc971fea1b957942327ddf7b503f9558dec5593235d7e74391d986ce9698c4102409064e9b505ac6e3c9b7b0426dd9dfe019aef9c
6
+ metadata.gz: 197d7fa53eda6c389cc68ff8eb97cb792e1704e4c808a74746bda25274194498a19b90cfbcd5b1dea89b5a7d7b16190790da198fba5571830ef902c0636e5b71
7
+ data.tar.gz: 680a13f38effb95f562898efd5b13baad3e6c16334ac2e37f783f4e8dec1ab4b86a3ada77a42b4cbe47c876340a946dd2c379361a36028ef5f2ac52d0bb28e7b
data/README.md CHANGED
@@ -44,6 +44,7 @@ However, in the future we might add some optional integrations.
44
44
 
45
45
  ## Tips
46
46
 
47
+ - A well-written PR and linked issue description make a big difference — and are good practice anyway.
47
48
  - Run `prreview` after you've thoroughly reviewed the PR. It works best when you understand the changes well.
48
49
  - Don't hesitate to try different LLMs or refresh the response to see if something new comes up.
49
50
  - Use `--all-content` and other extra options — they can significantly improve results for some PRs.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Prreview
4
- VERSION = '0.2.0'
4
+ VERSION = '0.3.0'
5
5
  end
data/lib/prreview.rb CHANGED
@@ -49,7 +49,7 @@ module Prreview
49
49
  @prompt = DEFAULT_PROMPT
50
50
  @include_content = false
51
51
  @issues_limit = DEFAULT_ISSUES_LIMIT
52
- @optional_files = []
52
+ @optional_files = []
53
53
 
54
54
  parser = OptionParser.new do |opts|
55
55
  opts.banner = "Usage: #{File.basename($PROGRAM_NAME)} -u URL [options]"
@@ -110,7 +110,8 @@ module Prreview
110
110
  puts "Fetching file content for #{path}"
111
111
 
112
112
  content = @client.contents(@full_repo, path:, ref: @pull_request.head.sha)
113
- Base64.decode64(content[:content])
113
+ decoded = Base64.decode64(content[:content])
114
+ binary?(decoded) ? '(binary file)' : decoded
114
115
  rescue Octokit::NotFound
115
116
  '(file content not found)'
116
117
  end
@@ -194,6 +195,7 @@ module Prreview
194
195
  builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |x|
195
196
  x.prompt do
196
197
  x.task @prompt
198
+ x.current_date DateTime.now
197
199
 
198
200
  x.pull_request do
199
201
  x.number @pr_number
@@ -241,6 +243,10 @@ module Prreview
241
243
  @xml = builder.doc.root.to_xml
242
244
  end
243
245
 
246
+ def binary?(string)
247
+ string.include?("\x00")
248
+ end
249
+
244
250
  def copy_result_to_clipboard
245
251
  Clipboard.copy(@xml)
246
252
  puts 'XML prompt generated and copied to clipboard.'
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.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgenii Morozov