ollama_chat 0.0.79 → 0.0.80

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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.utilsrc +1 -0
  3. data/CHANGES.md +113 -0
  4. data/README.md +100 -44
  5. data/bin/ollama_chat_send +1 -1
  6. data/lib/ollama_chat/chat.rb +591 -286
  7. data/lib/ollama_chat/command_concern.rb +159 -0
  8. data/lib/ollama_chat/config_handling.rb +3 -3
  9. data/lib/ollama_chat/conversation.rb +1 -1
  10. data/lib/ollama_chat/dialog.rb +39 -0
  11. data/lib/ollama_chat/follow_chat.rb +11 -1
  12. data/lib/ollama_chat/information.rb +46 -90
  13. data/lib/ollama_chat/input_content.rb +58 -14
  14. data/lib/ollama_chat/location_handling.rb +0 -3
  15. data/lib/ollama_chat/message_output.rb +1 -1
  16. data/lib/ollama_chat/ollama_chat_config/default_config.yml +1 -5
  17. data/lib/ollama_chat/pager.rb +3 -3
  18. data/lib/ollama_chat/personae_management.rb +36 -6
  19. data/lib/ollama_chat/server_socket.rb +1 -1
  20. data/lib/ollama_chat/source_fetching.rb +14 -3
  21. data/lib/ollama_chat/state_selectors.rb +4 -2
  22. data/lib/ollama_chat/switches.rb +8 -6
  23. data/lib/ollama_chat/tools/browse.rb +1 -0
  24. data/lib/ollama_chat/tools/copy_to_clipboard.rb +1 -1
  25. data/lib/ollama_chat/tools/directory_structure.rb +13 -2
  26. data/lib/ollama_chat/tools/execute_grep.rb +1 -0
  27. data/lib/ollama_chat/tools/execute_ri.rb +1 -1
  28. data/lib/ollama_chat/tools/file_context.rb +2 -1
  29. data/lib/ollama_chat/tools/generate_password.rb +1 -1
  30. data/lib/ollama_chat/tools/get_cve.rb +1 -0
  31. data/lib/ollama_chat/tools/get_endoflife.rb +1 -0
  32. data/lib/ollama_chat/tools/get_jira_issue.rb +1 -0
  33. data/lib/ollama_chat/tools/get_location.rb +1 -6
  34. data/lib/ollama_chat/tools/get_rfc.rb +1 -0
  35. data/lib/ollama_chat/tools/get_time.rb +1 -5
  36. data/lib/ollama_chat/tools/get_url.rb +1 -0
  37. data/lib/ollama_chat/tools/open_file_in_editor.rb +1 -0
  38. data/lib/ollama_chat/tools/paste_from_clipboard.rb +1 -1
  39. data/lib/ollama_chat/tools/paste_into_editor.rb +1 -1
  40. data/lib/ollama_chat/tools/patch_file.rb +4 -5
  41. data/lib/ollama_chat/tools/read_file.rb +2 -1
  42. data/lib/ollama_chat/tools/resolve_tag.rb +1 -1
  43. data/lib/ollama_chat/tools/run_tests.rb +1 -2
  44. data/lib/ollama_chat/tools/search_web.rb +1 -0
  45. data/lib/ollama_chat/tools/write_file.rb +1 -0
  46. data/lib/ollama_chat/utils/analyze_directory.rb +14 -6
  47. data/lib/ollama_chat/utils/fetcher.rb +0 -9
  48. data/lib/ollama_chat/utils/path_validator.rb +41 -20
  49. data/lib/ollama_chat/version.rb +1 -1
  50. data/lib/ollama_chat/web_searching.rb +0 -1
  51. data/lib/ollama_chat.rb +1 -0
  52. data/ollama_chat.gemspec +4 -4
  53. data/spec/ollama_chat/chat_spec.rb +139 -45
  54. data/spec/ollama_chat/information_spec.rb +9 -7
  55. data/spec/ollama_chat/tools/directory_structure_spec.rb +3 -0
  56. data/spec/ollama_chat/tools/patch_file_spec.rb +1 -1
  57. data/spec/ollama_chat/tools/read_file_spec.rb +2 -2
  58. data/spec/ollama_chat/utils/analyze_directory_spec.rb +8 -0
  59. data/spec/spec_helper.rb +9 -0
  60. metadata +3 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 982588e8a14a4bb35aebd365a9dea99fb7c7b474f4d1293436fa97d1258eec79
4
- data.tar.gz: 0a0410940246c4d9d260256e02373f002aeadba778a2097aefc97f190dc17e68
3
+ metadata.gz: 5116e552c78df5d85138b112ef43b4a80bbb7e2ce03fd5cbd5e58f7adbde948d
4
+ data.tar.gz: 22ff0f77807fa3560ce394a0e840ea367770596f2a261cddb650c24eaf362d01
5
5
  SHA512:
6
- metadata.gz: f15c28d9980519078af9b27d5706edfa91df2c4c13ac235377dd97623c62a40c9b8014c06373f093ef473e5c9553e20a949fa4488afb7be06b94ebd006c2eb1c
7
- data.tar.gz: 8bc4b5bd4880ab46ea227379ff4786681a7f7bef67d81df35628f5aea238c250f0842de5408fdb94056828c792080ce0ee0793a3a74e13d8a78c6d504b005f9d
6
+ metadata.gz: ad573ad4cfdd39455f2720e2283e4487afaae6d17dbb451580289afdfef77b433fb426bb2cc516225db514365d788b8441efeb11ab9b0f2916accc5817d619a1
7
+ data.tar.gz: 583cb266287eaad72e28543e34003da6b72f072f1c45b751327b6218b9ed842c35639759d8f37a0fd8051167fcbd735a3c32c4b0c9443a5c4cf2074ace755a03
data/.utilsrc CHANGED
@@ -56,6 +56,7 @@ code_indexer do
56
56
  more_math
57
57
  ollama-ruby
58
58
  ostruct
59
+ reline
59
60
  reverse_markdown
60
61
  rspec
61
62
  rspec-core
data/CHANGES.md CHANGED
@@ -1,5 +1,118 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-03-18 v0.0.80
4
+
5
+ ### Output & Paging
6
+
7
+ - Remove the automatic `info` call from the main flow
8
+ - Wrap all output handling inside a `use_pager do |output|` block
9
+ - Pass the `output:` keyword to sub‑methods (`collection_stats`,
10
+ `Switches.show`, etc.)
11
+ - Adjust `Pager` to use a local `buffer` variable and `output.puts buffer`
12
+ - Update `StateSelectors.show` and `Switches.show` to accept `output: STDOUT`
13
+ and use `output.puts`
14
+ - Modify `Switches.set` to accept `output: STDOUT` and call
15
+ `self.show(output:)`
16
+
17
+ ### Collection & Runtime Info
18
+
19
+ - Change `collection_stats` signature to `output: STDOUT` and replace
20
+ `STDOUT.puts` with `output.puts`
21
+ - Show runtime‑information only when `runtime_info.on? && content` is true
22
+ - Append a JSON line for runtime‑info instead of a plain‑text list
23
+
24
+ ### Tool Call Handling
25
+
26
+ - Initialize `tools_used` hash in `OllamaChat::FollowChat#handle_tool_calls`
27
+ - Store the formatted size of each tool result using `Tins::Unit.format`
28
+ - Replace the non‑existent `full?` check with `size ==
29
+ response.message.tool_calls.size`
30
+ - Show a summary of tool call results and pause for user confirmation
31
+
32
+ ### Confirmation Prompt
33
+
34
+ - Add `confirm?` method to `OllamaChat::Dialog` for single‑character
35
+ confirmation prompts
36
+ - Replace all `ask?` calls with `confirm?`
37
+
38
+ ### Command DSL
39
+
40
+ - Add a `command` DSL in `command_concern.rb` for registering chat commands
41
+ - Include `OllamaChat::CommandConcern` in `chat.rb` and drop the old
42
+ `handle_input` logic
43
+ - Replace hard‑coded command handling with the new DSL (e.g., `/toggle`,
44
+ `/input`, `/revise`, etc.)
45
+
46
+ ### Documentation & README
47
+
48
+ - Update `README.md` to show the new `/toggle` syntax and expanded command
49
+ table
50
+ - Update `bin/ollama_chat_send` help text to reflect the renamed `/input`
51
+ command
52
+
53
+ ### Utility Helpers
54
+
55
+ - Add `go_command` helper in `dialog.rb` for parsing command‑line options
56
+ - Add `file_set_each`, `all_file_set`, and `provide_file_set_content` to
57
+ `input_content.rb`
58
+ - Update `context_spook` to use `file_set_each` and accept an `all` flag
59
+ - Add `strip_internal_json_markers` helper in `chat.rb`
60
+ - Add `choose_file_set` helper in `OllamaChat::Dialog` returning a `Set` of
61
+ expanded `Pathname` objects
62
+
63
+ ### Source Fetching & Links
64
+
65
+ - Refactor `source_fetching.rb` to coerce sources to string
66
+ - Add a lazy `links` method and remove the old `links` method from `Chat`
67
+
68
+ ### Retrieval Snippets
69
+
70
+ - Update retrieval‑snippet injection to use a JSON block instead of a
71
+ plain‑text list
72
+ - Use `strip_internal_json_markers` for `:ollama_chat_retrieval_snippets` and
73
+ `:ollama_chat_runtime_information`
74
+ - Truncate user query to `config.embedding.model.context_length` before calling
75
+ `@documents.find_where`
76
+
77
+ ### Directory Structure Tool
78
+
79
+ - Add `suffix` parameter to `directory_structure` function
80
+ - Update `OllamaChat::Utils::AnalyzeDirectory.generate_structure` to accept a
81
+ `suffix:` argument and filter files accordingly
82
+ - Ensure only files matching the given extension are included; hidden files and
83
+ symlinks remain excluded
84
+
85
+ ### Persona Management
86
+
87
+ - Update persona option labels to `keep`, `reload_default`, `choose_different`
88
+ - Add interactive persona reload options via a menu in `reload_default_persona`
89
+ - Use `SearchUI::Wrapper` and `OllamaChat::Utils::Chooser` for selection
90
+ - Update `@default_persona` when selecting “load_new”
91
+
92
+ ### Path Validation
93
+
94
+ - Add `check_file` flag to `path_validator.rb` method signature
95
+ - Guard against non‑directory parents and file existence when `check_file:true`
96
+ - Propagate `check_file` flag in calls from `file_context`, `patch_file`, and
97
+ `read_file`
98
+
99
+ ### Tests & Specs
100
+
101
+ - Adjust specs to stub `OC::PAGER`, expect `use_pager` yielding a `StringIO`,
102
+ and verify `STDOUT.puts` calls
103
+ - Update test expectations for new command handling and help output
104
+ - Expect `OllamaChat::InvalidPathError` instead of `Errno::ENOENT` in relevant
105
+ specs
106
+ - Add `asset_pathname` helper in `spec_helper.rb`
107
+
108
+ ### Miscellaneous
109
+
110
+ - Add `reline` gem to `.utilsrc` dependency list
111
+ - Consider `-c` flag to skip persona setup when loading an existing
112
+ conversation
113
+ - Standardize `register_name` method comments to `@return [String] the
114
+ registered name for this tool`
115
+
3
116
  ## 2026-03-13 v0.0.79
4
117
 
5
118
  - Added `tmp/*` to Rakefile ignore list for cleaner builds.
data/README.md CHANGED
@@ -152,48 +152,104 @@ subject - the young, blue-eyed cat.
152
152
  The following commands can be given inside the chat, if prefixed by a `/`:
153
153
 
154
154
  ```
155
- /reconnect reconnect to current ollama server
156
- /copy to copy last response to clipboard
157
- /paste to paste content
158
- /markdown toggle markdown output
159
- /stream toggle stream output
160
- /location toggle location submission
161
- /runtime_info toggle runtime information in prompts
162
- /voice [change] toggle voice output or change the voice
163
- /last [n] show the last n / 1 system/assistant message
164
- /list [n] list the last n / all conversation exchanges
165
- /clear [what] clear what=messages|links|history|tags|all
166
- /clobber clear the conversation, links, and collection
167
- /drop [n] drop the last n exchanges, defaults to 1
168
- /model change the model
169
- /system [show] change/show system prompt
170
- /prompt prefill user prompt with preset prompts
171
- /persona [add|delete|edit|file|info|list|load|play] manage and load/play personas for roleplay
172
- /revise [edit] the last answer message
173
- /collection [clear|change] change (default) collection or clear
174
- /info show information for current session
175
- /config [edit|reload] output/edit/reload current configuration ("/Users/flori/.config/ollama_chat/config.yml")
176
- /document_policy pick a scan policy for document references
177
- /think choose ollama think mode setting for models
178
- /think_loud enable to think out loud instead of silently
179
- /import source import the source's content
180
- /summarize [n] source summarize the source's content in n words
181
- /embedding toggle embedding paused or not
182
- /embed source embed the source's content
183
- /web [n] query query web & for n(=1) results (policy: importing)
184
- /links [clear] display (or clear) links used in the chat
185
- /save filename store conversation messages
186
- /load filename load conversation messages
187
- /compose compose content using an EDITOR
188
- /input [pattern] select and read content from a file (default: **/*)
189
- /context [pattern...] collect context with glob patterns
190
- /change_response edit the last response in an external editor
191
- /output filename save last response to filename
192
- /pipe command write last response to command's stdin
193
- /tools [enable|disable|on|off] list enabled, enable/disable tools, support on/off
194
- /vim insert the last message into a vim server
195
- /quit to quit
196
- /help [me] to view this help (me = interactive ai help)
155
+ ╭──────────────────┬────────────────────┬──────────────────┬──────────────────────────────────────────────────────────╮
156
+ CMD │ SUBCMD │ OPTS │ HELP │
157
+ ╞══════════════════╪════════════════════╪══════════════════╪══════════════════════════════════════════════════════════╡
158
+ /copy │ │ │ to copy last response to clipboard │
159
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
160
+ /paste │ │ │ to paste content from the clipboard │
161
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
162
+ /config │ edit │ │ output/edit/reload configuration │
163
+ │ │ reload │ │ │
164
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
165
+ /document_policy │ │ │ pick a scan policy for documents │
166
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
167
+ /toggle │ embedding﹡ │ │ toggle switch │
168
+ │ │ location﹡ │ │ │
169
+ │ │ markdown﹡ │ │ │
170
+ │ │ runtime_info﹡ │ │ │
171
+ │ │ stream﹡ │ │ │
172
+ │ │ think_loud﹡ │ │ │
173
+ │ │ voice﹡ │ │ │
174
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
175
+ /model │ │ │ change the model │
176
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
177
+ /system │ change │ │ change/show system prompt │
178
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
179
+ /think │ │ │ choose ollama think mode setting for models │
180
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
181
+ /tools │ disable │ │ list enabled, enable/disable tools, │
182
+ │ │ enable │ │ support on/off │
183
+ │ │ off │ │ │
184
+ │ │ on │ │ │
185
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
186
+ /voice │ │ │ change the voice │
187
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
188
+ /list │ │ [n=1] list the last n / all conversation exchanges │
189
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
190
+ /last │ │ [n=1] │ show the last n / 1 system/assistant message │
191
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
192
+ /drop │ │ [n=1] │ drop the last n exchanges, defaults to 1 │
193
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
194
+ /clear │ all﹡ │ │ clear these records │
195
+ │ │ history﹡ │ │ │
196
+ │ │ links﹡ │ │ │
197
+ │ │ messages﹡ │ │ │
198
+ │ │ tags﹡ │ │ │
199
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
200
+ │ /links │ clear﹡ │ │ display (or clear) links used in the chat │
201
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
202
+ │ /revise │ edit﹡ │ │ revise the last message (and/or edit the query) │
203
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
204
+ │ /prompt │ │ │ prefill user prompt with preset prompts │
205
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
206
+ │ /change_response │ │ │ edit the last response in EDITOR │
207
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
208
+ │ /save │ │ path │ store conversation messages │
209
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
210
+ │ /load │ │ path │ load conversation messages │
211
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
212
+ │ /collection │ change﹡ │ │ change (default) collection or clear │
213
+ │ │ clear﹡ │ │ │
214
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
215
+ │ /persona │ add │ │ manage and load/play personae for roleplay │
216
+ │ │ delete │ │ │
217
+ │ │ edit │ │ │
218
+ │ │ file │ │ │
219
+ │ │ info │ │ │
220
+ │ │ list │ │ │
221
+ │ │ load │ │ │
222
+ │ │ play │ │ │
223
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
224
+ │ /compose │ │ │ compose content using an EDITOR │
225
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
226
+ │ /web │ │ [number=1] query │ query web for so many results │
227
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
228
+ │ /input │ context │ [-w|-a] [arg…] │ Read content from files, URLs, or glob patterns │
229
+ │ │ context pattern │ │ and optionally transform it. │
230
+ │ │ embedding │ │ Use subcommands: context, embedding, path, summary, │
231
+ │ │ embedding pattern │ │ import (the default). │
232
+ │ │ path │ │ Use pattern mode for local files. │
233
+ │ │ path pattern │ │ Options: │
234
+ │ │ pattern │ │ -w <words> (summary subcommand only, default 100) │
235
+ │ │ summary │ │ -a (pattern mode only, include all files for patterns) │
236
+ │ │ summary pattern │ │ │
237
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
238
+ │ /pipe │ │ path │ write last response to command's stdin │
239
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
240
+ │ /vim │ │ │ insert the last message into a vim (server) │
241
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
242
+ │ /output │ │ path │ save last response to path │
243
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
244
+ │ /reconnect │ │ │ reconnect to current ollama server │
245
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
246
+ │ /quit │ │ │ quit/exit the application │
247
+ │ /exit │ │ │ │
248
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
249
+ │ /info │ │ │ show information for current session │
250
+ ├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
251
+ │ /help │ me │ │ to view this help (me=interactive ai help) │
252
+ ╰──────────────────┴────────────────────┴──────────────────┴──────────────────────────────────────────────────────────╯
197
253
  ```
198
254
 
199
255
  ### Using `ollama_chat_send` to send input to a running `ollama_chat`
@@ -221,10 +277,10 @@ endfunction
221
277
 
222
278
  The `ollama_chat_send` command now supports additional parameters to enhance functionality:
223
279
 
224
- - **Terminal Input (`-t`)**: Sends input as terminal commands, enabling special commands like `/import`.
280
+ - **Terminal Input (`-t`)**: Sends input as terminal commands, enabling special commands like `/input`.
225
281
 
226
282
  ```bash
227
- $ echo "/import https://example.com/some-content" | ollama_chat_send -t
283
+ $ echo "/input https://example.com/some-content" | ollama_chat_send -t
228
284
  ```
229
285
 
230
286
  - **Wait for Response (`-r`)**: Enables two-way communication by waiting for and returning the server's response.
data/bin/ollama_chat_send CHANGED
@@ -19,7 +19,7 @@ def usage(rc = 0)
19
19
 
20
20
  Options:
21
21
  -r Wait for the response from Ollama Chat and output it
22
- -t Send input as terminal input including commands, e. g. /import
22
+ -t Send input as terminal input including commands, e. g. /input
23
23
  -p Send input with source parsing enabled (defaults to disabled)
24
24
  -f CONFIG file to read
25
25
  -d DIR the working directory to derive the socket file from