Class: RailsAiContext::FactsFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_ai_context/facts_formatter.rb

Overview

Renders the schema facts summary shared by the rake task (ai:facts) and the standalone CLI (rails-ai-context facts) so both outputs stay in sync.

Class Method Summary collapse

Class Method Details

.render(context, inspect_hint: "rails ai:inspect") ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rails_ai_context/facts_formatter.rb', line 8

def render(context, inspect_hint: "rails ai:inspect")
  lines = []
  lines << "# #{app_name(context)} - Schema Facts"
  lines << "# Generated: #{Time.now.strftime('%Y-%m-%d %H:%M')}"
  lines << ""
  lines.concat(tables_section(context))
  lines.concat(associations_section(context))
  lines.concat(dependencies_section(context))
  lines.concat(architecture_section(context))
  lines << "---"
  lines << "Run `#{inspect_hint}` for full JSON introspection."
  lines.join("\n")
end