ruby_todo 1.0.0 → 1.0.1

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.
@@ -10,112 +10,86 @@ module RubyTodo
10
10
  def setup
11
11
  return if ActiveRecord::Base.connected?
12
12
 
13
- db_path = File.expand_path("~/.ruby_todo/todo.db")
14
- FileUtils.mkdir_p(File.dirname(db_path))
13
+ ensure_database_directory
14
+ establish_connection
15
+ create_tables
16
+ end
17
+
18
+ private
15
19
 
20
+ def ensure_database_directory
21
+ db_dir = File.expand_path("~/.ruby_todo")
22
+ FileUtils.mkdir_p(db_dir)
23
+ end
24
+
25
+ def establish_connection
26
+ db_path = File.expand_path("~/.ruby_todo/ruby_todo.db")
16
27
  ActiveRecord::Base.establish_connection(
17
28
  adapter: "sqlite3",
18
29
  database: db_path
19
30
  )
20
-
21
- create_tables unless tables_exist?
22
- check_schema_version
23
- end
24
-
25
- private
26
-
27
- def tables_exist?
28
- ActiveRecord::Base.connection.tables.include?("notebooks") &&
29
- ActiveRecord::Base.connection.tables.include?("tasks") &&
30
- ActiveRecord::Base.connection.tables.include?("schema_migrations")
31
31
  end
32
32
 
33
33
  def create_tables
34
+ connection = ActiveRecord::Base.connection
35
+
34
36
  ActiveRecord::Schema.define do
35
- create_table :notebooks do |t|
36
- t.string :name, null: false
37
- t.timestamps
37
+ unless connection.table_exists?(:notebooks)
38
+ create_table :notebooks do |t|
39
+ t.string :name, null: false
40
+ t.boolean :is_default, default: false
41
+ t.timestamps
42
+ end
38
43
  end
39
44
 
40
- create_table :tasks do |t|
41
- t.references :notebook, null: false, foreign_key: true
42
- t.string :title, null: false
43
- t.string :status, null: false, default: "todo"
44
- t.text :description
45
- t.datetime :due_date
46
- t.string :priority
47
- t.string :tags
48
- t.timestamps
45
+ unless connection.table_exists?(:tasks)
46
+ create_table :tasks do |t|
47
+ t.references :notebook, null: false
48
+ t.string :title, null: false
49
+ t.text :description
50
+ t.string :status, default: "todo"
51
+ t.datetime :due_date
52
+ t.string :priority
53
+ t.string :tags
54
+ t.timestamps
55
+ end
49
56
  end
50
57
 
51
- create_table :templates do |t|
52
- t.references :notebook, foreign_key: true
53
- t.string :name, null: false
54
- t.string :title_pattern, null: false
55
- t.text :description_pattern
56
- t.string :tags_pattern
57
- t.string :priority
58
- t.string :due_date_offset
59
- t.timestamps
58
+ unless connection.table_exists?(:templates)
59
+ create_table :templates do |t|
60
+ t.string :name, null: false
61
+ t.string :title_pattern, null: false
62
+ t.text :description_pattern
63
+ t.string :priority
64
+ t.string :tags_pattern
65
+ t.string :due_date_offset
66
+ t.references :notebook
67
+ t.timestamps
68
+ end
60
69
  end
61
70
 
62
- add_index :tasks, %i[notebook_id status]
63
- add_index :tasks, :priority
64
- add_index :tasks, :due_date
65
- add_index :templates, :name, unique: true
66
-
67
- create_table :schema_migrations do |t|
68
- t.integer :version, null: false
71
+ # Add indexes if they don't exist
72
+ unless connection.index_exists?(:tasks, %i[notebook_id status])
73
+ add_index :tasks, %i[notebook_id status]
69
74
  end
70
- end
71
75
 
72
- # Set initial schema version
73
- ActiveRecord::Base.connection.execute("INSERT INTO schema_migrations (version) VALUES (2)")
74
- end
76
+ unless connection.index_exists?(:tasks, :priority)
77
+ add_index :tasks, :priority
78
+ end
75
79
 
76
- def check_schema_version
77
- # Get current schema version
78
- current_version = ActiveRecord::Base.connection.select_value("SELECT MAX(version) FROM schema_migrations").to_i
80
+ unless connection.index_exists?(:tasks, :due_date)
81
+ add_index :tasks, :due_date
82
+ end
79
83
 
80
- # If needed, perform migrations
81
- if current_version < 1
82
- upgrade_to_version_1
83
- end
84
+ unless connection.index_exists?(:templates, :name)
85
+ add_index :templates, :name, unique: true
86
+ end
84
87
 
85
- if current_version < 2
86
- upgrade_to_version_2
88
+ unless connection.index_exists?(:notebooks, :is_default)
89
+ add_index :notebooks, :is_default
90
+ end
87
91
  end
88
92
  end
89
-
90
- def upgrade_to_version_1
91
- ActiveRecord::Base.connection.execute(<<-SQL)
92
- ALTER TABLE tasks ADD COLUMN priority STRING;
93
- ALTER TABLE tasks ADD COLUMN tags STRING;
94
- SQL
95
-
96
- ActiveRecord::Base.connection.execute("UPDATE schema_migrations SET version = 1")
97
- end
98
-
99
- def upgrade_to_version_2
100
- ActiveRecord::Base.connection.execute(<<-SQL)
101
- CREATE TABLE templates (
102
- id INTEGER PRIMARY KEY AUTOINCREMENT,
103
- notebook_id INTEGER,
104
- name VARCHAR NOT NULL,
105
- title_pattern VARCHAR NOT NULL,
106
- description_pattern TEXT,
107
- tags_pattern VARCHAR,
108
- priority VARCHAR,
109
- due_date_offset VARCHAR,
110
- created_at DATETIME NOT NULL,
111
- updated_at DATETIME NOT NULL,
112
- FOREIGN KEY (notebook_id) REFERENCES notebooks(id)
113
- );
114
- CREATE UNIQUE INDEX index_templates_on_name ON templates (name);
115
- SQL
116
-
117
- ActiveRecord::Base.connection.execute("UPDATE schema_migrations SET version = 2")
118
- end
119
93
  end
120
94
  end
121
95
  end
@@ -5,8 +5,30 @@ require "active_record"
5
5
  module RubyTodo
6
6
  class Notebook < ActiveRecord::Base
7
7
  has_many :tasks, dependent: :destroy
8
+ has_many :templates
8
9
 
9
- validates :name, presence: true, uniqueness: true
10
+ validates :name, presence: true
11
+ validates :name, uniqueness: true
12
+
13
+ scope :default, -> { where(is_default: true).first }
14
+
15
+ before_create :set_default_if_first
16
+ before_save :ensure_only_one_default
17
+
18
+ def self.default_notebook
19
+ find_by(is_default: true)
20
+ end
21
+
22
+ def make_default!
23
+ transaction do
24
+ Notebook.where.not(id: id).update_all(is_default: false)
25
+ update!(is_default: true)
26
+ end
27
+ end
28
+
29
+ def is_default?
30
+ is_default
31
+ end
10
32
 
11
33
  def tasks_by_status(status)
12
34
  tasks.where(status: status)
@@ -59,16 +81,28 @@ module RubyTodo
59
81
  def statistics
60
82
  {
61
83
  total: tasks.count,
62
- todo: todo_tasks.count,
63
- in_progress: in_progress_tasks.count,
64
- done: done_tasks.count,
65
- archived: archived_tasks.count,
66
- overdue: overdue_tasks.count,
67
- due_soon: due_soon_tasks.count,
68
- high_priority: high_priority_tasks.count,
69
- medium_priority: medium_priority_tasks.count,
70
- low_priority: low_priority_tasks.count
84
+ todo: tasks.where(status: "todo").count,
85
+ in_progress: tasks.where(status: "in_progress").count,
86
+ done: tasks.where(status: "done").count,
87
+ archived: tasks.where(status: "archived").count,
88
+ overdue: tasks.select(&:overdue?).count,
89
+ due_soon: tasks.select(&:due_soon?).count,
90
+ high_priority: tasks.where(priority: "high").count,
91
+ medium_priority: tasks.where(priority: "medium").count,
92
+ low_priority: tasks.where(priority: "low").count
71
93
  }
72
94
  end
95
+
96
+ private
97
+
98
+ def set_default_if_first
99
+ self.is_default = true if Notebook.count.zero?
100
+ end
101
+
102
+ def ensure_only_one_default
103
+ return unless is_default_changed? && is_default?
104
+
105
+ Notebook.where.not(id: id).update_all(is_default: false)
106
+ end
73
107
  end
74
108
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyTodo
4
- VERSION = "1.0.0"
4
+ VERSION = "1.0.1"
5
5
  end
@@ -0,0 +1,126 @@
1
+ # AI Assistant Command Tests
2
+
3
+ This document tracks the testing of the `ruby_todo ai:ask` command with various natural language inputs to ensure all CLI functionalities work correctly.
4
+
5
+ ## Test Methodology
6
+
7
+ For each test:
8
+ 1. Run `ruby delete_notebooks.rb` to reset the environment
9
+ 2. Run `echo "y" | ruby_todo import protectors_tasks.json` to restore test data
10
+ 3. Run the test command
11
+ 4. Verify the expected behavior
12
+
13
+ ## Test Results
14
+
15
+ | Command Type | Natural Language Query | Expected Behavior | Result | Notes |
16
+ |--------------|------------------------|-------------------|--------|-------|
17
+ | Move Task | "move migrate arbitration-tf-shared to github actions" | Move task with ID 85 to in_progress status | ✅ Success | Successfully moved task to in_progress and provided confirmation message |
18
+ | Move Multiple Tasks | "move migrate arbitration-tf-shared and awsappman-tf-accounts-management to github actions" | Move tasks with IDs 104 and 105 to in_progress status | ✅ Success | Successfully moved both tasks to in_progress and provided confirmation message |
19
+ | Special Pattern Search | "move all migrate to barracuda org tasks to done" | Move all barracuda-related tasks (IDs 119-122) to done status | ✅ Success | Successfully identified and moved 4 barracuda-related tasks to done status |
20
+ | Generic Repository Pattern | "move acme tasks to done" | Move task with "acme org" in title to done status | ✅ Success | Successfully identified and moved task with generic repository pattern |
21
+ | Generic Repository Pattern (Different Syntax) | "move tasks related to quantum org to in_progress" | Move task with "quantum org" in title to in_progress status | ✅ Success | Successfully identified and moved task with different repository pattern syntax |
22
+ | Generic Repository Pattern (GitHub) | "move task with Move app-repo/frontend to GitHub to todo" | Move task with "GitHub" in title to todo status | ✅ Success | Successfully identified and moved task with GitHub migration pattern |
23
+ | Move to Archived | "move tappy-tf-shared to archived" | Move task with ID 149 to archived status | ✅ Success | Successfully moved task to archived status |
24
+ | Status Mapping | "move tappy-aws-infrastructure to pending" | Move task with ID 166 to todo status | ✅ Success | Successfully mapped "pending" to "todo" status |
25
+ | Partial Title Search | "move Add New Relic to in progress" | Move tasks with "New Relic" in their titles to in_progress status | ✅ Success | Successfully found and moved 4 matching tasks |
26
+ | Task Listing | "show me all high priority tasks" | Show high priority tasks | ✅ Success | Now directly handles priority-filtered task listing |
27
+ | Task Listing | "show me all medium priority tasks" | Show medium priority tasks | ✅ Success | Shows all medium priority tasks in default notebook |
28
+ | Task Listing | "show me all todo tasks" | Show tasks with todo status | ✅ Success | Shows all tasks with todo status in default notebook |
29
+ | Task Listing | "show me all in progress tasks" | Show tasks with in_progress status | ✅ Success | Shows all tasks with in_progress status in default notebook |
30
+ | Notebook Listing | "show me all notebooks" | Show all notebooks | ✅ Success | Displays all notebooks in the system |
31
+ | Statistics Request | "show statistics for protectors notebook" | Show notebook statistics | ✅ Success | Now directly handles statistics for specific notebooks |
32
+ | Task Creation | "create a new task called 'Test task creation via AI' with high priority" | Create a new task | ✅ Success | Successfully creates new tasks with specified priority |
33
+ | Move All Tasks | "move all tasks to todo" | Move all tasks to todo status | ✅ Success | Successfully moved all tasks in the notebook to todo status |
34
+ | Move All Tasks (Different Status) | "move all tasks to in_progress" | Move all tasks to in_progress status | ✅ Success | Successfully moved all tasks in the notebook to in_progress status |
35
+
36
+ ## Final Smoke Test Results
37
+
38
+ After implementing all direct command handlers, a comprehensive smoke test was conducted to verify the functionality of all supported commands:
39
+
40
+ | Command Type | Test Command | Result | Notes |
41
+ |--------------|--------------|--------|-------|
42
+ | Task Movement | "move Add New Relic to in progress" | ✅ Success | Successfully moved 4 tasks to in_progress status |
43
+ | Priority Filtering | "show me all high priority tasks" | ✅ Success | Correctly displayed all high priority tasks |
44
+ | Priority Filtering | "show me all medium priority tasks" | ✅ Success | Correctly displayed all medium priority tasks |
45
+ | Status Filtering | "show me all todo tasks" | ✅ Success | Correctly displayed all todo tasks |
46
+ | Notebook Listing | "show all notebooks" | ✅ Success | Correctly displayed all notebooks |
47
+ | Statistics | "show statistics for protectors notebook" | ✅ Success | Correctly displayed statistics for the notebook |
48
+ | Task Creation (Quoted) | "create a new task called 'Smoke test AI assistant' with high priority" | ✅ Success | Successfully created new task with high priority |
49
+ | Task Movement (Specific) | "move Smoke test AI assistant to in_progress" | ✅ Success | Successfully moved created task to in_progress |
50
+ | Task Creation (Unquoted) | "add a task for final verification" | ✅ Success | Successfully created task without quoted title |
51
+ | Status Filtering | "show me all in progress tasks" | ✅ Success | Correctly displayed all in-progress tasks including newly created ones |
52
+ | Bulk Task Movement | "move all tasks to todo" | ✅ Success | Successfully moved all tasks in the default notebook to todo status |
53
+ | Bulk Task Movement (Alt) | "move all tasks to in_progress" | ✅ Success | Successfully moved all tasks in the default notebook to in_progress status |
54
+ | Repository Migration | "move migrate repositories to in progress" | ✅ Success | Successfully moved all repository migration tasks regardless of organization name |
55
+ | Repository Migration (Other Org) | "move acme tasks to done" | ✅ Success | Successfully identified and moved repository migration tasks for non-barracuda organizations |
56
+ | Repository Migration (Different Syntax) | "move tasks related to quantum org to in_progress" | ✅ Success | Successfully identified and moved task with "repo/name to org" pattern |
57
+ | Repository Migration (GitHub) | "move task with Move app-repo/frontend to GitHub to todo" | ✅ Success | Successfully identified and moved task with GitHub migration pattern |
58
+
59
+ The smoke test confirms that all implemented AI assistant functionality is working as expected. The direct command handlers successfully bypass the OpenAI API for common queries, making these operations faster and more reliable.
60
+
61
+ ## Conclusions
62
+
63
+ The AI assistant has been significantly improved and now works effectively for:
64
+ 1. Task movement operations (as before)
65
+ - Single task movement
66
+ - Multiple task movement with compound search terms
67
+ - Special pattern recognition (repository migrations for any organization, not just "barracuda org")
68
+ - Support for different repository migration syntax patterns (both "to org" and "repo/name" formats)
69
+ - GitHub migration pattern recognition
70
+ - Status mappings (e.g., "pending" → "todo", "github actions" → "in_progress")
71
+ - Different statuses (todo, in_progress, done, archived)
72
+ - Bulk operations on all tasks ("move all tasks to...")
73
+
74
+ 2. Task listing operations
75
+ - Priority-filtered listings (high, medium)
76
+ - Status-filtered listings (todo, in_progress, done, archived)
77
+ - Notebook listings
78
+
79
+ 3. Statistics operations
80
+ - Notebook-specific statistics
81
+ - Global statistics
82
+
83
+ 4. Task creation
84
+ - Creating tasks with specified titles
85
+ - Setting priorities (high, medium, low)
86
+ - Adding to specific notebooks
87
+
88
+ The direct handling approach bypasses the AI model for common queries, making these operations consistently reliable and efficient.
89
+
90
+ Areas for further improvement:
91
+ 1. Add direct handling for task editing and deletion
92
+ 2. Add direct handling for template-related operations
93
+ 3. Add direct handling for due dates and tags in task creation
94
+ 4. Improve natural language understanding for complex queries
95
+
96
+ These enhancements will require adding pattern recognition for each command type and implementing the corresponding CLI commands directly.
97
+
98
+ ## Implementation Notes
99
+
100
+ The following approaches were used to improve the AI assistant:
101
+
102
+ 1. **Direct command handling**: Added pattern matching for common queries to bypass the AI and execute CLI commands directly
103
+ 2. **Improved error handling**: Enhanced command execution to better handle formatting issues and provide detailed debugging
104
+ 3. **Status mapping**: Fixed status mapping so that terms like "pending" correctly map to "todo"
105
+ 4. **Enhanced OpenAI system prompt**: Updated to provide clearer examples of command formats and expected outputs
106
+ 5. **Response cleaning**: Improved JSON parsing to handle malformed responses from the AI model
107
+ 6. **Intelligent pattern extraction**: Added logic to extract task titles, priorities, and notebook names from natural language queries
108
+ 7. **Contextual defaults**: Used the default notebook when specific notebooks aren't mentioned in queries
109
+ 8. **Special case handling**: Added special token pattern recognition for bulk operations like "move all tasks"
110
+ 9. **Generic pattern matching**: Updated repository migration pattern to work with any organization name, not just "barracuda"
111
+ 10. **Flexible syntax support**: Enhanced pattern matching to recognize different formats of repository migration commands
112
+ 11. **GitHub integration**: Added support for GitHub migration patterns in task search and movement
113
+
114
+ These changes have greatly improved the reliability and consistency of the AI assistant, particularly for common task and notebook operations. The AI-powered system now provides a robust natural language interface that makes task management more intuitive and efficient.
115
+
116
+ ## Next Steps
117
+
118
+ For future development, consider:
119
+
120
+ 1. **Expanding direct command handling**: Add handlers for remaining command types
121
+ 2. **Improving natural language processing**: Enhance pattern extraction for more complex queries
122
+ 3. **Adding conversational context**: Support follow-up queries that reference previous interactions
123
+ 4. **Implementing task editing**: Allow users to modify existing tasks via natural language
124
+ 5. **Supporting batch operations**: Enable operations across multiple notebooks at once
125
+
126
+ The combination of direct command handling and AI-based fallback provides a robust architecture that balances reliability with flexibility.
@@ -0,0 +1,159 @@
1
+ {
2
+ "name": "cox",
3
+ "created_at": "2024-04-01T00:00:00Z",
4
+ "updated_at": "2024-04-01T00:00:00Z",
5
+ "tasks": [
6
+ {
7
+ "title": "Add New Relic to tappy api",
8
+ "description": "Implement New Relic monitoring for tappy api",
9
+ "status": "todo",
10
+ "priority": "high",
11
+ "tags": "newrelic,monitoring,tappy",
12
+ "due_date": null
13
+ },
14
+ {
15
+ "title": "Add New Relic alerts and Pager Duty to Mission Control",
16
+ "description": "Implement New Relic alerts with low urgency Pager Duty integration for Mission Control",
17
+ "status": "todo",
18
+ "priority": "medium",
19
+ "tags": "newrelic,alerts,pagerduty,mission-control",
20
+ "due_date": null
21
+ },
22
+ {
23
+ "title": "Update assurance-postsale infrastructure",
24
+ "description": "Migrate to application load balancer, add New Relic infrastructure and alerts, update to Amazon Linux 2023, and update from OpenJDK8 to OpenJDK21 (EOL). Lock Docker image version instead of using latest.",
25
+ "status": "todo",
26
+ "priority": "high",
27
+ "tags": "migration,newrelic,infra,amazon-linux,openjdk,docker",
28
+ "due_date": null
29
+ },
30
+ {
31
+ "title": "Update apms-db-converter infrastructure",
32
+ "description": "Migrate to application load balancer, add New Relic infrastructure and alerts, update to Amazon Linux 2023, and update from OpenJDK8 to OpenJDK21 (EOL). Lock Docker image version instead of using latest.",
33
+ "status": "todo",
34
+ "priority": "high",
35
+ "tags": "migration,newrelic,infra,amazon-linux,openjdk,docker",
36
+ "due_date": null
37
+ },
38
+ {
39
+ "title": "Migrate MAN-Vintage/questions-engine-frontend to barracuda org",
40
+ "description": "Repository migration from MAN-Vintage to barracuda organization",
41
+ "status": "todo",
42
+ "priority": "medium",
43
+ "tags": "migration,repository,barracuda,vintage",
44
+ "due_date": null
45
+ },
46
+ {
47
+ "title": "Migrate MAN-Vintage/question-engine-api to barracuda org",
48
+ "description": "Repository migration from MAN-Vintage to barracuda organization",
49
+ "status": "todo",
50
+ "priority": "medium",
51
+ "tags": "migration,repository,barracuda,vintage",
52
+ "due_date": null
53
+ },
54
+ {
55
+ "title": "Migrate MAN-Fireflies/cr-popout-ui to barracuda org",
56
+ "description": "Repository migration from MAN-Fireflies to barracuda organization",
57
+ "status": "todo",
58
+ "priority": "medium",
59
+ "tags": "migration,repository,barracuda,fireflies",
60
+ "due_date": null
61
+ },
62
+ {
63
+ "title": "Migrate MAN-Fireflies/cr-popout-api to barracuda org",
64
+ "description": "Repository migration from MAN-Fireflies to barracuda organization",
65
+ "status": "todo",
66
+ "priority": "medium",
67
+ "tags": "migration,repository,barracuda,fireflies",
68
+ "due_date": null
69
+ },
70
+ {
71
+ "title": "Migrate arbitration-tf-shared to GitHub Actions",
72
+ "description": "Migrate terraform repository from current CI/CD to GitHub Actions",
73
+ "status": "todo",
74
+ "priority": "medium",
75
+ "tags": "migration,terraform,github-actions",
76
+ "due_date": null
77
+ },
78
+ {
79
+ "title": "Migrate awsappman-tf-accounts-management to GitHub Actions",
80
+ "description": "Migrate terraform repository from current CI/CD to GitHub Actions",
81
+ "status": "todo",
82
+ "priority": "medium",
83
+ "tags": "migration,terraform,github-actions",
84
+ "due_date": null
85
+ },
86
+ {
87
+ "title": "Migrate surcharge-tf-environment to GitHub Actions",
88
+ "description": "Migrate terraform repository from current CI/CD to GitHub Actions",
89
+ "status": "todo",
90
+ "priority": "medium",
91
+ "tags": "migration,terraform,github-actions",
92
+ "due_date": null
93
+ },
94
+ {
95
+ "title": "Migrate tapp-aurora-mysql to GitHub Actions",
96
+ "description": "Migrate terraform repository from current CI/CD to GitHub Actions",
97
+ "status": "todo",
98
+ "priority": "medium",
99
+ "tags": "migration,terraform,github-actions,aurora-mysql",
100
+ "due_date": null
101
+ },
102
+ {
103
+ "title": "Migrate tapp-aurora-postgresql to GitHub Actions",
104
+ "description": "Migrate terraform repository from current CI/CD to GitHub Actions",
105
+ "status": "todo",
106
+ "priority": "medium",
107
+ "tags": "migration,terraform,github-actions,aurora-postgresql",
108
+ "due_date": null
109
+ },
110
+ {
111
+ "title": "Migrate tappy-aws-infrastructure to GitHub Actions",
112
+ "description": "Migrate terraform repository from current CI/CD to GitHub Actions",
113
+ "status": "todo",
114
+ "priority": "medium",
115
+ "tags": "migration,terraform,github-actions,tappy-aws",
116
+ "due_date": null
117
+ },
118
+ {
119
+ "title": "Migrate tappy-mission-control-tf-environment to GitHub Actions",
120
+ "description": "Migrate terraform repository from current CI/CD to GitHub Actions",
121
+ "status": "todo",
122
+ "priority": "medium",
123
+ "tags": "migration,terraform,github-actions,mission-control",
124
+ "due_date": null
125
+ },
126
+ {
127
+ "title": "Migrate tappy-tf-shared to GitHub Actions",
128
+ "description": "Migrate terraform repository from current CI/CD to GitHub Actions",
129
+ "status": "todo",
130
+ "priority": "medium",
131
+ "tags": "migration,terraform,github-actions,tappy-shared",
132
+ "due_date": null
133
+ },
134
+ {
135
+ "title": "Migrate tappy-wordpress-tf-environment to GitHub Actions",
136
+ "description": "Migrate terraform repository from current CI/CD to GitHub Actions",
137
+ "status": "todo",
138
+ "priority": "medium",
139
+ "tags": "migration,terraform,github-actions,wordpress",
140
+ "due_date": null
141
+ },
142
+ {
143
+ "title": "Migrate tappy2-client-tf-environment to GitHub Actions",
144
+ "description": "Migrate terraform repository from current CI/CD to GitHub Actions",
145
+ "status": "todo",
146
+ "priority": "medium",
147
+ "tags": "migration,terraform,github-actions,tappy2-client",
148
+ "due_date": null
149
+ },
150
+ {
151
+ "title": "Migrate tappy_mysql to GitHub Actions",
152
+ "description": "Migrate terraform repository from current CI/CD to GitHub Actions",
153
+ "status": "todo",
154
+ "priority": "medium",
155
+ "tags": "migration,terraform,github-actions,tappy-mysql",
156
+ "due_date": null
157
+ }
158
+ ]
159
+ }
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "lib/ruby_todo"
5
+
6
+ # Create notebooks and tasks
7
+ puts "Creating test notebooks and tasks..."
8
+ notebook = RubyTodo::Notebook.create(name: "Test Notebook")
9
+ notebook.update!(is_default: true)
10
+
11
+ notebook.tasks.create(
12
+ title: "Migrate to the barracua org",
13
+ status: "todo",
14
+ description: "Migration task for repository"
15
+ )
16
+
17
+ notebook.tasks.create(
18
+ title: "Task 2",
19
+ status: "todo"
20
+ )
21
+
22
+ notebook.tasks.create(
23
+ title: "Regular task not related to migrations",
24
+ status: "in_progress"
25
+ )
26
+
27
+ # Create the AI Assistant
28
+ ai_command = RubyTodo::AIAssistantCommand.new([], { verbose: true })
29
+
30
+ # Test the problematic case
31
+ puts "\n\n=== Testing problematic case ==="
32
+ prompt = "move all migrate to the barracua org tasks to in porgress"
33
+
34
+ puts "Running test with prompt: '#{prompt}'"
35
+ context = {}
36
+
37
+ ai_command.send(:handle_task_request, prompt, context)
38
+
39
+ # Display results
40
+ puts "\n=== Results ==="
41
+ if context[:matching_tasks]&.any?
42
+ puts "Found #{context[:matching_tasks].size} matching tasks:"
43
+ context[:matching_tasks].each do |task|
44
+ puts "- #{task[:title]} (ID: #{task[:task_id]}, Notebook: #{task[:notebook]})"
45
+ end
46
+ puts "Target status: #{context[:target_status]}"
47
+ else
48
+ puts "No matching tasks found"
49
+ end
50
+
51
+ # Clean up
52
+ puts "\n=== Cleaning up ==="
53
+ RubyTodo::Task.delete_all
54
+ RubyTodo::Notebook.delete_all
55
+ puts "Test completed"
data/test_migration.rb ADDED
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "lib/ruby_todo"
5
+
6
+ # Create notebooks and tasks
7
+ puts "Creating test notebooks and tasks..."
8
+ notebook = RubyTodo::Notebook.create(name: "Test Notebook")
9
+ notebook.update!(is_default: true)
10
+
11
+ notebook.tasks.create(
12
+ title: "Migrate to the barracua org",
13
+ status: "todo",
14
+ description: "Migration task for repository"
15
+ )
16
+
17
+ notebook.tasks.create(
18
+ title: "Task 2",
19
+ status: "todo"
20
+ )
21
+
22
+ notebook.tasks.create(
23
+ title: "Regular task not related to migrations",
24
+ status: "in_progress"
25
+ )
26
+
27
+ # Create the AI Assistant
28
+ ai_command = RubyTodo::AIAssistantCommand.new([], { verbose: true })
29
+
30
+ # Test the problematic case
31
+ puts "\n\n=== Testing problematic case ==="
32
+ prompt = "move all migrate to the barracua org tasks to in porgress"
33
+
34
+ puts "Running test with prompt: '#{prompt}'"
35
+ context = {}
36
+
37
+ ai_command.send(:handle_task_request, prompt, context)
38
+
39
+ # Display results
40
+ puts "\n=== Results ==="
41
+ if context[:matching_tasks]&.any?
42
+ puts "Found #{context[:matching_tasks].size} matching tasks:"
43
+ context[:matching_tasks].each do |task|
44
+ puts "- #{task[:title]} (ID: #{task[:task_id]}, Notebook: #{task[:notebook]})"
45
+ end
46
+ puts "Target status: #{context[:target_status]}"
47
+ else
48
+ puts "No matching tasks found or no target status detected"
49
+ end
50
+
51
+ # Clean up
52
+ puts "\n=== Cleaning up ==="
53
+ RubyTodo::Task.delete_all
54
+ RubyTodo::Notebook.delete_all
55
+ puts "Test completed"