sylvia 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3dc29718344e9ceb4009585dbf01c72d9ec31616a1a5b32c55503f8e4bd7fdad
4
- data.tar.gz: 8b46080dd799481657ab1fad3eb738f605e59b7e5f7e74dfaa72b66935b4bb27
3
+ metadata.gz: 3400a3b8c14a722b2319389c619bbcb5fb141c0900b53eff8ab3cb0d3dfe0e4c
4
+ data.tar.gz: 734a5c7955a4f6210d3d7d48e87727c8c9654d3c2ce2db19ce1c0f4ffd5d9807
5
5
  SHA512:
6
- metadata.gz: 751dbabdce77a8dc61f6a6f3e0ba77f71954de39187cae38f2a83df7f608e7d3b4b1b2e1be7ebff6bcf49ac080fb25107a8937a8c7ae9d32a23c401ca1bca729
7
- data.tar.gz: 151882ff4746c1bde500e350c9f5b8882ac5394135cbd4fe1c4f473cec282b9f5df38df8c76b9523281e131cbf4f27c5ee49efbe511c0a6dd25afb73fcde6c5a
6
+ metadata.gz: 61a5beda98de772f434ed84d85776925105b136ab26ab3a92f38175b615d2cfaf8c9b73181d7a0cba8f3cfff775a537a5d904264be38d6c94ffe68e887c40ab2
7
+ data.tar.gz: 9e0784427701bac5cbf4b8d6ada49069cc618da76aec4c55f518a09531735d09e4175c3c89a070b6f04e6a8a9783f1344a028f33aeed3c0c18b40f274e3614ae
data/README.md CHANGED
@@ -1,36 +1,46 @@
1
1
 
2
2
  ## Sylvia
3
+
4
+ ![Lang](https://img.shields.io/badge/language-ruby-red)
5
+ [![Gem Version](https://img.shields.io/gem/v/sylvia.svg)](https://rubygems.org/gems/sylvia)
6
+ [![Gem Downloads](https://img.shields.io/gem/dt/sylvia.svg)](https://rubygems.org/gems/sylvia)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
+
3
9
  My Private Assistant Tool for ruby development (support Ruby LLM)
4
10
 
5
11
  ## Installation
6
12
 
7
- 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.
13
+ ```
14
+ gem install sylvia
15
+ ```
8
16
 
9
- Install the gem and add to the application's Gemfile by executing:
17
+ ## Usage
10
18
 
11
- ```bash
12
- bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
19
+ Setup Prettier
20
+ ```
21
+ sylvia prettier
13
22
  ```
14
23
 
15
- If bundler is not being used to manage dependencies, install the gem by executing:
16
-
17
- ```bash
18
- gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
24
+ Setup LLM (with Ruby_LLM)
25
+ ```
26
+ sylvia llm
19
27
  ```
20
28
 
21
- ## Usage
29
+ Run AI LLM
30
+ ```
31
+ sylvia ai
32
+ ```
22
33
 
23
- TODO: Write usage instructions here
24
34
 
25
35
  ## Development
26
36
 
27
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
37
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.
28
38
 
29
39
  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).
30
40
 
31
41
  ## Contributing
32
42
 
33
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/sylvia. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/sylvia/blob/master/CODE_OF_CONDUCT.md).
43
+ Bug reports and pull requests are welcome on GitHub at https://github.com/whdzera/sylvia. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/whdzera/sylvia/blob/master/CODE_OF_CONDUCT.md).
34
44
 
35
45
  ## License
36
46
 
@@ -38,4 +48,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
38
48
 
39
49
  ## Code of Conduct
40
50
 
41
- Everyone interacting in the Sylvia project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/sylvia/blob/master/CODE_OF_CONDUCT.md).
51
+ Everyone interacting in the Sylvia project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/whdzera/sylvia/blob/master/CODE_OF_CONDUCT.md).
data/lib/sylvia/cli.rb CHANGED
@@ -10,23 +10,24 @@ module Sylvia
10
10
  command = args.shift
11
11
 
12
12
  case command
13
- when "install"
14
- create_file
15
- when "run"
16
- run_file
13
+ when "llm"
14
+ setup_llm
15
+ when "ai"
16
+ run_llm
17
17
  when "prettier"
18
18
  setup_prettier
19
19
  else
20
20
  puts "Usage:"
21
- puts " sylvia install # Create sylvia.rb"
22
- puts " sylvia run # Run sylvia.rb"
21
+ puts " sylvia llm # Create setup file llm"
22
+ puts " sylvia ai # Run llm"
23
23
  puts " sylvia prettier # Setup Prettier for Ruby"
24
24
  end
25
25
  end
26
26
 
27
- def self.create_file
27
+ def self.setup_llm
28
28
  content = <<~RUBY
29
29
  require 'ruby_llm'
30
+ require 'tty-markdown'
30
31
  require 'dotenv'
31
32
  Dotenv.load
32
33
 
@@ -36,16 +37,18 @@ module Sylvia
36
37
 
37
38
  chat = RubyLLM.chat(model: 'gemini-2.0-flash')
38
39
 
39
- # Just ask questions
40
- response = chat.ask "Siapa prabowo Subianto?"
41
- puts response.content
40
+ response = chat.ask "how to improve this code", with: ["assets/example.rb", "assets/example2.rb"]
41
+
42
+ markdown = response.content.to_s
43
+
44
+ puts TTY::Markdown.parse(markdown)
42
45
  RUBY
43
46
 
44
47
  File.write(FILE_NAME, content)
45
48
  puts "✅ Created #{FILE_NAME}"
46
49
  end
47
50
 
48
- def self.run_file
51
+ def self.run_llm
49
52
  unless File.exist?(FILE_NAME)
50
53
  puts "⚠️ #{FILE_NAME} not found. Run `sylvia install` first."
51
54
  return
@@ -61,14 +64,14 @@ module Sylvia
61
64
  end
62
65
 
63
66
  prettier_config = <<~JSON
64
- {
65
- "plugins": ["@prettier/plugin-ruby"],
66
- "rubyStrictMode": false,
67
- "tabWidth": 2,
68
- "useTabs": false,
69
- "singleQuote": true
70
- }
71
- JSON
67
+ {
68
+ "plugins": ["@prettier/plugin-ruby"],
69
+ "rubyStrictMode": false,
70
+ "tabWidth": 2,
71
+ "useTabs": false,
72
+ "singleQuote": true
73
+ }
74
+ JSON
72
75
 
73
76
  File.write(PRETTIER_FILE, prettier_config)
74
77
  puts "✅ Created #{PRETTIER_FILE}"
@@ -87,6 +90,23 @@ module Sylvia
87
90
 
88
91
  puts "⚡ Running `npm install`..."
89
92
  system("npm install")
93
+
94
+ gemfile = "Gemfile"
95
+ if File.exist?(gemfile)
96
+ content = File.read(gemfile)
97
+ unless content.include?('gem "syntax_tree"')
98
+ File.open(gemfile, "a") { |f| f.puts "\ngem \"syntax_tree\"" }
99
+ puts "✅ Added gem 'syntax_tree' to Gemfile"
100
+ else
101
+ puts "⚠️ Gemfile already contains syntax_tree"
102
+ end
103
+
104
+ puts "⚡ Running `bundle install`..."
105
+ system("bundle install")
106
+ else
107
+ puts "⚠️ No Gemfile found. Skipping syntax_tree installation."
108
+ end
109
+
90
110
  puts "🎉 Prettier setup complete!"
91
111
  end
92
112
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sylvia
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.1"
5
5
  end
data/sylvia.gemspec CHANGED
@@ -28,5 +28,6 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.add_dependency "ruby_llm"
30
30
  spec.add_dependency "dotenv"
31
- spec.add_development_dependency "syntax_tree", "6.2.0"
31
+ spec.add_dependency "tty-markdown"
32
+ spec.add_development_dependency "syntax_tree"
32
33
  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.1.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - whdzera
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-08-23 00:00:00.000000000 Z
10
+ date: 2025-08-24 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: ruby_llm
@@ -37,26 +37,39 @@ dependencies:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: '0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: tty-markdown
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
40
54
  - !ruby/object:Gem::Dependency
41
55
  name: syntax_tree
42
56
  requirement: !ruby/object:Gem::Requirement
43
57
  requirements:
44
- - - '='
58
+ - - ">="
45
59
  - !ruby/object:Gem::Version
46
- version: 6.2.0
60
+ version: '0'
47
61
  type: :development
48
62
  prerelease: false
49
63
  version_requirements: !ruby/object:Gem::Requirement
50
64
  requirements:
51
- - - '='
65
+ - - ">="
52
66
  - !ruby/object:Gem::Version
53
- version: 6.2.0
67
+ version: '0'
54
68
  description: Sylvia is a command-line tool that helps you create and manage Ruby projects
55
69
  with ease.
56
70
  email:
57
71
  - whdzera@gmail.com
58
72
  executables:
59
- - setup
60
73
  - sylvia
61
74
  extensions: []
62
75
  extra_rdoc_files: []
@@ -68,11 +81,9 @@ files:
68
81
  - CHANGELOG.md
69
82
  - CODE_OF_CONDUCT.md
70
83
  - Gemfile
71
- - Gemfile.lock
72
84
  - LICENSE.txt
73
85
  - README.md
74
86
  - Rakefile
75
- - bin/setup
76
87
  - bin/sylvia
77
88
  - lib/sylvia.rb
78
89
  - lib/sylvia/cli.rb
data/Gemfile.lock DELETED
@@ -1,91 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- sylvia (0.1.0)
5
- dotenv
6
- ruby_llm
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- base64 (0.3.0)
12
- date (3.4.1)
13
- diff-lcs (1.6.2)
14
- dotenv (3.1.8)
15
- erb (5.0.2)
16
- event_stream_parser (1.0.0)
17
- faraday (2.13.4)
18
- faraday-net_http (>= 2.0, < 3.5)
19
- json
20
- logger
21
- faraday-multipart (1.1.1)
22
- multipart-post (~> 2.0)
23
- faraday-net_http (3.4.1)
24
- net-http (>= 0.5.0)
25
- faraday-retry (2.3.2)
26
- faraday (~> 2.0)
27
- io-console (0.8.1)
28
- irb (1.15.2)
29
- pp (>= 0.6.0)
30
- rdoc (>= 4.0.0)
31
- reline (>= 0.4.2)
32
- json (2.13.2)
33
- logger (1.7.0)
34
- marcel (1.0.4)
35
- multipart-post (2.4.1)
36
- net-http (0.6.0)
37
- uri
38
- pp (0.6.2)
39
- prettyprint
40
- prettier_print (1.2.1)
41
- prettyprint (0.2.0)
42
- psych (5.2.6)
43
- date
44
- stringio
45
- rake (13.3.0)
46
- rdoc (6.14.2)
47
- erb
48
- psych (>= 4.0.0)
49
- reline (0.6.2)
50
- io-console (~> 0.5)
51
- rspec (3.13.0)
52
- rspec-core (~> 3.13.0)
53
- rspec-expectations (~> 3.13.0)
54
- rspec-mocks (~> 3.13.0)
55
- rspec-core (3.13.4)
56
- rspec-support (~> 3.13.0)
57
- rspec-expectations (3.13.5)
58
- diff-lcs (>= 1.2.0, < 2.0)
59
- rspec-support (~> 3.13.0)
60
- rspec-mocks (3.13.5)
61
- diff-lcs (>= 1.2.0, < 2.0)
62
- rspec-support (~> 3.13.0)
63
- rspec-support (3.13.4)
64
- ruby_llm (1.5.1)
65
- base64
66
- event_stream_parser (~> 1)
67
- faraday (>= 1.10.0)
68
- faraday-multipart (>= 1)
69
- faraday-net_http (>= 1)
70
- faraday-retry (>= 1)
71
- marcel (~> 1.0)
72
- zeitwerk (~> 2)
73
- stringio (3.1.7)
74
- syntax_tree (6.2.0)
75
- prettier_print (>= 1.2.0)
76
- uri (1.0.3)
77
- zeitwerk (2.7.3)
78
-
79
- PLATFORMS
80
- ruby
81
- x86_64-linux
82
-
83
- DEPENDENCIES
84
- irb
85
- rake (~> 13.0)
86
- rspec (~> 3.0)
87
- sylvia!
88
- syntax_tree (= 6.2.0)
89
-
90
- BUNDLED WITH
91
- 2.6.9
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here