sylvia 0.2.2 → 0.2.3

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: 7f9ecbb50b89f7254c1283157123b2113eea53c62898ce089dfb83ea65ea8d28
4
- data.tar.gz: d7f8883c1b1ec0a3b1735308b9d29edf184f9bccca2065f61f3fc503b24f9b7c
3
+ metadata.gz: b36536661b2da3b7b5831f99d79b1b6d7f57c40a43eddbf2026bc68e25b6c9c7
4
+ data.tar.gz: 37ae0cb4923b95e61d12aba773f0833293cc9225a63df9221e12bec9b9f6b3de
5
5
  SHA512:
6
- metadata.gz: a76aaefa7ab89f2e7530e786561ea0fa7ee78c075f73030e0f3681024dd78f7d6a4dfb962759d613df1baabbf9d9f6d08823d978c2e77c09d535033ecd931d68
7
- data.tar.gz: 2e91b75f6734d6fab43fde3330082765953ffcd2a4966343ab2bac2512c5d6a8ab6c84c4d0dab460c0d9e61066b9c823506bd1ca84460f83abf01602cb62e2b2
6
+ metadata.gz: b782bce866c39f346b0574b74662461c78ca423c5cb7c5512a81357626f35b817c8ac15c657199c5f927a41dfcd01fd1e06d49c337a6950895de06941c6a2374
7
+ data.tar.gz: 3d42cbf0b1dfffc74c13e6dfe1cebede4a2f66b57b1fa683b37390634adebb96296c589f1fcc3c2ec559852f517c5d1ed164e8e4d1859ae0507019da3f07f22a
data/README.md CHANGED
@@ -49,6 +49,12 @@ This is like a cursor/copilot, but manual.
49
49
  sylvia ai
50
50
  ```
51
51
 
52
+ ##### Check Version
53
+
54
+ ```
55
+ sylvia -v
56
+ ```
57
+
52
58
  run ruby_LLM `sylvia.rb`
53
59
 
54
60
  ## Development
data/lib/sylvia/cli.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require "json"
2
+ require_relative "version"
2
3
  require_relative "llm"
3
4
  require_relative "prettier"
4
5
  require_relative "rubocop"
@@ -19,6 +20,8 @@ module Sylvia
19
20
  RuboCop.setup
20
21
  when "rubocop-todo"
21
22
  RuboCop.generate_todo
23
+ when "-v", "--version"
24
+ puts "Sylvia version #{Sylvia::VERSION}"
22
25
  else
23
26
  puts "Usage:"
24
27
  puts " sylvia llm # Create setup file llm"
@@ -26,6 +29,7 @@ module Sylvia
26
29
  puts " sylvia prettier # Setup Prettier for Ruby"
27
30
  puts " sylvia rubocop # Create .rubocop.yml config file"
28
31
  puts " sylvia rubocop-todo # Generate .rubocop_todo.yml automatically"
32
+ puts " sylvia -v, --version # Show Sylvia version"
29
33
  end
30
34
  end
31
35
  end
data/lib/sylvia/llm.rb CHANGED
@@ -6,16 +6,25 @@ module Sylvia
6
6
  content = <<~RUBY
7
7
  require 'ruby_llm'
8
8
  require 'tty-markdown'
9
- require 'dotenv'
10
- Dotenv.load
9
+
10
+ api_key = 'xxx'
11
+ model_ai = 'gemini-2.0-flash'
12
+
11
13
 
12
14
  RubyLLM.configure do |config|
13
- config.gemini_api_key = ENV.fetch('gemini', nil)
15
+ config.gemini_api_key = api_key
14
16
  end
15
17
 
16
- chat = RubyLLM.chat(model: 'gemini-2.0-flash')
18
+ chat = RubyLLM.chat(model: model_ai)
19
+
20
+ response = chat.ask <<~PROMPT, with: ["assets/example.rb", "assets/example2.rb"]
21
+ Please review the following Ruby code and suggest improvements:
17
22
 
18
- response = chat.ask "how to improve this code", with: ["assets/example.rb", "assets/example2.rb"]
23
+ 1. Use descriptive variable names.
24
+ 2. Follow Ruby style conventions.
25
+ 3. Optimize loops and iterators.
26
+ 4. Avoid unnecessary complexity.
27
+ PROMPT
19
28
 
20
29
  markdown = response.content.to_s
21
30
 
@@ -5,70 +5,83 @@ module Sylvia
5
5
  def self.setup
6
6
  if File.exist?(CONFIG_FILE)
7
7
  puts "#{CONFIG_FILE} already exists. Skipping."
8
- return
9
- end
8
+ else
9
+ config_content = <<~YAML
10
+ AllCops:
11
+ Include:
12
+ - "**/*.rb"
13
+ - "**/*.rake"
14
+ - "."
15
+ Exclude:
16
+ - "vendor/**/*"
17
+ - "db/schema.rb"
18
+ NewCops: enable
10
19
 
11
- config_content = <<~YAML
12
- AllCops:
13
- Include:
14
- - "**/*.rb"
15
- - "**/*.rake"
16
- - "."
17
- Exclude:
18
- - "vendor/**/*"
19
- - "db/schema.rb"
20
- NewCops: enable
20
+ Layout/LineLength:
21
+ Max: 120
22
+ Exclude:
23
+ - "spec/**/*"
21
24
 
22
- Layout/LineLength:
23
- Max: 120
24
- Exclude:
25
- - "spec/**/*"
25
+ Style/BlockDelimiters:
26
+ Exclude:
27
+ - "spec/**/*"
26
28
 
27
- Style/BlockDelimiters:
28
- Exclude:
29
- - "spec/**/*"
29
+ Lint/AmbiguousBlockAssociation:
30
+ Exclude:
31
+ - "spec/**/*"
30
32
 
31
- Lint/AmbiguousBlockAssociation:
32
- Exclude:
33
- - "spec/**/*"
33
+ Metrics/BlockLength:
34
+ Exclude:
35
+ - "spec/**/*"
34
36
 
35
- Metrics/BlockLength:
36
- Exclude:
37
- - "spec/**/*"
37
+ Layout/HeredocIndentation:
38
+ Enabled: false
38
39
 
39
- Layout/HeredocIndentation:
40
- Enabled: false
40
+ Metrics/ClassLength:
41
+ Max: 175
41
42
 
42
- Metrics/ClassLength:
43
- Max: 175
43
+ Metrics/MethodLength:
44
+ Max: 25
44
45
 
45
- Metrics/MethodLength:
46
- Max: 25
46
+ Metrics/ParameterLists:
47
+ Max: 20
47
48
 
48
- Metrics/ParameterLists:
49
- Max: 20
49
+ Metrics/AbcSize:
50
+ Enabled: false
50
51
 
51
- Metrics/AbcSize:
52
- Enabled: false
52
+ Metrics/PerceivedComplexity:
53
+ Enabled: false
53
54
 
54
- Metrics/PerceivedComplexity:
55
- Enabled: false
55
+ Metrics/CyclomaticComplexity:
56
+ Enabled: false
56
57
 
57
- Metrics/CyclomaticComplexity:
58
- Enabled: false
58
+ Style/HashEachMethods:
59
+ Enabled: true
59
60
 
60
- Style/HashEachMethods:
61
- Enabled: true
61
+ Style/HashTransformKeys:
62
+ Enabled: false
62
63
 
63
- Style/HashTransformKeys:
64
- Enabled: false
64
+ Style/HashTransformValues:
65
+ Enabled: false
66
+ YAML
65
67
 
66
- Style/HashTransformValues:
67
- Enabled: false
68
- YAML
68
+ File.write(CONFIG_FILE, config_content)
69
+ puts "Created #{CONFIG_FILE}"
70
+ end
69
71
 
70
- File.write(CONFIG_FILE, config_content)
71
- puts "Created #{CONFIG_FILE}"
72
+ gemfile = 'Gemfile'
73
+ if File.exist?(gemfile)
74
+ content = File.read(gemfile)
75
+ if content.include?('gem "rubocop"')
76
+ puts 'Gemfile already contains rubocop'
77
+ else
78
+ File.open(gemfile, 'a') { |f| f.puts "\ngem \"rubocop\", require: false" }
79
+ puts "Added gem 'rubocop' to Gemfile"
80
+ system('bundle install')
81
+ end
82
+ else
83
+ puts "No Gemfile found. Please create one and add gem 'rubocop'."
84
+ end
72
85
  end
73
86
 
74
87
  def self.generate_todo
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sylvia
4
- VERSION = "0.2.2"
4
+ VERSION = "0.2.3"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sylvia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - whdzera
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-09-05 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: ruby_llm
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  requirements: []
119
- rubygems_version: 3.6.3
119
+ rubygems_version: 3.7.1
120
120
  specification_version: 4
121
121
  summary: A command-line tool for generating and managing Ruby projects.
122
122
  test_files: []