gpt_helpr 0.2.0 → 0.2.1
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/lib/gpt_helpr/cli.rb +18 -22
- data/lib/gpt_helpr/version.rb +1 -1
- metadata +24 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43764907432b7f7b41c2964247f352032dca55e3de3f64417f1d1ce2e1b0c3ca
|
4
|
+
data.tar.gz: 53df5907162806ee004909d8fcb449185d227cedc16d06ba2073d3254e9d099b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ed06023e1eac48a0239ac70a2ca4e4a2f3d8ff72281ccb09c7d0fa123b66c6bfbffbc74d90cedb9a9c619ecd6f632b8fdadf44dd094a933c8b8c7a9d68ed3aa
|
7
|
+
data.tar.gz: ea3d13668ad073d2734e66ef053edd5ca27b1da860c707bd890a2a59c166f806128c759628dd5685ef8137abe77119d01df992eaab4269d47680fadd25321825
|
data/lib/gpt_helpr/cli.rb
CHANGED
@@ -5,11 +5,10 @@ require 'time'
|
|
5
5
|
|
6
6
|
module GptHelpr
|
7
7
|
class CLI
|
8
|
-
|
9
|
-
def self.start(args=[])
|
8
|
+
def self.start(args = [])
|
10
9
|
Dir.chdir(Dir.pwd)
|
11
10
|
|
12
|
-
puts "GptHelpr #{GptHelpr::VERSION}
|
11
|
+
puts "== 🏴☠️ GptHelpr #{GptHelpr::VERSION} == Helping to dig your codebase and cook GPT-XX instructions [Location: #{Dir.pwd}]"
|
13
12
|
line_numbers = args.include?('-ln') || args.include?('--line-numbers')
|
14
13
|
|
15
14
|
if args.include?('-i') || args.include?('--interactive')
|
@@ -17,7 +16,7 @@ module GptHelpr
|
|
17
16
|
else
|
18
17
|
|
19
18
|
if args.empty?
|
20
|
-
puts 'Usage: gpt_helpr <file1> <
|
19
|
+
puts 'Usage: gpt_helpr <file1> <instructions> / <file2> <instructions> [--f] [--file] [--i] [--interactive] [--ln] [--line-numbers]'
|
21
20
|
exit 1
|
22
21
|
end
|
23
22
|
|
@@ -48,6 +47,7 @@ module GptHelpr
|
|
48
47
|
write_to_file(final_output)
|
49
48
|
else
|
50
49
|
puts final_output
|
50
|
+
puts '(Output copied to clipboard)'
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
@@ -65,7 +65,7 @@ module GptHelpr
|
|
65
65
|
end
|
66
66
|
|
67
67
|
content
|
68
|
-
rescue => e
|
68
|
+
rescue StandardError => e
|
69
69
|
"Error reading file: #{e.message}"
|
70
70
|
end
|
71
71
|
|
@@ -76,12 +76,12 @@ module GptHelpr
|
|
76
76
|
|
77
77
|
content = process_file(file_path, lines_range, line_numbers)
|
78
78
|
|
79
|
-
output += "
|
79
|
+
output += "\n==== file source `#{file_path} #{lines_range}`\n"
|
80
80
|
output += "```\n"
|
81
81
|
output += "#{content}\n"
|
82
82
|
output += "```\n\n"
|
83
83
|
output += "#{re_text}\n\n"
|
84
|
-
output += "
|
84
|
+
output += "==== end of `#{file_path}`\n"
|
85
85
|
output += "\n"
|
86
86
|
end
|
87
87
|
output
|
@@ -96,29 +96,25 @@ module GptHelpr
|
|
96
96
|
timestamp = Time.now.utc.iso8601
|
97
97
|
filename = "gpt_#{timestamp}.md"
|
98
98
|
File.write(filename, output)
|
99
|
-
puts "Output written to #{filename}"
|
99
|
+
puts "(Output written to #{filename})"
|
100
100
|
end
|
101
101
|
|
102
|
-
def self.interactive_mode(
|
102
|
+
def self.interactive_mode(_line_numbers = false)
|
103
103
|
files = []
|
104
104
|
|
105
105
|
Readline.completion_append_character = nil
|
106
|
-
Readline.completion_proc = -> (input)
|
107
|
-
Dir[input + '*'].grep(/^#{Regexp.escape(input)}/)
|
108
|
-
}
|
106
|
+
Readline.completion_proc = ->(input) { Dir["#{input}*"].grep(/^#{Regexp.escape(input)}/) }
|
109
107
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
break if file_input.nil? || file_input.strip.empty?
|
108
|
+
loop do
|
109
|
+
file_input = Readline.readline('File Path (optional :start:end): ', true)
|
110
|
+
break if file_input.nil? || file_input.strip.empty?
|
114
111
|
|
115
|
-
|
116
|
-
|
112
|
+
file_path, lines_range = file_input.split(':', 2)
|
113
|
+
re_text = Readline.readline('Instructions: ', true)
|
117
114
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
end
|
115
|
+
files << [file_path.strip, re_text.strip, lines_range]
|
116
|
+
rescue Interrupt
|
117
|
+
break
|
122
118
|
end
|
123
119
|
|
124
120
|
files
|
data/lib/gpt_helpr/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gpt_helpr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emanuele Tozzato
|
@@ -24,9 +24,27 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.0.3
|
27
|
-
description: It is
|
28
|
-
Instead of manually copying and formatting code snippets, GPT-Helpr automates
|
29
|
-
process, generating well-structured Markdown output
|
27
|
+
description: "It is sometime necessary to provide context and explanations for your
|
28
|
+
code. Instead of manually copying and formatting code snippets, GPT-Helpr automates
|
29
|
+
the process with an interactive cli, generating a well-structured Markdown output,
|
30
|
+
which can be copied to your clipboard or printed to file.\n\n### Example Usage:\n\n```sh\n#
|
31
|
+
lmk is an alias for gpt_helpr -i -ln\n\n$ lmk\n== \U0001F3F4☠️ GptHelpr 0.2.1 ==
|
32
|
+
Helping to dig your codebase and cook GPT-XX instructions [current directory /Users/etozzato/WorkSpace/_AINZ/pizzatarians.com]\n\nFile
|
33
|
+
Path (optional :start:end): TAB ->\nfavicon.ico hey.md js
|
34
|
+
\ random-acts-of-pizza.md\n_config.yml _site
|
35
|
+
\ draft fonts\nimages kneading-baking-academy.md
|
36
|
+
\ _exe academy\nfavicon.gif hands-in-dough.md
|
37
|
+
\ index.md parties-and-events.md\n\nFile Path (optional
|
38
|
+
:start:end): hey.md 1:22\nInstructions: can you improve this text? Do you see any
|
39
|
+
issues with the template?\nFile Path (optional :start:end): ENTER to exit\n\n====
|
40
|
+
file source `hey.md`\n\n1: ---\n2: title: Hey, hello!\n3: layout: default\n4: ---\n5:\n6:
|
41
|
+
# {{ page.title }}\n7: ----\n8:\n9: <div class=\"row\">\n10: <div class=\"col-md-12\">\n11:
|
42
|
+
\ <p class='justin'>\n12: Nice to meet you, I am *Mek*!\n13: </p>\n14:
|
43
|
+
\ <p class='listo'>\n15: I am a self-proclaimed pizza guru and I am here
|
44
|
+
to teach & learn. Originally from Venice, Italy you can find me in San Diego, CA.\n16:
|
45
|
+
\ </p>\n17: <p class='listo'>\n18: In my spare time, I write code @
|
46
|
+
PlayStation!\n19: </p>\n20: </div>\n21: </div>\n22:\n\ncan you improve this
|
47
|
+
text? Do you see any issues with the template?\n\n==== end of `hey.md`\n\n"
|
30
48
|
email:
|
31
49
|
- etozzato@gmail.com
|
32
50
|
executables:
|
@@ -68,5 +86,6 @@ requirements: []
|
|
68
86
|
rubygems_version: 3.5.14
|
69
87
|
signing_key:
|
70
88
|
specification_version: 4
|
71
|
-
summary:
|
89
|
+
summary: "== \U0001F3F4☠️ GptHelpr 0.2.1 == Helping to dig your codebase and cook
|
90
|
+
GPT-XX instructions"
|
72
91
|
test_files: []
|