Class: RosettAi::Engines::Detector

Inherits:
Object
  • Object
show all
Defined in:
lib/rosett_ai/engines/detector.rb

Overview

Base engine detector that reads manifest detection rules and probes the system.

Subclasses may override custom_checks to add engine-specific detection logic beyond the manifest-driven cli_binary and config_dir checks.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(engine_name) ⇒ Detector

Returns a new instance of Detector.



15
16
17
18
# File 'lib/rosett_ai/engines/detector.rb', line 15

def initialize(engine_name)
  @engine_name = engine_name.to_s
  @manifest = Registry.manifest(@engine_name)
end

Instance Attribute Details

#engine_nameObject (readonly)

Returns the value of attribute engine_name.



13
14
15
# File 'lib/rosett_ai/engines/detector.rb', line 13

def engine_name
  @engine_name
end

Instance Method Details

#custom_checksObject (protected)



38
39
40
# File 'lib/rosett_ai/engines/detector.rb', line 38

def custom_checks
  []
end

#detectObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/rosett_ai/engines/detector.rb', line 20

def detect
  checks = []
  detection = @manifest['detection'] || {}

  checks << check_cli_binary(detection['cli_binary']) if detection['cli_binary']
  checks << check_config_dir(detection['config_dir']) if detection['config_dir']
  checks.concat(custom_checks)

  {
    engine: @engine_name,
    display_name: @manifest['display_name'],
    checks: checks,
    detected: checks.all? { |check| check[:passed] }
  }
end