Class: RailsAiBridge::Doctor
- Inherits:
-
Object
- Object
- RailsAiBridge::Doctor
- Defined in:
- lib/rails_ai_bridge/doctor.rb,
lib/rails_ai_bridge/doctor/check.rb,
lib/rails_ai_bridge/doctor/checkers/base_checker.rb,
lib/rails_ai_bridge/doctor/checkers/gems_checker.rb,
lib/rails_ai_bridge/doctor/checkers/i18n_checker.rb,
lib/rails_ai_bridge/doctor/checkers/tests_checker.rb,
lib/rails_ai_bridge/doctor/checkers/views_checker.rb,
lib/rails_ai_bridge/doctor/checkers/models_checker.rb,
lib/rails_ai_bridge/doctor/checkers/routes_checker.rb,
lib/rails_ai_bridge/doctor/checkers/schema_checker.rb,
lib/rails_ai_bridge/doctor/checkers/ripgrep_checker.rb,
lib/rails_ai_bridge/doctor/checkers/registry_checker.rb,
lib/rails_ai_bridge/doctor/checkers/migrations_checker.rb,
lib/rails_ai_bridge/doctor/checkers/controllers_checker.rb,
lib/rails_ai_bridge/doctor/checkers/context_files_checker.rb,
lib/rails_ai_bridge/doctor/checkers/mcp_buildable_checker.rb,
lib/rails_ai_bridge/doctor/checkers/view_mcp_tool_checker.rb,
lib/rails_ai_bridge/doctor/checkers/bridge_metadata_checker.rb,
lib/rails_ai_bridge/doctor/checkers/bridge_freshness_checker.rb,
lib/rails_ai_bridge/doctor/checkers/stimulus_mcp_tool_checker.rb
Overview
Diagnostic checker that validates the environment and reports AI readiness with pass/warn/fail checks and a readiness score.
Defined Under Namespace
Modules: Checkers Classes: Check
Constant Summary collapse
- CHECKS =
Maps stable check identifiers to checker classes. Each value must implement
.callon an instance and return a Check. { check_schema: Checkers::SchemaChecker, check_models: Checkers::ModelsChecker, check_routes: Checkers::RoutesChecker, check_gems: Checkers::GemsChecker, check_controllers: Checkers::ControllersChecker, check_views: Checkers::ViewsChecker, check_i18n: Checkers::I18nChecker, check_tests: Checkers::TestsChecker, check_migrations: Checkers::MigrationsChecker, check_context_files: Checkers::ContextFilesChecker, check_bridge_freshness: Checkers::BridgeFreshnessChecker, check_mcp_buildable: Checkers::McpBuildableChecker, check_ripgrep: Checkers::RipgrepChecker, check_view_mcp_tool: Checkers::ViewMcpToolChecker, check_stimulus_mcp_tool: Checkers::StimulusMcpToolChecker, check_bridge_metadata: Checkers::BridgeMetadataChecker, check_registry: Checkers::RegistryChecker }.freeze
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#boot_result ⇒ Object
readonly
Returns the value of attribute boot_result.
-
#network ⇒ Object
readonly
Returns the value of attribute network.
Class Method Summary collapse
-
.run_for(root, timeout: BootManager::DEFAULT_TIMEOUT, network: false) ⇒ Hash
Boots an application and runs diagnostics, using static fallback on failure.
Instance Method Summary collapse
- #initialize(app = nil, boot_result: nil, network: false) ⇒ void constructor
-
#run ⇒ Hash
Runs all diagnostic checks and computes a readiness score.
Constructor Details
#initialize(app = nil, boot_result: nil, network: false) ⇒ void
56 57 58 59 60 |
# File 'lib/rails_ai_bridge/doctor.rb', line 56 def initialize(app = nil, boot_result: nil, network: false) @app = app || AppScope.current_app @boot_result = boot_result @network = network end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
38 39 40 |
# File 'lib/rails_ai_bridge/doctor.rb', line 38 def app @app end |
#boot_result ⇒ Object (readonly)
Returns the value of attribute boot_result.
38 39 40 |
# File 'lib/rails_ai_bridge/doctor.rb', line 38 def boot_result @boot_result end |
#network ⇒ Object (readonly)
Returns the value of attribute network.
38 39 40 |
# File 'lib/rails_ai_bridge/doctor.rb', line 38 def network @network end |
Class Method Details
.run_for(root, timeout: BootManager::DEFAULT_TIMEOUT, network: false) ⇒ Hash
Boots an application and runs diagnostics, using static fallback on failure.
46 47 48 49 50 |
# File 'lib/rails_ai_bridge/doctor.rb', line 46 def self.run_for(root, timeout: BootManager::DEFAULT_TIMEOUT, network: false) boot_result = BootManager.boot(root, timeout: timeout) app = boot_result[:success] ? boot_result[:app] : BootManager.static_fallback(root) new(app, boot_result: boot_result, network: network).run end |
Instance Method Details
#run ⇒ Hash
Runs all diagnostic checks and computes a readiness score.
65 66 67 68 69 70 |
# File 'lib/rails_ai_bridge/doctor.rb', line 65 def run results = CHECKS.map { |name, checker_class| run_check(name, checker_class) } results.unshift(boot_failure_check) if boot_failed? score = compute_score(results) { checks: results, score: score } end |