diff --git a/cli.py b/cli.py index ff80a49b8..c0313fd24 100644 --- a/cli.py +++ b/cli.py @@ -1355,6 +1355,19 @@ class ChatConsole: for line in output.rstrip("\n").split("\n"): _cprint(line) + @contextmanager + def status(self, *_args, **_kwargs): + """Provide a no-op Rich-compatible status context. + + Some slash command helpers use ``console.status(...)`` when running in + the standalone CLI. Interactive chat routes those helpers through + ``ChatConsole()``, which historically only implemented ``print()``. + Returning a silent context manager keeps slash commands compatible + without duplicating the higher-level busy indicator already shown by + ``HermesCLI._busy_command()``. + """ + yield self + # ASCII Art - HERMES-AGENT logo (full width, single line - requires ~95 char terminal) HERMES_AGENT_LOGO = """[bold #FFD700]██╗ ██╗███████╗██████╗ ███╗ ███╗███████╗███████╗ █████╗ ██████╗ ███████╗███╗ ██╗████████╗[/] [bold #FFD700]██║ ██║██╔════╝██╔══██╗████╗ ████║██╔════╝██╔════╝ ██╔══██╗██╔════╝ ██╔════╝████╗ ██║╚══██╔══╝[/] diff --git a/tests/hermes_cli/test_skills_hub.py b/tests/hermes_cli/test_skills_hub.py index 0ef6c2d69..bf9fa71a3 100644 --- a/tests/hermes_cli/test_skills_hub.py +++ b/tests/hermes_cli/test_skills_hub.py @@ -1,8 +1,10 @@ from io import StringIO +from unittest.mock import patch import pytest from rich.console import Console +from cli import ChatConsole from hermes_cli.skills_hub import do_check, do_install, do_list, do_update, handle_skills_slash @@ -179,6 +181,21 @@ def test_do_update_reinstalls_outdated_skills(monkeypatch): assert "Updated 1 skill" in output +def test_handle_skills_slash_search_accepts_chatconsole_without_status_errors(): + results = [type("R", (), { + "name": "kubernetes", + "description": "Cluster orchestration", + "source": "skills.sh", + "trust_level": "community", + "identifier": "skills-sh/example/kubernetes", + })()] + + with patch("tools.skills_hub.unified_search", return_value=results), \ + patch("tools.skills_hub.create_source_router", return_value={}), \ + patch("tools.skills_hub.GitHubAuth"): + handle_skills_slash("/skills search kubernetes", console=ChatConsole()) + + def test_do_install_scans_with_resolved_identifier(monkeypatch, tmp_path, hub_env): import tools.skills_guard as guard import tools.skills_hub as hub