Class: RubyCode::Views::Cli::ResponseBox

Inherits:
Object
  • Object
show all
Defined in:
lib/rubycode/views/cli/response_box.rb

Overview

Builds response box with markdown rendering

Class Method Summary collapse

Class Method Details

.build(response:) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/rubycode/views/cli/response_box.rb', line 11

def self.build(response:)
  pastel = Pastel.new

  header = "\n#{pastel.magenta("╔═══ Agent Response ═══")}"
  footer = pastel.magenta("╚══════════════════════")

  # Try to parse as markdown, fallback to plain
  content = begin
    TTY::Markdown.parse(response, width: 80)
  rescue StandardError
    response
  end

  "#{header}\n#{content}\n#{footer}"
end