Class: SkillBench::Services::SourcePathResolverService

Inherits:
Object
  • Object
show all
Defined in:
lib/skill_bench/services/source_path_resolver_service.rb

Overview

Resolves the source path for context hydration.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(evaluation) ⇒ SourcePathResolverService

Returns a new instance of SourcePathResolverService.

Parameters:



21
22
23
# File 'lib/skill_bench/services/source_path_resolver_service.rb', line 21

def initialize(evaluation)
  @evaluation = evaluation
end

Class Method Details

.call(evaluation) ⇒ String?

Resolves the source path for context hydration.

Tries the eval’s ‘source/` subdirectory first, then falls back to SourcePathResolver inference.

Parameters:

Returns:

  • (String, nil)

    The resolved source path, or nil if not found



16
17
18
# File 'lib/skill_bench/services/source_path_resolver_service.rb', line 16

def self.call(evaluation)
  new(evaluation).call
end

Instance Method Details

#callString?

Resolves the source path for context hydration.

Tries the eval’s ‘source/` subdirectory first, then falls back to SourcePathResolver inference.

Returns:

  • (String, nil)

    The resolved source path, or nil if not found



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/skill_bench/services/source_path_resolver_service.rb', line 31

def call
  eval_path = @evaluation.path
  eval_source = File.join(eval_path, 'source')
  return eval_source if Dir.exist?(eval_source)

  sources = SkillBench::Config.skill_sources || {}
  inferred = Execution::SourcePathResolver.call(
    eval_folder_path: eval_path.to_s,
    skill_sources: sources
  )
  inferred if inferred && Dir.exist?(inferred)
end