Class: Clacky::UI2::Components::WelcomeBanner
- Inherits:
-
Object
- Object
- Clacky::UI2::Components::WelcomeBanner
- Defined in:
- lib/clacky/ui2/components/welcome_banner.rb
Overview
WelcomeBanner displays the startup screen with ASCII logo, tagline, tips, and agent info.
When a product_name is configured via BrandConfig, the hardcoded OPENCLACKY ASCII art is replaced by a dynamically generated logo using artii (FIGlet). Falls back to plain text when the terminal is too narrow or artii fails.
Constant Summary collapse
- LOGO =
<<~'LOGO' ██████╗ ██████╗ ███████╗███╗ ██╗ ██████╗██╗ █████╗ ██████╗██╗ ██╗██╗ ██╗ ██╔═══██╗██╔══██╗██╔════╝████╗ ██║██╔════╝██║ ██╔══██╗██╔════╝██║ ██╔╝╚██╗ ██╔╝ ██║ ██║██████╔╝█████╗ ██╔██╗ ██║██║ ██║ ███████║██║ █████╔╝ ╚████╔╝ ██║ ██║██╔═══╝ ██╔══╝ ██║╚██╗██║██║ ██║ ██╔══██║██║ ██╔═██╗ ╚██╔╝ ╚██████╔╝██║ ███████╗██║ ╚████║╚██████╗███████╗██║ ██║╚██████╗██║ ██╗ ██║ ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═══╝ ╚═════╝╚══════╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ LOGO
- TAGLINE =
"[>] Your personal Assistant & Technical Co-founder"- TIPS =
[ "[*] Ask questions, edit files, or run commands", "[*] Be specific for the best results", "[*] Create .clackyrules to customize interactions", "[*] Type /help for more commands" ].freeze
- MIN_WIDTH_FOR_LOGO =
Minimum terminal width required for full logo display
90
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.
38 39 40 |
# File 'lib/clacky/ui2/components/welcome_banner.rb', line 38 def initialize @pastel = Pastel.new end |
Instance Method Details
#render_agent_welcome(working_dir:, mode:) ⇒ String
Render agent welcome section
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 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/clacky/ui2/components/welcome_banner.rb', line 80 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 .clackyrules 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 .clackyrules 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)
123 124 125 126 127 128 |
# File 'lib/clacky/ui2/components/welcome_banner.rb', line 123 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)
50 51 52 53 54 55 56 |
# File 'lib/clacky/ui2/components/welcome_banner.rb', line 50 def render_logo(width:) lines = [] lines << "" lines << logo_content(width) lines << "" lines.join("\n") end |
#render_startup(width:) ⇒ String
Render startup banner
61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/clacky/ui2/components/welcome_banner.rb', line 61 def render_startup(width:) lines = [] lines << "" lines << logo_content(width) lines << "" lines << @pastel.bright_cyan(TAGLINE) lines << @pastel.dim(" Version #{Clacky::VERSION}") lines << "" TIPS.each do |tip| lines << @pastel.dim(tip) end lines << "" lines.join("\n") end |
#theme ⇒ Object
Get current theme from ThemeManager
43 44 45 |
# File 'lib/clacky/ui2/components/welcome_banner.rb', line 43 def theme UI2::ThemeManager.current_theme end |