MCPcopy
hub / github.com/Doorman11991/smallcode / _renderWelcomeScreen

Method _renderWelcomeScreen

src/tui/fullscreen.js:342–439  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

340 }
341
342 _renderWelcomeScreen() {
343 let buf = '';
344 const w = this.chatWidth;
345 const h = this.chatHeight;
346 const t = this.theme;
347
348 let version = 'unknown';
349 try { version = require('../../package.json').version; } catch {}
350 const cwd = process.cwd();
351
352 const cardWidth = Math.max(10, Math.min(w - 4, 76));
353 const padLeft = Math.max(0, Math.floor((w - cardWidth) / 2));
354 const pl = ' '.repeat(padLeft);
355
356 const bannerRow = Math.max(2, Math.floor(h * 0.25));
357
358 if (w < 20) {
359 buf += ANSI.moveTo(bannerRow, 1);
360 buf += fitAnsi(' SmallCode TUI', w);
361 return buf;
362 }
363
364 if (cardWidth < 45) {
365 // Extremely compact version for narrow terminals
366 buf += ANSI.moveTo(bannerRow, 1);
367 buf += pl + t.border + BOX.rTopLeft + BOX.horizontal.repeat(Math.max(0, cardWidth - 2)) + BOX.rTopRight + ANSI.reset;
368
369 buf += ANSI.moveTo(bannerRow + 1, 1);
370 const title = fitAnsi(` SmallCode v${version}`, cardWidth - 2);
371 buf += pl + t.border + BOX.vertical + ANSI.reset + t.brand + title + t.border + BOX.vertical + ANSI.reset;
372
373 buf += ANSI.moveTo(bannerRow + 2, 1);
374 const model = fitAnsi(` Model: ${this.model}`, cardWidth - 2);
375 buf += pl + t.border + BOX.vertical + ANSI.reset + t.accent + model + t.border + BOX.vertical + ANSI.reset;
376
377 buf += ANSI.moveTo(bannerRow + 3, 1);
378 const ep = fitAnsi(` Endpoint: ${this.endpoint || 'http://localhost:11434'}`, cardWidth - 2, { ellipsis: true });
379 buf += pl + t.border + BOX.vertical + ANSI.reset + t.muted + ep + t.border + BOX.vertical + ANSI.reset;
380
381 buf += ANSI.moveTo(bannerRow + 4, 1);
382 const hints = fitAnsi(` Hints: /help /quit /model /memory`, cardWidth - 2);
383 buf += pl + t.border + BOX.vertical + ANSI.reset + t.muted + hints + t.border + BOX.vertical + ANSI.reset;
384
385 buf += ANSI.moveTo(bannerRow + 5, 1);
386 const hints2 = fitAnsi(` /skill /diff /loop /mcp`, cardWidth - 2);
387 buf += pl + t.border + BOX.vertical + ANSI.reset + t.muted + hints2 + t.border + BOX.vertical + ANSI.reset;
388
389 buf += ANSI.moveTo(bannerRow + 6, 1);
390 buf += pl + t.border + BOX.rBottomLeft + BOX.horizontal.repeat(Math.max(0, cardWidth - 2)) + BOX.rBottomRight + ANSI.reset;
391 } else {
392 // Sleek grid layout
393 buf += ANSI.moveTo(bannerRow, 1);
394 buf += pl + t.border + BOX.rTopLeft + BOX.horizontal.repeat(Math.max(0, cardWidth - 2)) + BOX.rTopRight + ANSI.reset;
395
396 buf += ANSI.moveTo(bannerRow + 1, 1);
397 const titlePart = ` ⚡ SmallCode v${version} `;
398 const modelPart = ` Model: ${this.model} `;
399

Callers 2

_renderChatPanelMethod · 0.95
tui_layout.test.jsFile · 0.80

Calls 1

fitAnsiFunction · 0.85

Tested by

no test coverage detected