ruby_todo 1.0.8 → 1.0.10
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 +10 -0
- data/lib/ruby_todo/ai_assistant/task_creator.rb +46 -6
- data/lib/ruby_todo/commands/ai_assistant.rb +23 -2
- 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: 7b843fdda14d138619bd89530ac2133e5799a365101a9a8738d2309f671f33b4
|
4
|
+
data.tar.gz: c87f357f0eda45138a418aa833da84baaeda972a97871b984dd0d36a9bf286fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d285c3bfe74592f2466e05873ddd024ac97855cc8517eab215437f2916a5c674dd48e7401c2dd22cc3e7f50f11ce839b73e984025c76cebf5d11257bbc7848e6
|
7
|
+
data.tar.gz: e7f5605b9e299197cfd45138325caff5df3160b2e79266615ed4d2fe419f1dced9b95a1671ba86fdb2b223cc7d183653a1ed243d588aa2d9f13949898f4a5216
|
data/CHANGELOG.md
CHANGED
@@ -32,10 +32,11 @@ module RubyTodo
|
|
32
32
|
|
33
33
|
# Extract task description from the prompt
|
34
34
|
def extract_task_description(prompt)
|
35
|
-
|
35
|
+
# Match common task creation patterns
|
36
|
+
if prompt =~ /(?:create|add|make|set\s+up)(?:\s+a)?\s+(?:new\s+)?task\s+(?:to|for|about|:)\s+(.+)/i
|
36
37
|
Regexp.last_match(1).strip
|
37
38
|
else
|
38
|
-
|
39
|
+
prompt.strip
|
39
40
|
end
|
40
41
|
end
|
41
42
|
|
@@ -45,6 +46,7 @@ module RubyTodo
|
|
45
46
|
task_query = build_task_query(task_description)
|
46
47
|
|
47
48
|
# Query OpenAI for task details
|
49
|
+
say "Enhancing task title and generating details..." if @options && @options[:verbose]
|
48
50
|
content = query_openai_for_task_details(task_query, api_key)
|
49
51
|
|
50
52
|
# Parse the response
|
@@ -56,7 +58,9 @@ module RubyTodo
|
|
56
58
|
"Generate a professional task with the following information:\n" \
|
57
59
|
"Task description: #{task_description}\n" \
|
58
60
|
"Please generate a JSON response with these fields:\n" \
|
59
|
-
"- title: A concise, professional title for the task
|
61
|
+
"- title: A concise, professional title for the task. Transform basic descriptions into more professional, " \
|
62
|
+
"action-oriented titles. For example, 'add new relic infra to questions-engine' should become " \
|
63
|
+
"'Integrate New Relic Infrastructure with Questions Engine'\n" \
|
60
64
|
"- description: A detailed description of what the task involves\n" \
|
61
65
|
"- priority: Suggested priority (high, medium, or low)\n" \
|
62
66
|
"- tags: Relevant tags as a comma-separated string"
|
@@ -68,21 +72,50 @@ module RubyTodo
|
|
68
72
|
# Query OpenAI for task details
|
69
73
|
def query_openai_for_task_details(task_query, api_key)
|
70
74
|
client = OpenAI::Client.new(access_token: api_key)
|
75
|
+
system_prompt = <<~PROMPT
|
76
|
+
You are a task management assistant that generates professional task details.
|
77
|
+
|
78
|
+
Transform simple task descriptions into professional, action-oriented titles that clearly communicate purpose.
|
79
|
+
|
80
|
+
Examples of transformations:
|
81
|
+
- "add new relic infra to questions-engine" → "Integrate New Relic Infrastructure with Questions Engine"
|
82
|
+
- "update docker image for app" → "Update and Standardize Docker Image Configuration for Application"
|
83
|
+
- "fix login bug" → "Resolve Authentication Issue in Login System"
|
84
|
+
- "add monitoring to service" → "Implement Comprehensive Monitoring Solution for Service"
|
85
|
+
- "migrate repo to new org" → "Migrate Repository to New Organization Structure"
|
86
|
+
- "add newrelic to the questions engine app" → "Integrate New Relic Monitoring with Questions Engine Application"
|
87
|
+
- "create a new task to add newrelic to the questions engine app" → "Implement New Relic Monitoring for Questions Engine Application"
|
88
|
+
|
89
|
+
Create concise but descriptive titles that use proper capitalization and professional terminology.
|
90
|
+
PROMPT
|
91
|
+
|
71
92
|
messages = [
|
72
|
-
{ role: "system", content:
|
93
|
+
{ role: "system", content: system_prompt },
|
73
94
|
{ role: "user", content: task_query }
|
74
95
|
]
|
75
96
|
|
76
97
|
say "Generating professional task details..." if @options[:verbose]
|
77
98
|
|
78
99
|
response = client.chat(parameters: {
|
79
|
-
model: "gpt-4o
|
100
|
+
model: "gpt-4o",
|
80
101
|
messages: messages,
|
81
|
-
temperature: 0.
|
102
|
+
temperature: 0.6,
|
82
103
|
max_tokens: 500
|
83
104
|
})
|
84
105
|
|
85
106
|
response["choices"][0]["message"]["content"]
|
107
|
+
rescue StandardError => e
|
108
|
+
# If gpt-4o fails (not available), fallback to gpt-4o-mini
|
109
|
+
if e.message.include?("gpt-4o")
|
110
|
+
client.chat(parameters: {
|
111
|
+
model: "gpt-4o-mini",
|
112
|
+
messages: messages,
|
113
|
+
temperature: 0.6,
|
114
|
+
max_tokens: 500
|
115
|
+
})["choices"][0]["message"]["content"]
|
116
|
+
else
|
117
|
+
raise e
|
118
|
+
end
|
86
119
|
end
|
87
120
|
end
|
88
121
|
|
@@ -137,6 +170,13 @@ module RubyTodo
|
|
137
170
|
end
|
138
171
|
end
|
139
172
|
|
173
|
+
# Display the improved task title if there's a significant difference
|
174
|
+
if task_details["title"] && task_details["description"] &&
|
175
|
+
task_details["title"] != task_details["description"] &&
|
176
|
+
task_details["title"] != "Task from #{task_details["description"]}"
|
177
|
+
say "✨ Enhanced title: \"#{task_details["title"]}\"", :green
|
178
|
+
end
|
179
|
+
|
140
180
|
args = ["task:add", notebook_name, task_details["title"]]
|
141
181
|
args << "--description" << task_details["description"] if task_details["description"]
|
142
182
|
args << "--priority" << task_details["priority"] if task_details["priority"]
|
@@ -837,9 +837,10 @@ module RubyTodo
|
|
837
837
|
# Create a CLI instance for executing commands
|
838
838
|
cli = RubyTodo::CLI.new
|
839
839
|
|
840
|
-
# Special case: handling natural language task creation
|
840
|
+
# Special case: handling natural language task creation with title enhancement
|
841
841
|
if prompt.match?(/create(?:\s+a)?\s+(?:new\s+)?task\s+(?:to|for|about)\s+(.+)/i)
|
842
|
-
|
842
|
+
task_description = prompt.match(/create(?:\s+a)?\s+(?:new\s+)?task\s+(?:to|for|about)\s+(.+)/i)[1].strip
|
843
|
+
handle_task_creation_with_enhancement(task_description, api_key)
|
843
844
|
return
|
844
845
|
end
|
845
846
|
|
@@ -1688,6 +1689,26 @@ module RubyTodo
|
|
1688
1689
|
end
|
1689
1690
|
end
|
1690
1691
|
|
1692
|
+
# Enhanced task creation that uses AI to improve titles
|
1693
|
+
def handle_task_creation_with_enhancement(task_description, api_key)
|
1694
|
+
# Get the default notebook
|
1695
|
+
notebook_name = default_notebook_name
|
1696
|
+
|
1697
|
+
# Log the original description if in verbose mode
|
1698
|
+
say "Original task description: #{task_description}" if @options[:verbose]
|
1699
|
+
|
1700
|
+
# Generate task details using AI
|
1701
|
+
task_details = generate_task_details(task_description, api_key)
|
1702
|
+
|
1703
|
+
# Log the enhanced title for better UX
|
1704
|
+
if task_details["title"] && task_details["title"] != task_description
|
1705
|
+
say "✨ Enhanced title: \"#{task_details["title"]}\"".green
|
1706
|
+
end
|
1707
|
+
|
1708
|
+
# Create the task with the enhanced details
|
1709
|
+
create_task_from_details(notebook_name, task_details)
|
1710
|
+
end
|
1711
|
+
|
1691
1712
|
def handle_natural_language_task_creation(prompt, _api_key)
|
1692
1713
|
# Make sure Ruby Todo is initialized
|
1693
1714
|
initialize_ruby_todo
|
data/lib/ruby_todo/version.rb
CHANGED