matheus 0.7.0 → 0.8.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/.standard.yml +1 -0
- data/.tool-versions +1 -1
- data/CHANGELOG.md +11 -0
- data/Rakefile +1 -1
- data/lib/matheus/alert_me.rb +2 -2
- data/lib/matheus/convert_currency.rb +1 -1
- data/lib/matheus/q.rb +6 -16
- data/lib/matheus/quick_commit.rb +1 -2
- data/lib/matheus/version.rb +1 -1
- metadata +8 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 668bbb45792868d5cdc9d9e8ec08e57a0ee0cad7f6b8f6f06d9d0525054c6419
|
|
4
|
+
data.tar.gz: 85432c2885378382bce069b276898886bfb6b6b3e90af780d8de303844b793fb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c415912e5e87e7f9fed56d1d1a4cbc50573bc57a8ada623b8e950cf852e7eeb08c05285a87491e44bca50919162407c44b19720610891abcbe4cb86c059cef38
|
|
7
|
+
data.tar.gz: 4c512102ec35dcf5641771c60cc848e42c1b1dc936312f1a94816f0044346961158ddc51a84b91ad1a551c4021201c2376c1e21e0a4428d07d38d53ec95e1976
|
data/.standard.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ruby_version: 3.2
|
data/.tool-versions
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
ruby 3.
|
|
1
|
+
ruby 3.4
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.8.0]
|
|
4
|
+
|
|
5
|
+
- Replace `ruby-openai` with `ruby_llm` in `q`.
|
|
6
|
+
- Change the `q` model from `gpt-4o-mini` to `gpt-5.4-nano`.
|
|
7
|
+
- Fix the `q` errors that occur when json 3.0 is installed.
|
|
8
|
+
|
|
9
|
+
## [0.7.1]
|
|
10
|
+
|
|
11
|
+
- Update sound playback commands to run in the background with success status
|
|
12
|
+
|
|
3
13
|
## [0.7.0]
|
|
4
14
|
|
|
5
15
|
_Released 2025-03-03_
|
|
@@ -11,6 +21,7 @@ _Released 2025-03-03_
|
|
|
11
21
|
_Released 2025-01-07_
|
|
12
22
|
|
|
13
23
|
- Allow specifying values on `convert-currency` command.
|
|
24
|
+
|
|
14
25
|
```sh
|
|
15
26
|
$ convert-currency 100 usd eur
|
|
16
27
|
```
|
data/Rakefile
CHANGED
data/lib/matheus/alert_me.rb
CHANGED
|
@@ -9,9 +9,9 @@ module Matheus
|
|
|
9
9
|
# Runs the command and plays a sound based on its success or failure after it finishes.
|
|
10
10
|
def call(*args)
|
|
11
11
|
if system(args.join(" ").presence || "true")
|
|
12
|
-
system("afplay /System/Library/Sounds/Glass.aiff")
|
|
12
|
+
system("afplay /System/Library/Sounds/Glass.aiff & true")
|
|
13
13
|
else
|
|
14
|
-
system("afplay /System/Library/Sounds/Sosumi.aiff")
|
|
14
|
+
system("afplay /System/Library/Sounds/Sosumi.aiff & false")
|
|
15
15
|
end
|
|
16
16
|
rescue => e
|
|
17
17
|
Failure(e.message)
|
|
@@ -32,7 +32,7 @@ module Matheus
|
|
|
32
32
|
def parse_args(args)
|
|
33
33
|
first_arg = args.fetch(0) { raise "Missing amount or source currency" }
|
|
34
34
|
|
|
35
|
-
if (amount = Float(first_arg
|
|
35
|
+
if (amount = Float(first_arg, exception: false))
|
|
36
36
|
source = args.fetch(1) { raise "Missing source currency" }
|
|
37
37
|
target = args.fetch(2) { raise "Missing target currency" }
|
|
38
38
|
date = Date.parse(args.fetch(3, Date.today.to_s))
|
data/lib/matheus/q.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require "
|
|
1
|
+
require "ruby_llm"
|
|
2
2
|
require "tty-markdown"
|
|
3
3
|
require "tty-prompt"
|
|
4
4
|
require "json"
|
|
@@ -21,7 +21,7 @@ module Matheus
|
|
|
21
21
|
save_qa(question, answer)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
answer.tap { |
|
|
24
|
+
answer.tap { |text| print_markdown(text) }
|
|
25
25
|
rescue => e
|
|
26
26
|
Failure(e.message)
|
|
27
27
|
end
|
|
@@ -31,26 +31,16 @@ module Matheus
|
|
|
31
31
|
def ask_llm(question)
|
|
32
32
|
raise "Question can't be blank." if question.blank?
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
parameters: {
|
|
36
|
-
model: "gpt-4o-mini",
|
|
37
|
-
messages: [{role: "user", content: "#{BASE_PROMPT}#{question}"}]
|
|
38
|
-
}
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
raise response["error"]["message"] if response.has_key?("error")
|
|
42
|
-
|
|
43
|
-
response.dig("choices", 0, "message", "content")
|
|
44
|
-
rescue Faraday::ClientError => error
|
|
45
|
-
raise error.response_body.dig("error", "message") || error
|
|
34
|
+
chat.ask("#{BASE_PROMPT}#{question}").content
|
|
46
35
|
end
|
|
47
36
|
|
|
48
37
|
def print_markdown(text)
|
|
49
38
|
puts TTY::Markdown.parse(text)
|
|
50
39
|
end
|
|
51
40
|
|
|
52
|
-
def
|
|
53
|
-
|
|
41
|
+
def chat
|
|
42
|
+
RubyLLM.configure { |config| config.openai_api_key = ENV.fetch("OPENAI_API_KEY") }
|
|
43
|
+
RubyLLM.chat(model: "gpt-5.4-nano")
|
|
54
44
|
end
|
|
55
45
|
|
|
56
46
|
def save_qa(question, answer)
|
data/lib/matheus/quick_commit.rb
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
module Matheus
|
|
2
|
-
|
|
3
2
|
class QuickCommit < Command
|
|
4
3
|
# Usage:
|
|
5
4
|
# $ quick-commit
|
|
@@ -9,7 +8,7 @@ module Matheus
|
|
|
9
8
|
|
|
10
9
|
Q.call(["Please write a good one-line commit message for the following diff. Return only plain-text. Diff:\n#{diff}"], skip_cache: true)
|
|
11
10
|
.on_success { |msg| confirm("Accept commit message?", return_value: msg) }
|
|
12
|
-
.on_success { |commit_message| system(%(git commit -m "#{commit_message}"), :
|
|
11
|
+
.on_success { |commit_message| system(%(git commit -m "#{commit_message}"), out: :close) }
|
|
13
12
|
end
|
|
14
13
|
|
|
15
14
|
private
|
data/lib/matheus/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: matheus
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matheus Richard
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: zeitwerk
|
|
@@ -39,19 +38,19 @@ dependencies:
|
|
|
39
38
|
- !ruby/object:Gem::Version
|
|
40
39
|
version: 7.2.0
|
|
41
40
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
41
|
+
name: ruby_llm
|
|
43
42
|
requirement: !ruby/object:Gem::Requirement
|
|
44
43
|
requirements:
|
|
45
44
|
- - "~>"
|
|
46
45
|
- !ruby/object:Gem::Version
|
|
47
|
-
version:
|
|
46
|
+
version: '2.0'
|
|
48
47
|
type: :runtime
|
|
49
48
|
prerelease: false
|
|
50
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
50
|
requirements:
|
|
52
51
|
- - "~>"
|
|
53
52
|
- !ruby/object:Gem::Version
|
|
54
|
-
version:
|
|
53
|
+
version: '2.0'
|
|
55
54
|
- !ruby/object:Gem::Dependency
|
|
56
55
|
name: tty-markdown
|
|
57
56
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -123,6 +122,7 @@ extensions: []
|
|
|
123
122
|
extra_rdoc_files: []
|
|
124
123
|
files:
|
|
125
124
|
- ".rspec"
|
|
125
|
+
- ".standard.yml"
|
|
126
126
|
- ".tool-versions"
|
|
127
127
|
- CHANGELOG.md
|
|
128
128
|
- LICENSE.txt
|
|
@@ -154,7 +154,7 @@ metadata:
|
|
|
154
154
|
homepage_uri: https://github.com/MatheusRich/matheus
|
|
155
155
|
source_code_uri: https://github.com/MatheusRich/matheus
|
|
156
156
|
changelog_uri: https://github.com/MatheusRich/matheus/blob/main/CHANGELOG.md
|
|
157
|
-
|
|
157
|
+
rubygems_mfa_required: 'true'
|
|
158
158
|
rdoc_options: []
|
|
159
159
|
require_paths:
|
|
160
160
|
- lib
|
|
@@ -169,8 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
169
169
|
- !ruby/object:Gem::Version
|
|
170
170
|
version: '0'
|
|
171
171
|
requirements: []
|
|
172
|
-
rubygems_version: 3.
|
|
173
|
-
signing_key:
|
|
172
|
+
rubygems_version: 3.6.9
|
|
174
173
|
specification_version: 4
|
|
175
174
|
summary: A bunch of CLI tools I made for my own use.
|
|
176
175
|
test_files: []
|