Description
Add a dispatch tag command to add, remove, set, and list tags on a session from the command line. Today tags can only be edited inside the TUI; dispatch tags only lists tags already in use.
Use Case
Tags group related sessions and drive the tag: search token, but they can only be created by pressing # in the TUI. That blocks scripting. A user who wants to tag every session that matches a search, or label sessions from a setup script, has no command-line path. Adding a writer that mirrors the existing reader (dispatch tags) makes tagging automatable and keeps curation reproducible.
Proposed Solution
Add cmd/dispatch/tag.go:
dispatch tag <session-id> lists the current tags for a session.
dispatch tag <session-id> --add work,api adds tags, --remove api removes them, --set a,b replaces the whole set.
- Accept a session alias in place of the ID, reusing
SessionIDForAlias.
- Validate that the session exists in the store before writing, and persist to
SessionTags via the existing config save path.
--json prints the resulting tag list.
Acceptance criteria
dispatch tag <id> prints the session's current tags.
--add, --remove, and --set change tags and persist them, with de-duplication and stable ordering.
- A session alias resolves to its ID.
- An unknown session ID exits nonzero with a clear message.
- Tests cover list, add, remove, set, alias resolution, unknown ID, and JSON output.
Alternatives Considered
A single dispatch mark command covering tags, favorites, and aliases together, rejected for the first version to keep the surface focused and mirror the existing tags reader. Editing config.json directly, rejected because it skips validation and de-duplication.
Complexity
M
Description
Add a
dispatch tagcommand to add, remove, set, and list tags on a session from the command line. Today tags can only be edited inside the TUI;dispatch tagsonly lists tags already in use.Use Case
Tags group related sessions and drive the
tag:search token, but they can only be created by pressing#in the TUI. That blocks scripting. A user who wants to tag every session that matches a search, or label sessions from a setup script, has no command-line path. Adding a writer that mirrors the existing reader (dispatch tags) makes tagging automatable and keeps curation reproducible.Proposed Solution
Add
cmd/dispatch/tag.go:dispatch tag <session-id>lists the current tags for a session.dispatch tag <session-id> --add work,apiadds tags,--remove apiremoves them,--set a,breplaces the whole set.SessionIDForAlias.SessionTagsvia the existing config save path.--jsonprints the resulting tag list.Acceptance criteria
dispatch tag <id>prints the session's current tags.--add,--remove, and--setchange tags and persist them, with de-duplication and stable ordering.Alternatives Considered
A single
dispatch markcommand covering tags, favorites, and aliases together, rejected for the first version to keep the surface focused and mirror the existingtagsreader. Editingconfig.jsondirectly, rejected because it skips validation and de-duplication.Complexity
M