@@ -2,20 +2,36 @@ import { existsSync } from "node:fs";
22import { getSnapshotPath } from "../cache/snapshot.js" ;
33import { theme } from "./output.js" ;
44
5- const LOGO = String . raw `
6- ██████╗ ███████╗██╗ ██╗███╗ ███╗ █████╗ ██████╗
7- ██╔══██╗██╔════╝██║ ██║████╗ ████║██╔══██╗██╔══██╗
8- ██║ ██║█████╗ ██║ ██║██╔████╔██║███████║██████╔╝
9- ██║ ██║██╔══╝ ╚██╗ ██╔╝██║╚██╔╝██║██╔══██║██╔═══╝
10- ██████╔╝███████╗ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║██║
11- ╚═════╝ ╚══════╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝
12- ` ;
5+ const SYMBOL_LOGO = [
6+ " ╷ ╱╲" ,
7+ " ╭──────┼──────╱ ╲" ,
8+ " ╭─╯ ●─────╯ ╱" ,
9+ " ╱ ╱│ ╱" ,
10+ "│ ╱ │ ╭────╯" ,
11+ "│ ╱ │╱╱" ,
12+ " ╲__╱ ╱│" ,
13+ " ╲____╱ │" ,
14+ " ╵"
15+ ] ;
16+
17+ const WIDE_WORDMARK = [
18+ "██████╗ ███████╗██╗ ██╗███╗ ███╗ █████╗ ██████╗" ,
19+ "██╔══██╗██╔════╝██║ ██║████╗ ████║██╔══██╗██╔══██╗" ,
20+ "██║ ██║█████╗ ██║ ██║██╔████╔██║███████║██████╔╝" ,
21+ "██║ ██║██╔══╝ ╚██╗ ██╔╝██║╚██╔╝██║██╔══██║██╔═══╝" ,
22+ "██████╔╝███████╗ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║██║" ,
23+ "╚═════╝ ╚══════╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝"
24+ ] ;
25+
26+ const WIDE_PANEL_WIDTH = 76 ;
27+ const COMPACT_PANEL_WIDTH = 48 ;
28+ const WIDE_TERMINAL_MINIMUM = 72 ;
1329
1430export function printWelcome ( projectRoot : string ) : void {
1531 const hasSnapshot = existsSync ( getSnapshotPath ( projectRoot ) ) ;
1632 const status = hasSnapshot ? "Project snapshot found." : "No project analyzed yet." ;
1733
18- console . log ( ` ${ theme . aqua } ${ LOGO } ${ theme . reset } ` ) ;
34+ console . log ( renderWelcomeBrandPanel ( process . stdout . columns ?? 80 ) ) ;
1935 console . log ( " Understand Any Codebase." ) ;
2036 console . log ( `\n ${ theme . gray } ──────────────────────────────────────────${ theme . reset } \n` ) ;
2137 console . log ( ` ${ status } \n` ) ;
@@ -31,6 +47,36 @@ export function printWelcome(projectRoot: string): void {
3147 console . log ( "" ) ;
3248}
3349
50+ export function renderWelcomeBrandPanel ( terminalWidth : number ) : string {
51+ const isWide = terminalWidth >= WIDE_TERMINAL_MINIMUM ;
52+ const panelWidth = Math . max (
53+ 28 ,
54+ Math . min (
55+ terminalWidth ,
56+ isWide ? WIDE_PANEL_WIDTH : COMPACT_PANEL_WIDTH
57+ )
58+ ) ;
59+ const contentWidth = panelWidth - 4 ;
60+ const wordmark = isWide ? WIDE_WORDMARK : [ "DEVMAP" ] ;
61+ const content = [
62+ ...SYMBOL_LOGO ,
63+ "" ,
64+ ...wordmark
65+ ] ;
66+ const top = `╭${ "─" . repeat ( panelWidth - 2 ) } ╮` ;
67+ const bottom = `╰${ "─" . repeat ( panelWidth - 2 ) } ╯` ;
68+ const rows = content . map ( ( line ) => {
69+ const visibleLine = line . slice ( 0 , contentWidth ) ;
70+ const leftPadding = Math . floor ( ( contentWidth - visibleLine . length ) / 2 ) ;
71+ const rightPadding = contentWidth - visibleLine . length - leftPadding ;
72+ return `│ ${ " " . repeat ( leftPadding ) } ${ visibleLine } ${ " " . repeat ( rightPadding ) } │` ;
73+ } ) ;
74+
75+ return [ top , ...rows , bottom ]
76+ . map ( ( line ) => `${ theme . aqua } ${ line } ${ theme . reset } ` )
77+ . join ( "\n" ) ;
78+ }
79+
3480function printCommand ( command : string , description ?: string ) : void {
3581 const padded = command . padEnd ( 22 ) ;
3682 const suffix = description ? ` ${ theme . gray } ${ description } ${ theme . reset } ` : "" ;
0 commit comments