Class: Aidp::PromptOptimization::TaskContext
- Inherits:
-
Object
- Object
- Aidp::PromptOptimization::TaskContext
- Defined in:
- lib/aidp/prompt_optimization/relevance_scorer.rb
Overview
Represents the context for a task
Contains information about the current work being done, used to calculate relevance scores for fragments
Instance Attribute Summary collapse
-
#affected_files ⇒ Object
Returns the value of attribute affected_files.
-
#description ⇒ Object
Returns the value of attribute description.
-
#step_name ⇒ Object
Returns the value of attribute step_name.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#task_type ⇒ Object
Returns the value of attribute task_type.
Instance Method Summary collapse
-
#extract_tags_from_description ⇒ Object
Extract relevant tags from description text.
-
#initialize(task_type: nil, description: nil, affected_files: [], step_name: nil, tags: []) ⇒ TaskContext
constructor
A new instance of TaskContext.
- #to_h ⇒ Object
Constructor Details
#initialize(task_type: nil, description: nil, affected_files: [], step_name: nil, tags: []) ⇒ TaskContext
Returns a new instance of TaskContext.
218 219 220 221 222 223 224 225 226 227 |
# File 'lib/aidp/prompt_optimization/relevance_scorer.rb', line 218 def initialize(task_type: nil, description: nil, affected_files: [], step_name: nil, tags: []) @task_type = task_type @description = description @affected_files = affected_files || [] @step_name = step_name @tags = || [] # Extract additional tags from description if provided if @description end |
Instance Attribute Details
#affected_files ⇒ Object
Returns the value of attribute affected_files.
211 212 213 |
# File 'lib/aidp/prompt_optimization/relevance_scorer.rb', line 211 def affected_files @affected_files end |
#description ⇒ Object
Returns the value of attribute description.
211 212 213 |
# File 'lib/aidp/prompt_optimization/relevance_scorer.rb', line 211 def description @description end |
#step_name ⇒ Object
Returns the value of attribute step_name.
211 212 213 |
# File 'lib/aidp/prompt_optimization/relevance_scorer.rb', line 211 def step_name @step_name end |
#tags ⇒ Object
Returns the value of attribute tags.
211 212 213 |
# File 'lib/aidp/prompt_optimization/relevance_scorer.rb', line 211 def @tags end |
#task_type ⇒ Object
Returns the value of attribute task_type.
211 212 213 |
# File 'lib/aidp/prompt_optimization/relevance_scorer.rb', line 211 def task_type @task_type end |
Instance Method Details
#extract_tags_from_description ⇒ Object
Extract relevant tags from description text
230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
# File 'lib/aidp/prompt_optimization/relevance_scorer.rb', line 230 def return unless @description desc_lower = @description.downcase @tags << "testing" if /test|spec|coverage/.match?(desc_lower) @tags << "security" if /security|auth|permission/.match?(desc_lower) @tags << "performance" if /performance|speed|optimization/.match?(desc_lower) @tags << "database" if /database|sql|migration/.match?(desc_lower) @tags << "api" if /\bapi\b|endpoint|rest/.match?(desc_lower) @tags << "ui" if /\bui\b|interface|view/.match?(desc_lower) @tags.uniq! end |
#to_h ⇒ Object
245 246 247 248 249 250 251 252 253 |
# File 'lib/aidp/prompt_optimization/relevance_scorer.rb', line 245 def to_h { task_type: @task_type, description: @description, affected_files: @affected_files, step_name: @step_name, tags: @tags } end |