Class: RailsAiBridge::Doctor::Checkers::BridgeFreshnessChecker

Inherits:
BaseChecker
  • Object
show all
Defined in:
lib/rails_ai_bridge/doctor/checkers/bridge_freshness_checker.rb

Overview

Verifies the freshness of bridge-generated context files.

Defined Under Namespace

Classes: ScanResult

Instance Attribute Summary collapse

Attributes inherited from BaseChecker

#app

Instance Method Summary collapse

Constructor Details

#initialize(app, formats: :all) ⇒ BridgeFreshnessChecker

Returns a new instance of BridgeFreshnessChecker.

Parameters:

  • app (Rails::Application)
  • formats (Symbol, Array<Symbol>) (defaults to: :all)

    formats to check, defaults to all in FORMAT_MAP



19
20
21
22
# File 'lib/rails_ai_bridge/doctor/checkers/bridge_freshness_checker.rb', line 19

def initialize(app, formats: :all)
  super(app)
  @formats = formats == :all ? RailsAiBridge::Serializers::ContextFileSerializer::FORMAT_MAP.keys : Array(formats)
end

Instance Attribute Details

#formatsObject (readonly)

Returns the value of attribute formats.



15
16
17
# File 'lib/rails_ai_bridge/doctor/checkers/bridge_freshness_checker.rb', line 15

def formats
  @formats
end

Instance Method Details

#callDoctor::Check

Diagnostic check for bridge file freshness.

Returns:



27
28
29
30
31
32
33
34
35
36
# File 'lib/rails_ai_bridge/doctor/checkers/bridge_freshness_checker.rb', line 27

def call
  output_dir = RailsAiBridge.configuration.output_dir_for(app)
  current_fp = safe_source_fingerprint
  return current_fp if current_fp.is_a?(Doctor::Check)

  scan = scan_files(output_dir, current_fp)
  build_outcome(scan)
rescue StandardError => error
  check_error('Error checking freshness', error)
end