band-aider-pub/band_aider/ui/splash.py
2026-07-26 08:42:33 -07:00

58 lines
7.7 KiB
Python

# SPDX-FileCopyrightText: 2026 Art Sea LLC
#
# SPDX-License-Identifier: AGPL-3.0-only
from __future__ import annotations
import curses
from pathlib import Path
from typing import Optional, Tuple
ASCII_ART = '\n \n \n \n \n \n \n ████████▓██ \n ▓█████████▒▓█░██░░▒ \n ▒█████████████▒█████▓░ \n ▒███████████████████████ \n ████████████░░ ▓█████████ \n ▓███████████▓██▒██████████▒ \n ▒██▓▒███████ ████████████████ \n ░███████ ████▒ ███▒██████████ \n ████████ █ ███▒███████████░ \n ░█████████▓▓▓ ░██████████████▓█░ \n ▓███████████▓░ ███████████ ████▒█▓ \n ███████████████████████▓██████▒ ░████ \n ▒██████████████████████▓█▓████▒█ ░▒ \n ██▓▒█▓█████████▓█████░▒█▒████▓ ▓ \n ████████████████████░▓▒░████░ \n ▒███████████████████████████░██ \n ███████████████████▓█▓████████░ ▒██████████▓░ \n ░██████████████████████████▓▓▓███████████▒████████████████████████▓▒░ \n ██▓█████████████████████████████▓▓█████████████████████▒████████████ \n ██████████▓▒██████████████████████████████████████████████████████████ \n ████████████████████████████▒ ▓████████████████████████████████▓████████ \n ████████████████████████▓▓███ ▒██████████████████████████▓██████████ \n ░▓████████████████████████▓▓▓█▒ █████████████████████████████████ \n ░▓ ██████████████████████████░ ▓███████████████████████████████ \n ▓░ ▓█▓███████ ░████████████ ███████████████████████████████ \n █▓▓▓████ ▓███▓██████░ ███████████████████████████▒ \n ▓███████ ▒▓▓▓██████░ ████████████████████████ \n ░███████░ █████████ ▓████████████████████ \n █▓████ ░████████░ ▒████████████████ \n ░█████ ░██▓████ ▒██████████▒ \n ▒█████▓ ▒██████ \n █▓█████▓ ██████░ \n ░█████ ███████▓ \n ░█▓██████░ \n ▓██████ \n \n \n \n \n'
def _safe_addstr(stdscr, y: int, x: int, text: str, attr: int = curses.A_NORMAL) -> None:
try:
stdscr.addstr(y, x, text, attr)
except curses.error:
pass
def _draw_centered_text(
stdscr,
top: int,
height: int,
width: int,
lines: list[str],
attr: int,
) -> None:
start_y = top + max(0, (height - len(lines)) // 2)
for i, line in enumerate(lines):
x = max(0, (width - len(line)) // 2)
_safe_addstr(stdscr, start_y + i, x, line[: max(0, width - 1)], attr)
def run_start_wizard(
initial_repo_root: Optional[Path],
can_resume: bool,
initial_overflow_strategy: Optional[str] = None,
initial_language: Optional[str] = None,
) -> Tuple[Path, bool, Optional[str], str, str]:
"""Run the startup wizard and return repository, mode, task, overflow strategy, and language."""
from .startup_wizard import StartupWizard
result = StartupWizard(
initial_repo_root=initial_repo_root,
initial_task=None,
initial_resume=can_resume,
initial_overflow_strategy=initial_overflow_strategy,
initial_language=initial_language,
resume_available=lambda _root: can_resume,
).run()
return (
result.repo_root,
result.resume,
result.task,
result.token_overflow_strategy,
result.language,
)