ollama_chat 0.0.111 → 0.0.112
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 +4 -4
- data/CHANGES.md +12 -0
- data/lib/ollama_chat/commands.rb +6 -3
- data/lib/ollama_chat/config_handling.rb +20 -8
- data/lib/ollama_chat/version.rb +1 -1
- data/ollama_chat.gemspec +2 -2
- data/spec/ollama_chat/config_handling_spec.rb +30 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7e680260fa6eb6e0fb4c81629a962bffba24af8824a3fe6851bf4084e5bd3172
|
|
4
|
+
data.tar.gz: 5c615c09ff36858276befde7029956941d8ee275b6da8b5bcffbe00099102d39
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3707cb40694f7dc16cc011e4e57ca73ee282809de7ee4fad0bff69f06749a11444354310f82c9ffc475ff3ace01e054d19dc94b0d71ea849e6db21bfdf56e97b
|
|
7
|
+
data.tar.gz: c878bc0af562cf7519469345bb5c800b7382b5b523fa72d5bba6fe2da2d6bebc25e4657068fc02001222f45a1aaea7163ff0e6e28bbe190c0193b47f7f2ac67d
|
data/CHANGES.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-08-25 v0.0.112
|
|
4
|
+
|
|
5
|
+
* Added a `diff` subcommand to the `/config` command, including updated
|
|
6
|
+
regexp, completion, and help text.
|
|
7
|
+
* Extracted a `diff_config` method in `OllamaChat::ConfigHandling` that
|
|
8
|
+
resolves `OC::DIFF_TOOL` and launches a diff against
|
|
9
|
+
`@ollama_chat_config.filename` and
|
|
10
|
+
`@ollama_chat_config.default_config_path`.
|
|
11
|
+
* Simplified `fix_config` to delegate the diff invocation to `diff_config`.
|
|
12
|
+
* Added `#diff_config` specs covering both the missing-diff-tool path (STDERR
|
|
13
|
+
+ `nil`) and the successful `system` invocation.
|
|
14
|
+
|
|
3
15
|
## 2026-08-25 v0.0.111
|
|
4
16
|
|
|
5
17
|
### Added
|
data/lib/ollama_chat/commands.rb
CHANGED
|
@@ -62,11 +62,11 @@ module OllamaChat::Commands
|
|
|
62
62
|
|
|
63
63
|
command(
|
|
64
64
|
name: :config,
|
|
65
|
-
regexp: %r(^/config(?:\s+(edit|reload))?$),
|
|
66
|
-
complete: [ 'config', %w[ edit reload ] ],
|
|
65
|
+
regexp: %r(^/config(?:\s+(edit|reload|diff))?$),
|
|
66
|
+
complete: [ 'config', %w[ edit reload diff ] ],
|
|
67
67
|
optional: true,
|
|
68
68
|
help: <<~EOT
|
|
69
|
-
\u2699\uFE0F View, edit, or reload configuration
|
|
69
|
+
\u2699\uFE0F View, edit, diff, or reload configuration
|
|
70
70
|
EOT
|
|
71
71
|
) do |subcommand|
|
|
72
72
|
case subcommand
|
|
@@ -74,9 +74,12 @@ module OllamaChat::Commands
|
|
|
74
74
|
edit_config
|
|
75
75
|
when 'reload'
|
|
76
76
|
reload_config
|
|
77
|
+
when 'diff'
|
|
78
|
+
diff_config
|
|
77
79
|
else
|
|
78
80
|
display_config
|
|
79
81
|
end
|
|
82
|
+
|
|
80
83
|
:next
|
|
81
84
|
end
|
|
82
85
|
|
|
@@ -44,6 +44,22 @@ module OllamaChat::ConfigHandling
|
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
+
# Opens a diff tool to compare the current config file with the
|
|
48
|
+
# default config, allowing the user to visually inspect differences.
|
|
49
|
+
#
|
|
50
|
+
# @return [Boolean, nil] the result of +system+ if a diff tool was
|
|
51
|
+
# found, or +nil+ if no diff tool is configured.
|
|
52
|
+
def diff_config
|
|
53
|
+
diff_tool = OC::DIFF_TOOL? or
|
|
54
|
+
return STDERR.puts 'No diff tool configured (OC::DIFF_TOOL).'
|
|
55
|
+
cmd = [
|
|
56
|
+
diff_tool,
|
|
57
|
+
@ollama_chat_config.filename,
|
|
58
|
+
@ollama_chat_config.default_config_path,
|
|
59
|
+
].map(&:to_s)
|
|
60
|
+
system(*cmd)
|
|
61
|
+
end
|
|
62
|
+
|
|
47
63
|
# The fix_config method handles configuration file errors by informing the
|
|
48
64
|
# user about the exception and prompting them to fix it. It then executes a
|
|
49
65
|
# diff tool to compare the current config file with the default one.
|
|
@@ -52,9 +68,9 @@ module OllamaChat::ConfigHandling
|
|
|
52
68
|
# @param exception [Exception] the exception that occurred while reading
|
|
53
69
|
# the config file
|
|
54
70
|
def fix_config(exception)
|
|
55
|
-
STDOUT.puts "When reading the config file, a #{exception.class} "\
|
|
71
|
+
STDOUT.puts "When reading the config file, a #{exception.class} " \
|
|
56
72
|
"exception was caught: #{exception.message.inspect}"
|
|
57
|
-
unless
|
|
73
|
+
unless OC::DIFF_TOOL?
|
|
58
74
|
exit 1
|
|
59
75
|
end
|
|
60
76
|
if confirm?(
|
|
@@ -62,18 +78,14 @@ module OllamaChat::ConfigHandling
|
|
|
62
78
|
yes: /\Ay/i
|
|
63
79
|
)
|
|
64
80
|
then
|
|
65
|
-
|
|
66
|
-
diff_tool,
|
|
67
|
-
@ollama_chat_config.filename,
|
|
68
|
-
@ollama_chat_config.default_config_path,
|
|
69
|
-
].map(&:to_s)
|
|
70
|
-
system(*cmd)
|
|
81
|
+
diff_config
|
|
71
82
|
exit 0
|
|
72
83
|
else
|
|
73
84
|
exit 1
|
|
74
85
|
end
|
|
75
86
|
end
|
|
76
87
|
|
|
88
|
+
|
|
77
89
|
# Adjusts the command-line argument array to ensure the current session is
|
|
78
90
|
# explicitly reloaded by injecting the `-l <session_id>` flag.
|
|
79
91
|
#
|
data/lib/ollama_chat/version.rb
CHANGED
data/ollama_chat.gemspec
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
# stub: ollama_chat 0.0.
|
|
2
|
+
# stub: ollama_chat 0.0.112 ruby lib
|
|
3
3
|
|
|
4
4
|
Gem::Specification.new do |s|
|
|
5
5
|
s.name = "ollama_chat".freeze
|
|
6
|
-
s.version = "0.0.
|
|
6
|
+
s.version = "0.0.112".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]
|
|
@@ -110,6 +110,36 @@ describe OllamaChat::ConfigHandling do
|
|
|
110
110
|
end
|
|
111
111
|
end
|
|
112
112
|
|
|
113
|
+
describe '#diff_config' do
|
|
114
|
+
context 'without a diff tool' do
|
|
115
|
+
before do
|
|
116
|
+
expect(OC).to receive(:DIFF_TOOL?).and_return(nil)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
it 'prints an error to STDERR and returns nil' do
|
|
120
|
+
expect(STDERR).to receive(:puts).with(/No diff tool configured/)
|
|
121
|
+
expect(chat.diff_config).to be_nil
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
context 'with a diff tool' do
|
|
126
|
+
before { const_conf_as('OC::DIFF_TOOL' => 'vimdiff') }
|
|
127
|
+
|
|
128
|
+
it 'launches the diff tool with config and default paths' do
|
|
129
|
+
expect(chat.instance_variable_get(:@ollama_chat_config))
|
|
130
|
+
.to receive(:filename).and_return('/cfg.yml')
|
|
131
|
+
.ordered
|
|
132
|
+
expect(chat.instance_variable_get(:@ollama_chat_config))
|
|
133
|
+
.to receive(:default_config_path).and_return('/default.yml')
|
|
134
|
+
.ordered
|
|
135
|
+
expect(chat).to receive(:system)
|
|
136
|
+
.with('vimdiff', '/cfg.yml', '/default.yml')
|
|
137
|
+
.and_return(true)
|
|
138
|
+
expect(chat.diff_config).to be true
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
113
143
|
describe '#edit_config' do
|
|
114
144
|
it 'edits the config and restarts on confirmation' do
|
|
115
145
|
expect(chat).to receive(:edit_file).and_return(true)
|