Skip to content

Add a dispatch aliases command to list session aliases #275

Description

@jongio

Problem

dispatch open <alias> resumes a session by its short alias, and the TUI can set aliases with A, but there is no way to list the aliases you have set from the command line. To see which alias maps to which session you have to open the TUI or read config.json by hand. dispatch tags already solves the same discovery problem for tags, so aliases are the odd one out.

flowchart TD
    A[dispatch aliases] --> B[Load config SessionAliases]
    B --> C[Load sessions from store]
    C --> D{Alias target in store?}
    D -->|yes| E[Show alias, id, summary, repo]
    D -->|no| F[Mark as orphaned]
    E --> G[Text or --json output]
    F --> G
Loading

Proposed solution

Add a dispatch aliases command that lists every alias with the session it points at, mirroring the shape and flags of dispatch tags:

  • Print each alias, the target session ID (short form), and the session summary and repo when the session still exists.
  • Flag aliases whose target session is no longer in the store as orphaned, so stale entries are easy to spot.
  • Support --json for scripting, emitting a stable object with the alias list and counts.
  • Take no positional arguments; reject unknown flags with the same error style as the other subcommands.

Wire it into handleArgs, the usage banner, and shell completion (bash, zsh, fish, powershell) next to tags.

Acceptance criteria

  • dispatch aliases prints each alias with its target session ID, summary, and repo.
  • Aliases pointing at sessions that are no longer in the store are shown as orphaned.
  • dispatch aliases --json prints a stable JSON object with the alias entries and a total count.
  • With no aliases set, the command prints a clear empty-state message (and []/zero counts for --json).
  • The command is listed in dispatch help and all four completion scripts.
  • Unit tests cover the populated, empty, and orphaned cases, following the existing seam pattern.

Notes

config.SessionAliases already maps session ID to alias, and AliasFor/SessionIDForAlias exist. The session load path can reuse defaultStatsListSessions the way tags.go does.

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