sylvia 0.2.5 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c34bb60cfa6051d1abc0e47ef8c98f2e041387d0f6629a976c873865243f16b3
4
- data.tar.gz: 06f0445f90ba8b7966e89f9d5a643e35702324db20153728ba75111804f2e3d7
3
+ metadata.gz: 8783c3724ed736abf502fe3a02e41e2216e6ec3a961a4472a864b66f243a2a0c
4
+ data.tar.gz: 1d9da5a2034b12694486606972a6443489787a0941b25408a350699aa394f681
5
5
  SHA512:
6
- metadata.gz: 9dc1a2aae9564c61d52a137a5ef8a19ab943d0b62a4209eb6f9ffa381bb0649fa22d3745aff442d2f16975efbc2c2c206816d87a5cc08243ccac95564f11579a
7
- data.tar.gz: 965069849d23eaa084fc7992dc7236e1da04fc2649129a0aaac80f6f0d410f6834d59f0590c87e6cb06cc804de662930eb96faa18f038cc00637871855964df8
6
+ metadata.gz: ae40c8d17067ff2f2d81c4562de5d1d6ecb31e72df2525ec3b03d2c494bc78a4ba8e714f62b6e8e340d6704e5636b960978da628461bd96a2e40bcd0cd3f8601
7
+ data.tar.gz: a1e14069c41b86718fd70948358c6c0deebf7f0d154a1d7819ce3b1b5ea98a4ad95d9e75371662532affde136bbdc07478c0eaac73c2877c2428d1327b23e407
data/lib/sylvia/llm.rb CHANGED
@@ -35,12 +35,11 @@ PROMPT
35
35
  puts "Created #{FILE_NAME}"
36
36
 
37
37
  if File.exist?(GITIGNORE_FILE)
38
- gitignore_content = File.read(GITIGNORE_FILE)
39
- gitignore_content += "\n" unless gitignore_content.end_with?("\n")
38
+ gitignore_content = File.read(GITIGNORE_FILE).split("\n")
40
39
  if gitignore_content.include?(FILE_NAME)
41
40
  puts "#{FILE_NAME} is already in #{GITIGNORE_FILE}"
42
41
  else
43
- File.open(GITIGNORE_FILE, 'a') { |f| f.puts FILE_NAME }
42
+ File.open(GITIGNORE_FILE, 'a') { |f| f.puts "\n#{FILE_NAME}" }
44
43
  puts "Added #{FILE_NAME} to #{GITIGNORE_FILE}"
45
44
  end
46
45
  else
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sylvia
4
- VERSION = "0.2.5"
4
+ VERSION = "0.2.6"
5
5
  end
data/sylvia.rb ADDED
@@ -0,0 +1,24 @@
1
+ require 'ruby_llm'
2
+ require 'tty-markdown'
3
+
4
+ api_key = 'xxx'
5
+ model_ai = 'gemini-2.0-flash'
6
+
7
+ RubyLLM.configure do |config|
8
+ config.gemini_api_key = api_key
9
+ end
10
+
11
+ chat = RubyLLM.chat(model: model_ai)
12
+
13
+ response = chat.ask <<~PROMPT, with: ["assets/example.rb", "assets/example2.rb"]
14
+ Please review the following Ruby code and suggest improvements:
15
+
16
+ 1. Use descriptive variable names.
17
+ 2. Follow Ruby style conventions.
18
+ 3. Optimize loops and iterators.
19
+ 4. Avoid unnecessary complexity.
20
+ PROMPT
21
+
22
+ markdown = response.content.to_s
23
+
24
+ puts TTY::Markdown.parse(markdown)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sylvia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - whdzera
@@ -95,6 +95,7 @@ files:
95
95
  - spec/spec_helper.rb
96
96
  - spec/sylvia_spec.rb
97
97
  - sylvia.gemspec
98
+ - sylvia.rb
98
99
  homepage: https://github.com/whdzera/sylvia
99
100
  licenses:
100
101
  - MIT