|
1 | | -"""Startup banner for the interactive CLI. |
2 | | -
|
3 | | -The layout follows §3.3 of the 2026-05-19 UI/UX design proposal: |
4 | | -
|
5 | | - Vibe-Trading v0.2.0 |
6 | | - ───────────────────────────────────────────── |
7 | | - Natural-language finance research that |
8 | | - thinks before it answers. |
9 | | -
|
10 | | - Model: deepseek/deepseek-v4-pro |
11 | | - Skills: 72 loaded |
12 | | - Tools: 27 registered |
13 | | - Sessions: 3 prior (use /history to browse) |
14 | | -
|
15 | | - Try one of these: |
16 | | - > Compare AAPL and MSFT fundamentals |
17 | | - > Backtest a momentum strategy on BTC, 2020-now |
18 | | - > What's the implied vol on TSLA Jan 2026 calls? |
19 | | -
|
20 | | - /help for commands · Ctrl+C to clear input · Ctrl+D to exit |
21 | | - ───────────────────────────────────────────── |
22 | | -
|
23 | | -The wordmark "Vibe-Trading" is rendered in the brand orange (single accent), |
24 | | -everything else uses neutral / dim styles per the "Orange discipline rule". |
25 | | -No emoji, no ASCII-art logo — wordmark-only (proposal §1.3). |
26 | | -""" |
27 | | - |
28 | | -from __future__ import annotations |
29 | | - |
30 | | -from typing import Final, Sequence |
31 | | - |
32 | | -from rich.console import Console |
33 | | -from rich.text import Text |
34 | | - |
35 | | -from cli._version import __version__ as _VERSION |
36 | | -from cli.theme import Theme |
37 | | - |
38 | | -_TAGLINE: Final[str] = ( |
39 | | - "Natural-language finance research that\nthinks before it answers." |
40 | | -) |
41 | | - |
42 | | -_DEFAULT_EXAMPLES: Final[tuple[str, ...]] = ( |
43 | | - "Compare AAPL and MSFT fundamentals", |
44 | | - "Backtest a momentum strategy on BTC, 2020-now", |
45 | | - "What's the implied vol on TSLA Jan 2026 calls?", |
46 | | -) |
47 | | - |
48 | | - |
49 | | -def _rule(console: Console, *, width: int = 60) -> None: |
50 | | - """Print a single-character horizontal rule using muted style.""" |
51 | | - |
52 | | - char = "─" |
53 | | - target = min(width, max(20, console.size.width - 2)) |
54 | | - console.print(Text(char * target, style=Theme.muted)) |
55 | | - |
56 | | - |
57 | | -def print_banner( |
58 | | - console: Console, |
59 | | - *, |
60 | | - model: str, |
61 | | - skills: int, |
62 | | - tools: int, |
63 | | - sessions: int, |
64 | | - examples: Sequence[str] | None = None, |
65 | | - version: str = _VERSION, |
66 | | -) -> None: |
67 | | - """Render the startup banner. |
68 | | -
|
69 | | - Args: |
70 | | - console: Shared Rich console (use :func:`cli.theme.get_console`). |
71 | | - model: Active LLM model id, e.g. ``"deepseek/deepseek-v4-pro"``. |
72 | | - skills: Number of skills currently loaded. |
73 | | - tools: Number of tools registered in the agent registry. |
74 | | - sessions: Number of prior sessions on disk. ``0`` suppresses the |
75 | | - "/history to browse" hint. |
76 | | - examples: Three prompt examples to show under "Try one of these:". |
77 | | - Defaults to a curated triplet covering equities / crypto / |
78 | | - options. |
79 | | - version: Override version string (defaults to the package |
80 | | - metadata version via :mod:`cli._version`). |
81 | | -
|
82 | | - Notes: |
83 | | - - Wordmark is the *only* primary-orange element (design proposal §1.3 |
84 | | - "Orange discipline rule"). |
85 | | - - Padding on the left is two spaces, matching dexter's intro.ts. |
86 | | - - Examples are prefixed with ``>`` (not ``•``) so they read as REPL |
87 | | - input prompts, hinting that the user can paste them verbatim. |
88 | | - """ |
89 | | - |
90 | | - pad = " " |
91 | | - console.print() # leading blank line |
92 | | - |
93 | | - # ── Wordmark ──────────────────────────────────────────────────────── |
94 | | - wordmark = Text() |
95 | | - wordmark.append(pad) |
96 | | - wordmark.append("Vibe-Trading", style=Theme.primary) |
97 | | - wordmark.append(f" v{version}", style=Theme.muted) |
98 | | - console.print(wordmark) |
99 | | - |
100 | | - # ── Rule ──────────────────────────────────────────────────────────── |
101 | | - indent = Text(pad) |
102 | | - rule = Text("─" * 50, style=Theme.muted) |
103 | | - console.print(indent + rule) |
104 | | - |
105 | | - # ── Tagline ───────────────────────────────────────────────────────── |
106 | | - for line in _TAGLINE.splitlines(): |
107 | | - console.print(Text(pad) + Text(line, style=Theme.muted)) |
108 | | - console.print() |
109 | | - |
110 | | - # ── Stats grid ────────────────────────────────────────────────────── |
111 | | - rows: list[tuple[str, str]] = [ |
112 | | - ("Model", model), |
113 | | - ("Skills", f"{skills} loaded"), |
114 | | - ("Tools", f"{tools} registered"), |
115 | | - ] |
116 | | - if sessions > 0: |
117 | | - rows.append(("Sessions", f"{sessions} prior (use /history to browse)")) |
118 | | - else: |
119 | | - rows.append(("Sessions", "none yet")) |
120 | | - |
121 | | - label_width = max(len(label) for label, _ in rows) + 2 |
122 | | - for label, value in rows: |
123 | | - line = Text(pad) |
124 | | - line.append(f"{label}:".ljust(label_width), style=Theme.label) |
125 | | - line.append(value, style=Theme.muted) |
126 | | - console.print(line) |
127 | | - |
128 | | - console.print() |
129 | | - |
130 | | - # ── Examples ──────────────────────────────────────────────────────── |
131 | | - console.print(Text(pad) + Text("Try one of these:", style=Theme.label)) |
132 | | - for ex in (examples or _DEFAULT_EXAMPLES): |
133 | | - line = Text(pad) |
134 | | - line.append("> ", style=Theme.primary_dim) |
135 | | - line.append(ex, style=Theme.muted) |
136 | | - console.print(line) |
137 | | - |
138 | | - console.print() |
139 | | - |
140 | | - # ── Footer hint ───────────────────────────────────────────────────── |
141 | | - footer = Text(pad) |
142 | | - footer.append("/help", style=Theme.info) |
143 | | - footer.append(" for commands · ", style=Theme.muted) |
144 | | - footer.append("Ctrl+C", style=Theme.info) |
145 | | - footer.append(" to clear input · ", style=Theme.muted) |
146 | | - footer.append("Ctrl+D", style=Theme.info) |
147 | | - footer.append(" to exit", style=Theme.muted) |
148 | | - console.print(footer) |
149 | | - |
150 | | - # ── Bottom rule ───────────────────────────────────────────────────── |
151 | | - console.print(indent + Text("─" * 60, style=Theme.muted)) |
152 | | - console.print() |
| 1 | +"""Compatibility wrapper for the interactive startup banner.""" |
153 | 2 |
|
| 3 | +from cli.ui.banner import print_banner |
154 | 4 |
|
155 | 5 | __all__ = ["print_banner"] |
0 commit comments