Class: RailsAiContext::Doctor
- Inherits:
-
Object
- Object
- RailsAiContext::Doctor
- Includes:
- CountPhrase
- 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_initializer_guard 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_stdio_activation_hygiene 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.
Class Method Summary collapse
-
.mcp_config_checks ⇒ Object
Where each tool's MCP config lives, and how to name it in a report.
Instance Method Summary collapse
-
#initialize(app = nil) ⇒ Doctor
constructor
A new instance of Doctor.
- #run ⇒ Object
Methods included from CountPhrase
Constructor Details
#initialize(app = nil) ⇒ Doctor
Returns a new instance of Doctor.
41 42 43 |
# File 'lib/rails_ai_context/doctor.rb', line 41 def initialize(app = nil) @app = app || Rails.application end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
39 40 41 |
# File 'lib/rails_ai_context/doctor.rb', line 39 def app @app end |
Class Method Details
.mcp_config_checks ⇒ Object
Where each tool's MCP config lives, and how to name it in a report.
176 177 178 179 180 181 |
# File 'lib/rails_ai_context/doctor.rb', line 176 def self.mcp_config_checks Install::AiTool.all.to_h { |tool| path = tool.mcp_config[:path] [ tool.key, { path: path, label: "#{path} (#{tool.name})" } ] } end |
Instance Method Details
#run ⇒ Object
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/rails_ai_context/doctor.rb', line 45 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 |