ollama_chat 0.0.115 → 0.0.117
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 +102 -0
- data/lib/ollama_chat/command_concern.rb +38 -9
- data/lib/ollama_chat/commands.rb +236 -264
- data/lib/ollama_chat/conversation.rb +2 -6
- data/lib/ollama_chat/dialog.rb +34 -0
- data/lib/ollama_chat/file_editing.rb +2 -5
- data/lib/ollama_chat/information.rb +1 -0
- data/lib/ollama_chat/message_output.rb +3 -11
- data/lib/ollama_chat/ollama_chat_config/default_config.yml +56 -30
- data/lib/ollama_chat/prompt_management.rb +1 -1
- data/lib/ollama_chat/rag_handling.rb +4 -3
- data/lib/ollama_chat/session_management.rb +109 -15
- data/lib/ollama_chat/tool_calling.rb +13 -10
- data/lib/ollama_chat/version.rb +1 -1
- data/ollama_chat.gemspec +2 -2
- data/spec/ollama_chat/chat_spec.rb +1 -1
- data/spec/ollama_chat/commands_spec.rb +30 -0
- data/spec/ollama_chat/compaction_spec.rb +5 -4
- data/spec/ollama_chat/conversation_spec.rb +3 -3
- data/spec/ollama_chat/session_management_spec.rb +84 -0
- data/spec/ollama_chat/tool_calling_spec.rb +12 -3
- 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: cbe0a034dee8079ea14e573b0e98624ebaa3311baaf60e1bd666d7f7b0d61dda
|
|
4
|
+
data.tar.gz: 2a2b0c1b00ce5db2fa4b20660d8cda86669f1bac50e62352a07953e0c327d863
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f187ae33f48c198b1aa15d680b5d7dd45e96c8ba7bcb71bf80adf5d0cb049a766d79d57d8bad32175363c490cfe94a94908b1eba4a1ba28a8b0e9896065079ed
|
|
7
|
+
data.tar.gz: 0d61b926d6e7018d5f21d52ed06d36e81ea859dc5f288a0247834def14245813f1306bf444baaf715c8ec37df20ea64d97f03279045e34eb669a29c9facadb23
|
data/CHANGES.md
CHANGED
|
@@ -1,5 +1,107 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-09-03 v0.0.117
|
|
4
|
+
|
|
5
|
+
* Fixed `/favourite` subcommand completion rendering by replacing separate
|
|
6
|
+
`add`/`delete` and type arrays in `complete` with `.product`, ensuring each
|
|
7
|
+
subcommand renders as an explicit pair (e.g., `add model`, `delete
|
|
8
|
+
persona`) instead of being independently cross-multiplied by `arguments`.
|
|
9
|
+
* Added command categories to help output:
|
|
10
|
+
* Added `category(name)` and `current_category` class methods to
|
|
11
|
+
`command_concern.rb` for tracking the active category during
|
|
12
|
+
registration.
|
|
13
|
+
* Added `category:` keyword to `command` and `Command#initialize` with
|
|
14
|
+
`attr_reader :category`.
|
|
15
|
+
* Reworked `help_message` to sort commands by `[category, name]` and
|
|
16
|
+
insert bold full-width category header rows via `colspan: 4`.
|
|
17
|
+
* Added `extend Term::ANSIColor` to the `included` block for `bold{}`
|
|
18
|
+
access.
|
|
19
|
+
* Replaced `## Section` comments in `commands.rb` with `category
|
|
20
|
+
:Section` calls.
|
|
21
|
+
* Added two new categories: `Models` (`/model`, `/think`) and `Prompts`
|
|
22
|
+
(`/prompt`, `/system`, `/suggest`).
|
|
23
|
+
* Moved session-persisted commands (`/toggle`, `/tools`, `/voice`,
|
|
24
|
+
`/document_policy`, `/context_format`) under `category :Session`.
|
|
25
|
+
* Moved `/change_response` and `/conversation` under `category
|
|
26
|
+
:Conversation`.
|
|
27
|
+
* Reduced `Settings` to app-level commands only (`/config`,
|
|
28
|
+
`/favourite`).
|
|
29
|
+
* Made `report_session` a pure generator:
|
|
30
|
+
* Removed `&block` parameter and `block&.(result)` call from
|
|
31
|
+
`report_session`, eliminating the infobar side-effect that caused
|
|
32
|
+
double output.
|
|
33
|
+
* Simplified `report_conversation` to call `report_session(name:)`
|
|
34
|
+
without a block; display logic (pager or file write) is the sole
|
|
35
|
+
consumer of the returned string.
|
|
36
|
+
* Removed `@param block [Proc]` from `report_session` YARD docs.
|
|
37
|
+
|
|
38
|
+
## 2026-09-03 v0.0.116
|
|
39
|
+
|
|
40
|
+
### Added
|
|
41
|
+
|
|
42
|
+
* `session.roleplay_story` prompt in `default_config.yml` for narrative
|
|
43
|
+
retelling of roleplay sessions via `/conversation report`.
|
|
44
|
+
* `session.coding_brief` prompt in `default_config.yml`.
|
|
45
|
+
* `summarize` and `report` subcommands to `/conversation`.
|
|
46
|
+
* `summarize_conversation(sentence:, save:)` and `report_conversation(name:,
|
|
47
|
+
save:)` methods in `session_management.rb` to handle filename prompts,
|
|
48
|
+
overwrite checks, and I/O.
|
|
49
|
+
* `report_session(name:, &block)` method using `messages.compacted_messages` to
|
|
50
|
+
keep interpolated content bounded after compaction.
|
|
51
|
+
* `Status:` line with `✅`/`⛔` indicators to `collection_stats` in
|
|
52
|
+
`information.rb`.
|
|
53
|
+
* `✅`/`⛔` prefixes to `list_collections` in `rag_handling.rb` to replace
|
|
54
|
+
`[DISABLED]` text suffixes.
|
|
55
|
+
* `✅`/`⛔` indicators for enabled/disabled states and `❔`/`⭕` for
|
|
56
|
+
confirmation requirements in `list_tools` in `tool_calling.rb`.
|
|
57
|
+
* `ask_for_filename?(action:)` and `should_overwrite?(filename)` helpers in
|
|
58
|
+
`dialog.rb` with YARD documentation.
|
|
59
|
+
* Specs for `summarize_conversation`, `report_session`, and
|
|
60
|
+
`report_conversation` in `session_management_spec.rb`.
|
|
61
|
+
* Routing specs for `/conversation summarize` and `/conversation report` in
|
|
62
|
+
`commands_spec.rb`.
|
|
63
|
+
* YARD documentation for `repair_group_uuids`.
|
|
64
|
+
|
|
65
|
+
### Changed
|
|
66
|
+
|
|
67
|
+
* Moved `summarize` subcommand from `/session` to `/conversation`.
|
|
68
|
+
* Reworked compaction prompt to a draft-rewrite model, treating previous
|
|
69
|
+
summaries as drafts to be rewritten rather than ambient context.
|
|
70
|
+
* Replaced "6-12 sentences" constraint in compaction prompt with "Be concise;
|
|
71
|
+
skip filler and repetition".
|
|
72
|
+
* Changed `assemble: |-` to `assemble: |` in compaction prompt to preserve
|
|
73
|
+
trailing newlines.
|
|
74
|
+
* Widened factuality scope in compaction prompt to include "groups or previous
|
|
75
|
+
summary above".
|
|
76
|
+
* Wrapped `list_tools` body in `use_pager`, redirecting writes through the
|
|
77
|
+
yielded `output` IO.
|
|
78
|
+
* Passed `output:` keyword argument to `tools_support.show(output:)`.
|
|
79
|
+
* Replaced inline `File.exist?` and `confirm?` blocks in
|
|
80
|
+
`conversation.rb#save_conversation`,
|
|
81
|
+
`message_output.rb#attempt_to_write_file`, `session_management.rb`, and
|
|
82
|
+
`file_editing.rb#determine_valid_output_filename` with the shared
|
|
83
|
+
`should_overwrite?` helper.
|
|
84
|
+
* Updated `chat_spec.rb` `collection_stats` regex to include the new `Status:
|
|
85
|
+
✅` line.
|
|
86
|
+
* Updated `tool_calling_spec.rb` `list_tools` regex to use `✅`/`⛔` instead of
|
|
87
|
+
`✓`/`☐`.
|
|
88
|
+
* Updated `tool_calling_spec.rb` `#list_tools` example to stub `use_pager` with
|
|
89
|
+
a `StringIO` yield.
|
|
90
|
+
* Updated `conversation_spec.rb` expectations for `Pathname` type and
|
|
91
|
+
`should_overwrite?` STDERR output.
|
|
92
|
+
* Updated comment in `lib/ollama_chat/prompt_management.rb` to reflect new
|
|
93
|
+
naming convention for prompt templates (e.g., `suggest.coding`).
|
|
94
|
+
* Rewrapped `prompts.suggest.roleplaying` few-shot examples to stay within 80
|
|
95
|
+
columns in `default_config.yml`.
|
|
96
|
+
* Fixed stale YARD example in `session_management.rb#report_session`
|
|
97
|
+
(`roleplay_report` to `roleplay_story`).
|
|
98
|
+
|
|
99
|
+
### Removed
|
|
100
|
+
|
|
101
|
+
* `pretty:` keyword argument from `summarize_session` and
|
|
102
|
+
`summarize_conversation`; markdown formatting is now the only path.
|
|
103
|
+
* `%{message_thinking}` from the `session_summarize` prompt.
|
|
104
|
+
|
|
3
105
|
## 2026-09-01 v0.0.115
|
|
4
106
|
|
|
5
107
|
* Added `OllamaChat::Tools::ExecuteShell` in
|
|
@@ -11,6 +11,20 @@ module OllamaChat::CommandConcern
|
|
|
11
11
|
# `Command` instances.
|
|
12
12
|
attr_accessor :commands
|
|
13
13
|
|
|
14
|
+
# @return [Symbol] the category currently in effect for new commands
|
|
15
|
+
def current_category
|
|
16
|
+
(@category || :Misc).to_sym
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Set the category that subsequent `command` registrations will be
|
|
20
|
+
# assigned to. Commands registered without an explicit `category:`
|
|
21
|
+
# keyword inherit the current category (defaults to `:Misc`).
|
|
22
|
+
#
|
|
23
|
+
# @param name [String, Symbol] the category name
|
|
24
|
+
def category(name)
|
|
25
|
+
@category = name.to_sym
|
|
26
|
+
end
|
|
27
|
+
|
|
14
28
|
# Register a new command.
|
|
15
29
|
#
|
|
16
30
|
# @param name [String, Symbol] The primary name of the command.
|
|
@@ -24,17 +38,19 @@ module OllamaChat::CommandConcern
|
|
|
24
38
|
# @param options [String, nil] A string describing command options
|
|
25
39
|
# for help output.
|
|
26
40
|
# @param help [String, nil] Short help text for the command.
|
|
41
|
+
# @param category [Symbol] Category for grouping in help output
|
|
42
|
+
# (defaults to `current_category`).
|
|
27
43
|
# @yield [context] Block that receives a binding context for
|
|
28
44
|
# execution. The block must be provided.
|
|
29
45
|
#
|
|
30
46
|
# @raise [ArgumentError] if a command with the same name already
|
|
31
47
|
# exists or if no block is given.
|
|
32
|
-
def command(name:, regexp:, complete: nil, optional: false, options: nil, help: nil, &block)
|
|
48
|
+
def command(name:, regexp:, complete: nil, optional: false, options: nil, help: nil, category: current_category, &block)
|
|
33
49
|
name = name.to_sym
|
|
34
50
|
commands.key?(name) and
|
|
35
51
|
raise ArgumentError, "command #{name} already registered!"
|
|
36
|
-
commands[name] =Command.new(
|
|
37
|
-
name:, regexp:, complete:, optional:, options:, help:, &block
|
|
52
|
+
commands[name] = Command.new(
|
|
53
|
+
name:, regexp:, complete:, optional:, options:, help:, category:, &block
|
|
38
54
|
)
|
|
39
55
|
end
|
|
40
56
|
|
|
@@ -52,15 +68,18 @@ module OllamaChat::CommandConcern
|
|
|
52
68
|
#
|
|
53
69
|
# @param pattern [String, Regexp, nil] An optional pattern to filter
|
|
54
70
|
# commands by their names.
|
|
55
|
-
# @return [Terminal::Table] A table with columns CMD, SUBCMD, OPTS, HELP
|
|
71
|
+
# @return [Terminal::Table] A table with columns CMD, SUBCMD, OPTS, HELP,
|
|
72
|
+
# with bold category header rows inserted between groups.
|
|
56
73
|
def help_message(pattern = nil)
|
|
57
74
|
table = Terminal::Table.new
|
|
58
75
|
table.style = {
|
|
59
76
|
all_separators: true,
|
|
60
77
|
border: :unicode_round,
|
|
61
78
|
}
|
|
62
|
-
table.headings
|
|
63
|
-
commands.
|
|
79
|
+
table.headings = %w[ CMD SUBCMD OPTS HELP ]
|
|
80
|
+
sorted_commands = self.commands.sort_by { [ _2.category, _2.name ] }.map(&:last)
|
|
81
|
+
cat = nil
|
|
82
|
+
sorted_commands.each do |command|
|
|
64
83
|
command.help or next
|
|
65
84
|
if pattern
|
|
66
85
|
command.command_names.any? { _1 =~ pattern } or next
|
|
@@ -72,6 +91,10 @@ module OllamaChat::CommandConcern
|
|
|
72
91
|
[ _1, (?﹡ unless command.optional?) ].compact.join
|
|
73
92
|
}.sort.join(?\n)
|
|
74
93
|
}
|
|
94
|
+
if cat != command.category
|
|
95
|
+
cat = command.category
|
|
96
|
+
table << [ { value: bold{cat}, colspan: 4 } ]
|
|
97
|
+
end
|
|
75
98
|
table << [
|
|
76
99
|
"%s" % command.command_names.map { ?/ + _1 }.join(?\n),
|
|
77
100
|
'%s' % subcommands,
|
|
@@ -91,6 +114,8 @@ module OllamaChat::CommandConcern
|
|
|
91
114
|
delegate :command_completions, to: self
|
|
92
115
|
|
|
93
116
|
delegate :help_message, to: self
|
|
117
|
+
|
|
118
|
+
extend Term::ANSIColor
|
|
94
119
|
end
|
|
95
120
|
|
|
96
121
|
# Represents a registered command in the OllamaChat command DSL.
|
|
@@ -117,13 +142,14 @@ module OllamaChat::CommandConcern
|
|
|
117
142
|
# @param optional [Boolean] Whether the command is optional.
|
|
118
143
|
# @param options [String, nil] Options description.
|
|
119
144
|
# @param help [String] Help text.
|
|
145
|
+
# @param category [Symbol] Category for grouping in help output.
|
|
120
146
|
# @yield [context] Execution block.
|
|
121
147
|
#
|
|
122
148
|
# @raise [ArgumentError] if no block is given.
|
|
123
|
-
def initialize(name:, regexp:, complete: nil, optional: false, options: nil, help:, &block)
|
|
149
|
+
def initialize(name:, regexp:, complete: nil, optional: false, options: nil, help:, category:, &block)
|
|
124
150
|
block or raise ArgumentError, 'require &block'
|
|
125
|
-
@name, @regexp, @optional, @options, @help, @block =
|
|
126
|
-
name, regexp, optional, options, help, block
|
|
151
|
+
@name, @regexp, @optional, @options, @help, @category, @block =
|
|
152
|
+
name, regexp, optional, options, help, category, block
|
|
127
153
|
@complete = Array(complete || name.to_s).map { Array(_1) }
|
|
128
154
|
end
|
|
129
155
|
|
|
@@ -133,6 +159,9 @@ module OllamaChat::CommandConcern
|
|
|
133
159
|
# @return [String] Help text for the command.
|
|
134
160
|
attr_reader :help
|
|
135
161
|
|
|
162
|
+
# @return [Symbol] Category for grouping in help output.
|
|
163
|
+
attr_reader :category
|
|
164
|
+
|
|
136
165
|
# @return [String, nil] Options description.
|
|
137
166
|
attr_reader :options
|
|
138
167
|
|