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.
235 236 237 238 239 240 241 242 243 244 |
# File 'lib/aidp/prompt_optimization/relevance_scorer.rb', line 235 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.
228 229 230 |
# File 'lib/aidp/prompt_optimization/relevance_scorer.rb', line 228 def affected_files @affected_files end |
#description ⇒ Object
Returns the value of attribute description.
228 229 230 |
# File 'lib/aidp/prompt_optimization/relevance_scorer.rb', line 228 def description @description end |
#step_name ⇒ Object
Returns the value of attribute step_name.
228 229 230 |
# File 'lib/aidp/prompt_optimization/relevance_scorer.rb', line 228 def step_name @step_name end |
#tags ⇒ Object
Returns the value of attribute tags.
228 229 230 |
# File 'lib/aidp/prompt_optimization/relevance_scorer.rb', line 228 def @tags end |
#task_type ⇒ Object
Returns the value of attribute task_type.
228 229 230 |
# File 'lib/aidp/prompt_optimization/relevance_scorer.rb', line 228 def task_type @task_type end |
Instance Method Details
#extract_tags_from_description ⇒ Object
Extract relevant tags from description text
247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/aidp/prompt_optimization/relevance_scorer.rb', line 247 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
262 263 264 265 266 267 268 269 270 |
# File 'lib/aidp/prompt_optimization/relevance_scorer.rb', line 262 def to_h { task_type: @task_type, description: @description, affected_files: @affected_files, step_name: @step_name, tags: @tags } end |