ollama_chat 0.0.51 → 0.0.53

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: 6fb9a8c4d866252bfa8ace6399ae3a9c7b72ace633c5b98b7a5c40543be105ba
4
- data.tar.gz: d899a33db800219a4874d1db8da428dfacf14d6013fd2a2b76f58c12c7cece82
3
+ metadata.gz: 30525dbd5fcb884ff5a7a978f59e06c77b051a16007938f3eb12770b869aa6f2
4
+ data.tar.gz: 906f22197039173a58bc242b9ff7108842e9d5ec453cf2a77adb589352367fb1
5
5
  SHA512:
6
- metadata.gz: 303e0bda16f1cf0eba110271a63e40eb4563a90af5cb152465ba51bde1a3dcfaf3b317210df77cfcdc78541f1c0c0bbcf0346edfd134821928922083cc37cddd
7
- data.tar.gz: b05f2ead74ccb3e534beb407203fb26d6070715337255ab09b451b52fd355a740c0a3ceaad348091a5e302b11db4d56cd9c3c71e0e207268c4fc0a93d2231b8f
6
+ metadata.gz: e8be84b4c4e4902cdab557f81b8fdf9729fa5ec7c54c585aa8c8a3f2a76585fcc6e6344f454af579f24676252bf5dd1234664b3304f6086f9bdb9c5ecf31b92a
7
+ data.tar.gz: '0827fa2a548405d5e9208fa0c181220dd7955360882dfa3d7311756aa611594f544ac4fedb89bf9a1f0ef90be98fd952ff61bbe336749715f610a0eec9215a20'
data/CHANGES.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-01-07 v0.0.53
4
+
5
+ - Added `/compose` command functionality to compose content using an external
6
+ editor
7
+ - Introduced `OllamaChat::EnvConfig::EDITOR?` and
8
+ `OllamaChat::EnvConfig::EDITOR!` methods for editor configuration access
9
+ - Implemented `compose` method in `InputContent` module using `Tempfile` for
10
+ temporary file handling
11
+ - Added `EDITOR` configuration with default value of `vim` or `vi` if available
12
+ - Updated help text to include the new `/compose` command
13
+ - Added graceful error handling for editor failures, returning `nil` and
14
+ printing error to `STDERR`
15
+ - Required `tempfile` gem for temporary file handling functionality
16
+
17
+ ## 2026-01-06 v0.0.52
18
+
19
+ - Enabled verbose context generation to provide real-time feedback during
20
+ context collection operations
21
+ - Improved user experience by monitoring context size for LLM token limit
22
+ considerations
23
+ - Added better feedback mechanisms to help users gauge processing time during
24
+ context generation
25
+
3
26
  ## 2026-01-06 v0.0.51
4
27
 
5
28
  - Added `/input` command to allow users to select files using glob patterns
data/README.md CHANGED
@@ -180,6 +180,7 @@ The following commands can be given inside the chat, if prefixed by a `/`:
180
180
  /links [clear] display (or clear) links used in the chat
181
181
  /save filename store conversation messages
182
182
  /load filename load conversation messages
183
+ /compose compose content using an EDITOR
183
184
  /input [pattern] select and read content from a file (default: **/*)
184
185
  /context [pattern...] collect context with glob patterns
185
186
  /output filename save last response to filename
@@ -338,6 +338,8 @@ class OllamaChat::Chat
338
338
  arg and patterns = arg.scan(/(\S+)/).flatten
339
339
  @parse_content = false
340
340
  context_spook(patterns) or :next
341
+ when %r(^/compose$)
342
+ compose or :next
341
343
  when %r(^/save\s+(.+)$)
342
344
  save_conversation($1)
343
345
  :next
@@ -30,6 +30,18 @@ module OllamaChat
30
30
  end
31
31
  end
32
32
 
33
+ EDITOR = set do
34
+ description 'Editor to use'
35
+
36
+ default do
37
+ if editor = %w[ vim vi ].find { `which #{_1}`.full?(:chomp) }
38
+ editor
39
+ else
40
+ warn 'Need an editor command configured via env var "EDITOR"'
41
+ end
42
+ end
43
+ end
44
+
33
45
  DIFF_TOOL = set do
34
46
  description 'Diff tool to apply changes with'
35
47
 
@@ -147,6 +147,7 @@ module OllamaChat::Information
147
147
  /links [clear] display (or clear) links used in the chat
148
148
  /save filename store conversation messages
149
149
  /load filename load conversation messages
150
+ /compose compose content using an EDITOR
150
151
  /input [pattern] select and read content from a file (default: **/*)
151
152
  /context [pattern...] collect context with glob patterns
152
153
  /output filename save last response to filename
@@ -1,3 +1,5 @@
1
+ require 'tempfile'
2
+
1
3
  # A module that provides input content processing functionality for OllamaChat.
2
4
  #
3
5
  # The InputContent module encapsulates methods for reading and returning
@@ -74,7 +76,7 @@ module OllamaChat::InputContent
74
76
  # context_spook(nil)
75
77
  def context_spook(patterns)
76
78
  if patterns
77
- ContextSpook::generate_context(verbose: false) do |context|
79
+ ContextSpook::generate_context(verbose: true) do |context|
78
80
  context do
79
81
  Dir.glob(patterns).each do |filename|
80
82
  File.file?(filename) or next
@@ -84,8 +86,34 @@ module OllamaChat::InputContent
84
86
  end.to_json
85
87
  else
86
88
  if context_filename = choose_filename('.contexts/*.rb')
87
- ContextSpook.generate_context(context_filename, verbose: false).to_json
89
+ ContextSpook.generate_context(context_filename, verbose: true).to_json
90
+ end
91
+ end
92
+ end
93
+
94
+ # The compose method opens an editor to compose content.
95
+ #
96
+ # This method checks for a configured editor and opens a temporary file in
97
+ # that editor for the user to compose content. Upon successful editing, it
98
+ # reads the content from the temporary file and returns it. If the editor
99
+ # fails or no editor is configured, appropriate error messages are displayed
100
+ # and nil is returned.
101
+ #
102
+ # @return [ String, nil ] the composed content if successful, nil otherwise
103
+ def compose
104
+ unless editor = OllamaChat::EnvConfig::EDITOR?
105
+ STDERR.puts "Editor reqired for compose, set env var "\
106
+ "#{OllamaChat::EnvConfig::EDITOR!.env_var.inspect}."
107
+ return
108
+ end
109
+ Tempfile.open do |tmp|
110
+ system %{#{editor} #{tmp.path.inspect}}
111
+ if $?.success?
112
+ return File.read(tmp.path)
113
+ else
114
+ STDERR.puts "Editor failed to edit #{tmp.path.inspect}."
88
115
  end
89
116
  end
117
+ nil
90
118
  end
91
119
  end
@@ -1,6 +1,6 @@
1
1
  module OllamaChat
2
2
  # OllamaChat version
3
- VERSION = '0.0.51'
3
+ VERSION = '0.0.53'
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.51 ruby lib
2
+ # stub: ollama_chat 0.0.53 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "ollama_chat".freeze
6
- s.version = "0.0.51".freeze
6
+ s.version = "0.0.53".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]
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.51
4
+ version: 0.0.53
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank