fix(cli): wire /whoami slash command in classic CLI

This commit is contained in:
kronexoi
2026-05-15 05:08:42 +03:00
committed by Teknium
parent 4511ba49dd
commit 4f12cfd98d
2 changed files with 36 additions and 0 deletions
+18
View File
@@ -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":
+18
View File
@@ -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."""