feat(cli): display custom profile alias names in profile list/show#40371
Merged
kshitijk4poor merged 1 commit intoJun 6, 2026
Merged
Conversation
profile list and profile show assumed the wrapper script is always named after the profile (wrapper_dir / name). When a custom alias exists — e.g. `hermes profile alias steve --name qiaobusi` creates ~/.local/bin/qiaobusi pointing at `hermes -p steve` — the display silently showed the profile name (or nothing) instead of the alias the user actually typed. The custom-alias *creation* path (create_wrapper_script(name, target)) was added later; the *display* path was never updated to match. Add find_alias_for_profile() — a reverse lookup that scans the wrapper dir for our own wrappers (alias-named file containing 'hermes -p <profile>'), prefers a custom alias over the profile-named one, strips .bat on Windows, and sorts for deterministic output. Populate ProfileInfo.alias_name and wire it into the three display sites (profile describe, list, show). Credit: salvages the intent of NousResearch#11506 by wss434631143, reimplemented on current main against the post-NousResearch#11506 custom-alias (--name/target) mechanism. Tests: 6 new (profile-named, custom-name, none, unrelated-file rejection, windows .bat strip, list_profiles surfacing). All 123 in test_profiles pass. E2E verified against the real CLI for both custom and profile-named aliases.
PatrickNoFilter
pushed a commit
to PatrickNoFilter/hermes-agent
that referenced
this pull request
Jun 10, 2026
…ousResearch#40371) profile list and profile show assumed the wrapper script is always named after the profile (wrapper_dir / name). When a custom alias exists — e.g. `hermes profile alias steve --name qiaobusi` creates ~/.local/bin/qiaobusi pointing at `hermes -p steve` — the display silently showed the profile name (or nothing) instead of the alias the user actually typed. The custom-alias *creation* path (create_wrapper_script(name, target)) was added later; the *display* path was never updated to match. Add find_alias_for_profile() — a reverse lookup that scans the wrapper dir for our own wrappers (alias-named file containing 'hermes -p <profile>'), prefers a custom alias over the profile-named one, strips .bat on Windows, and sorts for deterministic output. Populate ProfileInfo.alias_name and wire it into the three display sites (profile describe, list, show). Credit: salvages the intent of NousResearch#11506 by wss434631143, reimplemented on current main against the post-NousResearch#11506 custom-alias (--name/target) mechanism. Tests: 6 new (profile-named, custom-name, none, unrelated-file rejection, windows .bat strip, list_profiles surfacing). All 123 in test_profiles pass. E2E verified against the real CLI for both custom and profile-named aliases.
changman
pushed a commit
to changman/hermes-agent
that referenced
this pull request
Jun 10, 2026
…ousResearch#40371) profile list and profile show assumed the wrapper script is always named after the profile (wrapper_dir / name). When a custom alias exists — e.g. `hermes profile alias steve --name qiaobusi` creates ~/.local/bin/qiaobusi pointing at `hermes -p steve` — the display silently showed the profile name (or nothing) instead of the alias the user actually typed. The custom-alias *creation* path (create_wrapper_script(name, target)) was added later; the *display* path was never updated to match. Add find_alias_for_profile() — a reverse lookup that scans the wrapper dir for our own wrappers (alias-named file containing 'hermes -p <profile>'), prefers a custom alias over the profile-named one, strips .bat on Windows, and sorts for deterministic output. Populate ProfileInfo.alias_name and wire it into the three display sites (profile describe, list, show). Credit: salvages the intent of NousResearch#11506 by wss434631143, reimplemented on current main against the post-NousResearch#11506 custom-alias (--name/target) mechanism. Tests: 6 new (profile-named, custom-name, none, unrelated-file rejection, windows .bat strip, list_profiles surfacing). All 123 in test_profiles pass. E2E verified against the real CLI for both custom and profile-named aliases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
hermes profile listandhermes profile showassumed a profile's wrapper script is always named after the profile (wrapper_dir / name). When a custom alias exists — e.g.hermes profile alias steve --name qiaobusicreates~/.local/bin/qiaobusiinvokinghermes -p steve— the display silently showed the profile name (or nothing) instead of the alias the user actually typed.The custom-alias creation path (
create_wrapper_script(name, target)) and theprofile alias --name <custom>flag were added after the original report; the display path was never updated to match, so the two halves of the feature were out of sync.Changes
find_alias_for_profile()inhermes_cli/profiles.py— a reverse lookup that scans the wrapper dir for our own wrappers (a file named after the alias whose body containshermes -p <profile>), prefers a custom alias over the profile-named one, strips.baton Windows, and sorts for deterministic output when several match.ProfileInfo.alias_nameand populate it inlist_profiles()(also fixingalias_pathto point at the real, possibly custom-named, wrapper file).alias_nameinto the three display sites inhermes_cli/main.py:profile describe,profile list, andprofile show.Credit
Salvages the intent of #11506 by @wss434631143. That PR was ~6300 commits behind
mainand predated the--name/targetcustom-alias mechanism, so the implementation was reworked against currentmainrather than cherry-picked — but the bug it identified (display assumeswrapper == profile name) is real and still present, and the fix here closes it. Thanks for surfacing it.Test plan
tests/hermes_cli/test_profiles.py(TestFindAliasForProfile): profile-named alias, custom-name alias preferred, no-alias → None, unrelated-binary rejection, Windows.batextension stripping, andlist_profiles()surfacing the custom alias onProfileInfo.tests/hermes_cli/test_profiles.pysuite: 123 passed.HERMES_HOME):profile create steve --no-alias→profile alias steve --name qiaobusi→ bothprofile listandprofile show stevenow display qiaobusi. Profile-named alias (profile alias coder) still displayscoder(no regression).Closes #11506