rubycode 0.1.0 → 0.1.2

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.
data/rubycode_cli.rb ADDED
@@ -0,0 +1,88 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "lib/rubycode"
5
+ require "readline"
6
+
7
+ puts "\n#{"=" * 80}"
8
+ puts "šŸš€ RubyCode - AI Ruby/Rails Code Assistant"
9
+ puts "=" * 80
10
+
11
+ # Ask for directory
12
+ print "\nWhat directory do you want to work on? (default: current directory): "
13
+ directory = gets.chomp
14
+ directory = Dir.pwd if directory.empty?
15
+
16
+ # Resolve the full path
17
+ full_path = File.expand_path(directory)
18
+
19
+ unless Dir.exist?(full_path)
20
+ puts "\nāŒ Error: Directory '#{full_path}' does not exist!"
21
+ exit 1
22
+ end
23
+
24
+ puts "\nšŸ“ Working directory: #{full_path}"
25
+
26
+ # Ask if debug mode should be enabled
27
+ print "Enable debug mode? (shows JSON requests/responses) [y/N]: "
28
+ debug_input = gets.chomp.downcase
29
+ debug_mode = %w[y yes].include?(debug_input)
30
+
31
+ # Configure the client
32
+ RubyCode.configure do |config|
33
+ config.adapter = :ollama
34
+ config.url = "http://localhost:11434"
35
+ config.model = "deepseek-v3.1:671b-cloud"
36
+ config.root_path = full_path
37
+ config.debug = debug_mode
38
+
39
+ # Enable workaround to force tool-calling for models that don't follow instructions
40
+ config.enable_tool_injection_workaround = true
41
+ end
42
+
43
+ puts "šŸ› Debug mode: #{debug_mode ? "ON" : "OFF"}" if debug_mode
44
+
45
+ # Create a client
46
+ client = RubyCode::Client.new
47
+
48
+ puts "\n#{"=" * 80}"
49
+ puts "✨ Agent initialized! You can now ask questions or request code changes."
50
+ puts " Type 'exit' or 'quit' to exit, 'clear' to clear history"
51
+ puts "=" * 80
52
+
53
+ # Interactive loop
54
+ loop do
55
+ print "\nšŸ’¬ You: "
56
+ prompt = Readline.readline("", true)
57
+
58
+ # Handle empty input
59
+ next if prompt.nil? || prompt.strip.empty?
60
+
61
+ # Handle commands
62
+ case prompt.strip.downcase
63
+ when "exit", "quit"
64
+ puts "\nšŸ‘‹ Goodbye!"
65
+ break
66
+ when "clear"
67
+ client.clear_history
68
+ puts "\nšŸ—‘ļø History cleared!"
69
+ next
70
+ end
71
+
72
+ puts "\n#{"-" * 80}"
73
+
74
+ begin
75
+ # Get response from agent
76
+ response = client.ask(prompt: prompt)
77
+
78
+ puts "\nšŸ¤– Agent:"
79
+ puts "-" * 80
80
+ puts response
81
+ puts "-" * 80
82
+ rescue Interrupt
83
+ puts "\n\nāš ļø Interrupted! Type 'exit' to quit or continue chatting."
84
+ rescue StandardError => e
85
+ puts "\nāŒ Error: #{e.message}"
86
+ puts e.backtrace.first(3).join("\n")
87
+ end
88
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubycode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Medeiros
@@ -21,14 +21,40 @@ files:
21
21
  - LICENSE.txt
22
22
  - README.md
23
23
  - Rakefile
24
+ - USAGE.md
25
+ - config/tools/bash.json
26
+ - config/tools/done.json
27
+ - config/tools/read.json
28
+ - config/tools/search.json
24
29
  - lib/rubycode.rb
30
+ - lib/rubycode/adapters/base.rb
31
+ - lib/rubycode/adapters/ollama.rb
32
+ - lib/rubycode/agent_loop.rb
33
+ - lib/rubycode/client.rb
34
+ - lib/rubycode/client/display_formatter.rb
35
+ - lib/rubycode/client/response_handler.rb
36
+ - lib/rubycode/configuration.rb
37
+ - lib/rubycode/context_builder.rb
38
+ - lib/rubycode/errors.rb
39
+ - lib/rubycode/history.rb
40
+ - lib/rubycode/tools.rb
41
+ - lib/rubycode/tools/base.rb
42
+ - lib/rubycode/tools/bash.rb
43
+ - lib/rubycode/tools/done.rb
44
+ - lib/rubycode/tools/read.rb
45
+ - lib/rubycode/tools/search.rb
46
+ - lib/rubycode/value_objects.rb
25
47
  - lib/rubycode/version.rb
48
+ - rubycode_cli.rb
26
49
  - sig/rubycode.rbs
27
- homepage: https://example.com
50
+ homepage: https://github.com/jonasmedeiros/rubycode
28
51
  licenses:
29
52
  - MIT
30
53
  metadata:
31
- homepage_uri: https://example.com
54
+ homepage_uri: https://github.com/jonasmedeiros/rubycode
55
+ source_code_uri: https://github.com/jonasmedeiros/rubycode
56
+ bug_tracker_uri: https://github.com/jonasmedeiros/rubycode/issues
57
+ rubygems_mfa_required: 'true'
32
58
  rdoc_options: []
33
59
  require_paths:
34
60
  - lib