acpmux group ls|move|tidy: sort sessions into sidebar groups without duplicates

Merged
TE
4d ago
+420-1

Leo: "there are still hundreds of random sessions that i have 0 clue what are for plus you didnt do these groups well don't we have better acpmux commands for you guys yet"

Agents sorted his sessions into sidebar groups with raw workspace_group_create + workspace_place calls and made one "Leads" group per lane, plus empty "UI think tank" duplicates. This adds commands for that job:

  • acpmux group ls [--json]: every sidebar group, with its space, members and pin. Groups that share a name with another group in the same space are marked DUP.
  • acpmux group move SESSION GROUP: the workspace acpmux new --group opened for SESSION (found by its stable workspace key) joins GROUP. GROUP is created only when the space has no group of that name: workspace group create --reuse from #32097, or on an older daemon, a lookup by name first.
  • acpmux group tidy [--apply]: for each space and name (outer spaces trimmed, case counted), keeps the pinned group if there is one, otherwise the first in group order. It moves each duplicate's members into the kept group in their order with workspace group <kept> add, then deletes the emptied duplicate. A group with no same-named twin is never touched, even if it is empty. A duplicate that still holds another machine's row (which this Mac can't move) stays. Without --apply it only prints the plan.

Every step runs the cmux CLI, which is the app's bundled one when the app started the daemon, so the app's group rules and undo apply. It needs no new daemon API, so it works on today's builds.

Tests

cli/group.rs unit tests: the tidy plan (merges Leads and UI think tank duplicates, keeps member order, leaves another space's Leads, a lowercase "leads" and a lone group alone; prefers a pinned group; leaves another machine's row and its group), ls duplicate marks, and move's workspace lookup by the launch key. help_examples gets entries for the new commands.

Observed / Not run

The unit tests and help tests run on the PR (cmux-ci test). Running against a live app is not done yet; it waits for a DEV build capture.

Agent session: agent session

šŸ¤– Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Adds acpmux group ls|move|tidy so agents can sort sessions into sidebar groups without creating duplicates. Previously agents made groups with raw API calls, leaving many unnamed sessions and duplicate groups like multiple "Leads" and empty "UI think tank" copies per space.

New Features

  • acpmux group ls [--json] lists every sidebar group with its space, members, and DUP marks for same-named groups in a space.
  • acpmux group move SESSION GROUP puts the session's workspace into GROUP, creating it only when its space has none; it skips another machine's row of the launch key.
  • acpmux group tidy [--apply] merges duplicate groups by moving members into the kept one, a pinned group first, then deletes the emptied duplicates; prints the plan unless --apply.
  • tidy never touches a group whose name no other group in its space has, even if empty, and leaves a duplicate that still holds another machine's rows.
  • Every step runs the cmux CLI, so the app's group rules and undo apply; no new daemon API is needed.