ollama_chat 0.0.65 → 0.0.66

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: 93d007af4b92cbca56b9738f9b2121d460bcff227beaee8f97b8a3fafd362797
4
- data.tar.gz: e29f2db240c9d232e98e1381c3ef56b34db959d93fe2a15035e0ca55c85bc372
3
+ metadata.gz: f1a18f61aaf91ee38941a242b7ad2930db7e03e2070ce056f6c7e527fd669cdf
4
+ data.tar.gz: f9d94af7c77f4639ed977a783d353f2be3a476fe027264f55a405537839f5cc3
5
5
  SHA512:
6
- metadata.gz: d914de741cbcb653a8a937b0ab298249be6ea3a933e609de96ec5c4ba87d9faa55cc65577f8ebec31b4b6f43927e8b33d245ad3bab82a1a5e48d155522370983
7
- data.tar.gz: 052d95396af6f76ec7c8978d4cc2e70117aa7cf55ad922dc0454a3fa2b54ddf5d2ee621060fc9ab53837949ca89c4edbf8c6b549e7c56806a974ddd909308871
6
+ metadata.gz: 9fc0f6fbb9f5b8afa6937f7f1a136f007b6ec41cc6085b4f8a72de1849624f41b3ff2212d0350ddf8eae3b2c181ed965e425d0fe33288d7960d6314db9e7cb3a
7
+ data.tar.gz: 0257f7bdee23f896e40e6b6610d9561c9c9c77d925eb706514e61ec890865476cff3d989c9dcdb42063a68625a58b34e3ec6d82cbfa327dae0cd4262c742bd5f
data/CHANGES.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-02-16 v0.0.66
4
+
5
+ - Updated `OllamaChat::Tools::GetCurrentWeather.execute` to return a JSON
6
+ string with keys `current_time`, `measurement_time`, `temperature`, and
7
+ `unit`
8
+ - Renamed tool class `OllamaChat::Tools::VimOpenFile` to
9
+ `OllamaChat::Tools::OpenFileInEditor`
10
+ - Updated `register_name` from `vim_open_file` to `open_file_in_editor` for the
11
+ file opening tool
12
+ - Changed `execute` method in `OpenFileInEditor` to resolve `args.path` with
13
+ `Pathname.new(...).expand_path` and call `chat.vim.open_file`
14
+ - Updated `OllamaChat::Tools::ReadFile` to return a JSON string containing
15
+ `path` and `content` instead of raw content
16
+ - Updated `default_config.yml` to use `open_file_in_editor` instead of
17
+ `vim_open_file`
18
+ - Updated gemspec `s.version` to **0.0.66** and adjusted file references from
19
+ `vim_open_file` to `open_file_in_editor`
20
+ - Updated `s.extra_rdoc_files`, `s.files`, and `s.test_files` to include
21
+ `open_file_in_editor.rb` and remove `vim_open_file.rb`
22
+ - Improved error handling in weather tool with JSON error messages that are
23
+ more consistent with Ruby exception handling patterns
24
+ - Enhanced documentation for `fetch_issue` method in
25
+ `OllamaChat::Tools::GetJiraIssue` class with detailed parameter and return
26
+ value descriptions
27
+ - Added regular expression documentation in `OllamaChat::Parsing` module
28
+ - Improved maintainability by adding comprehensive comments to JIRA tool
29
+ implementation
30
+ - Replaced `STDERR.printf` calls for unconfigured and unregistered tools with
31
+ assignments to `@chat.tool_call_results[name]`
32
+ - Updated error strings to include the `"Error: "` prefix and use string
33
+ interpolation with `%` formatting
34
+ - Removed all direct stderr output, centralizing error handling in the chat
35
+ object
36
+
3
37
  ## 2026-02-10 v0.0.65
4
38
 
5
39
  - Updated `location_handling.rb` to return only `location_name`,
@@ -99,11 +99,13 @@ class OllamaChat::FollowChat
99
99
  response.message.tool_calls.each do |tool_call|
100
100
  name = tool_call.function.name
101
101
  unless @chat.config.tools.attribute_set?(name)
102
- STDERR.printf("Unconfigured tool named %s ignored => Skip.\n", name)
102
+ @chat.tool_call_results[name] =
103
+ "Error: Unconfigured tool named %s ignored => Skip.\n" % name
103
104
  next
104
105
  end
105
106
  unless OllamaChat::Tools.registered?(name)
106
- STDERR.printf("Unregistered tool named %s ignored => Skip.\n", name)
107
+ @chat.tool_call_results[name] =
108
+ "Error: Unregistered tool named %s ignored => Skip.\n" % name
107
109
  next
108
110
  end
109
111
  STDOUT.puts
@@ -137,7 +137,7 @@ tools:
137
137
  - https
138
138
  gem_path_lookup:
139
139
  default: true
140
- vim_open_file:
140
+ open_file_in_editor:
141
141
  default: true
142
142
  run_tests:
143
143
  require_confirmation: true
@@ -188,6 +188,7 @@ module OllamaChat::Parsing
188
188
  )
189
189
  end
190
190
 
191
+ # Regular expression to scan content for url/file references
191
192
  CONTENT_REGEXP = %r{
192
193
  (https?://\S+) # Match HTTP/HTTPS URLs
193
194
  | # OR
@@ -61,7 +61,7 @@ class OllamaChat::Tools::GetCurrentWeather
61
61
  # @param opts [Hash] additional options
62
62
  # @option opts [ComplexConfig::Settings] :config the configuration object
63
63
  #
64
- # @return [String] a formatted weather report or error message
64
+ # @return [String] a JSON string containing the retrieved weather data
65
65
  # @return [String] an error message if the weather data could not be
66
66
  # retrieved
67
67
  def execute(tool_call, **opts)
@@ -72,20 +72,25 @@ class OllamaChat::Tools::GetCurrentWeather
72
72
  logger: Logger.new(STDOUT)
73
73
  )
74
74
 
75
- time, temp = sensor.measure
75
+ measurement_time, temperature = sensor.measure
76
76
 
77
- unless time && temp
78
- return "Could not retrieve temperature for station #{station_id}"
77
+ unless measurement_time && temperature
78
+ raise "could not retrieve temperature"
79
79
  end
80
80
 
81
81
  unit = ?℃
82
82
 
83
83
  if tool_call.function.arguments.temperature_unit == 'fahrenheit'
84
- unit = ?℉
85
- temp = temp * 9.0 / 5 + 32
84
+ unit = ?℉
85
+ temperature = temperature * 9.0 / 5 + 32
86
86
  end
87
87
 
88
- "The temperature was %s %s at the time of %s" % [ temp, unit, time ]
88
+ {
89
+ current_time: Time.now,
90
+ measurement_time:,
91
+ temperature:,
92
+ unit:,
93
+ }.to_json
89
94
  rescue => e
90
95
  {
91
96
  error: e.class,
@@ -52,6 +52,16 @@ class OllamaChat::Tools::GetJiraIssue
52
52
  { error: e.class, message: e.message }.to_json
53
53
  end
54
54
 
55
+ # The fetch_issue method retrieves JIRA issue data by key from the configured
56
+ # JIRA instance.
57
+ #
58
+ # This method constructs the appropriate API endpoint URL using the base URL,
59
+ # user, and API token configured in the environment, then fetches the issue
60
+ # data using the configured fetcher.
61
+ #
62
+ # @param issue_key [ String ] the JIRA issue key to retrieve
63
+ #
64
+ # @return [ String ] the JSON response containing the JIRA issue data
55
65
  def fetch_issue(issue_key)
56
66
  # Construct the JIRA API URL
57
67
  env = OllamaChat::EnvConfig::OLLAMA::CHAT::TOOLS::JIRA
@@ -1,12 +1,12 @@
1
- # A tool for opening files in a remote Vim server.
1
+ # A tool for opening files in a the Vim Editor.
2
2
  #
3
- # This tool allows the chat client to open files in a remote Vim server at
4
- # specific line numbers or line ranges. It integrates with the Ollama tool calling
3
+ # This tool allows the chat client to open files in vim at specific line
4
+ # numbers or line ranges. It integrates with the Ollama tool calling
5
5
  # system to provide file editing capabilities.
6
- class OllamaChat::Tools::VimOpenFile
6
+ class OllamaChat::Tools::OpenFileInEditor
7
7
  include OllamaChat::Tools::Concern
8
8
 
9
- def self.register_name = 'vim_open_file'
9
+ def self.register_name = 'open_file_in_editor'
10
10
 
11
11
  # The tool method defines the Ollama tool specification for Vim file opening.
12
12
  #
@@ -20,7 +20,7 @@ class OllamaChat::Tools::VimOpenFile
20
20
  type: 'function',
21
21
  function: Tool::Function.new(
22
22
  name:,
23
- description: 'Open a file in the remote Vim server at a specific line or range',
23
+ description: 'Open a file in the vim editor at a specific line or range',
24
24
  parameters: Tool::Function::Parameters.new(
25
25
  type: 'object',
26
26
  properties: {
@@ -45,9 +45,9 @@ class OllamaChat::Tools::VimOpenFile
45
45
 
46
46
  # The execute method processes a tool call to open a file in Vim.
47
47
  #
48
- # This method handles the actual execution of opening a file in the remote
49
- # Vim server at the specified line or line range. It validates that the file
50
- # exists and then calls the chat's vim.open_file method.
48
+ # This method handles the actual execution of opening a file in the Vim at
49
+ # the specified line or line range. It validates that the file exists and
50
+ # then calls the chat's vim.open_file method.
51
51
  #
52
52
  # @param tool_call [Ollama::Tool::Call] the tool call containing function details
53
53
  # @param opts [Hash] additional options
@@ -58,7 +58,7 @@ class OllamaChat::Tools::VimOpenFile
58
58
  def execute(tool_call, **opts)
59
59
  chat = opts[:chat]
60
60
  args = tool_call.function.arguments
61
- file_path = args.path
61
+ file_path = Pathname.new(args.path).expand_path
62
62
  start_line = args.start_line
63
63
  end_line = args.end_line
64
64
 
@@ -28,9 +28,12 @@ class OllamaChat::Tools::ReadFile
28
28
  config = opts[:config]
29
29
  args = tool_call.function.arguments
30
30
 
31
- target_path = assert_valid_path(args.path, config.tools.read_file.allowed?)
31
+ path = assert_valid_path(args.path, config.tools.read_file.allowed?)
32
32
 
33
- File.read(target_path)
33
+ {
34
+ path:,
35
+ content: File.read(path),
36
+ }.to_json
34
37
  rescue => e
35
38
  {
36
39
  error: e.class,
@@ -55,5 +55,5 @@ require 'ollama_chat/tools/import_url'
55
55
  require 'ollama_chat/tools/read_file'
56
56
  require 'ollama_chat/tools/run_tests'
57
57
  require 'ollama_chat/tools/search_web'
58
- require 'ollama_chat/tools/vim_open_file'
58
+ require 'ollama_chat/tools/open_file_in_editor'
59
59
  require 'ollama_chat/tools/write_file'
@@ -1,6 +1,6 @@
1
1
  module OllamaChat
2
2
  # OllamaChat version
3
- VERSION = '0.0.65'
3
+ VERSION = '0.0.66'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
data/ollama_chat.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: ollama_chat 0.0.65 ruby lib
2
+ # stub: ollama_chat 0.0.66 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "ollama_chat".freeze
6
- s.version = "0.0.65".freeze
6
+ s.version = "0.0.66".freeze
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
@@ -12,15 +12,15 @@ Gem::Specification.new do |s|
12
12
  s.description = "The app provides a command-line interface (CLI) to an Ollama AI model,\nallowing users to engage in text-based conversations and generate\nhuman-like responses. Users can import data from local files or web pages,\nwhich are then processed through three different modes: fully importing the\ncontent into the conversation context, summarizing the information for\nconcise reference, or storing it in an embedding vector database for later\nretrieval based on the conversation.\n".freeze
13
13
  s.email = "flori@ping.de".freeze
14
14
  s.executables = ["ollama_chat".freeze, "ollama_chat_send".freeze]
15
- s.extra_rdoc_files = ["README.md".freeze, "lib/ollama_chat.rb".freeze, "lib/ollama_chat/chat.rb".freeze, "lib/ollama_chat/clipboard.rb".freeze, "lib/ollama_chat/conversation.rb".freeze, "lib/ollama_chat/dialog.rb".freeze, "lib/ollama_chat/document_cache.rb".freeze, "lib/ollama_chat/env_config.rb".freeze, "lib/ollama_chat/follow_chat.rb".freeze, "lib/ollama_chat/history.rb".freeze, "lib/ollama_chat/information.rb".freeze, "lib/ollama_chat/input_content.rb".freeze, "lib/ollama_chat/kramdown_ansi.rb".freeze, "lib/ollama_chat/location_handling.rb".freeze, "lib/ollama_chat/message_editing.rb".freeze, "lib/ollama_chat/message_format.rb".freeze, "lib/ollama_chat/message_list.rb".freeze, "lib/ollama_chat/message_output.rb".freeze, "lib/ollama_chat/model_handling.rb".freeze, "lib/ollama_chat/ollama_chat_config.rb".freeze, "lib/ollama_chat/parsing.rb".freeze, "lib/ollama_chat/redis_cache.rb".freeze, "lib/ollama_chat/server_socket.rb".freeze, "lib/ollama_chat/source_fetching.rb".freeze, "lib/ollama_chat/state_selectors.rb".freeze, "lib/ollama_chat/switches.rb".freeze, "lib/ollama_chat/think_control.rb".freeze, "lib/ollama_chat/tool_calling.rb".freeze, "lib/ollama_chat/tools.rb".freeze, "lib/ollama_chat/tools/browse.rb".freeze, "lib/ollama_chat/tools/concern.rb".freeze, "lib/ollama_chat/tools/directory_structure.rb".freeze, "lib/ollama_chat/tools/endoflife.rb".freeze, "lib/ollama_chat/tools/execute_grep.rb".freeze, "lib/ollama_chat/tools/file_context.rb".freeze, "lib/ollama_chat/tools/gem_path_lookup.rb".freeze, "lib/ollama_chat/tools/get_current_weather.rb".freeze, "lib/ollama_chat/tools/get_cve.rb".freeze, "lib/ollama_chat/tools/get_endoflife.rb".freeze, "lib/ollama_chat/tools/get_jira_issue.rb".freeze, "lib/ollama_chat/tools/get_location.rb".freeze, "lib/ollama_chat/tools/get_time.rb".freeze, "lib/ollama_chat/tools/import_url.rb".freeze, "lib/ollama_chat/tools/read_file.rb".freeze, "lib/ollama_chat/tools/run_tests.rb".freeze, "lib/ollama_chat/tools/search_web.rb".freeze, "lib/ollama_chat/tools/vim_open_file.rb".freeze, "lib/ollama_chat/tools/weather/dwd_sensor.rb".freeze, "lib/ollama_chat/tools/write_file.rb".freeze, "lib/ollama_chat/utils.rb".freeze, "lib/ollama_chat/utils/analyze_directory.rb".freeze, "lib/ollama_chat/utils/cache_fetcher.rb".freeze, "lib/ollama_chat/utils/chooser.rb".freeze, "lib/ollama_chat/utils/fetcher.rb".freeze, "lib/ollama_chat/utils/file_argument.rb".freeze, "lib/ollama_chat/utils/path_validator.rb".freeze, "lib/ollama_chat/version.rb".freeze, "lib/ollama_chat/vim.rb".freeze, "lib/ollama_chat/web_searching.rb".freeze]
16
- s.files = [".utilsrc".freeze, "CHANGES.md".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "bin/ollama_chat".freeze, "bin/ollama_chat_send".freeze, "config/searxng/settings.yml".freeze, "docker-compose.yml".freeze, "lib/ollama_chat.rb".freeze, "lib/ollama_chat/chat.rb".freeze, "lib/ollama_chat/clipboard.rb".freeze, "lib/ollama_chat/conversation.rb".freeze, "lib/ollama_chat/dialog.rb".freeze, "lib/ollama_chat/document_cache.rb".freeze, "lib/ollama_chat/env_config.rb".freeze, "lib/ollama_chat/follow_chat.rb".freeze, "lib/ollama_chat/history.rb".freeze, "lib/ollama_chat/information.rb".freeze, "lib/ollama_chat/input_content.rb".freeze, "lib/ollama_chat/kramdown_ansi.rb".freeze, "lib/ollama_chat/location_handling.rb".freeze, "lib/ollama_chat/message_editing.rb".freeze, "lib/ollama_chat/message_format.rb".freeze, "lib/ollama_chat/message_list.rb".freeze, "lib/ollama_chat/message_output.rb".freeze, "lib/ollama_chat/model_handling.rb".freeze, "lib/ollama_chat/ollama_chat_config.rb".freeze, "lib/ollama_chat/ollama_chat_config/default_config.yml".freeze, "lib/ollama_chat/parsing.rb".freeze, "lib/ollama_chat/redis_cache.rb".freeze, "lib/ollama_chat/server_socket.rb".freeze, "lib/ollama_chat/source_fetching.rb".freeze, "lib/ollama_chat/state_selectors.rb".freeze, "lib/ollama_chat/switches.rb".freeze, "lib/ollama_chat/think_control.rb".freeze, "lib/ollama_chat/tool_calling.rb".freeze, "lib/ollama_chat/tools.rb".freeze, "lib/ollama_chat/tools/browse.rb".freeze, "lib/ollama_chat/tools/concern.rb".freeze, "lib/ollama_chat/tools/directory_structure.rb".freeze, "lib/ollama_chat/tools/endoflife.rb".freeze, "lib/ollama_chat/tools/execute_grep.rb".freeze, "lib/ollama_chat/tools/file_context.rb".freeze, "lib/ollama_chat/tools/gem_path_lookup.rb".freeze, "lib/ollama_chat/tools/get_current_weather.rb".freeze, "lib/ollama_chat/tools/get_cve.rb".freeze, "lib/ollama_chat/tools/get_endoflife.rb".freeze, "lib/ollama_chat/tools/get_jira_issue.rb".freeze, "lib/ollama_chat/tools/get_location.rb".freeze, "lib/ollama_chat/tools/get_time.rb".freeze, "lib/ollama_chat/tools/import_url.rb".freeze, "lib/ollama_chat/tools/read_file.rb".freeze, "lib/ollama_chat/tools/run_tests.rb".freeze, "lib/ollama_chat/tools/search_web.rb".freeze, "lib/ollama_chat/tools/vim_open_file.rb".freeze, "lib/ollama_chat/tools/weather/dwd_sensor.rb".freeze, "lib/ollama_chat/tools/write_file.rb".freeze, "lib/ollama_chat/utils.rb".freeze, "lib/ollama_chat/utils/analyze_directory.rb".freeze, "lib/ollama_chat/utils/cache_fetcher.rb".freeze, "lib/ollama_chat/utils/chooser.rb".freeze, "lib/ollama_chat/utils/fetcher.rb".freeze, "lib/ollama_chat/utils/file_argument.rb".freeze, "lib/ollama_chat/utils/path_validator.rb".freeze, "lib/ollama_chat/version.rb".freeze, "lib/ollama_chat/vim.rb".freeze, "lib/ollama_chat/web_searching.rb".freeze, "ollama_chat.gemspec".freeze, "redis/redis.conf".freeze, "spec/assets/api_show.json".freeze, "spec/assets/api_tags.json".freeze, "spec/assets/api_version.json".freeze, "spec/assets/conversation.json".freeze, "spec/assets/deep/deeper/empty.txt".freeze, "spec/assets/deep/deeper/not-empty.txt".freeze, "spec/assets/deep/empty.txt".freeze, "spec/assets/duckduckgo.html".freeze, "spec/assets/example.atom".freeze, "spec/assets/example.csv".freeze, "spec/assets/example.html".freeze, "spec/assets/example.pdf".freeze, "spec/assets/example.ps".freeze, "spec/assets/example.rb".freeze, "spec/assets/example.rss".freeze, "spec/assets/example.xml".freeze, "spec/assets/example_with_quote.html".freeze, "spec/assets/kitten.jpg".freeze, "spec/assets/prompt.txt".freeze, "spec/assets/searxng.json".freeze, "spec/ollama_chat/chat_spec.rb".freeze, "spec/ollama_chat/clipboard_spec.rb".freeze, "spec/ollama_chat/follow_chat_spec.rb".freeze, "spec/ollama_chat/information_spec.rb".freeze, "spec/ollama_chat/input_content_spec.rb".freeze, "spec/ollama_chat/kramdown_ansi_spec.rb".freeze, "spec/ollama_chat/message_editing_spec.rb".freeze, "spec/ollama_chat/message_list_spec.rb".freeze, "spec/ollama_chat/message_output_spec.rb".freeze, "spec/ollama_chat/model_handling_spec.rb".freeze, "spec/ollama_chat/parsing_spec.rb".freeze, "spec/ollama_chat/redis_cache_spec.rb".freeze, "spec/ollama_chat/server_socket_spec.rb".freeze, "spec/ollama_chat/source_fetching_spec.rb".freeze, "spec/ollama_chat/state_selectors_spec.rb".freeze, "spec/ollama_chat/switches_spec.rb".freeze, "spec/ollama_chat/think_control_spec.rb".freeze, "spec/ollama_chat/tools/browse_spec.rb".freeze, "spec/ollama_chat/tools/directory_structure_spec.rb".freeze, "spec/ollama_chat/tools/execute_grep_spec.rb".freeze, "spec/ollama_chat/tools/file_context_spec.rb".freeze, "spec/ollama_chat/tools/gem_path_lookup_spec.rb".freeze, "spec/ollama_chat/tools/get_current_weather_spec.rb".freeze, "spec/ollama_chat/tools/get_cve_spec.rb".freeze, "spec/ollama_chat/tools/get_endoflife_spec.rb".freeze, "spec/ollama_chat/tools/get_jira_issue_spec.rb".freeze, "spec/ollama_chat/tools/get_location_spec.rb".freeze, "spec/ollama_chat/tools/get_time_spec.rb".freeze, "spec/ollama_chat/tools/import_url_spec.rb".freeze, "spec/ollama_chat/tools/read_file_spec.rb".freeze, "spec/ollama_chat/tools/run_tests_spec.rb".freeze, "spec/ollama_chat/tools/search_web_spec.rb".freeze, "spec/ollama_chat/tools/vim_open_file_spec.rb".freeze, "spec/ollama_chat/tools/write_file_spec.rb".freeze, "spec/ollama_chat/utils/analyze_directory_spec.rb".freeze, "spec/ollama_chat/utils/cache_fetcher_spec.rb".freeze, "spec/ollama_chat/utils/fetcher_spec.rb".freeze, "spec/ollama_chat/utils/file_argument_spec.rb".freeze, "spec/ollama_chat/vim_spec.rb".freeze, "spec/ollama_chat/web_searching_spec.rb".freeze, "spec/spec_helper.rb".freeze, "tmp/.keep".freeze]
15
+ s.extra_rdoc_files = ["README.md".freeze, "lib/ollama_chat.rb".freeze, "lib/ollama_chat/chat.rb".freeze, "lib/ollama_chat/clipboard.rb".freeze, "lib/ollama_chat/conversation.rb".freeze, "lib/ollama_chat/dialog.rb".freeze, "lib/ollama_chat/document_cache.rb".freeze, "lib/ollama_chat/env_config.rb".freeze, "lib/ollama_chat/follow_chat.rb".freeze, "lib/ollama_chat/history.rb".freeze, "lib/ollama_chat/information.rb".freeze, "lib/ollama_chat/input_content.rb".freeze, "lib/ollama_chat/kramdown_ansi.rb".freeze, "lib/ollama_chat/location_handling.rb".freeze, "lib/ollama_chat/message_editing.rb".freeze, "lib/ollama_chat/message_format.rb".freeze, "lib/ollama_chat/message_list.rb".freeze, "lib/ollama_chat/message_output.rb".freeze, "lib/ollama_chat/model_handling.rb".freeze, "lib/ollama_chat/ollama_chat_config.rb".freeze, "lib/ollama_chat/parsing.rb".freeze, "lib/ollama_chat/redis_cache.rb".freeze, "lib/ollama_chat/server_socket.rb".freeze, "lib/ollama_chat/source_fetching.rb".freeze, "lib/ollama_chat/state_selectors.rb".freeze, "lib/ollama_chat/switches.rb".freeze, "lib/ollama_chat/think_control.rb".freeze, "lib/ollama_chat/tool_calling.rb".freeze, "lib/ollama_chat/tools.rb".freeze, "lib/ollama_chat/tools/browse.rb".freeze, "lib/ollama_chat/tools/concern.rb".freeze, "lib/ollama_chat/tools/directory_structure.rb".freeze, "lib/ollama_chat/tools/endoflife.rb".freeze, "lib/ollama_chat/tools/execute_grep.rb".freeze, "lib/ollama_chat/tools/file_context.rb".freeze, "lib/ollama_chat/tools/gem_path_lookup.rb".freeze, "lib/ollama_chat/tools/get_current_weather.rb".freeze, "lib/ollama_chat/tools/get_cve.rb".freeze, "lib/ollama_chat/tools/get_endoflife.rb".freeze, "lib/ollama_chat/tools/get_jira_issue.rb".freeze, "lib/ollama_chat/tools/get_location.rb".freeze, "lib/ollama_chat/tools/get_time.rb".freeze, "lib/ollama_chat/tools/import_url.rb".freeze, "lib/ollama_chat/tools/open_file_in_editor.rb".freeze, "lib/ollama_chat/tools/read_file.rb".freeze, "lib/ollama_chat/tools/run_tests.rb".freeze, "lib/ollama_chat/tools/search_web.rb".freeze, "lib/ollama_chat/tools/weather/dwd_sensor.rb".freeze, "lib/ollama_chat/tools/write_file.rb".freeze, "lib/ollama_chat/utils.rb".freeze, "lib/ollama_chat/utils/analyze_directory.rb".freeze, "lib/ollama_chat/utils/cache_fetcher.rb".freeze, "lib/ollama_chat/utils/chooser.rb".freeze, "lib/ollama_chat/utils/fetcher.rb".freeze, "lib/ollama_chat/utils/file_argument.rb".freeze, "lib/ollama_chat/utils/path_validator.rb".freeze, "lib/ollama_chat/version.rb".freeze, "lib/ollama_chat/vim.rb".freeze, "lib/ollama_chat/web_searching.rb".freeze]
16
+ s.files = [".utilsrc".freeze, "CHANGES.md".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "bin/ollama_chat".freeze, "bin/ollama_chat_send".freeze, "config/searxng/settings.yml".freeze, "docker-compose.yml".freeze, "lib/ollama_chat.rb".freeze, "lib/ollama_chat/chat.rb".freeze, "lib/ollama_chat/clipboard.rb".freeze, "lib/ollama_chat/conversation.rb".freeze, "lib/ollama_chat/dialog.rb".freeze, "lib/ollama_chat/document_cache.rb".freeze, "lib/ollama_chat/env_config.rb".freeze, "lib/ollama_chat/follow_chat.rb".freeze, "lib/ollama_chat/history.rb".freeze, "lib/ollama_chat/information.rb".freeze, "lib/ollama_chat/input_content.rb".freeze, "lib/ollama_chat/kramdown_ansi.rb".freeze, "lib/ollama_chat/location_handling.rb".freeze, "lib/ollama_chat/message_editing.rb".freeze, "lib/ollama_chat/message_format.rb".freeze, "lib/ollama_chat/message_list.rb".freeze, "lib/ollama_chat/message_output.rb".freeze, "lib/ollama_chat/model_handling.rb".freeze, "lib/ollama_chat/ollama_chat_config.rb".freeze, "lib/ollama_chat/ollama_chat_config/default_config.yml".freeze, "lib/ollama_chat/parsing.rb".freeze, "lib/ollama_chat/redis_cache.rb".freeze, "lib/ollama_chat/server_socket.rb".freeze, "lib/ollama_chat/source_fetching.rb".freeze, "lib/ollama_chat/state_selectors.rb".freeze, "lib/ollama_chat/switches.rb".freeze, "lib/ollama_chat/think_control.rb".freeze, "lib/ollama_chat/tool_calling.rb".freeze, "lib/ollama_chat/tools.rb".freeze, "lib/ollama_chat/tools/browse.rb".freeze, "lib/ollama_chat/tools/concern.rb".freeze, "lib/ollama_chat/tools/directory_structure.rb".freeze, "lib/ollama_chat/tools/endoflife.rb".freeze, "lib/ollama_chat/tools/execute_grep.rb".freeze, "lib/ollama_chat/tools/file_context.rb".freeze, "lib/ollama_chat/tools/gem_path_lookup.rb".freeze, "lib/ollama_chat/tools/get_current_weather.rb".freeze, "lib/ollama_chat/tools/get_cve.rb".freeze, "lib/ollama_chat/tools/get_endoflife.rb".freeze, "lib/ollama_chat/tools/get_jira_issue.rb".freeze, "lib/ollama_chat/tools/get_location.rb".freeze, "lib/ollama_chat/tools/get_time.rb".freeze, "lib/ollama_chat/tools/import_url.rb".freeze, "lib/ollama_chat/tools/open_file_in_editor.rb".freeze, "lib/ollama_chat/tools/read_file.rb".freeze, "lib/ollama_chat/tools/run_tests.rb".freeze, "lib/ollama_chat/tools/search_web.rb".freeze, "lib/ollama_chat/tools/weather/dwd_sensor.rb".freeze, "lib/ollama_chat/tools/write_file.rb".freeze, "lib/ollama_chat/utils.rb".freeze, "lib/ollama_chat/utils/analyze_directory.rb".freeze, "lib/ollama_chat/utils/cache_fetcher.rb".freeze, "lib/ollama_chat/utils/chooser.rb".freeze, "lib/ollama_chat/utils/fetcher.rb".freeze, "lib/ollama_chat/utils/file_argument.rb".freeze, "lib/ollama_chat/utils/path_validator.rb".freeze, "lib/ollama_chat/version.rb".freeze, "lib/ollama_chat/vim.rb".freeze, "lib/ollama_chat/web_searching.rb".freeze, "ollama_chat.gemspec".freeze, "redis/redis.conf".freeze, "spec/assets/api_show.json".freeze, "spec/assets/api_tags.json".freeze, "spec/assets/api_version.json".freeze, "spec/assets/conversation.json".freeze, "spec/assets/deep/deeper/empty.txt".freeze, "spec/assets/deep/deeper/not-empty.txt".freeze, "spec/assets/deep/empty.txt".freeze, "spec/assets/duckduckgo.html".freeze, "spec/assets/example.atom".freeze, "spec/assets/example.csv".freeze, "spec/assets/example.html".freeze, "spec/assets/example.pdf".freeze, "spec/assets/example.ps".freeze, "spec/assets/example.rb".freeze, "spec/assets/example.rss".freeze, "spec/assets/example.xml".freeze, "spec/assets/example_with_quote.html".freeze, "spec/assets/kitten.jpg".freeze, "spec/assets/prompt.txt".freeze, "spec/assets/searxng.json".freeze, "spec/ollama_chat/chat_spec.rb".freeze, "spec/ollama_chat/clipboard_spec.rb".freeze, "spec/ollama_chat/follow_chat_spec.rb".freeze, "spec/ollama_chat/information_spec.rb".freeze, "spec/ollama_chat/input_content_spec.rb".freeze, "spec/ollama_chat/kramdown_ansi_spec.rb".freeze, "spec/ollama_chat/message_editing_spec.rb".freeze, "spec/ollama_chat/message_list_spec.rb".freeze, "spec/ollama_chat/message_output_spec.rb".freeze, "spec/ollama_chat/model_handling_spec.rb".freeze, "spec/ollama_chat/parsing_spec.rb".freeze, "spec/ollama_chat/redis_cache_spec.rb".freeze, "spec/ollama_chat/server_socket_spec.rb".freeze, "spec/ollama_chat/source_fetching_spec.rb".freeze, "spec/ollama_chat/state_selectors_spec.rb".freeze, "spec/ollama_chat/switches_spec.rb".freeze, "spec/ollama_chat/think_control_spec.rb".freeze, "spec/ollama_chat/tools/browse_spec.rb".freeze, "spec/ollama_chat/tools/directory_structure_spec.rb".freeze, "spec/ollama_chat/tools/execute_grep_spec.rb".freeze, "spec/ollama_chat/tools/file_context_spec.rb".freeze, "spec/ollama_chat/tools/gem_path_lookup_spec.rb".freeze, "spec/ollama_chat/tools/get_current_weather_spec.rb".freeze, "spec/ollama_chat/tools/get_cve_spec.rb".freeze, "spec/ollama_chat/tools/get_endoflife_spec.rb".freeze, "spec/ollama_chat/tools/get_jira_issue_spec.rb".freeze, "spec/ollama_chat/tools/get_location_spec.rb".freeze, "spec/ollama_chat/tools/get_time_spec.rb".freeze, "spec/ollama_chat/tools/import_url_spec.rb".freeze, "spec/ollama_chat/tools/open_file_in_editor_spec.rb".freeze, "spec/ollama_chat/tools/read_file_spec.rb".freeze, "spec/ollama_chat/tools/run_tests_spec.rb".freeze, "spec/ollama_chat/tools/search_web_spec.rb".freeze, "spec/ollama_chat/tools/write_file_spec.rb".freeze, "spec/ollama_chat/utils/analyze_directory_spec.rb".freeze, "spec/ollama_chat/utils/cache_fetcher_spec.rb".freeze, "spec/ollama_chat/utils/fetcher_spec.rb".freeze, "spec/ollama_chat/utils/file_argument_spec.rb".freeze, "spec/ollama_chat/vim_spec.rb".freeze, "spec/ollama_chat/web_searching_spec.rb".freeze, "spec/spec_helper.rb".freeze, "tmp/.keep".freeze]
17
17
  s.homepage = "https://github.com/flori/ollama_chat".freeze
18
18
  s.licenses = ["MIT".freeze]
19
19
  s.rdoc_options = ["--title".freeze, "OllamaChat - A command-line interface (CLI) for interacting with an Ollama AI model.".freeze, "--main".freeze, "README.md".freeze]
20
20
  s.required_ruby_version = Gem::Requirement.new(">= 3.2".freeze)
21
21
  s.rubygems_version = "4.0.3".freeze
22
22
  s.summary = "A command-line interface (CLI) for interacting with an Ollama AI model.".freeze
23
- s.test_files = ["spec/assets/example.rb".freeze, "spec/ollama_chat/chat_spec.rb".freeze, "spec/ollama_chat/clipboard_spec.rb".freeze, "spec/ollama_chat/follow_chat_spec.rb".freeze, "spec/ollama_chat/information_spec.rb".freeze, "spec/ollama_chat/input_content_spec.rb".freeze, "spec/ollama_chat/kramdown_ansi_spec.rb".freeze, "spec/ollama_chat/message_editing_spec.rb".freeze, "spec/ollama_chat/message_list_spec.rb".freeze, "spec/ollama_chat/message_output_spec.rb".freeze, "spec/ollama_chat/model_handling_spec.rb".freeze, "spec/ollama_chat/parsing_spec.rb".freeze, "spec/ollama_chat/redis_cache_spec.rb".freeze, "spec/ollama_chat/server_socket_spec.rb".freeze, "spec/ollama_chat/source_fetching_spec.rb".freeze, "spec/ollama_chat/state_selectors_spec.rb".freeze, "spec/ollama_chat/switches_spec.rb".freeze, "spec/ollama_chat/think_control_spec.rb".freeze, "spec/ollama_chat/tools/browse_spec.rb".freeze, "spec/ollama_chat/tools/directory_structure_spec.rb".freeze, "spec/ollama_chat/tools/execute_grep_spec.rb".freeze, "spec/ollama_chat/tools/file_context_spec.rb".freeze, "spec/ollama_chat/tools/gem_path_lookup_spec.rb".freeze, "spec/ollama_chat/tools/get_current_weather_spec.rb".freeze, "spec/ollama_chat/tools/get_cve_spec.rb".freeze, "spec/ollama_chat/tools/get_endoflife_spec.rb".freeze, "spec/ollama_chat/tools/get_jira_issue_spec.rb".freeze, "spec/ollama_chat/tools/get_location_spec.rb".freeze, "spec/ollama_chat/tools/get_time_spec.rb".freeze, "spec/ollama_chat/tools/import_url_spec.rb".freeze, "spec/ollama_chat/tools/read_file_spec.rb".freeze, "spec/ollama_chat/tools/run_tests_spec.rb".freeze, "spec/ollama_chat/tools/search_web_spec.rb".freeze, "spec/ollama_chat/tools/vim_open_file_spec.rb".freeze, "spec/ollama_chat/tools/write_file_spec.rb".freeze, "spec/ollama_chat/utils/analyze_directory_spec.rb".freeze, "spec/ollama_chat/utils/cache_fetcher_spec.rb".freeze, "spec/ollama_chat/utils/fetcher_spec.rb".freeze, "spec/ollama_chat/utils/file_argument_spec.rb".freeze, "spec/ollama_chat/vim_spec.rb".freeze, "spec/ollama_chat/web_searching_spec.rb".freeze, "spec/spec_helper.rb".freeze]
23
+ s.test_files = ["spec/assets/example.rb".freeze, "spec/ollama_chat/chat_spec.rb".freeze, "spec/ollama_chat/clipboard_spec.rb".freeze, "spec/ollama_chat/follow_chat_spec.rb".freeze, "spec/ollama_chat/information_spec.rb".freeze, "spec/ollama_chat/input_content_spec.rb".freeze, "spec/ollama_chat/kramdown_ansi_spec.rb".freeze, "spec/ollama_chat/message_editing_spec.rb".freeze, "spec/ollama_chat/message_list_spec.rb".freeze, "spec/ollama_chat/message_output_spec.rb".freeze, "spec/ollama_chat/model_handling_spec.rb".freeze, "spec/ollama_chat/parsing_spec.rb".freeze, "spec/ollama_chat/redis_cache_spec.rb".freeze, "spec/ollama_chat/server_socket_spec.rb".freeze, "spec/ollama_chat/source_fetching_spec.rb".freeze, "spec/ollama_chat/state_selectors_spec.rb".freeze, "spec/ollama_chat/switches_spec.rb".freeze, "spec/ollama_chat/think_control_spec.rb".freeze, "spec/ollama_chat/tools/browse_spec.rb".freeze, "spec/ollama_chat/tools/directory_structure_spec.rb".freeze, "spec/ollama_chat/tools/execute_grep_spec.rb".freeze, "spec/ollama_chat/tools/file_context_spec.rb".freeze, "spec/ollama_chat/tools/gem_path_lookup_spec.rb".freeze, "spec/ollama_chat/tools/get_current_weather_spec.rb".freeze, "spec/ollama_chat/tools/get_cve_spec.rb".freeze, "spec/ollama_chat/tools/get_endoflife_spec.rb".freeze, "spec/ollama_chat/tools/get_jira_issue_spec.rb".freeze, "spec/ollama_chat/tools/get_location_spec.rb".freeze, "spec/ollama_chat/tools/get_time_spec.rb".freeze, "spec/ollama_chat/tools/import_url_spec.rb".freeze, "spec/ollama_chat/tools/open_file_in_editor_spec.rb".freeze, "spec/ollama_chat/tools/read_file_spec.rb".freeze, "spec/ollama_chat/tools/run_tests_spec.rb".freeze, "spec/ollama_chat/tools/search_web_spec.rb".freeze, "spec/ollama_chat/tools/write_file_spec.rb".freeze, "spec/ollama_chat/utils/analyze_directory_spec.rb".freeze, "spec/ollama_chat/utils/cache_fetcher_spec.rb".freeze, "spec/ollama_chat/utils/fetcher_spec.rb".freeze, "spec/ollama_chat/utils/file_argument_spec.rb".freeze, "spec/ollama_chat/vim_spec.rb".freeze, "spec/ollama_chat/web_searching_spec.rb".freeze, "spec/spec_helper.rb".freeze]
24
24
 
25
25
  s.specification_version = 4
26
26
 
@@ -33,9 +33,12 @@ describe OllamaChat::Tools::GetCurrentWeather do
33
33
  )
34
34
  )
35
35
  )
36
- expect(
37
- described_class.new.execute(tool_call, config: chat.config)
38
- ).to match(/The temperature was 23.0 ℃ at the time of /)
36
+ result = described_class.new.execute(tool_call, config: chat.config)
37
+ json = json_object(result)
38
+ expect(json.measurement_time).to match(/\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}[+-]\d{2}:\d{2}\z/)
39
+ expect(json.current_time).to match(/\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}[+-]\d{2}:\d{2}\z/)
40
+ expect(json.temperature).to be_within(0.01).of(23.0)
41
+ expect(json.unit).to eq "℃"
39
42
  end
40
43
 
41
44
  it 'can be executed for fahrenheit' do
@@ -52,9 +55,12 @@ describe OllamaChat::Tools::GetCurrentWeather do
52
55
  )
53
56
  )
54
57
  )
55
- expect(
56
- described_class.new.execute(tool_call, config: chat.config)
57
- ).to match(/The temperature was 73.4 ℉ at the time of /)
58
+ result = described_class.new.execute(tool_call, config: chat.config)
59
+ json = json_object(result)
60
+ expect(json.measurement_time).to match(/\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}[+-]\d{2}:\d{2}\z/)
61
+ expect(json.current_time).to match(/\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}[+-]\d{2}:\d{2}\z/)
62
+ expect(json.temperature).to be_within(0.01).of(73.4)
63
+ expect(json.unit).to eq "℉"
58
64
  end
59
65
 
60
66
  it 'can handle execution errors with structured JSON error response' do
@@ -78,11 +84,9 @@ describe OllamaChat::Tools::GetCurrentWeather do
78
84
  json = json_object(result)
79
85
 
80
86
  # Verify the structured error response
81
- expect(json.error).to be_a(String)
82
- expect(json.message).to be_a(String)
83
-
84
- # Verify it's a proper JSON structure that can be parsed
85
- expect(json.error).to eq 'RuntimeError' # or whatever the actual exception class is
87
+ expect(json.error).to be_a String
88
+ expect(json.message).to be_a String
89
+ expect(json.error).to eq 'RuntimeError'
86
90
  expect(json.message).to include('Network error occurred')
87
91
  end
88
92
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe OllamaChat::Tools::VimOpenFile do
3
+ describe OllamaChat::Tools::OpenFileInEditor do
4
4
  let :chat do
5
5
  OllamaChat::Chat.new(argv: chat_default_config)
6
6
  end
@@ -12,7 +12,7 @@ describe OllamaChat::Tools::VimOpenFile do
12
12
  connect_to_ollama_server
13
13
 
14
14
  it 'can have name' do
15
- expect(described_class.new.name).to eq 'vim_open_file'
15
+ expect(described_class.new.name).to eq 'open_file_in_editor'
16
16
  end
17
17
 
18
18
  it 'can have tool' do
@@ -23,7 +23,7 @@ describe OllamaChat::Tools::VimOpenFile do
23
23
  tool_call = double(
24
24
  'ToolCall',
25
25
  function: double(
26
- name: 'vim_open_file',
26
+ name: 'open_file',
27
27
  arguments: double(
28
28
  path: asset('example.rb'),
29
29
  start_line: 42,
@@ -43,7 +43,7 @@ describe OllamaChat::Tools::VimOpenFile do
43
43
  tool_call = double(
44
44
  'ToolCall',
45
45
  function: double(
46
- name: 'vim_open_file',
46
+ name: 'open_file',
47
47
  arguments: double(
48
48
  path: asset('example.rb'),
49
49
  start_line: 23,
@@ -64,7 +64,7 @@ describe OllamaChat::Tools::VimOpenFile do
64
64
  tool_call = double(
65
65
  'ToolCall',
66
66
  function: double(
67
- name: 'vim_open_file',
67
+ name: 'open_file',
68
68
  arguments: double(
69
69
  path: '/non/existent',
70
70
  start_line: 1,
@@ -37,7 +37,9 @@ describe OllamaChat::Tools::ReadFile do
37
37
  result = described_class.new.execute(tool_call, config: config)
38
38
 
39
39
  expect(result).to be_a(String)
40
- expect(result).to eq <<~EOT
40
+ json = json_object(result)
41
+ expect(json.path).to include 'example.rb'
42
+ expect(json.content).to eq <<~EOT
41
43
  puts "Hello World!"
42
44
  EOT
43
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ollama_chat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.65
4
+ version: 0.0.66
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
@@ -492,10 +492,10 @@ extra_rdoc_files:
492
492
  - lib/ollama_chat/tools/get_location.rb
493
493
  - lib/ollama_chat/tools/get_time.rb
494
494
  - lib/ollama_chat/tools/import_url.rb
495
+ - lib/ollama_chat/tools/open_file_in_editor.rb
495
496
  - lib/ollama_chat/tools/read_file.rb
496
497
  - lib/ollama_chat/tools/run_tests.rb
497
498
  - lib/ollama_chat/tools/search_web.rb
498
- - lib/ollama_chat/tools/vim_open_file.rb
499
499
  - lib/ollama_chat/tools/weather/dwd_sensor.rb
500
500
  - lib/ollama_chat/tools/write_file.rb
501
501
  - lib/ollama_chat/utils.rb
@@ -561,10 +561,10 @@ files:
561
561
  - lib/ollama_chat/tools/get_location.rb
562
562
  - lib/ollama_chat/tools/get_time.rb
563
563
  - lib/ollama_chat/tools/import_url.rb
564
+ - lib/ollama_chat/tools/open_file_in_editor.rb
564
565
  - lib/ollama_chat/tools/read_file.rb
565
566
  - lib/ollama_chat/tools/run_tests.rb
566
567
  - lib/ollama_chat/tools/search_web.rb
567
- - lib/ollama_chat/tools/vim_open_file.rb
568
568
  - lib/ollama_chat/tools/weather/dwd_sensor.rb
569
569
  - lib/ollama_chat/tools/write_file.rb
570
570
  - lib/ollama_chat/utils.rb
@@ -628,10 +628,10 @@ files:
628
628
  - spec/ollama_chat/tools/get_location_spec.rb
629
629
  - spec/ollama_chat/tools/get_time_spec.rb
630
630
  - spec/ollama_chat/tools/import_url_spec.rb
631
+ - spec/ollama_chat/tools/open_file_in_editor_spec.rb
631
632
  - spec/ollama_chat/tools/read_file_spec.rb
632
633
  - spec/ollama_chat/tools/run_tests_spec.rb
633
634
  - spec/ollama_chat/tools/search_web_spec.rb
634
- - spec/ollama_chat/tools/vim_open_file_spec.rb
635
635
  - spec/ollama_chat/tools/write_file_spec.rb
636
636
  - spec/ollama_chat/utils/analyze_directory_spec.rb
637
637
  - spec/ollama_chat/utils/cache_fetcher_spec.rb
@@ -697,10 +697,10 @@ test_files:
697
697
  - spec/ollama_chat/tools/get_location_spec.rb
698
698
  - spec/ollama_chat/tools/get_time_spec.rb
699
699
  - spec/ollama_chat/tools/import_url_spec.rb
700
+ - spec/ollama_chat/tools/open_file_in_editor_spec.rb
700
701
  - spec/ollama_chat/tools/read_file_spec.rb
701
702
  - spec/ollama_chat/tools/run_tests_spec.rb
702
703
  - spec/ollama_chat/tools/search_web_spec.rb
703
- - spec/ollama_chat/tools/vim_open_file_spec.rb
704
704
  - spec/ollama_chat/tools/write_file_spec.rb
705
705
  - spec/ollama_chat/utils/analyze_directory_spec.rb
706
706
  - spec/ollama_chat/utils/cache_fetcher_spec.rb