Skip to content

Add dispatch alias to set and remove session aliases from the CLI #331

Description

@jongio

Problem

Session aliases can be set in the TUI with A, and dispatch aliases lists them, but there is no way to set or remove an alias from the CLI. That breaks the pattern the other metadata commands follow: dispatch tag <id> mutates tags and dispatch notes set/clear mutates notes, while aliases are read-only from the command line. Scripts and dotfiles cannot assign a stable alias without opening the TUI.

Solution

Add dispatch alias to set and remove aliases, matching the style of tag and notes:

dispatch alias <id> <name>     # assign or reassign an alias
dispatch alias <id> --clear    # remove the alias on a session
dispatch alias --remove <name> # remove by alias name

<id> accepts a full ID or short ID prefix, consistent with the rest of the CLI. Alias names reuse the same validation the TUI applies (non-empty, no whitespace, unique across sessions) so dispatch open <alias> keeps resolving to exactly one session. Assigning a name already used by another session is rejected with a message naming the current owner. A --json flag prints the resulting mapping for scripting.

Acceptance criteria

  • dispatch alias <id> <name> assigns an alias and persists it to config
  • dispatch alias <id> --clear and dispatch alias --remove <name> both remove an alias
  • Alias names are validated (non-empty, no whitespace) and rejected when already taken by another session
  • Short ID prefixes resolve the same way they do for dispatch open
  • --json prints the resulting alias mapping
  • Unit tests cover set, reassign, clear, remove-by-name, duplicate rejection, and validation failures
  • README and dispatch man document the command

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestideaFeature idea from the idea pipeline

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions