gchatsh 0.1.4 → 0.1.6
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/Makefile +1 -2
- data/README.md +3 -35
- data/demo.tape +109 -0
- data/deploy.rb +45 -0
- data/lib/credentials.rb +34 -17
- data/lib/gchatsh/version.rb +1 -1
- metadata +19 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e388ba0e2c5731b272b6df7d45307a937bbca79e352f6e24e41a68d689d4efc
|
4
|
+
data.tar.gz: 35711524edf737f54641fa4e2c9472a553b76a9a7e29bbc039e1c86fe3b33d94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57a0dd9295a0d6f8f4bb0d283fce0e000b57a84c57939b696dde831b377f356606997067ec4e098c43f09f7939f89e7232a116a97c701e7d79a1fb64bd7d2f71
|
7
|
+
data.tar.gz: 8ca4b385191b5f7281c28083cc102e009979a5352b60fa9ce784441b4360a900704459b62877ab3caea53e501f52d29c4d5a30e8c9dc48bde54f411c27d3025e
|
data/Makefile
CHANGED
data/README.md
CHANGED
@@ -1,39 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# Groq-Chat-Sh
|
2
2
|
|
3
|
-
|
3
|
+
Chat with AI, produce shell commands
|
4
4
|
|
5
|
-
|
5
|
+
[[gif]]
|
6
6
|
|
7
|
-
## Installation
|
8
7
|
|
9
|
-
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
10
|
-
|
11
|
-
Install the gem and add to the application's Gemfile by executing:
|
12
|
-
|
13
|
-
```bash
|
14
|
-
bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
|
15
|
-
```
|
16
|
-
|
17
|
-
If bundler is not being used to manage dependencies, install the gem by executing:
|
18
|
-
|
19
|
-
```bash
|
20
|
-
gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
|
21
|
-
```
|
22
|
-
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
-
|
33
|
-
## Contributing
|
34
|
-
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/gchatsh.
|
36
|
-
|
37
|
-
## License
|
38
|
-
|
39
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/demo.tape
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
Set FontFamily "RobotoMono Nerd Font Mono"
|
2
|
+
Set FontSize 26
|
3
|
+
Set Width 1200
|
4
|
+
Set Height 600
|
5
|
+
|
6
|
+
Type "gchatsh"
|
7
|
+
|
8
|
+
Sleep 500ms
|
9
|
+
|
10
|
+
Enter
|
11
|
+
|
12
|
+
Sleep 1s
|
13
|
+
|
14
|
+
Type "remove docker dangling images"
|
15
|
+
|
16
|
+
Sleep 1s
|
17
|
+
|
18
|
+
Enter
|
19
|
+
|
20
|
+
Sleep 5s
|
21
|
+
|
22
|
+
Type "c"
|
23
|
+
|
24
|
+
Sleep 1s
|
25
|
+
|
26
|
+
Enter
|
27
|
+
|
28
|
+
Sleep 1s
|
29
|
+
|
30
|
+
Type "clear"
|
31
|
+
|
32
|
+
Sleep 1s
|
33
|
+
|
34
|
+
Enter
|
35
|
+
|
36
|
+
Sleep 1s
|
37
|
+
|
38
|
+
Type "gchatsh"
|
39
|
+
|
40
|
+
Sleep 1s
|
41
|
+
|
42
|
+
Enter
|
43
|
+
|
44
|
+
Sleep 1s
|
45
|
+
|
46
|
+
Type "zip all files in the current folder in project.zip"
|
47
|
+
|
48
|
+
Sleep 1s
|
49
|
+
|
50
|
+
Enter
|
51
|
+
|
52
|
+
Sleep 5s
|
53
|
+
|
54
|
+
# VHS documentation
|
55
|
+
#
|
56
|
+
# Output:
|
57
|
+
Output demo.gif
|
58
|
+
# Output <path>.mp4 Create an MP4 output at the given <path>
|
59
|
+
# Output <path>.webm Create a WebM output at the given <path>
|
60
|
+
#
|
61
|
+
# Require:
|
62
|
+
# Require <string> Ensure a program is on the $PATH to proceed
|
63
|
+
#
|
64
|
+
# Settings:
|
65
|
+
# Set FontSize <number> Set the font size of the terminal
|
66
|
+
# Set FontFamily <string> Set the font family of the terminal
|
67
|
+
# Set Height <number> Set the height of the terminal
|
68
|
+
# Set Width <number> Set the width of the terminal
|
69
|
+
# Set LetterSpacing <float> Set the font letter spacing (tracking)
|
70
|
+
# Set LineHeight <float> Set the font line height
|
71
|
+
# Set LoopOffset <float>% Set the starting frame offset for the GIF loop
|
72
|
+
# Set Theme <json|string> Set the theme of the terminal
|
73
|
+
# Set Padding <number> Set the padding of the terminal
|
74
|
+
# Set Framerate <number> Set the framerate of the recording
|
75
|
+
# Set PlaybackSpeed <float> Set the playback speed of the recording
|
76
|
+
# Set MarginFill <file|#000000> Set the file or color the margin will be filled with.
|
77
|
+
# Set Margin <number> Set the size of the margin. Has no effect if MarginFill isn't set.
|
78
|
+
# Set BorderRadius <number> Set terminal border radius, in pixels.
|
79
|
+
# Set WindowBar <string> Set window bar type. (one of: Rings, RingsRight, Colorful, ColorfulRight)
|
80
|
+
# Set WindowBarSize <number> Set window bar size, in pixels. Default is 40.
|
81
|
+
# Set TypingSpeed <time> Set the typing speed of the terminal. Default is 50ms.
|
82
|
+
#
|
83
|
+
# Sleep:
|
84
|
+
# Sleep <time> Sleep for a set amount of <time> in seconds
|
85
|
+
#
|
86
|
+
# Type:
|
87
|
+
# Type[@<time>] "<characters>" Type <characters> into the terminal with a
|
88
|
+
# <time> delay between each character
|
89
|
+
#
|
90
|
+
# Keys:
|
91
|
+
# Escape[@<time>] [number] Press the Escape key
|
92
|
+
# Backspace[@<time>] [number] Press the Backspace key
|
93
|
+
# Delete[@<time>] [number] Press the Delete key
|
94
|
+
# Insert[@<time>] [number] Press the Insert key
|
95
|
+
# Down[@<time>] [number] Press the Down key
|
96
|
+
# Enter[@<time>] [number] Press the Enter key
|
97
|
+
# Space[@<time>] [number] Press the Space key
|
98
|
+
# Tab[@<time>] [number] Press the Tab key
|
99
|
+
# Left[@<time>] [number] Press the Left Arrow key
|
100
|
+
# Right[@<time>] [number] Press the Right Arrow key
|
101
|
+
# Up[@<time>] [number] Press the Up Arrow key
|
102
|
+
# Down[@<time>] [number] Press the Down Arrow key
|
103
|
+
# PageUp[@<time>] [number] Press the Page Up key
|
104
|
+
# PageDown[@<time>] [number] Press the Page Down key
|
105
|
+
# Ctrl+<key> Press the Control key + <key> (e.g. Ctrl+C)
|
106
|
+
#
|
107
|
+
# Display:
|
108
|
+
# Hide Hide the subsequent commands from the output
|
109
|
+
# Show Show the subsequent commands in the output
|
data/deploy.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# VersionUpdater
|
4
|
+
class VersionUpdater
|
5
|
+
attr_accessor :new_version
|
6
|
+
|
7
|
+
def initialize(version_path)
|
8
|
+
@version_path = version_path
|
9
|
+
@new_version = nil
|
10
|
+
end
|
11
|
+
|
12
|
+
def call
|
13
|
+
update_version
|
14
|
+
deploy
|
15
|
+
end
|
16
|
+
|
17
|
+
def deploy
|
18
|
+
system('gem build')
|
19
|
+
system("gem push gchatsh-#{new_version}.gem")
|
20
|
+
end
|
21
|
+
|
22
|
+
def update_version
|
23
|
+
version_file = File.read(@version_path)
|
24
|
+
results = []
|
25
|
+
|
26
|
+
version_file.each_line do |line|
|
27
|
+
if /.*VERSION.*/.match(line)
|
28
|
+
matched = /(\d\.\d\.\d+)/.match(line)
|
29
|
+
old_version = matched[0]
|
30
|
+
semver_numbers = old_version.split('.')
|
31
|
+
@new_version = "#{semver_numbers[0]}.#{semver_numbers[1]}.#{semver_numbers[2].to_i + 1}"
|
32
|
+
new_line = line.gsub(old_version, new_version)
|
33
|
+
results.push(new_line)
|
34
|
+
else
|
35
|
+
results.push(line)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
File.write(@version_path, results.join(""))
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
version_path = 'lib/gchatsh/version.rb'
|
44
|
+
updater = VersionUpdater.new(version_path)
|
45
|
+
updater.call
|
data/lib/credentials.rb
CHANGED
@@ -1,29 +1,46 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
require 'dotenv'
|
3
|
+
|
4
|
+
# Load environment variables from the .env file
|
2
5
|
|
3
6
|
# Credentials class
|
4
7
|
class Credentials
|
5
|
-
attr_accessor :url, :key, :model
|
8
|
+
attr_accessor :url, :key, :model, :credentials_file
|
6
9
|
|
7
10
|
def initialize
|
8
|
-
credentials_file = File.expand_path('~/.gchatsh')
|
11
|
+
@credentials_file = File.expand_path('~/.gchatsh')
|
9
12
|
unless File.exist?(credentials_file)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
+
File.write(credentials_file, initial_file_format)
|
14
|
+
error_message = <<~ERROR
|
15
|
+
You need to add your API key to the credentials file at #{credentials_file}
|
16
|
+
ERROR
|
17
|
+
raise "\n#{error_message}"
|
13
18
|
end
|
14
19
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
@model = value
|
24
|
-
else
|
25
|
-
raise 'Invalid credentials file format'
|
26
|
-
end
|
20
|
+
Dotenv.load(credentials_file)
|
21
|
+
|
22
|
+
if ENV['KEY'].empty?
|
23
|
+
raise missing_config_message('API key not found')
|
24
|
+
elsif ENV['URL'].empty?
|
25
|
+
raise missing_config_message('API URL not found')
|
26
|
+
elsif ENV['MODEL'].empty?
|
27
|
+
raise missing_config_message('Model not found')
|
27
28
|
end
|
29
|
+
|
30
|
+
@url = ENV['URL']
|
31
|
+
@key = ENV['KEY']
|
32
|
+
@model = ENV['MODEL']
|
33
|
+
end
|
34
|
+
|
35
|
+
def missing_config_message(message)
|
36
|
+
"#{message} in the credentials file at #{credentials_file}"
|
37
|
+
end
|
38
|
+
|
39
|
+
def initial_file_format
|
40
|
+
<<~CREDENTIALS
|
41
|
+
URL=https://api.groq.com/openai/v1/chat/completions
|
42
|
+
KEY=
|
43
|
+
MODEL=llama3-8b-8192
|
44
|
+
CREDENTIALS
|
28
45
|
end
|
29
46
|
end
|
data/lib/gchatsh/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gchatsh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ____marcell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
11
|
+
date: 2025-01-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rouge
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.5'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.5'
|
13
27
|
description:
|
14
28
|
email:
|
15
29
|
- 0000marcell@gmail.com
|
@@ -23,6 +37,8 @@ files:
|
|
23
37
|
- README.md
|
24
38
|
- Rakefile
|
25
39
|
- bin/gchatsh
|
40
|
+
- demo.tape
|
41
|
+
- deploy.rb
|
26
42
|
- lib/credentials.rb
|
27
43
|
- lib/gchatsh.rb
|
28
44
|
- lib/gchatsh/version.rb
|