ruby_todo 1.0.1 → 1.0.3
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 +5 -0
- data/delete_notebooks.rb +60 -10
- data/lib/ruby_todo/ai_assistant/openai_integration.rb +12 -8
- data/lib/ruby_todo/ai_assistant/task_management.rb +8 -4
- data/lib/ruby_todo/ai_assistant/task_search.rb +10 -7
- data/lib/ruby_todo/version.rb +1 -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: 342db9ba03efc1c1dce6d88189c62f4e137155e5495e1ad97d7f88df91bc0542
|
4
|
+
data.tar.gz: 6dee74213c99437b972b0267391ecf62561da217e167b07626cb4be9b1ffb254
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4cacbfd07becb5aca147a972fa83c840e0e9d9c3db68416b922c7cbfc32e574d9bcb8ef91ebbe46b6be783fd5a2013cf5672c5fd99c95e592b84b54a0c9ba40
|
7
|
+
data.tar.gz: 91710c2fc5314a1f332694179ed556e7d834f9f6dfc2fd1e7d8af3776b331d31b3e1f0281f61b7e293c2db8d3c64c30bde1168e582eac53dc96b186bd6bffe6c
|
data/CHANGELOG.md
CHANGED
data/delete_notebooks.rb
CHANGED
@@ -4,17 +4,67 @@
|
|
4
4
|
require_relative "lib/ruby_todo"
|
5
5
|
require_relative "lib/ruby_todo/database"
|
6
6
|
|
7
|
-
#
|
7
|
+
# Ensure database connection is established first
|
8
8
|
RubyTodo::Database.setup
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
def count_records
|
11
|
+
{
|
12
|
+
tasks: RubyTodo::Task.count,
|
13
|
+
notebooks: RubyTodo::Notebook.count,
|
14
|
+
templates: RubyTodo::Template.count
|
15
|
+
}
|
16
|
+
end
|
13
17
|
|
14
|
-
|
15
|
-
|
16
|
-
puts "
|
18
|
+
def print_counts(counts, prefix = "")
|
19
|
+
puts "#{prefix}Tasks: #{counts[:tasks]}"
|
20
|
+
puts "#{prefix}Notebooks: #{counts[:notebooks]}"
|
21
|
+
puts "#{prefix}Templates: #{counts[:templates]}"
|
22
|
+
end
|
17
23
|
|
18
|
-
|
19
|
-
|
20
|
-
|
24
|
+
def reset_sqlite_sequences
|
25
|
+
connection = ActiveRecord::Base.connection
|
26
|
+
connection.tables.each do |table|
|
27
|
+
connection.execute("DELETE FROM sqlite_sequence WHERE name='#{table}'")
|
28
|
+
puts "Reset sequence counter for table: #{table}"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
begin
|
33
|
+
# Get initial record counts
|
34
|
+
initial_counts = count_records
|
35
|
+
puts "\nCurrent record counts:"
|
36
|
+
print_counts(initial_counts)
|
37
|
+
|
38
|
+
puts "\nResetting database..."
|
39
|
+
|
40
|
+
# Drop all tables
|
41
|
+
ActiveRecord::Base.connection.tables.each do |table|
|
42
|
+
ActiveRecord::Base.connection.drop_table(table)
|
43
|
+
puts "Dropped table: #{table}"
|
44
|
+
end
|
45
|
+
|
46
|
+
# Recreate the database schema
|
47
|
+
puts "\nRecreating database schema..."
|
48
|
+
RubyTodo::Database.setup
|
49
|
+
|
50
|
+
# Reset sequence counters
|
51
|
+
puts "\nResetting sequence counters..."
|
52
|
+
reset_sqlite_sequences
|
53
|
+
|
54
|
+
# Verify the reset
|
55
|
+
final_counts = count_records
|
56
|
+
puts "\nFinal record counts:"
|
57
|
+
print_counts(final_counts)
|
58
|
+
|
59
|
+
puts "\nDatabase reset complete! All tables and sequence counters have been reset."
|
60
|
+
rescue ActiveRecord::ConnectionNotEstablished => e
|
61
|
+
puts "\nError: Could not establish database connection"
|
62
|
+
puts "Make sure the database directory exists at ~/.ruby_todo/"
|
63
|
+
puts "Error details: #{e.message}"
|
64
|
+
exit 1
|
65
|
+
rescue StandardError => e
|
66
|
+
puts "\nAn error occurred while resetting the database:"
|
67
|
+
puts e.message
|
68
|
+
puts e.backtrace
|
69
|
+
exit 1
|
70
|
+
end
|
@@ -10,7 +10,7 @@ module RubyTodo
|
|
10
10
|
ruby_todo task:list [NOTEBOOK]
|
11
11
|
- Lists all tasks in a notebook or all notebooks if no name provided
|
12
12
|
- To filter by status: ruby_todo task:list [NOTEBOOK] --status STATUS
|
13
|
-
- Example: ruby_todo task:list
|
13
|
+
- Example: ruby_todo task:list ExampleNotebook --status in_progress
|
14
14
|
|
15
15
|
2. Search tasks:
|
16
16
|
ruby_todo task:search SEARCH_TERM
|
@@ -147,10 +147,10 @@ module RubyTodo
|
|
147
147
|
prompt += "\n- To move a task to a status: ruby_todo task:move [NOTEBOOK] [TASK_ID] [STATUS]"
|
148
148
|
|
149
149
|
prompt += "\n\nExamples of specific requests and corresponding commands:"
|
150
|
-
prompt += "\n- 'show me all high priority tasks' → ruby_todo task:list
|
151
|
-
prompt += "\n- 'list tasks that are in progress' → ruby_todo task:list
|
150
|
+
prompt += "\n- 'show me all high priority tasks' → ruby_todo task:list ExampleNotebook --priority high"
|
151
|
+
prompt += "\n- 'list tasks that are in progress' → ruby_todo task:list ExampleNotebook --status in_progress"
|
152
152
|
prompt += "\n- 'show me all notebooks' → ruby_todo notebook:list"
|
153
|
-
prompt += "\n- 'move task 5 to done' → ruby_todo task:move
|
153
|
+
prompt += "\n- 'move task 5 to done' → ruby_todo task:move ExampleNotebook 5 done"
|
154
154
|
prompt
|
155
155
|
end
|
156
156
|
|
@@ -178,20 +178,24 @@ module RubyTodo
|
|
178
178
|
end
|
179
179
|
|
180
180
|
def build_final_instructions
|
181
|
+
# Get the default notebook name
|
182
|
+
default_notebook = RubyTodo::Notebook.default_notebook&.name || "YourNotebook"
|
183
|
+
|
181
184
|
prompt = "\n\nEven if no tasks match a search or if your request isn't about task movement, "
|
182
|
-
prompt += "I still need you to return a JSON response with commands and explanation."
|
185
|
+
prompt += "I still need you to return a JSON response with commands and explanation. The following examples use the current default notebook '#{default_notebook}'."
|
183
186
|
prompt += "\n\nExample JSON Response:"
|
184
187
|
prompt += "\n```json"
|
185
188
|
prompt += "\n{"
|
186
189
|
prompt += "\n \"commands\": ["
|
187
|
-
prompt += "\n \"ruby_todo task:list
|
188
|
-
prompt += "\n \"ruby_todo stats
|
190
|
+
prompt += "\n \"ruby_todo task:list #{default_notebook}\","
|
191
|
+
prompt += "\n \"ruby_todo stats #{default_notebook}\""
|
189
192
|
prompt += "\n ],"
|
190
|
-
prompt += "\n \"explanation\": \"Listing all tasks and statistics for the
|
193
|
+
prompt += "\n \"explanation\": \"Listing all tasks and statistics for the #{default_notebook} notebook\""
|
191
194
|
prompt += "\n}"
|
192
195
|
prompt += "\n```"
|
193
196
|
|
194
197
|
prompt += "\n\nNote that all commands use colons, not underscores (e.g., 'task:list', not 'task_list')."
|
198
|
+
prompt += "\n\nIf no notebook is specified in the user's request, use the default notebook '#{default_notebook}'."
|
195
199
|
prompt
|
196
200
|
end
|
197
201
|
|
@@ -278,14 +278,18 @@ module RubyTodo
|
|
278
278
|
def move_single_task(task, status)
|
279
279
|
say "\nMoving task #{task[:task_id]} in notebook #{task[:notebook]} to #{status}".blue if options[:verbose]
|
280
280
|
|
281
|
-
notebook
|
282
|
-
|
281
|
+
# Try to find the notebook, first by name, then use default if not found
|
282
|
+
notebook = RubyTodo::Notebook.find_by(name: task[:notebook]) || RubyTodo::Notebook.default_notebook
|
283
|
+
unless notebook
|
284
|
+
say "No notebook found (neither specified nor default)".red
|
285
|
+
return
|
286
|
+
end
|
283
287
|
|
284
288
|
task_record = notebook.tasks.find_by(id: task[:task_id])
|
285
|
-
return say "Task #{task[:task_id]} not found in notebook '#{
|
289
|
+
return say "Task #{task[:task_id]} not found in notebook '#{notebook.name}'".red unless task_record
|
286
290
|
|
287
291
|
if task_record.update(status: status)
|
288
|
-
say "
|
292
|
+
say "Moved task #{task[:task_id]} to #{status}".green
|
289
293
|
else
|
290
294
|
say "Error moving task #{task[:task_id]}: #{task_record.errors.full_messages.join(", ")}".red
|
291
295
|
end
|
@@ -224,16 +224,21 @@ module RubyTodo
|
|
224
224
|
private
|
225
225
|
|
226
226
|
def find_all_tasks
|
227
|
+
# Start with the default notebook if it exists
|
228
|
+
notebooks = if RubyTodo::Notebook.default_notebook
|
229
|
+
[RubyTodo::Notebook.default_notebook]
|
230
|
+
else
|
231
|
+
RubyTodo::Notebook.all
|
232
|
+
end
|
233
|
+
|
227
234
|
tasks = []
|
228
|
-
|
235
|
+
notebooks.each do |notebook|
|
229
236
|
notebook.tasks.each do |task|
|
230
237
|
tasks << {
|
238
|
+
notebook: notebook.name,
|
231
239
|
task_id: task.id,
|
232
240
|
title: task.title,
|
233
|
-
|
234
|
-
status: task.status,
|
235
|
-
tags: task.tags,
|
236
|
-
notebook: notebook.name
|
241
|
+
status: task.status
|
237
242
|
}
|
238
243
|
end
|
239
244
|
end
|
@@ -248,9 +253,7 @@ module RubyTodo
|
|
248
253
|
task_info = {
|
249
254
|
task_id: task.id,
|
250
255
|
title: task.title,
|
251
|
-
description: task.description,
|
252
256
|
status: task.status,
|
253
|
-
tags: task.tags,
|
254
257
|
notebook: notebook.name
|
255
258
|
}
|
256
259
|
|
data/lib/ruby_todo/version.rb
CHANGED