Skip to content

feat(cli): support custom profile alias names in profile list/show#11506

Closed
wss434631143 wants to merge 1 commit into
NousResearch:mainfrom
wss434631143:fix/profile-custom-alias
Closed

feat(cli): support custom profile alias names in profile list/show#11506
wss434631143 wants to merge 1 commit into
NousResearch:mainfrom
wss434631143:fix/profile-custom-alias

Conversation

@wss434631143

Copy link
Copy Markdown

Previously, hermes profile list and hermes profile show always displayed the profile name as the alias, even when a custom wrapper (e.g. qiaobusi pointing to steve-jobs) existed.

This patch:

  • Adds _find_alias_name() to scan wrapper scripts and detect custom aliases that invoke hermes -p <profile>.
  • Extends ProfileInfo with an alias_name field.
  • Updates profile list to display the custom alias when present.
  • Updates profile show to display the detected alias name.

Fixes the hard-coded assumption that alias == profile name.

Previously, `hermes profile list` and `hermes profile show` always
displayed the profile name as the alias, even when a custom wrapper
(e.g. `qiaobusi` pointing to `steve-jobs`) existed.

This patch:
- Adds `_find_alias_name()` to scan wrapper scripts and detect
custom aliases that invoke `hermes -p <profile>`.
- Extends `ProfileInfo` with an `alias_name` field.
- Updates `profile list` to display the custom alias when present.
- Updates `profile show` to display the detected alias name.

Fixes the hard-coded assumption that alias == profile name.
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard labels Apr 24, 2026
kshitijk4poor added a commit that referenced this pull request Jun 6, 2026
…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 #11506 by wss434631143, reimplemented on
current main against the post-#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

Copy link
Copy Markdown
Collaborator

Salvaged and merged via #40371. Your branch was ~6300 commits behind main and predated the custom-alias --name/target mechanism that landed later, so the fix was reimplemented on current main rather than cherry-picked — but the display bug you identified (profile list/show assuming wrapper == profile name) was real and is now fixed, with credit to you in the commit and PR body. Thanks for surfacing it!

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

comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants