Class: RailsAiContext::Doctor
- Inherits:
-
Object
- Object
- RailsAiContext::Doctor
- Defined in:
- lib/rails_ai_context/doctor.rb
Overview
Diagnostic checker that validates the environment and reports AI readiness with pass/warn/fail checks and a readiness score.
Defined Under Namespace
Classes: Check
Constant Summary collapse
- CHECKS =
%i[ check_schema check_pending_migrations check_models check_routes check_gems check_controllers check_views check_tests check_migrations check_context_freshness check_mcp_json check_codex_env_staleness check_mcp_buildable check_introspector_health check_preset_coverage check_ripgrep check_prism check_brakeman check_live_reload check_security_gitignore check_security_auto_mount check_performance_schema_size check_performance_view_count ].freeze
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
Instance Method Summary collapse
-
#initialize(app = nil) ⇒ Doctor
constructor
A new instance of Doctor.
- #run ⇒ Object
Constructor Details
#initialize(app = nil) ⇒ Doctor
Returns a new instance of Doctor.
37 38 39 |
# File 'lib/rails_ai_context/doctor.rb', line 37 def initialize(app = nil) @app = app || Rails.application end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
35 36 37 |
# File 'lib/rails_ai_context/doctor.rb', line 35 def app @app end |
Instance Method Details
#run ⇒ Object
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rails_ai_context/doctor.rb', line 41 def run results = CHECKS.filter_map do |check| send(check) rescue StandardError => e $stderr.puts "[rails-ai-context] Doctor check #{check} failed: #{e.class}: #{e.}" nil end score = compute_score(results) { checks: results, score: score } end |