From 3b811eb2e2ed4b60ccec5dfe1b2f3b0a3c80252e Mon Sep 17 00:00:00 2001 From: ktej721 Date: Sun, 12 Oct 2025 21:53:24 +0530 Subject: [PATCH 1/2] feat: add --reinstall-tui flag to force reinstall rogue-tui This flag allows the user to force the reinstallation of the rogue-tui binary, even if it already exists. This is useful for development and testing purposes. Fixes #74 --- rogue/__main__.py | 10 +++++++++- rogue/common/tui_installer.py | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/rogue/__main__.py b/rogue/__main__.py index 7d1fdc5e..c08b1f1a 100644 --- a/rogue/__main__.py +++ b/rogue/__main__.py @@ -53,6 +53,12 @@ def common_parser() -> ArgumentParser: default="localhost", help="Host for the example agent (default: localhost)", ) + parent_parser.add_argument( + "--reinstall-tui", + action="store_true", + default=False, + help="Force reinstallation of the TUI.", + ) parent_parser.add_argument( "--example-port", type=int, @@ -199,7 +205,9 @@ def main() -> None: logger.info("Starting rogue-ai...") # Step 1: Install rogue-tui if needed - if not RogueTuiInstaller().install_rogue_tui(): + if not RogueTuiInstaller().install_rogue_tui( + reinstall=args.reinstall_tui + ): logger.error("Failed to install rogue-tui. Exiting.") if example_process: example_process.terminate() diff --git a/rogue/common/tui_installer.py b/rogue/common/tui_installer.py index b1783d73..13f7d0fe 100644 --- a/rogue/common/tui_installer.py +++ b/rogue/common/tui_installer.py @@ -168,11 +168,12 @@ def _is_rogue_tui_installed(self) -> bool: def install_rogue_tui( self, upgrade: bool = False, + reinstall: bool = False, ) -> bool: """Install rogue-tui from GitHub releases if not already installed.""" console = Console() # Check if rogue-tui is already available - if self._is_rogue_tui_installed() and not upgrade: + if self._is_rogue_tui_installed() and not upgrade and not reinstall: console.print("[green]✅ rogue-tui is already installed.[/green]") return True From 643d6b65348da2c452d68bd6a0a4a537969b67b3 Mon Sep 17 00:00:00 2001 From: ktej721 Date: Sun, 12 Oct 2025 22:02:17 +0530 Subject: [PATCH 2/2] docs: update docstring for install_rogue_tui --- rogue/__main__.py | 10 +++++----- rogue/common/tui_installer.py | 17 ++++++++++------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/rogue/__main__.py b/rogue/__main__.py index c08b1f1a..a6cc0dc7 100644 --- a/rogue/__main__.py +++ b/rogue/__main__.py @@ -54,7 +54,7 @@ def common_parser() -> ArgumentParser: help="Host for the example agent (default: localhost)", ) parent_parser.add_argument( - "--reinstall-tui", + "--force-reinstall", action="store_true", default=False, help="Force reinstallation of the TUI.", @@ -205,9 +205,7 @@ def main() -> None: logger.info("Starting rogue-ai...") # Step 1: Install rogue-tui if needed - if not RogueTuiInstaller().install_rogue_tui( - reinstall=args.reinstall_tui - ): + if not RogueTuiInstaller().install_rogue_tui(force=args.force_reinstall): logger.error("Failed to install rogue-tui. Exiting.") if example_process: example_process.terminate() @@ -254,7 +252,9 @@ def main() -> None: exit_code = asyncio.run(run_cli(args)) sys.exit(exit_code) elif args.mode == "tui": - if not RogueTuiInstaller().install_rogue_tui(): + if not RogueTuiInstaller().install_rogue_tui( + force=args.force_reinstall + ): logger.error("Failed to install rogue-tui. Exiting.") sys.exit(1) exit_code = run_rogue_tui() diff --git a/rogue/common/tui_installer.py b/rogue/common/tui_installer.py index 13f7d0fe..32813593 100644 --- a/rogue/common/tui_installer.py +++ b/rogue/common/tui_installer.py @@ -165,15 +165,18 @@ def _is_rogue_tui_installed(self) -> bool: else: return False - def install_rogue_tui( - self, - upgrade: bool = False, - reinstall: bool = False, - ) -> bool: - """Install rogue-tui from GitHub releases if not already installed.""" + def install_rogue_tui(self, force: bool = False) -> bool: + """Install rogue-tui from GitHub releases if not already installed. + + Args: + force: Force installation even if already installed. + + Returns: + bool: True if installation succeeded, False otherwise. + """ console = Console() # Check if rogue-tui is already available - if self._is_rogue_tui_installed() and not upgrade and not reinstall: + if self._is_rogue_tui_installed() and not force: console.print("[green]✅ rogue-tui is already installed.[/green]") return True