ollama_chat 0.0.81 → 0.0.82

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: 5fb8acfbab42d7afd6b6bf67dfe087cfb3c12a61719834713c9cd2f095dd7ce8
4
- data.tar.gz: efdba3f26df1ae84df62f2aa2a2f48e914baf2a5dd1430691e55be9f01a23774
3
+ metadata.gz: 4dfcb462fdb59e2b4cf31ef8d489627982e71c88cfc9dea8c89597607311e95d
4
+ data.tar.gz: 1fed1ad543d810ddf0b54b5390b8a031cf3108bd67d56a9a91b5917fc2cdd219
5
5
  SHA512:
6
- metadata.gz: b5042b32617e390e4cad869c2356dc0a12c5a8cc55a57c6f3d6f84fa20f2342a91afcddeb24898947b9a3d73d083b3b4ce666b13cab1e339a37ba76ecb3ec961
7
- data.tar.gz: c3ada9646a5580fe07c463c62348e972a50f69cc563ae240b0000e18db917af160adc9e3234e4bbdbfda68907421f3445e18c61db1b25ccba393f670652938b9
6
+ metadata.gz: fe1384443f22e5890a784be50a632c9a4d15e8fbf72f0084acf99016aa46a741320af818a72d3797007bced8f0f47155001a12e0103be3ac35f2fb6beba8db6d
7
+ data.tar.gz: e79cd80f16e97778f6e61451b7aefbbfdf44a1a08cdce5029a21e050f78461fcf11e198ae04e9e0845d2ed9426057c5616333a09bc9d8eaf391be7a3b8c4d290
data/CHANGES.md CHANGED
@@ -1,34 +1,48 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-03-21 v0.0.82
4
+
5
+ - Add a `before` block setting `OC::OLLAMA::CHAT::TOOLS::CTAGS_TOOL` to `ctags`
6
+ in the `resolve_tag` spec.
7
+ - Updated `OllamaChat::Tools::PasteIntoEditor` description to use `text`
8
+ instead of `string` and clarified that no file or line is required when
9
+ pasting into the editor.
10
+ - Added bell and question mark emojis to various `confirm?` and `ask?` prompts
11
+ across multiple modules for clearer UX.
12
+ - Updated prompt string to `⏎ Press …` for better display.
13
+ - Enhanced `OllamaChat::Tools::ResolveTag` and `OllamaChat::Utils::TagResolver`
14
+ with a new `kinds` method, updated `kind` parameter description, refactored
15
+ `kind_of`, and fixed tag‑parsing regex to capture all columns.
16
+
3
17
  ## 2026-03-20 v0.0.81
4
18
 
5
19
  - Added `http_handling.rb` and `path_completer.rb` to gemspec
6
20
  `s.extra_rdoc_files`, `s.files`, and `s.test_files` lists, ensuring these
7
- modules are documented and packaged.
8
- - Updated `http_options` to build SSL and proxy settings.
9
- - Completed `get_url` to merge headers, pass cache, debug, and reraise flags.
10
- - Updated YARD comments with parameter and return details.
11
- - Fixed `config.request_headers` usage and added `merge`.
12
- - Declared `proxy` variable in options hash.
13
- - Added `debug` flag from `config` to fetcher call.
21
+ modules are documented and packaged.
22
+ - Updated `http_options` to build SSL and proxy settings.
23
+ - Completed `get_url` to merge headers, pass cache, debug, and reraise flags.
24
+ - Updated YARD comments with parameter and return details.
25
+ - Fixed `config.request_headers` usage and added `merge`.
26
+ - Declared `proxy` variable in options hash.
27
+ - Added `debug` flag from `config` to fetcher call.
14
28
  - Added `PathCompleter` utility in `lib/ollama_chat/utils/path_completer.rb`
15
- that expands `./` and `~/` paths using `Dir.glob` and `File.expand_path`.
16
- - Updated `lib/ollama_chat/utils.rb` to require the new helper.
29
+ that expands `./` and `~/` paths using `Dir.glob` and `File.expand_path`.
30
+ - Updated `lib/ollama_chat/utils.rb` to require the new helper.
17
31
  - Replaced inline path completion logic in `lib/ollama_chat/chat.rb` with
18
- `OllamaChat::Utils::PathCompleter.new(pre, input).complete`.
32
+ `OllamaChat::Utils::PathCompleter.new(pre, input).complete`.
19
33
  - Added tests for `PathCompleter` in
20
34
  `spec/ollama_chat/utils/path_completer_spec.rb`, stubbing `expand_path` for
21
- home‑directory case.
35
+ home‑directory case.
22
36
  - Added duration metric to tool call results: recorded `start = Time.now`
23
37
  before each tool call, stored `tools_used[name]` as a hash with `size` and
24
38
  `duration` keys, calculated `duration` with `Time.now - start` and formatted
25
39
  as `Tins::Duration.new(...).to_s`, kept size formatting using
26
- `Tins::Unit.format(..., unit: ?B, prefix: 1024, format: '%.1f %U')`.
40
+ `Tins::Unit.format(..., unit: ?B, prefix: 1024, format: '%.1f %U')`.
27
41
  - Added `./` file path completion to Reline: updated
28
42
  `OllamaChat::Chat#enable_command_completion` to add `./` path completion,
29
43
  replaced old `RELINE` completion proc with a new `case before` block that
30
44
  checks for `^/` and `./` patterns, ensuring file path completions are only
31
- offered when the user starts with `./`.
45
+ offered when the user starts with `./`.
32
46
  - Added user name to runtime info and prompts: added `OC::USER` config variable
33
47
  with default from `ENV['USER']`, included `user` in the hash returned by
34
48
  `runtime_information_values`, extended default prompts in
@@ -40,166 +54,166 @@
40
54
 
41
55
  ### Output & Paging
42
56
 
43
- - Remove the automatic `info` call from the main flow
44
- - Wrap all output handling inside a `use_pager do |output|` block
57
+ - Remove the automatic `info` call from the main flow
58
+ - Wrap all output handling inside a `use_pager do |output|` block
45
59
  - Pass the `output:` keyword to sub‑methods (`collection_stats`,
46
- `Switches.show`, etc.)
47
- - Adjust `Pager` to use a local `buffer` variable and `output.puts buffer`
60
+ `Switches.show`, etc.)
61
+ - Adjust `Pager` to use a local `buffer` variable and `output.puts buffer`
48
62
  - Update `StateSelectors.show` and `Switches.show` to accept `output: STDOUT`
49
- and use `output.puts`
63
+ and use `output.puts`
50
64
  - Modify `Switches.set` to accept `output: STDOUT` and call
51
65
  `self.show(output:)`
52
66
 
53
67
  ### Collection & Runtime Info
54
68
 
55
69
  - Change `collection_stats` signature to `output: STDOUT` and replace
56
- `STDOUT.puts` with `output.puts`
57
- - Show runtime‑information only when `runtime_info.on? && content` is true
70
+ `STDOUT.puts` with `output.puts`
71
+ - Show runtime‑information only when `runtime_info.on? && content` is true
58
72
  - Append a JSON line for runtime‑info instead of a plain‑text list
59
73
 
60
74
  ### Tool Call Handling
61
75
 
62
- - Initialize `tools_used` hash in `OllamaChat::FollowChat#handle_tool_calls`
63
- - Store the formatted size of each tool result using `Tins::Unit.format`
76
+ - Initialize `tools_used` hash in `OllamaChat::FollowChat#handle_tool_calls`
77
+ - Store the formatted size of each tool result using `Tins::Unit.format`
64
78
  - Replace the non‑existent `full?` check with `size ==
65
- response.message.tool_calls.size`
79
+ response.message.tool_calls.size`
66
80
  - Show a summary of tool call results and pause for user confirmation
67
81
 
68
82
  ### Confirmation Prompt
69
83
 
70
84
  - Add `confirm?` method to `OllamaChat::Dialog` for single‑character
71
- confirmation prompts
85
+ confirmation prompts
72
86
  - Replace all `ask?` calls with `confirm?`
73
87
 
74
88
  ### Command DSL
75
89
 
76
- - Add a `command` DSL in `command_concern.rb` for registering chat commands
90
+ - Add a `command` DSL in `command_concern.rb` for registering chat commands
77
91
  - Include `OllamaChat::CommandConcern` in `chat.rb` and drop the old
78
- `handle_input` logic
92
+ `handle_input` logic
79
93
  - Replace hard‑coded command handling with the new DSL (e.g., `/toggle`,
80
94
  `/input`, `/revise`, etc.)
81
95
 
82
96
  ### Documentation & README
83
97
 
84
98
  - Update `README.md` to show the new `/toggle` syntax and expanded command
85
- table
99
+ table
86
100
  - Update `bin/ollama_chat_send` help text to reflect the renamed `/input`
87
101
  command
88
102
 
89
103
  ### Utility Helpers
90
104
 
91
- - Add `go_command` helper in `dialog.rb` for parsing command‑line options
105
+ - Add `go_command` helper in `dialog.rb` for parsing command‑line options
92
106
  - Add `file_set_each`, `all_file_set`, and `provide_file_set_content` to
93
- `input_content.rb`
94
- - Update `context_spook` to use `file_set_each` and accept an `all` flag
95
- - Add `strip_internal_json_markers` helper in `chat.rb`
107
+ `input_content.rb`
108
+ - Update `context_spook` to use `file_set_each` and accept an `all` flag
109
+ - Add `strip_internal_json_markers` helper in `chat.rb`
96
110
  - Add `choose_file_set` helper in `OllamaChat::Dialog` returning a `Set` of
97
111
  expanded `Pathname` objects
98
112
 
99
113
  ### Source Fetching & Links
100
114
 
101
- - Refactor `source_fetching.rb` to coerce sources to string
115
+ - Refactor `source_fetching.rb` to coerce sources to string
102
116
  - Add a lazy `links` method and remove the old `links` method from `Chat`
103
117
 
104
118
  ### Retrieval Snippets
105
119
 
106
120
  - Update retrieval‑snippet injection to use a JSON block instead of a
107
- plain‑text list
121
+ plain‑text list
108
122
  - Use `strip_internal_json_markers` for `:ollama_chat_retrieval_snippets` and
109
- `:ollama_chat_runtime_information`
123
+ `:ollama_chat_runtime_information`
110
124
  - Truncate user query to `config.embedding.model.context_length` before calling
111
125
  `@documents.find_where`
112
126
 
113
127
  ### Directory Structure Tool
114
128
 
115
- - Add `suffix` parameter to `directory_structure` function
129
+ - Add `suffix` parameter to `directory_structure` function
116
130
  - Update `OllamaChat::Utils::AnalyzeDirectory.generate_structure` to accept a
117
- `suffix:` argument and filter files accordingly
131
+ `suffix:` argument and filter files accordingly
118
132
  - Ensure only files matching the given extension are included; hidden files and
119
133
  symlinks remain excluded
120
134
 
121
135
  ### Persona Management
122
136
 
123
- - Update persona option labels to `keep`, `reload_default`, `choose_different`
124
- - Add interactive persona reload options via a menu in `reload_default_persona`
125
- - Use `SearchUI::Wrapper` and `OllamaChat::Utils::Chooser` for selection
137
+ - Update persona option labels to `keep`, `reload_default`, `choose_different`
138
+ - Add interactive persona reload options via a menu in `reload_default_persona`
139
+ - Use `SearchUI::Wrapper` and `OllamaChat::Utils::Chooser` for selection
126
140
  - Update `@default_persona` when selecting “load_new”
127
141
 
128
142
  ### Path Validation
129
143
 
130
- - Add `check_file` flag to `path_validator.rb` method signature
131
- - Guard against non‑directory parents and file existence when `check_file:true`
144
+ - Add `check_file` flag to `path_validator.rb` method signature
145
+ - Guard against non‑directory parents and file existence when `check_file:true`
132
146
  - Propagate `check_file` flag in calls from `file_context`, `patch_file`, and
133
147
  `read_file`
134
148
 
135
149
  ### Tests & Specs
136
150
 
137
151
  - Adjust specs to stub `OC::PAGER`, expect `use_pager` yielding a `StringIO`,
138
- and verify `STDOUT.puts` calls
139
- - Update test expectations for new command handling and help output
152
+ and verify `STDOUT.puts` calls
153
+ - Update test expectations for new command handling and help output
140
154
  - Expect `OllamaChat::InvalidPathError` instead of `Errno::ENOENT` in relevant
141
- specs
155
+ specs
142
156
  - Add `asset_pathname` helper in `spec_helper.rb`
143
157
 
144
158
  ### Miscellaneous
145
159
 
146
- - Add `reline` gem to `.utilsrc` dependency list
160
+ - Add `reline` gem to `.utilsrc` dependency list
147
161
  - Consider `-c` flag to skip persona setup when loading an existing
148
- conversation
162
+ conversation
149
163
  - Standardize `register_name` method comments to `@return [String] the
150
- registered name for this tool`
164
+ registered name for this tool`
151
165
 
152
166
  ## 2026-03-13 v0.0.79
153
167
 
154
- - Added `tmp/*` to Rakefile ignore list for cleaner builds.
155
- - Updated gemspec: changed `s.rubygems_version` to **3.6.9**.
156
- - Added `logging.rb` to `extra_rdoc_files` and `files` in gemspec.
157
- - Adjusted gemspec file list to reflect new structure.
158
- - Removed `Runtime Directory` (`-d`) explanation from `README.md`.
159
- - Updated URL in `README.md`.
168
+ - Added `tmp/*` to Rakefile ignore list for cleaner builds.
169
+ - Updated gemspec: changed `s.rubygems_version` to **3.6.9**.
170
+ - Added `logging.rb` to `extra_rdoc_files` and `files` in gemspec.
171
+ - Adjusted gemspec file list to reflect new structure.
172
+ - Removed `Runtime Directory` (`-d`) explanation from `README.md`.
173
+ - Updated URL in `README.md`.
160
174
  - Added explicit check that `args.path.full?` is true before calling
161
175
  `assert_valid_path`, raising `ArgumentError` with message `'require path to
162
- file to be patched'`.
176
+ file to be patched'`.
163
177
  - Updated path assignment to first validate presence, then assert validity
164
- against `config.tools.functions.patch_file.allowed?`.
178
+ against `config.tools.functions.patch_file.allowed?`.
165
179
  - Updated `OllamaChat::Tools::ExecuteGrep` to accept new options `before`,
166
- `after`, and `context`.
167
- - Added helper method `normalize_number` for optional integer arguments.
180
+ `after`, and `context`.
181
+ - Added helper method `normalize_number` for optional integer arguments.
168
182
  - Adjusted command template in `default_config.yml` to include `-B`, `-A`, and
169
- `-C` flags based on provided values.
183
+ `-C` flags based on provided values.
170
184
  - Refactored logging: replaced `logger.error` / `logger.warn` calls with
171
- `log(:error, …)` or `log(:warn, …)` across multiple files.
185
+ `log(:error, …)` or `log(:warn, …)` across multiple files.
172
186
  - Added optional `warn: true` flag to new helper so that critical errors also
173
187
  trigger a user‑visible warning output while still being written to the log
174
- file.
188
+ file.
175
189
  - Implemented `OllamaChat::Logging#log(severity, msg, warn:)` in `logging.rb`;
176
190
  it formats exceptions with backtraces and forwards messages to the underlying
177
- Ruby `Logger`.
191
+ Ruby `Logger`.
178
192
  - Updated `spec_helper.rb` by adding a global `config.before` hook that sets
179
193
  temporary paths for `OC::OLLAMA::CHAT::HISTORY` and `LOGFILE` so all specs
180
- run against isolated files.
181
- - Added `tmp/*` to `.gitignore`.
194
+ run against isolated files.
195
+ - Added `tmp/*` to `.gitignore`.
182
196
  - Created new module `OllamaChat::Logging` that lazily builds a Logger writing
183
- to the file defined by `OC::OLLAMA::CHAT::LOGFILE` in XDG STATE.
197
+ to the file defined by `OC::OLLAMA::CHAT::LOGFILE` in XDG STATE.
184
198
  - Required this logging module in `lib/ollama_chat.rb` and included it in
185
- `class OllamaChat::Chat` so every chat instance has access to `logger`.
199
+ `class OllamaChat::Chat` so every chat instance has access to `logger`.
186
200
  - Logged connection messages via `@chat.logger.info` before printing the
187
- “Connecting …” line in `OllamaChat::Dialog#connect_message`.
201
+ “Connecting …” line in `OllamaChat::Dialog#connect_message`.
188
202
  - Centralized tool‑call error handling: log unconfigured, unregistered or
189
203
  disabled tools with `@chat.logger.error`, and record each executed function
190
- payload using `JSON.pretty_generate`.
204
+ payload using `JSON.pretty_generate`.
191
205
  - Introduced an explicit vs implicit confirmation flow (`:explicit`,
192
206
  `:implicite`, `:denied`) in `OllamaChat::FollowChat#follow_chat` and log the
193
- outcome accordingly.
207
+ outcome accordingly.
194
208
  - Switched chat history storage from XDG CACHE to XDG STATE by updating
195
209
  `OC::OLLAMA::CHAT::HISTORY` path, adjusting file operations in
196
210
  `lib/ollama_chat/history.rb`, and adding a new config entry for `LOGFILE`
197
- under state home in `oc.rb`.
211
+ under state home in `oc.rb`.
198
212
  - Enhanced PatchFile tool: updated documentation to specify `unified diff
199
- format` and `JSON response`.
200
- - Added private method `digest` that returns `MD5` of a file path.
213
+ format` and `JSON response`.
214
+ - Added private method `digest` that returns `MD5` of a file path.
201
215
  - Modified `apply_patch` to compute old digest, run patch command, compare
202
- digests, set `success` flag accordingly.
216
+ digests, set `success` flag accordingly.
203
217
  - Improved error handling: now includes `success`, clearer messages, empty
204
218
  result on failure.
205
219
 
@@ -229,64 +243,64 @@
229
243
  inserted `%{time}` placeholder into prompts section of `default_config.yml`;
230
244
  added Git placeholders (`%{git_current_branch}`, `%{git_remote_origin}`)
231
245
  under **Git** key; reformatted terminal info under a single **Terminal**
232
- heading with height and width.
246
+ heading with height and width.
233
247
  - Extend weather tool to include six‑day forecast: updated `GetCurrentWeather`
234
248
  description to mention a six‑day forecast; functionality unchanged; tool
235
- still requires no arguments.
249
+ still requires no arguments.
236
250
  - Rename `insert_into_editor` tool to `paste_into_editor`: updated
237
251
  `lib/ollama_chat/tools.rb` to require `paste_into_editor`; renamed and
238
252
  updated class from `InsertIntoEditor` to `PasteIntoEditor` in
239
253
  `paste_into_editor.rb`, changing its register name, description text, and
240
254
  method logic; switched default config key in `default_config.yml` from
241
255
  `insert_into_editor` to `paste_into_editor`; refactored spec files; adjusted
242
- all internal references.
256
+ all internal references.
243
257
 
244
258
  ## 2026-03-09 v0.0.76
245
259
 
246
260
  - Added `client:` and `current_directory:` keys to `runtime_info_values` in
247
- `chat.rb`.
261
+ `chat.rb`.
248
262
  - Implemented `#client` method returning `"progname **0.0.75**"` in
249
- `information.rb`.
250
- - Introduced helper `location_description?` in `location_handling.rb`.
263
+ `information.rb`.
264
+ - Introduced helper `location_description?` in `location_handling.rb`.
251
265
  - Simplified `MessageList#to_ary` to return a duplicate of the internal array,
252
- removing automatic system prompt + location injection.
266
+ removing automatic system prompt + location injection.
253
267
  - Updated default config placeholders for `%{client}` and
254
- `%{current_directory}` in `default_config.yml`.
268
+ `%{current_directory}` in `default_config.yml`.
255
269
  - Adjusted web searching logic to use `location_description?` instead of
256
- deprecated methods.
270
+ deprecated methods.
257
271
  - Removed tests that expected location‑augmented system prompts from
258
- `spec/ollama_chat/message_list_spec.rb`.
272
+ `spec/ollama_chat/message_list_spec.rb`.
259
273
  - Standardized JSON output formatting across tools: aligned JSON keys, added
260
274
  spaces after commas, and added trailing commas in tool responses such as
261
275
  `copy_to_clipboard`, `gem_path_lookup`, `generate_password`, `get_endoflife`,
262
276
  `get_rfc`, `insert_into_editor`, `open_file_in_editor`,
263
- `paste_from_clipboard`, and `search_web`.
277
+ `paste_from_clipboard`, and `search_web`.
264
278
  - Added trailing commas to JSON objects for consistency and easier future
265
- edits.
279
+ edits.
266
280
  - Standardized error field formatting, ensuring each error block includes a
267
- space after the colon and a trailing comma where appropriate.
281
+ space after the colon and a trailing comma where appropriate.
268
282
  - Added helper `disable_content_parsing` in `chat.rb` that sets `@parse_content
269
- = false`.
283
+ = false`.
270
284
  - Refactored command handlers to call `disable_content_parsing` instead of
271
- assigning directly to `@parse_content`.
285
+ assigning directly to `@parse_content`.
272
286
  - Updated persona setup logic so that a returned persona result triggers
273
287
  `disable_content_parsing`; otherwise parsing is enabled with
274
- `enable_command_completion`.
275
- - Added explanatory comments around the new helper for clarity.
288
+ `enable_command_completion`.
289
+ - Added explanatory comments around the new helper for clarity.
276
290
  - Improved clean flow: captured return value of `clean` and set `@parse_content
277
- = true` when a persona profile is returned.
291
+ = true` when a persona profile is returned.
278
292
  - Replaced old flag `@persona_setup` with `@default_persona`; ensured it
279
- defaults to `:none` in an `ensure` block after setup.
293
+ defaults to `:none` in an `ensure` block after setup.
280
294
  - Added new method `reload_default_persona` that prompts for confirmation
281
- before reloading the default persona file if one exists.
295
+ before reloading the default persona file if one exists.
282
296
  - Modified `clean(what)` to return the result of `reload_default_persona`,
283
- enabling the caller to react to a reload.
297
+ enabling the caller to react to a reload.
284
298
  - Adjusted `/clear` command handling in the chat loop to use the returned value
285
- from `clean` and only proceed when nothing is returned.
299
+ from `clean` and only proceed when nothing is returned.
286
300
  - Renamed local variable `runtime_info` to `runtime_info_values` in `chat.rb`
287
- for clarity.
301
+ for clarity.
288
302
  - Updated runtime info prompt interpolation to use `runtime_info_values`
289
- instead of `runtime_info`.
303
+ instead of `runtime_info`.
290
304
  - Updated `/.utilsrc` by adding gems to the `code_indexer` configuration:
291
305
  `all_images`, `const_conf`, `context_spook`, `csv`, `fileutils`, `gem_hadar`,
292
306
  `infobar`, `irb`, `kramdown`, and `kramdown-parser-gfm`.
@@ -298,28 +312,28 @@
298
312
  prompt, and normalizing tool name handling.
299
313
  - Added new tool `OllamaChat::Tools::ResolveTag` with utility
300
314
  `OllamaChat::Utils::TagResolver` to parse tag files; enabled in
301
- `default_config.yml` and added corresponding tests.
315
+ `default_config.yml` and added corresponding tests.
302
316
  - Introduced `runtime_info` switch in `OllamaChat::Switches`; added
303
317
  `/runtime_info` command handling in `chat.rb`, runtime info block injection,
304
318
  and display via `information.rb`; added `prompts/runtime_info` template and
305
319
  `languages:` array; added `runtime_info.toggle`, `runtime_info.show`,
306
- `runtime_info.on?`, `runtime_info.enabled` support.
320
+ `runtime_info.on?`, `runtime_info.enabled` support.
307
321
  - Updated `OllamaChat::Tools::DirectoryStructure` description to note it can
308
- locate one or multiple files, referencing `max_depth`.
322
+ locate one or multiple files, referencing `max_depth`.
309
323
  - Clarified usage of `browse`, `copy_to_clipboard`, `open_file_in_editor`,
310
324
  `insert_into_editor` tools in documentation strings; fixed double‑negative
311
- typo in `insert_into_editor.rb`.
325
+ typo in `insert_into_editor.rb`.
312
326
  - Renamed `import_url` tool to `get_url`: updated config key, tool
313
327
  registration, class name `OllamaChat::Tools::GetURL`, spec file names, method
314
328
  calls to `config.tools.functions.get_url.schemes?`, replaced all
315
- `chat.import` with `OllamaChat::Utils::Fetcher.get`.
329
+ `chat.import` with `OllamaChat::Utils::Fetcher.get`.
316
330
  - Added path validation and error handling to `OllamaChat::Tools::RunTests`:
317
331
  new private method `check_path(path)` prevents using `"./"` and validates
318
332
  existence; wrapped execution in rescue block returning JSON with `error:` and
319
- `message:`; updated function description accordingly.
320
- - Refined and unified tool descriptions with consistent punctuation.
333
+ `message:`; updated function description accordingly.
334
+ - Refined and unified tool descriptions with consistent punctuation.
321
335
  - Added explicit persona loading verification when editing: confirmation step
322
- before applying edited personality configurations.
336
+ before applying edited personality configurations.
323
337
  - Improved persona loading and prompt formatting: updated
324
338
  `setup_persona_from_opts`, `info_persona`, `load_persona_file` to return
325
339
  `[pathname, content]`, added newline in `play_persona_prompt`, adjusted
data/Rakefile CHANGED
@@ -41,7 +41,7 @@ GemHadar do
41
41
  )
42
42
 
43
43
  dependency 'excon', '~> 1.0'
44
- dependency 'ollama-ruby', '~> 1.18'
44
+ dependency 'ollama-ruby', '~> 1.21'
45
45
  dependency 'documentrix', '>= 0.0.4'
46
46
  dependency 'unix_socks', '~> 0.3'
47
47
  dependency 'rss', '~> 0.3'
@@ -49,7 +49,7 @@ GemHadar do
49
49
  dependency 'redis', '~> 5.0'
50
50
  dependency 'mime-types', '~> 3.0'
51
51
  dependency 'reverse_markdown', '~> 3.0'
52
- dependency 'kramdown-ansi', '~> 0.3'
52
+ dependency 'kramdown-ansi', '~> 0.5'
53
53
  dependency 'complex_config', '~> 0.22', '>= 0.22.2'
54
54
  dependency 'tins', '~> 1.52'
55
55
  dependency 'search_ui', '~> 0.1'
@@ -492,7 +492,7 @@ class OllamaChat::Chat
492
492
  STDOUT.puts "Exiting chooser."
493
493
  break
494
494
  when '[ALL]'
495
- if confirm?(prompt: 'Are you sure? (y/n) ') =~ /y/i
495
+ if confirm?(prompt: '🔔 Are you sure? (y/n) ') =~ /y/i
496
496
  @documents.clear
497
497
  STDOUT.puts "Cleared collection #{bold{@documents.collection}}."
498
498
  break
@@ -537,7 +537,7 @@ class OllamaChat::Chat
537
537
  end
538
538
  when 'edit'
539
539
  if result = edit_persona and
540
- confirm?(prompt: 'Load new persona profile? (y/n) ') =~ /y/i
540
+ confirm?(prompt: '🔔 Load new persona profile? (y/n) ') =~ /y/i
541
541
  then
542
542
  result
543
543
  else
@@ -868,7 +868,7 @@ class OllamaChat::Chat
868
868
  STDOUT.puts "Exiting chooser."
869
869
  break
870
870
  when '[ALL]'
871
- if confirm?(prompt: 'Are you sure? (y/n) ') =~ /y/i
871
+ if confirm?(prompt: '🔔 Are you sure? (y/n) ') =~ /y/i
872
872
  links.clear
873
873
  STDOUT.puts "Cleared all links in list."
874
874
  break
@@ -916,7 +916,7 @@ class OllamaChat::Chat
916
916
  @documents.clear
917
917
  STDOUT.puts "Cleared all tags."
918
918
  when 'all'
919
- if confirm?(prompt: 'Are you sure to clear messages and collection? (y/n) ') =~ /y/i
919
+ if confirm?(prompt: '🔔 Are you sure to clear messages and collection? (y/n) ') =~ /y/i
920
920
  messages.clear
921
921
  @documents.clear
922
922
  links.clear
@@ -58,7 +58,7 @@ module OllamaChat::ConfigHandling
58
58
  unless diff_tool = OC::DIFF_TOOL?
59
59
  exit 1
60
60
  end
61
- if confirm?(prompt: 'Do you want to fix the config? (y/n) ') =~ /y/i
61
+ if confirm?(prompt: '🔔 Do you want to fix the config? (y/n) ') =~ /y/i
62
62
  system Shellwords.join([
63
63
  diff_tool,
64
64
  @ollama_chat_config.filename,
@@ -84,7 +84,7 @@ module OllamaChat::ConfigHandling
84
84
  # `ollama_chat` if desired.
85
85
  def edit_config
86
86
  if result = edit_file(@ollama_chat_config.filename)
87
- if confirm?(prompt: "Do you want to restart #{progname}? (y/n) ") =~ /y/i
87
+ if confirm?(prompt: "🔔 Do you want to restart #{progname}? (y/n) ") =~ /y/i
88
88
  save_conversation(OC::XDG_CACHE_HOME + 'backup.json')
89
89
  save_history
90
90
  exec($0, *ARGV)
@@ -101,7 +101,7 @@ module OllamaChat::ConfigHandling
101
101
  # @example Restarting the app after confirmation
102
102
  # config.reload_config # => restarts if user answers "y"
103
103
  def reload_config
104
- if confirm?(prompt: "Do you want to restart #{progname}? (y/n) ") =~ /y/i
104
+ if confirm?(prompt: "🔔 Do you want to restart #{progname}? (y/n) ") =~ /y/i
105
105
  save_conversation(OC::XDG_CACHE_HOME + 'backup.json')
106
106
  save_history
107
107
  exec($0, *ARGV)
@@ -27,7 +27,7 @@ module OllamaChat::Conversation
27
27
  # chat.save_conversation('conversations/2023-10-15_my_session.json')
28
28
  def save_conversation(filename)
29
29
  File.exist?(filename) &&
30
- confirm?(prompt: "File #{filename.to_s.inspect} already exists, overwrite? (y/n) ") !~ /y/i and
30
+ confirm?(prompt: "🔔 File #{filename.to_s.inspect} already exists, overwrite? (y/n) ") !~ /y/i and
31
31
  return
32
32
  if messages.save_conversation(filename)
33
33
  STDOUT.puts "Saved conversation to #{filename.to_s.inspect}."
@@ -84,7 +84,7 @@ module OllamaChat::Dialog
84
84
  collection = OllamaChat::Utils::Chooser.choose(collections) || current_collection
85
85
  case collection
86
86
  when '[NEW]'
87
- @documents.collection = ask?(prompt: "Enter name of the new collection: ")
87
+ @documents.collection = ask?(prompt: "Enter name of the new collection: ")
88
88
  when nil, '[EXIT]'
89
89
  STDOUT.puts "Exiting chooser."
90
90
  when /./
@@ -122,7 +122,7 @@ module OllamaChat::Dialog
122
122
  system =
123
123
  case chosen
124
124
  when '[NEW]'
125
- ask?(prompt: "Enter new system prompt to use: ")
125
+ ask?(prompt: "Enter new system prompt to use: ")
126
126
  when '[EXIT]'
127
127
  STDOUT.puts "Exiting chooser."
128
128
  return
@@ -123,7 +123,7 @@ class OllamaChat::FollowChat
123
123
  function = JSON.pretty_generate(tool_call.function)
124
124
  @chat.log(:info, function)
125
125
  if @chat.tool_function(name).require_confirmation?
126
- prompt = "I want to execute tool %s\n%s\nConfirm? (y/n) " % [
126
+ prompt = "🔔 I want to execute tool %s\n%s\nConfirm? (y/n) " % [
127
127
  bold { name },
128
128
  italic { function },
129
129
  ]
@@ -180,7 +180,7 @@ class OllamaChat::FollowChat
180
180
  infobar.reset
181
181
  puts "🔧 Tool functions returned result:",
182
182
  tools_used.to_yaml.sub(/\A---\s*\n/, '').gsub(/^/, ' '), ""
183
- @chat.confirm?(prompt: 'Press any key to continue.')
183
+ @chat.confirm?(prompt: 'Press any key to continue. ')
184
184
  end
185
185
  end
186
186
 
@@ -83,7 +83,7 @@ module OllamaChat::MessageOutput
83
83
  def attempt_to_write_file(filename, message)
84
84
  path = Pathname.new(filename.to_s).expand_path
85
85
  if !path.exist? ||
86
- confirm?(prompt: "File #{path.to_s.inspect} already exists, overwrite? (y/n) ") =~ /y/i
86
+ confirm?(prompt: "🔔 File #{path.to_s.inspect} already exists, overwrite? (y/n) ") =~ /y/i
87
87
  then
88
88
  File.open(path, ?w) do |output|
89
89
  output.write(message.content)
@@ -127,7 +127,7 @@ module OllamaChat::PersonaeManagement
127
127
  # if the user cancels.
128
128
  def add_persona
129
129
  persona_name = ask?(
130
- prompt: "Enter the name of the new persona (or press return to cancel): "
130
+ prompt: "Enter the name of the new persona (or press return to cancel): "
131
131
  ).full? or return
132
132
 
133
133
  pathname = personae_directory + "#{persona_name}.md"
@@ -173,7 +173,7 @@ module OllamaChat::PersonaeManagement
173
173
  STDOUT.puts "Deleting '#{bold{persona.sub_ext('')}}'..."
174
174
  STDOUT.puts "Backup will be saved to: #{backup_pathname}"
175
175
 
176
- if confirm?(prompt: "Are you sure? (y/n) ") =~ /y/i
176
+ if confirm?(prompt: "🔔 Are you sure? (y/n) ") =~ /y/i
177
177
  FileUtils.mv pathname, backup_pathname
178
178
  STDOUT.puts "✅ Persona #{bold{persona.sub_ext('')}} deleted successfully"
179
179
  {
@@ -117,7 +117,7 @@ module OllamaChat::ServerSocket
117
117
  running using the same directory or that a previous process left a stale
118
118
  socket file.
119
119
  EOT
120
- if confirm?(prompt: 'Do you want to remove the existing socket file and continue? (y/n) ') =~ /y/i
120
+ if confirm?(prompt: '🔔 Do you want to remove the existing socket file and continue? (y/n) ') =~ /y/i
121
121
  FileUtils.rm_f socket_path
122
122
  retry
123
123
  else
@@ -15,11 +15,10 @@ class OllamaChat::Tools::PasteIntoEditor
15
15
  function: Tool::Function.new(
16
16
  name:,
17
17
  description: <<~EOT,
18
- Editor helper – Pastes a string (or last reply if omitted) straight
19
- into the User’s running editor.
20
- If no `text` is supplied, the tool will automatically use the last assistant
21
- response. Do not not call this tool function unless explicitly
22
- requested by the user.
18
+ Editor helper – Pastes a text (or last reply if omitted) into
19
+ the editor, no file or line is required.
20
+ If no `text` is supplied, the tool will automatically use the last
21
+ assistant response.
23
22
  EOT
24
23
  parameters: Tool::Function::Parameters.new(
25
24
  type: 'object',
@@ -32,7 +32,7 @@ class OllamaChat::Tools::ResolveTag
32
32
  ),
33
33
  kind: Tool::Function::Parameters::Property.new(
34
34
  type: 'string',
35
- description: 'Optional tag kind (e.g., f for function, v for variable).'
35
+ description: 'Optional tag kind (%s).' % OllamaChat::Utils::TagResolver.kinds.to_json
36
36
  ),
37
37
  directory: Tool::Function::Parameters::Property.new(
38
38
  type: 'string',
@@ -10,19 +10,26 @@ class OllamaChat::Utils::TagResolver
10
10
  HEADERS = %i[ symbol filename regexp kind rest ]
11
11
  private_constant :HEADERS
12
12
 
13
- # Return a human‑readable description of a ctags tag kind. For example, `f`
14
- # (function) becomes "methods".
13
+ # The kinds method returns a mapping of single character kind identifiers to
14
+ # human‑readable descriptions for Ruby ctags kinds.
15
15
  #
16
- # @param [String] kind The single character kind identifier from the tags file.
17
- # @return [String]
18
- def self.kind_of(kind)
16
+ # @return [Hash] a hash mapping kind identifiers to their descriptions.
17
+ def self.kinds
19
18
  ctags = ::OC::OLLAMA::CHAT::TOOLS::CTAGS_TOOL? or
20
19
  raise OllamaChat::ConfigMissingError,
21
20
  'need ctags tool path defined in %s' % (
22
21
  ::OC::OLLAMA::CHAT::TOOLS::CTAGS_TOOL!.env_var_name
23
22
  )
24
23
  @kinds ||= `#{ctags} --list-kinds=Ruby`.lines.map { _1.chomp.split(/\s+/, 2) }.to_h
25
- @kinds.fetch(kind, 'unknown')
24
+ end
25
+
26
+ # Return a human‑readable description of a ctags tag kind. For example, `f`
27
+ # (function) becomes "methods".
28
+ #
29
+ # @param [String] kind The single character kind identifier from the tags file.
30
+ # @return [String]
31
+ def self.kind_of(kind)
32
+ kinds.fetch(kind, 'unknown')
26
33
  end
27
34
 
28
35
  # A lightweight struct representing a single tag entry. It extends the base
@@ -85,7 +92,7 @@ class OllamaChat::Utils::TagResolver
85
92
  results = []
86
93
  @tags_file.each_line do |line|
87
94
  line.chomp!
88
- line =~ /\A([^\t]+)\t([^\t]+)\t\/\^([^\t]+)\$\/\;"\t([^\t])\t([^\t]+)$/ or next
95
+ line =~ /\A([^\t]+)\t([^\t]+)\t\/\^([^\t]+)\$\/\;"\t([^\t])(.*)/ or next
89
96
  obj = TagResult.new(*$~.captures)
90
97
  next unless obj.symbol == symbol
91
98
  if kind
@@ -1,6 +1,6 @@
1
1
  module OllamaChat
2
2
  # OllamaChat version
3
- VERSION = '0.0.81'
3
+ VERSION = '0.0.82'
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.81 ruby lib
2
+ # stub: ollama_chat 0.0.82 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "ollama_chat".freeze
6
- s.version = "0.0.81".freeze
6
+ s.version = "0.0.82".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]
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
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
- s.rubygems_version = "3.6.9".freeze
21
+ s.rubygems_version = "4.0.8".freeze
22
22
  s.summary = "A command-line interface (CLI) for interacting with an Ollama AI model.".freeze
23
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/copy_to_clipboard_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/execute_ri_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/generate_password_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_rfc_spec.rb".freeze, "spec/ollama_chat/tools/get_time_spec.rb".freeze, "spec/ollama_chat/tools/get_url_spec.rb".freeze, "spec/ollama_chat/tools/open_file_in_editor_spec.rb".freeze, "spec/ollama_chat/tools/paste_from_clipboard_spec.rb".freeze, "spec/ollama_chat/tools/paste_into_editor_spec.rb".freeze, "spec/ollama_chat/tools/patch_file_spec.rb".freeze, "spec/ollama_chat/tools/read_file_spec.rb".freeze, "spec/ollama_chat/tools/resolve_tag_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/utils/path_completer_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
 
@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
34
34
  s.add_development_dependency(%q<context_spook>.freeze, [">= 0".freeze])
35
35
  s.add_development_dependency(%q<utils>.freeze, [">= 0".freeze])
36
36
  s.add_runtime_dependency(%q<excon>.freeze, ["~> 1.0".freeze])
37
- s.add_runtime_dependency(%q<ollama-ruby>.freeze, ["~> 1.18".freeze])
37
+ s.add_runtime_dependency(%q<ollama-ruby>.freeze, ["~> 1.21".freeze])
38
38
  s.add_runtime_dependency(%q<documentrix>.freeze, [">= 0.0.4".freeze])
39
39
  s.add_runtime_dependency(%q<unix_socks>.freeze, ["~> 0.3".freeze])
40
40
  s.add_runtime_dependency(%q<rss>.freeze, ["~> 0.3".freeze])
@@ -42,7 +42,7 @@ Gem::Specification.new do |s|
42
42
  s.add_runtime_dependency(%q<redis>.freeze, ["~> 5.0".freeze])
43
43
  s.add_runtime_dependency(%q<mime-types>.freeze, ["~> 3.0".freeze])
44
44
  s.add_runtime_dependency(%q<reverse_markdown>.freeze, ["~> 3.0".freeze])
45
- s.add_runtime_dependency(%q<kramdown-ansi>.freeze, ["~> 0.3".freeze])
45
+ s.add_runtime_dependency(%q<kramdown-ansi>.freeze, ["~> 0.5".freeze])
46
46
  s.add_runtime_dependency(%q<complex_config>.freeze, ["~> 0.22".freeze, ">= 0.22.2".freeze])
47
47
  s.add_runtime_dependency(%q<tins>.freeze, ["~> 1.52".freeze])
48
48
  s.add_runtime_dependency(%q<search_ui>.freeze, ["~> 0.1".freeze])
@@ -5,6 +5,12 @@ describe OllamaChat::Tools::ResolveTag do
5
5
 
6
6
  connect_to_ollama_server
7
7
 
8
+ before do
9
+ const_conf_as(
10
+ 'OC::OLLAMA::CHAT::TOOLS::CTAGS_TOOL' => 'true'
11
+ )
12
+ end
13
+
8
14
  it 'can have name' do
9
15
  expect(described_class.new.name).to eq 'resolve_tag'
10
16
  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.81
4
+ version: 0.0.82
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
@@ -155,14 +155,14 @@ dependencies:
155
155
  requirements:
156
156
  - - "~>"
157
157
  - !ruby/object:Gem::Version
158
- version: '1.18'
158
+ version: '1.21'
159
159
  type: :runtime
160
160
  prerelease: false
161
161
  version_requirements: !ruby/object:Gem::Requirement
162
162
  requirements:
163
163
  - - "~>"
164
164
  - !ruby/object:Gem::Version
165
- version: '1.18'
165
+ version: '1.21'
166
166
  - !ruby/object:Gem::Dependency
167
167
  name: documentrix
168
168
  requirement: !ruby/object:Gem::Requirement
@@ -267,14 +267,14 @@ dependencies:
267
267
  requirements:
268
268
  - - "~>"
269
269
  - !ruby/object:Gem::Version
270
- version: '0.3'
270
+ version: '0.5'
271
271
  type: :runtime
272
272
  prerelease: false
273
273
  version_requirements: !ruby/object:Gem::Requirement
274
274
  requirements:
275
275
  - - "~>"
276
276
  - !ruby/object:Gem::Version
277
- version: '0.3'
277
+ version: '0.5'
278
278
  - !ruby/object:Gem::Dependency
279
279
  name: complex_config
280
280
  requirement: !ruby/object:Gem::Requirement
@@ -703,7 +703,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
703
703
  - !ruby/object:Gem::Version
704
704
  version: '0'
705
705
  requirements: []
706
- rubygems_version: 3.6.9
706
+ rubygems_version: 4.0.8
707
707
  specification_version: 4
708
708
  summary: A command-line interface (CLI) for interacting with an Ollama AI model.
709
709
  test_files: