Skip to content

feat(cli): display custom profile alias names in profile list/show#40371

Merged
kshitijk4poor merged 1 commit into
NousResearch:mainfrom
kshitijk4poor:salvage/profile-custom-alias-display
Jun 6, 2026
Merged

feat(cli): display custom profile alias names in profile list/show#40371
kshitijk4poor merged 1 commit into
NousResearch:mainfrom
kshitijk4poor:salvage/profile-custom-alias-display

Conversation

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Summary

hermes profile list and hermes profile show assumed 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 qiaobusi creates ~/.local/bin/qiaobusi invoking 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)) and the profile 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

  • Add find_alias_for_profile() in hermes_cli/profiles.py — a reverse lookup that scans the wrapper dir for our own wrappers (a file named after the alias whose body contains hermes -p <profile>), prefers a custom alias over the profile-named one, strips .bat on Windows, and sorts for deterministic output when several match.
  • Add ProfileInfo.alias_name and populate it in list_profiles() (also fixing alias_path to point at the real, possibly custom-named, wrapper file).
  • Wire alias_name into the three display sites in hermes_cli/main.py: profile describe, profile list, and profile show.

Credit

Salvages the intent of #11506 by @wss434631143. That PR was ~6300 commits behind main and predated the --name/target custom-alias mechanism, so the implementation was reworked against current main rather than cherry-picked — but the bug it identified (display assumes wrapper == profile name) is real and still present, and the fix here closes it. Thanks for surfacing it.

Test plan

  • 6 new unit tests in tests/hermes_cli/test_profiles.py (TestFindAliasForProfile): profile-named alias, custom-name alias preferred, no-alias → None, unrelated-binary rejection, Windows .bat extension stripping, and list_profiles() surfacing the custom alias on ProfileInfo.
  • Full tests/hermes_cli/test_profiles.py suite: 123 passed.
  • E2E against the real CLI (isolated HERMES_HOME): profile create steve --no-aliasprofile alias steve --name qiaobusi → both profile list and profile show steve now display qiaobusi. Profile-named alias (profile alias coder) still displays coder (no regression).

Closes #11506

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.
@kshitijk4poor kshitijk4poor enabled auto-merge (squash) June 6, 2026 08:05
@kshitijk4poor kshitijk4poor merged commit 5af899c into NousResearch:main Jun 6, 2026
22 checks passed
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant