rails_console_ai 0.15.0 → 0.16.0
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/CHANGELOG.md +7 -0
- data/lib/rails_console_ai/channel/slack.rb +13 -27
- data/lib/rails_console_ai/executor.rb +2 -2
- data/lib/rails_console_ai/version.rb +1 -1
- data/lib/rails_console_ai.rb +3 -1
- 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: e038cc77de185b7afbbc1d859400948335adfe8d69e714ef35d57a8c49fb8b34
|
|
4
|
+
data.tar.gz: e614a1ccaa212bfaa93dfb1770f3d8c5b39ee2c1e678ba3a4cab3786f7e0c86f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ba68a62e707d3b35f2fc0f7f24d9d73d930c951936f37f8ec60c34dce7975bf67e184bf05fd418db1773c9ec7d58455cf25c122477ec67bde8fcee47247fcb25
|
|
7
|
+
data.tar.gz: 3fa2a64467e090b52ae68b21f93e9a1cc15f03b445f8f9a02ec0ca51d74514211f6a4eeff551ec91858adccb7c59e1a46218191480c7e749c28538c665897287
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.16.0]
|
|
6
|
+
|
|
7
|
+
- Run migrations during setup
|
|
8
|
+
- Clarify LLM activity messages in Slack channel
|
|
9
|
+
- Clean up error messages
|
|
10
|
+
- Rotate thinking messages in Slack bot
|
|
11
|
+
|
|
5
12
|
## [0.15.0]
|
|
6
13
|
|
|
7
14
|
- Add `config.code_search_paths` to configure searchable code directories
|
|
@@ -5,24 +5,6 @@ module RailsConsoleAi
|
|
|
5
5
|
class Slack < Base
|
|
6
6
|
ANSI_REGEX = /\e\[[0-9;]*m/
|
|
7
7
|
|
|
8
|
-
THINKING_MESSAGES = [
|
|
9
|
-
"Thinking...",
|
|
10
|
-
"Reticulating splines...",
|
|
11
|
-
"Scrubbing encryption bits...",
|
|
12
|
-
"Consulting the oracle...",
|
|
13
|
-
"Rummaging through the database...",
|
|
14
|
-
"Warming up the hamster wheel...",
|
|
15
|
-
"Polishing the pixels...",
|
|
16
|
-
"Untangling the spaghetti code...",
|
|
17
|
-
"Asking the magic 8-ball...",
|
|
18
|
-
"Counting all the things...",
|
|
19
|
-
"Herding the electrons...",
|
|
20
|
-
"Dusting off the old records...",
|
|
21
|
-
"Feeding the algorithms...",
|
|
22
|
-
"Shaking the data tree...",
|
|
23
|
-
"Bribing the servers...",
|
|
24
|
-
].freeze
|
|
25
|
-
|
|
26
8
|
def initialize(slack_bot:, channel_id:, thread_ts:, user_name: nil)
|
|
27
9
|
@slack_bot = slack_bot
|
|
28
10
|
@channel_id = channel_id
|
|
@@ -47,13 +29,20 @@ module RailsConsoleAi
|
|
|
47
29
|
end
|
|
48
30
|
|
|
49
31
|
def display_dim(text)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
32
|
+
raw = strip_ansi(text)
|
|
33
|
+
stripped = raw.strip
|
|
34
|
+
|
|
35
|
+
if stripped =~ /\AThinking\.\.\.|\AAttempting to fix|\ACancelled|\A_session:/
|
|
36
|
+
post(stripped)
|
|
37
|
+
elsif stripped =~ /\ACalling LLM/
|
|
38
|
+
# Technical LLM round status — suppress in Slack
|
|
39
|
+
@output_log.write("#{stripped}\n")
|
|
40
|
+
$stdout.puts "#{@log_prefix} (dim) #{stripped}"
|
|
41
|
+
elsif raw =~ /\A {2,4}\S/ && stripped.length > 10
|
|
42
|
+
# LLM thinking text (2-space indent from conversation engine) — show as status
|
|
54
43
|
post(stripped)
|
|
55
44
|
else
|
|
56
|
-
#
|
|
45
|
+
# Tool result previews (5+ space indent) and other technical noise — log only
|
|
57
46
|
@output_log.write("#{stripped}\n")
|
|
58
47
|
$stdout.puts "#{@log_prefix} (dim) #{stripped}"
|
|
59
48
|
end
|
|
@@ -135,6 +124,7 @@ module RailsConsoleAi
|
|
|
135
124
|
- The output of `puts` in your code is automatically shown to the user. Do NOT
|
|
136
125
|
repeat or re-display data that your code already printed via `puts`.
|
|
137
126
|
Just add a brief summary after (e.g. "10 events found" or "Let me know if you need more detail").
|
|
127
|
+
- Do not offer to make changes or take actions on behalf of the user. Only report findings.
|
|
138
128
|
- This is a live production database — other processes, users, and background jobs are
|
|
139
129
|
constantly changing data. Never assume results will be the same as a previous query.
|
|
140
130
|
Always re-run queries when asked, even if you just ran the same one.
|
|
@@ -170,10 +160,6 @@ module RailsConsoleAi
|
|
|
170
160
|
RailsConsoleAi.logger.error("Slack post failed: #{e.message}")
|
|
171
161
|
end
|
|
172
162
|
|
|
173
|
-
def random_thinking_message
|
|
174
|
-
THINKING_MESSAGES.sample
|
|
175
|
-
end
|
|
176
|
-
|
|
177
163
|
def strip_ansi(text)
|
|
178
164
|
text.to_s.gsub(ANSI_REGEX, '')
|
|
179
165
|
end
|
|
@@ -140,8 +140,8 @@ module RailsConsoleAi
|
|
|
140
140
|
return nil
|
|
141
141
|
end
|
|
142
142
|
@last_error = "#{e.class}: #{e.message}"
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
backtrace = e.backtrace.first(3).map { |line| " #{line}" }.join("\n")
|
|
144
|
+
display_error("Error: #{@last_error}\n#{backtrace}")
|
|
145
145
|
@last_output = captured_output&.string
|
|
146
146
|
nil
|
|
147
147
|
end
|
data/lib/rails_console_ai.rb
CHANGED
|
@@ -94,7 +94,8 @@ module RailsConsoleAi
|
|
|
94
94
|
table = 'rails_console_ai_sessions'
|
|
95
95
|
|
|
96
96
|
if conn.table_exists?(table)
|
|
97
|
-
$stdout.puts "\e[32mRailsConsoleAi: #{table} already exists
|
|
97
|
+
$stdout.puts "\e[32mRailsConsoleAi: #{table} already exists — checking for pending migrations.\e[0m"
|
|
98
|
+
migrate!
|
|
98
99
|
else
|
|
99
100
|
conn.create_table(table) do |t|
|
|
100
101
|
t.text :query, null: false
|
|
@@ -151,6 +152,7 @@ module RailsConsoleAi
|
|
|
151
152
|
if migrations.empty?
|
|
152
153
|
$stdout.puts "\e[32mRailsConsoleAi: #{table} is up to date.\e[0m"
|
|
153
154
|
else
|
|
155
|
+
RailsConsoleAi::Session.reset_column_information if defined?(RailsConsoleAi::Session)
|
|
154
156
|
$stdout.puts "\e[32mRailsConsoleAi: added columns: #{migrations.join(', ')}.\e[0m"
|
|
155
157
|
end
|
|
156
158
|
rescue => e
|