The agent that turns websites into APIs!
Redesign CLI UI to match system design brown theme (#84)
kalil0321f1878bc79e8b
diff --git a/src/reverse_api/branding.py b/src/reverse_api/branding.pynew file mode 100644index 0000000..03d51ad--- /dev/null+++ b/src/reverse_api/branding.py@@ -0,0 +1,20 @@+"""CLI branding — text logo and display helpers.++SVG cannot be rendered faithfully in most terminals. Rich can show raster images+(PNG) in iTerm2, Kitty, WezTerm, etc., but that needs a bundled PNG and still+fails on plain SSH sessions. A fixed-width text logo works everywhere.+"""++from __future__ import annotations++from rich.console import Console++from .theme import BRAND_MARK, BRAND_WORDMARK, THEME_PRIMARY, THEME_SECONDARY+++def print_cli_logo(console: Console) -> None:+ """Print the bundled text logo: pink * followed by rae (site lockup)."""+ console.print(+ f" [{THEME_PRIMARY}]{BRAND_MARK}[/{THEME_PRIMARY}]"+ f" [{THEME_SECONDARY}]{BRAND_WORDMARK}[/{THEME_SECONDARY}]"+ )diff --git a/src/reverse_api/collector_ui.py b/src/reverse_api/collector_ui.pyindex 2e94cec..76053ab 100644--- a/src/reverse_api/collector_ui.py+++ b/src/reverse_api/collector_ui.py@@ -2,9 +2,10 @@from rich.console import Console-from .tui import THEME_DIM+from .theme import MODE_COLORS, THEME_DIM+from .tui import print_session_header-COLLECTOR_COLOR = "#ffd700" # Gold+COLLECTOR_COLOR = MODE_COLORS["collector"]class CollectorUI:@@ -17,14 +18,15 @@ class CollectorUI:def header(self, run_id: str, prompt: str, model: str | None = None, **kwargs) -> None:"""Display the collector session header."""- from . import __version__-- self.console.print()- self.console.print(f" [white]reverse-api[/white] [{COLLECTOR_COLOR}]v{__version__}[/{COLLECTOR_COLOR}]")- self.console.print(f" [dim]━[/dim] [white]{run_id}[/white]")- self.console.print(f" [{COLLECTOR_COLOR}]collector[/{COLLECTOR_COLOR}] [dim]|[/dim] [dim]model[/dim] [white]{model or '---'}[/white]")- self.console.print(f" [{COLLECTOR_COLOR}]task[/{COLLECTOR_COLOR}] [white]{prompt[:80]}{'...' if len(prompt) > 80 else ''}[/white]")- self.console.print()+ task = prompt[:80] + ("..." if len(prompt) > 80 else "")+ print_session_header(+ self.console,+ run_id,+ task,+ model=model,+ mode="collector",+ mode_label="collector",+ )def start_collecting(self) -> None:"""Display collection start message."""diff --git a/src/reverse_api/opencode_ui.py b/src/reverse_api/opencode_ui.pyindex 2fcac5a..a733dcd 100644--- a/src/reverse_api/opencode_ui.py+++ b/src/reverse_api/opencode_ui.py@@ -7,13 +7,8 @@ from rich.console import Consolefrom rich.live import Livefrom rich.text import Text-from .tui import ERROR_CTA, MODE_COLORS--# Theme configuration (matching tui.py)-THEME_PRIMARY = "#ff5f50"-THEME_SECONDARY = "white"-THEME_DIM = "#555555"-THEME_SUCCESS = "#ff5f50"+from .theme import MODE_COLORS, THEME_DIM, THEME_PRIMARY, THEME_SUCCESS+from .tui import ERROR_CTA, print_session_headerclass OpenCodeUI:@@ -38,19 +33,7 @@ class OpenCodeUI:mode: str | None = None,) -> None:"""Display the session header."""- from . import __version__-- mode_color = MODE_COLORS.get(mode or "", THEME_PRIMARY)-- self.console.print()- self.console.print(f" [white]reverse-api[/white] [{mode_color}]v{__version__}[/{mode_color}]")- self.console.print(f" [dim]━[/dim] [white]{run_id}[/white]")- if sdk:- self.console.print(f" [dim]sdk[/dim] [white]{sdk}[/white] [dim]|[/dim] [dim]model[/dim] [white]{model or '---'}[/white]")- else:- self.console.print(f" [dim]model[/dim] [white]{model or '---'}[/white]")- self.console.print(f" [{mode_color}]task[/{mode_color}] [white]{prompt}[/white]")- self.console.print()+ print_session_header(self.console, run_id, prompt, model=model, sdk=sdk, mode=mode)def start_analysis(self) -> None:"""Display analysis start message."""diff --git a/src/reverse_api/theme.py b/src/reverse_api/theme.pynew file mode 100644index 0000000..553a459--- /dev/null+++ b/src/reverse_api/theme.py@@ -0,0 +1,31 @@+"""Design tokens for the CLI, aligned with System_Design.md (dark / terminal)."""++# Core palette (website dark mode)+COLOR_INK = "#fff7f0"+COLOR_INK_SOFT = "#c9bdb3"+COLOR_CREAM = "#14110e"+COLOR_CREAM_SOFT = "#1c1814"+COLOR_WASHED = "#1a1612"+COLOR_ORANGE = "#3a1d0e"+COLOR_MINT = "#7ec99a"+COLOR_SKY = "#7eb8ff"+COLOR_PRIMARY = "#ff3d8b"+COLOR_PRIMARY_ALT = "#e50d75"++# Rich / prompt styling aliases+THEME_PRIMARY = COLOR_PRIMARY+THEME_SECONDARY = COLOR_INK+THEME_DIM = "#8a7d72"+THEME_SUCCESS = COLOR_MINT+THEME_ERROR = f"bold {COLOR_INK} on {COLOR_PRIMARY_ALT}"++MODE_COLORS = {+ "agent": COLOR_PRIMARY,+ "manual": COLOR_MINT,+ "engineer": COLOR_SKY,+ "collector": "#e8b86d",+}++BRAND_MARK = "*"+BRAND_WORDMARK = "rae"+APP_TAGLINE = "Turn websites into APIs."diff --git a/src/reverse_api/tui.py b/src/reverse_api/tui.pyindex db5d562..d9c14a4 100644--- a/src/reverse_api/tui.py+++ b/src/reverse_api/tui.py@@ -7,24 +7,22 @@ from rich.console import Consolefrom rich.padding import Paddingfrom rich.text import Text-# Theme configuration-THEME_PRIMARY = "#ff5f50" # Coral Red-THEME_SECONDARY = "white"-THEME_DIM = "#555555"-THEME_SUCCESS = "#ff5f50"-THEME_ERROR = "bold white on #ff5f50"+from .branding import print_cli_logo+from .theme import (+ APP_TAGLINE,+ BRAND_MARK,+ BRAND_WORDMARK,+ MODE_COLORS,+ THEME_DIM,+ THEME_ERROR,+ THEME_PRIMARY,+ THEME_SECONDARY,+ THEME_SUCCESS,+)ERROR_CTA = "If an unexpected error occurred, please create an issue at https://github.com/kalil0321/reverse-api-engineer/issues/new"-MODE_COLORS = {- "agent": "#ff5f50", # Coral Red- "manual": "#50ff9f", # Green/Cyan- "engineer": "#5f9fff", # Blue- "collector": "#ffd700", # Gold-}--# Tool icons for visual clarity (minimalist text)TOOL_ICONS = {"Read": "rd",@@ -73,19 +71,7 @@ class ClaudeUI:def header(self, run_id: str, prompt: str, model: str | None = None, sdk: str | None = None, mode: str | None = None) -> None:"""Display the session header."""- from . import __version__-- mode_color = MODE_COLORS.get(mode or "", THEME_PRIMARY)-- self.console.print()- self.console.print(f" [white]reverse-api[/white] [{mode_color}]v{__version__}[/{mode_color}]")- self.console.print(f" [dim]━[/dim] [white]{run_id}[/white]")- if sdk:- self.console.print(f" [dim]sdk[/dim] [white]{sdk}[/white] [dim]|[/dim] [dim]model[/dim] [white]{model or '---'}[/white]")- else:- self.console.print(f" [dim]model[/dim] [white]{model or '---'}[/white]")- self.console.print(f" [{mode_color}]task[/{mode_color}] [white]{prompt}[/white]")- self.console.print()+ print_session_header(self.console, run_id, prompt, model=model, sdk=sdk, mode=mode)def start_analysis(self) -> None:"""Display analysis start message."""@@ -358,15 +344,60 @@ def get_model_choices() -> list[dict]:]+def print_brand_line(console: Console, *, version: str | None = None, version_color: str | None = None) -> None:+ """Print the * rae wordmark (optional version suffix)."""+ line = f" [{THEME_PRIMARY}]{BRAND_MARK}[/{THEME_PRIMARY}] [{THEME_SECONDARY}]{BRAND_WORDMARK}[/{THEME_SECONDARY}]"+ if version is not None:+ color = version_color or THEME_PRIMARY+ line += f" [{color}]v{version}[/{color}]"+ console.print(line)+++def print_session_header(+ console: Console,+ run_id: str,+ prompt: str,+ model: str | None = None,+ sdk: str | None = None,+ mode: str | None = None,+ *,+ mode_label: str = "task",+) -> None:+ """Session header matching the site terminal-window pattern."""+ from . import __version__++ mode_color = MODE_COLORS.get(mode or "", THEME_PRIMARY)++ console.print()+ print_brand_line(console, version=__version__, version_color=mode_color)+ console.print(f" [{THEME_DIM}]━[/{THEME_DIM}] [{THEME_SECONDARY}]{run_id}[/{THEME_SECONDARY}]")+ if sdk:+ console.print(+ f" [{THEME_DIM}]sdk[/{THEME_DIM}] [{THEME_SECONDARY}]{sdk}[/{THEME_SECONDARY}]"+ f" [{THEME_DIM}]|[/{THEME_DIM}] [{THEME_DIM}]model[/{THEME_DIM}]"+ f" [{THEME_SECONDARY}]{model or '---'}[/{THEME_SECONDARY}]"+ )+ else:+ console.print(+ f" [{THEME_DIM}]model[/{THEME_DIM}] [{THEME_SECONDARY}]{model or '---'}[/{THEME_SECONDARY}]"+ )+ console.print(f" [{mode_color}]{mode_label}[/{mode_color}] [{THEME_SECONDARY}]{prompt}[/{THEME_SECONDARY}]")+ console.print()++def display_banner(console: Console, sdk: str | None = None, model: str | None = None):- """Display ultra-minimalist banner."""+ """Display minimalist startup banner with * rae branding."""console.print()- console.print(" [bold white]reverse-api[/bold white]")+ print_cli_logo(console)console.print(f" [bold {THEME_PRIMARY}]━━[/bold {THEME_PRIMARY}]")if sdk and model:- console.print(f" [red]sdk[/red] [red]{sdk}[/red] [red]|[/red] [red]model[/red] [red]{model}[/red]")+ console.print(+ f" [{THEME_DIM}]sdk[/{THEME_DIM}] [{THEME_SECONDARY}]{sdk}[/{THEME_SECONDARY}]"+ f" [{THEME_DIM}]·[/{THEME_DIM}] [{THEME_DIM}]model[/{THEME_DIM}]"+ f" [{THEME_SECONDARY}]{model}[/{THEME_SECONDARY}]"+ )console.print()- console.print(" [dim white]AI agents for API reverse engineering.[/dim white]")+ console.print(f" [{THEME_DIM}]{APP_TAGLINE}[/{THEME_DIM}]")console.print()@@ -378,10 +409,8 @@ def display_footer(console: Console):time_str = datetime.now().strftime("%H:%M")- footer = Text()- footer.append(f"\n v{__version__} ", style=THEME_DIM)- footer.append(f" {time_str} ", style=THEME_DIM)- footer.append(" VIA CLI ", style=THEME_DIM)-- console.print(footer)+ console.print(+ f"\n [{THEME_DIM}][{THEME_PRIMARY}]{BRAND_MARK}[/{THEME_PRIMARY}]"+ f" v{__version__} {time_str} via cli[/{THEME_DIM}]"+ )console.print()diff --git a/tests/test_tui.py b/tests/test_tui.pyindex 2216f60..8b40aea 100644--- a/tests/test_tui.py+++ b/tests/test_tui.py@@ -353,7 +353,8 @@ class TestDisplayBanner:console = Console(file=StringIO(), no_color=True)display_banner(console)output = console.file.getvalue()- assert "reverse-api" in output+ assert "rae" in output+ assert "Turn websites into APIs" in outputdef test_banner_with_sdk_and_model(self):"""Banner with SDK and model info."""@@ -371,4 +372,5 @@ class TestDisplayFooter:console = Console(file=StringIO(), no_color=True)display_footer(console)output = console.file.getvalue()- assert "VIA CLI" in output+ assert "via cli" in output+ assert "*" in output