Class: RogIQ::Commands::Diagnose
- Defined in:
- lib/rogiq/commands/diagnose.rb
Instance Method Summary collapse
- #emergency(identifier) ⇒ Object
- #genius(identifier) ⇒ Object
- #migrations ⇒ Object
- #pinecone ⇒ Object
- #search_insights ⇒ Object
- #subdomain(identifier) ⇒ Object
- #zeitwerk ⇒ Object
Instance Method Details
#emergency(identifier) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/rogiq/commands/diagnose.rb', line 42 def emergency(identifier) RogIQ.load_rails! client = RogIQ::Helpers.resolve_client(identifier) unless client fmt.error_msg("Client not found") exit 1 end fmt.say("\n" + "=" * 80) fmt.say("EMERGENCY DIAGNOSTIC: #{client.name} (#{client.id})") fmt.say("=" * 80) fmt.say("\n1. CLIENT DATA") fmt.say(" Name: #{client.name}") fmt.say(" Website: #{client.website.presence || "EMPTY"}") fmt.say(" Research Ready: #{client.research_ready}") fmt.say(" Description: #{client.description.present? ? client.description[0, 100] + "…" : "EMPTY"}") fmt.say(" Primary Color: #{client.primary_color || "EMPTY"}") fmt.say(" Created: #{client.created_at} (#{((Time.current - client.created_at) / 60).round} min ago)") fmt.say("\n2. RESEARCH STATUS") research = client.client_settings.find_by(setting_key: "research_status") if research v = research.setting_value fmt.say(" Status: #{v["status"]}") fmt.say(" Website: #{v["website"] || "none"}") fmt.say(" Updated: #{v["updated_at"]}") else fmt.say(" NO RESEARCH STATUS — after_create callback may not have run") end fmt.say("\n3. SOLID QUEUE JOBS FOR THIS CLIENT") jobs = ::SolidQueue::Job.where("arguments::text LIKE ?", "%#{client.id}%").order(created_at: :desc) if jobs.empty? fmt.say(" NO JOBS FOUND — callback not firing, SolidQueue not configured, or DB issue") else fmt.say(" Found #{jobs.count} job record(s):") jobs.group_by(&:class_name).each do |name, list| fmt.say(" #{name} (#{list.size} run(s)):") list.first(3).each do |job| status = job.finished_at ? "FINISHED" : (job.failed_at ? "FAILED" : "PENDING") fmt.say(" #{status} — created #{job.created_at}, finished #{job.finished_at || "—"}") end end end fmt.say("\n4. KEY SETTINGS PRESENCE") important = %w[website_content ai_insights onboarding_processed_data] present = client.client_settings.pluck(:setting_key) important.each do |key| fmt.say(" #{key}: #{present.include?(key) ? "present" : "MISSING"}") end fmt.say("\n" + "=" * 80) fmt.say("END DIAGNOSTIC") fmt.say("=" * 80) end |
#genius(identifier) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/rogiq/commands/diagnose.rb', line 14 def genius(identifier) RogIQ.load_rails! client = RogIQ::Helpers.resolve_client(identifier) unless client fmt.error_msg("Client not found") exit 1 end RogIQ::Helpers.with_saved_argv([ client.id.to_s ]) do load File.join(RogIQ.repo_root, "debug_genius_mode_goals.rb") end end |
#migrations ⇒ Object
123 124 125 126 127 128 129 130 131 |
# File 'lib/rogiq/commands/diagnose.rb', line 123 def migrations RogIQ.load_rails! pending = ActiveRecord::Base.connection.pool.migration_context.pending_migration_versions fmt.output( pending_count: pending.size, pending_versions: pending ) exit(pending.any? ? 1 : 0) end |
#pinecone ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/rogiq/commands/diagnose.rb', line 108 def pinecone RogIQ.load_rails! if defined?(Rails.configuration.ai_engine) cfg = Rails.configuration.ai_engine fmt.output( pinecone_enabled: cfg.try(:pinecone_enabled), pinecone_index_name: cfg.try(:pinecone_index_name), api_key_present: ENV["PINECONE_API_KEY"].present? ) else fmt.output(pinecone: "Rails.configuration.ai_engine not defined") end end |
#search_insights ⇒ Object
8 9 10 11 |
# File 'lib/rogiq/commands/diagnose.rb', line 8 def search_insights(*) RogIQ.load_rails! load File.join(RogIQ.repo_root, "diagnose_search_insights.rb") end |
#subdomain(identifier) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rogiq/commands/diagnose.rb', line 28 def subdomain(identifier) RogIQ.load_rails! client = RogIQ::Helpers.resolve_client(identifier) unless client&.account&.slug fmt.error_msg("Client or account slug not found") exit 1 end RogIQ::Helpers.with_saved_argv([ client.account.slug ]) do load File.join(RogIQ.repo_root, "diagnose_subdomain_issues.rb") end end |