Class: Octo::UI2::Components::WelcomeBanner
- Inherits:
-
Object
- Object
- Octo::UI2::Components::WelcomeBanner
- Defined in:
- lib/octo/ui2/components/welcome_banner.rb
Overview
WelcomeBanner displays the startup screen with ASCII logo, tagline, tips, and agent info.
Constant Summary collapse
- LOGO =
Octo::BlockFont.render("octo")
- TAGLINE =
"[>] Your personal Assistant & Technical Co-founder"- TIPS =
[ "[*] Ask questions, edit files, or run commands", "[*] Be specific for the best results", "[*] Create .octorules to customize interactions", "[*] Type /help for more commands" ].freeze
- MIN_WIDTH_FOR_LOGO =
Minimum terminal width required for full logo display
50
Instance Method Summary collapse
-
#initialize ⇒ WelcomeBanner
constructor
A new instance of WelcomeBanner.
-
#render_agent_welcome(working_dir:, mode:) ⇒ String
Render agent welcome section.
-
#render_full(working_dir:, mode:, width:) ⇒ String
Render full welcome (startup + agent info).
-
#render_logo(width:) ⇒ String
Render only the logo (ASCII art or simple text based on terminal width).
-
#render_startup(width:) ⇒ String
Render startup banner.
-
#theme ⇒ Object
Get current theme from ThemeManager.
Constructor Details
#initialize ⇒ WelcomeBanner
Returns a new instance of WelcomeBanner.
27 28 29 |
# File 'lib/octo/ui2/components/welcome_banner.rb', line 27 def initialize @pastel = Pastel.new end |
Instance Method Details
#render_agent_welcome(working_dir:, mode:) ⇒ String
Render agent welcome section
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 99 100 101 102 103 104 105 |
# File 'lib/octo/ui2/components/welcome_banner.rb', line 69 def render_agent_welcome(working_dir:, mode:) lines = [] lines << "" lines << separator("=") lines << @pastel.bright_green("[+] AGENT MODE INITIALIZED") lines << separator("=") lines << "" lines << info_line("Working Directory", working_dir) lines << info_line("Permission Mode", mode) # Show loaded project rules file if present main = Utils::WorkspaceRules.find_main(working_dir) lines << info_line("Project Rules", "#{main[:name]} ✓") if main lines << "" lines << theme.format_text("[!] Type 'exit' or 'quit' to terminate session", :thinking) lines << separator("-") lines << "" # Show sub-project agents block if any sub-dirs have .octorules sub_projects = Utils::WorkspaceRules.find_sub_projects(working_dir) unless sub_projects.empty? lines << @pastel.bright_cyan("[>] SUB-PROJECT AGENT MODE") lines << @pastel.dim(" #{sub_projects.size} sub-project(s) detected with rules:") sub_projects.each do |sp| first_line = sp[:summary].lines.first&.strip&.delete_prefix("#")&.strip label = @pastel.cyan(" • #{sp[:sub_name]}/") desc = first_line && !first_line.empty? ? @pastel.dim(" — #{first_line}") : "" lines << "#{label}#{desc}" end lines << @pastel.dim(" AI will read each sub-project's full .octorules before working in it.") lines << separator("-") lines << "" end lines.join("\n") end |
#render_full(working_dir:, mode:, width:) ⇒ String
Render full welcome (startup + agent info)
112 113 114 115 116 117 |
# File 'lib/octo/ui2/components/welcome_banner.rb', line 112 def render_full(working_dir:, mode:, width:) render_startup(width: width) + render_agent_welcome( working_dir: working_dir, mode: mode ) end |
#render_logo(width:) ⇒ String
Render only the logo (ASCII art or simple text based on terminal width)
39 40 41 42 43 44 45 |
# File 'lib/octo/ui2/components/welcome_banner.rb', line 39 def render_logo(width:) lines = [] lines << "" lines << logo_content(width) lines << "" lines.join("\n") end |
#render_startup(width:) ⇒ String
Render startup banner
50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/octo/ui2/components/welcome_banner.rb', line 50 def render_startup(width:) lines = [] lines << "" lines << logo_content(width) lines << "" lines << @pastel.bright_cyan(TAGLINE) lines << @pastel.dim(" Version #{Octo::VERSION}") lines << "" TIPS.each do |tip| lines << @pastel.dim(tip) end lines << "" lines.join("\n") end |
#theme ⇒ Object
Get current theme from ThemeManager
32 33 34 |
# File 'lib/octo/ui2/components/welcome_banner.rb', line 32 def theme UI2::ThemeManager.current_theme end |