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.
23 24 25 |
# File 'lib/rosett_ai/migration/detector.rb', line 23 def initialize(config_dir:) @config_dir = Pathname.new(config_dir) end |
Instance Attribute Details
#config_dir ⇒ Pathname (readonly)
Returns configuration directory to scan.
20 21 22 |
# File 'lib/rosett_ai/migration/detector.rb', line 20 def config_dir @config_dir end |
Instance Method Details
#detect ⇒ Array<Hash{Symbol => String}>
Scan all config files and return migration findings.
31 32 33 34 35 36 |
# File 'lib/rosett_ai/migration/detector.rb', line 31 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.
41 42 43 |
# File 'lib/rosett_ai/migration/detector.rb', line 41 def migrations_needed? detect.any? end |