diff --git a/cli.py b/cli.py index a0e0e4ff79..1f1ebd45f5 100644 --- a/cli.py +++ b/cli.py @@ -9212,6 +9212,22 @@ class HermesCLI(CLIAgentSetupMixin, CLICommandsMixin, CLIBillingMixin): print() + def _handle_whoami_command(self): + """Display slash-command access for the local CLI surface.""" + import getpass + + try: + user_name = getpass.getuser() or "?" + except Exception: + user_name = "?" + + print() + print(" You: cli (local terminal)") + print(f" User: {user_name}") + print(" Tier: unrestricted") + print(" Slash commands: all available") + print() + def show_config(self): """Display current configuration with kawaii ASCII art.""" # Get terminal config from environment (which was set from cli-config.yaml) @@ -11381,6 +11397,8 @@ class HermesCLI(CLIAgentSetupMixin, CLICommandsMixin, CLIBillingMixin): return False elif canonical == "help": self.show_help() + elif canonical == "whoami": + self._handle_whoami_command() elif canonical == "profile": self._handle_profile_command() elif canonical == "tools": diff --git a/tests/cli/test_cli_init.py b/tests/cli/test_cli_init.py index bcad5af82a..15e6c653be 100644 --- a/tests/cli/test_cli_init.py +++ b/tests/cli/test_cli_init.py @@ -443,6 +443,24 @@ class TestNestedDictModelDefaultPairing: assert cli.requested_provider == "anthropic" assert cli.provider == "anthropic" + def test_whoami_command_is_dispatched_and_prints_cli_access(self, capsys): + """/whoami is advertised in classic CLI help and must not fall through. + + Regression test: the command existed in the shared registry, so it + appeared in /help and completion, but classic CLI dispatch lacked a + matching branch and printed `Unknown command: /whoami`. + """ + cli = _make_cli() + + cli.process_command("/whoami") + output = capsys.readouterr().out + + assert "Unknown command" not in output + assert "cli (local terminal)" in output + assert "Tier:" in output + assert "unrestricted" in output + assert "Slash commands: all available" in output + class TestRootLevelProviderOverride: """Root-level provider/base_url in config.yaml must NOT override model.provider."""