feat(api): group automations (setGroup, CLI --group, MCP group)

Merged
KI
1d ago
+186-6

Stack (merge in order)

  1. #9208: migration
  2. this PR: API, CLI, MCP
  3. Desktop UI (next PR, based on this branch)

Summary

  • New automation.setGroup({ id, group }): owner-only and cheap. It writes only the group column, unlike update, which re-resolves the target and resyncs schedules.
  • Optional group on automation.create and automation.update. list and get now return group.
  • @superset/shared/automation-group normalizes names: trims, collapses spaces, keeps case, max 64 characters, and treats blank as ungrouped.
  • CLI: automations create/update --group <name>, update --clear-group, list --group <name> (case-insensitive), plus a GROUP column in list.
  • MCP: group on the automations create and update tools.

tRPC compatibility (packages/trpc/AGENTS.md)

  • Additive only: a new procedure, new optional input fields, and a new output field (group, typed string | null).
  • No existing input is tightened, and no behavior or error code changes.
  • Older clients ignore the new field; older CLI builds simply don't send --group.
  • Ship the API before the desktop PR: it calls setGroup and reads group.

Testing

  • bun test packages/shared/src/automation-group.test.ts: normalizing, blank means ungrouped, length limit, matching an existing group without regard to case
  • bun test packages/trpc/src/router/automation, packages/cli, packages/mcp: all pass
  • bunx tsc --noEmit in trpc, cli, mcp, shared
  • Real CLI run against the dev API on this branch:
    • list --group growth filters to that group.
    • update --group " Launch watch " stores "Launch watch".
    • --group with --clear-group is refused.
    • --clear-group sets the group to null.
    • The table view shows the GROUP column.
  • create with group through the API. Two automations created this way were then bulk-deleted from the desktop UI.

Docs

  • apps/docs/content/docs/cli/cli-reference.mdx: new flags and the GROUP column.

Summary by cubic

Adds automation groups across the API, CLI, and MCP, and fixes automation.update so edits that leave the schedule alone no longer drop schedules.

  • New automation.setGroup writes only the group column and is owner-only, much cheaper than update for single-field changes.
  • group is now an optional input on create and update (null ungroups) and an output of list and get.
  • New @superset/shared/automation-group helper trims and collapses whitespace, keeps case, caps names at 64 characters, treats blank input as ungrouped, and resolves a name to the organization's existing spelling when it matches a group case-insensitively.
  • CLI gained --group on create/update/list, --clear-group on update, and a GROUP column in list.
  • The MCP create and update tools accept group.

Bug Fixes

  • automation.update only re-syncs the schedule when rrule, dtstart, or timezone change, so updates like rename or --group keep every schedule.
  • list --group normalizes the filter like create and update do.

Compatibility

  • All tRPC changes are additive — a new procedure, new optional inputs, and one new output field — so older clients are unaffected.