Skip to content
This repository was archived by the owner on Apr 22, 2026. It is now read-only.

Commit f52f028

Browse files
authored
feat: show agentspaces version in TUI header (#45)
Display the package version in the TUI header alongside the main checkout info. The header now shows: - With main checkout: "agentspaces • Main: {project} ({branch}) • v{version}" - Without main checkout: "agentspaces • v{version}" Implements proper Textual Header.format_title() override instead of using internal attributes. Closes agentspaces-5b0
1 parent fb28a82 commit f52f028

1 file changed

Lines changed: 27 additions & 9 deletions

File tree

src/agentspaces/ui/widgets.py

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from rich.text import Text
99
from textual.containers import Container, Horizontal
10+
from textual.content import Content
1011
from textual.screen import ModalScreen
1112
from textual.widgets import (
1213
Button,
@@ -16,6 +17,8 @@
1617
Static,
1718
)
1819

20+
from agentspaces import __version__
21+
1922
if TYPE_CHECKING:
2023
from textual.app import ComposeResult
2124

@@ -163,7 +166,7 @@ def update_preview(self, workspace: WorkspaceInfo | None) -> None:
163166

164167

165168
class WorkspaceHeader(Header):
166-
"""Header showing main repository checkout info."""
169+
"""Header showing main repository checkout info and version."""
167170

168171
def __init__(self, main_checkout: WorkspaceInfo | None = None) -> None:
169172
"""Initialize header.
@@ -173,7 +176,6 @@ def __init__(self, main_checkout: WorkspaceInfo | None = None) -> None:
173176
"""
174177
super().__init__()
175178
self._main_checkout = main_checkout
176-
self._update_title()
177179

178180
def set_main_checkout(self, main_checkout: WorkspaceInfo | None) -> None:
179181
"""Update main checkout display.
@@ -182,17 +184,33 @@ def set_main_checkout(self, main_checkout: WorkspaceInfo | None) -> None:
182184
main_checkout: Main repository checkout info.
183185
"""
184186
self._main_checkout = main_checkout
185-
self._update_title()
187+
# Trigger header title refresh
188+
self._refresh_title()
189+
190+
def _refresh_title(self) -> None:
191+
"""Refresh the header title display."""
192+
from textual.css.query import NoMatches
193+
from textual.widgets._header import HeaderTitle
194+
195+
try:
196+
header_title = self.query_one(HeaderTitle)
197+
header_title.update(self.format_title())
198+
except NoMatches:
199+
pass # Widget not yet mounted
200+
201+
def format_title(self) -> Content:
202+
"""Format the header title with main checkout info and version.
186203
187-
def _update_title(self) -> None:
188-
"""Update header title with main checkout info."""
204+
Returns:
205+
Formatted title content.
206+
"""
189207
if self._main_checkout:
190208
project = self._main_checkout.project
191209
branch = self._main_checkout.branch
192-
self.tall_title = True
193-
self._text = f"agentspaces • Main: {project} ({branch})"
194-
else:
195-
self._text = "agentspaces"
210+
return Content(
211+
f"agentspaces • Main: {project} ({branch}) • v{__version__}"
212+
)
213+
return Content(f"agentspaces • v{__version__}")
196214

197215

198216
class WorkspaceFooter(Footer):

0 commit comments

Comments
 (0)