Class: RosettAi::Migration::Detector
- Inherits:
-
Object
- Object
- RosettAi::Migration::Detector
- Defined in:
- lib/rosett_ai/migration/detector.rb
Overview
Detects configuration files that need migration to the current schema.
Scans behaviour YAML, design YAML, and rai config files for deprecated patterns or missing required fields. Returns structured findings that CLI commands can display to the user.
Instance Attribute Summary collapse
-
#config_dir ⇒ Pathname
readonly
Configuration directory to scan.
Instance Method Summary collapse
-
#detect ⇒ Array<Hash{Symbol => String}>
Scan all config files and return migration findings.
-
#initialize(config_dir:) ⇒ Detector
constructor
A new instance of Detector.
-
#migrations_needed? ⇒ Boolean
Convenience check for whether any migrations are needed.
Constructor Details
#initialize(config_dir:) ⇒ Detector
Returns a new instance of Detector.
22 23 24 |
# File 'lib/rosett_ai/migration/detector.rb', line 22 def initialize(config_dir:) @config_dir = Pathname.new(config_dir) end |
Instance Attribute Details
#config_dir ⇒ Pathname (readonly)
Returns configuration directory to scan.
19 20 21 |
# File 'lib/rosett_ai/migration/detector.rb', line 19 def config_dir @config_dir end |
Instance Method Details
#detect ⇒ Array<Hash{Symbol => String}>
Scan all config files and return migration findings.
30 31 32 33 34 35 |
# File 'lib/rosett_ai/migration/detector.rb', line 30 def detect findings = [] findings.concat(scan_behaviour_files) findings.concat(scan_design_files) findings end |
#migrations_needed? ⇒ Boolean
Convenience check for whether any migrations are needed.
40 41 42 |
# File 'lib/rosett_ai/migration/detector.rb', line 40 def migrations_needed? detect.any? end |