Class: RailsAiBridge::Tools::GetContext::Composer
- Inherits:
-
Object
- Object
- RailsAiBridge::Tools::GetContext::Composer
- Defined in:
- lib/rails_ai_bridge/tools/get_context/composer.rb
Overview
Renders the composite markdown payload for RailsAiBridge::Tools::GetContext.
Constant Summary collapse
- SUMMARY_ASSOC_LIMIT =
Max association, validation, route, and filter samples in
summaryoutput. 3- TEST_LIMITS =
Related-test path caps keyed by
detaillevel. { 'summary' => 5, 'standard' => 10, 'full' => 20 }.freeze
Instance Method Summary collapse
-
#call ⇒ String
Markdown body.
-
#initialize(resolution:, snapshots:, detail:, test_paths:) ⇒ Composer
constructor
A new instance of Composer.
Constructor Details
#initialize(resolution:, snapshots:, detail:, test_paths:) ⇒ Composer
Returns a new instance of Composer.
17 18 19 20 21 22 |
# File 'lib/rails_ai_bridge/tools/get_context/composer.rb', line 17 def initialize(resolution:, snapshots:, detail:, test_paths:) @resolution = resolution @snapshots = snapshots @detail = %w[summary standard full].include?(detail) ? detail : 'summary' @test_paths = test_paths end |
Instance Method Details
#call ⇒ String
Returns markdown body.
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/rails_ai_bridge/tools/get_context/composer.rb', line 25 def call return [@resolution[:error], *@resolution[:setup_messages]].compact.join("\n\n") if hard_error? lines = ["# Context: #{heading_label}", ''] @resolution[:setup_messages].each { || lines << << '' } append_table(lines) append_model(lines) append_routes(lines) append_controller(lines) append_tests(lines) lines.join("\n").strip end |