Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2837,6 +2837,28 @@ def show_toolsets(self):
print(" Example: python cli.py --toolsets web,terminal")
print()

def _handle_profile_command(self):
"""Display active profile name and home directory."""
from hermes_constants import get_hermes_home, display_hermes_home

home = get_hermes_home()
display = display_hermes_home()

profiles_parent = Path.home() / ".hermes" / "profiles"
try:
rel = home.relative_to(profiles_parent)
profile_name = str(rel).split("/")[0]
except ValueError:
profile_name = None

print()
if profile_name:
print(f" Profile: {profile_name}")
else:
print(" Profile: default")
print(f" Home: {display}")
print()

def show_config(self):
"""Display current configuration with kawaii ASCII art."""
# Get terminal config from environment (which was set from cli-config.yaml)
Expand Down Expand Up @@ -3679,6 +3701,8 @@ def process_command(self, command: str) -> bool:
return False
elif canonical == "help":
self.show_help()
elif canonical == "profile":
self._handle_profile_command()
elif canonical == "tools":
self._handle_tools_command(cmd_original)
elif canonical == "toolsets":
Expand Down
33 changes: 33 additions & 0 deletions gateway/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -1865,6 +1865,9 @@ async def _handle_message(self, event: MessageEvent) -> Optional[str]:
if canonical == "commands":
return await self._handle_commands_command(event)

if canonical == "profile":
return await self._handle_profile_command(event)

if canonical == "status":
return await self._handle_status_command(event)

Expand Down Expand Up @@ -3055,6 +3058,36 @@ async def _handle_reset_command(self, event: MessageEvent) -> str:
return f"{header}\n\n{session_info}"
return header

async def _handle_profile_command(self, event: MessageEvent) -> str:
"""Handle /profile β€” show active profile name and home directory."""
from hermes_constants import get_hermes_home, display_hermes_home
from pathlib import Path

home = get_hermes_home()
display = display_hermes_home()

# Detect profile name from HERMES_HOME path
# Profile paths look like: ~/.hermes/profiles/<name>
profiles_parent = Path.home() / ".hermes" / "profiles"
try:
rel = home.relative_to(profiles_parent)
profile_name = str(rel).split("/")[0]
except ValueError:
profile_name = None

if profile_name:
lines = [
f"πŸ‘€ **Profile:** `{profile_name}`",
f"πŸ“‚ **Home:** `{display}`",
]
else:
lines = [
"πŸ‘€ **Profile:** default",
f"πŸ“‚ **Home:** `{display}`",
]

return "\n".join(lines)

async def _handle_status_command(self, event: MessageEvent) -> str:
"""Handle /status command."""
source = event.source
Expand Down
1 change: 1 addition & 0 deletions hermes_cli/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class CommandDef:
aliases=("q",), args_hint="<prompt>"),
CommandDef("status", "Show session info", "Session",
gateway_only=True),
CommandDef("profile", "Show active profile name and home directory", "Info"),
CommandDef("sethome", "Set this chat as the home channel", "Session",
gateway_only=True, aliases=("set-home",)),
CommandDef("resume", "Resume a previously-named session", "Session",
Expand Down
Loading