Skip to content

Team dispatch — split a multi-team section by assigning each repo/extract to exactly one team #86

@shouze

Description

@shouze

Problem

When a repo (or individual extract) appears in a combined section like squad-frontend + squad-mobile, its ownership is ambiguous. github-issue-ops requires a single owner per item to route and assign issues without conflict.

#85 resolves this at the section level (one pick reassigns the entire section to a single team). This issue addresses the finer granularity: individually reassigning specific repos or extracts within a multi-team section to different teams.

Relationship to #85 — pick vs. dispatch

The two mechanisms are complementary and can be combined in the same replay command:

Mechanism Granularity Flag When to use
--pick-team (#85) Whole section --pick-team "A + B"=A All repos in the section belong to the same team
--dispatch (#86) Individual repo or extract --dispatch A=repoX --dispatch B=repoY Repos/extracts in the section belong to different teams

--pick-team is applied first (on TeamSection[], before flattenTeamSections); --dispatch is applied second (on the flat RepoGroup[], after flattenTeamSections). A section resolved by --pick-team can still have individual repos/extracts overridden by --dispatch.

Proposed design

TUI — dispatch mode

A new dispatch mode toggled with t, available only when --group-by-team-prefix is active. In dispatch mode:

  • Each repo/extract row in a multi-team section shows its candidate teams inline
  • The user presses 1, 2, … to assign the focused item to the nth candidate team
  • The item visually moves to that team's sub-section immediately
  • Dispatch mode is exited with Escape or t again

CLI — --dispatch (repeatable)

github-code-search query "..." --org myorg \
  --group-by-team-prefix squad- \
  --pick-team "squad-frontend + squad-mobile"=squad-frontend \
  --dispatch squad-mobile=repoA:src/critical.ts:0

Format: --dispatch <team>=<refs> where <refs> is a comma-separated list of refs using the same format as --exclude-repositories and --exclude-extracts:

  • repo short-name: repoA
  • extract ref: repoA:src/foo.ts:0

= is used as the team/refs separator because it never appears in team slugs or repo/extract refs. Multiple --dispatch flags are allowed (one per team), enabling mixed repo-level and extract-level dispatch in the same command.

New types in src/types.ts

// On RepoGroup
dispatchedTeam?: string;                        // repo-level team override
extractDispatchedTeam?: (string | undefined)[];  // per-extract override, parallel to extractSelected

Implementation order

  1. Add dispatchedTeam / extractDispatchedTeam to RepoGroup in src/types.ts
  2. Add a pure helper in src/group.ts:
    applyDispatch(groups: RepoGroup[], dispatches: Record<string, string[]>, org: string): RepoGroup[]
    Parses each ref list, matches repos/extracts, sets the override fields, then re-runs groupByTeamPrefix to produce updated sections.
  3. Add dispatches?: Record<string, string[]> to ReplayOptions in src/output.ts; emit one --dispatch <team>=<refs> line per entry in buildReplayCommand
  4. Add TUI dispatch mode in src/tui.ts (key t, 1/2/…, Escape)
  5. Add --dispatch <spec> (repeatable) to github-code-search.ts; apply after flattenTeamSections (i.e. after --pick-team has already been applied)

Replay

The replay command emits one --dispatch <team>=<refs> flag per team that received dispatches, with all its refs comma-joined — after any --pick-team flags.

Acceptance criteria

  • TUI dispatch mode (t) allows assigning any repo or extract to one of its candidate teams
  • --dispatch in non-interactive mode reproduces the same section layout as a TUI dispatch session
  • --pick-team and --dispatch can be combined in the same command; --pick-team is applied first
  • Dispatch overrides are reflected in both markdown and JSON output section headers
  • The replay command round-trips: re-running it produces bit-identical output
  • bun test, bun run lint, bun run knip all pass
  • bun run docs:build completes without errors

Documentation

Three files must be updated. Follow the conventions in .github/instructions/documentation.instructions.md.

  • docs/usage/team-grouping.md — add a ## Team dispatch section after ## Team pick mode (Team pick mode — p on a multi-team section header to assign it to a single team #85). Describe: the problem (ambiguous ownership at repo/extract granularity), the TUI dispatch mode (t, 1/2/…, Escape), the --dispatch <team>=<refs> flag with a worked example combining it with --pick-team, and how the replay command encodes dispatches.

  • docs/reference/keyboard-shortcuts.md — extend the ## Team ownership section introduced in Team pick mode — p on a multi-team section header to assign it to a single team #85 with a ### Dispatch mode bindings table documenting t (toggle dispatch mode), 1/2/… (assign to nth team), and Escape (exit dispatch mode).

  • docs/reference/cli-options.md — add a --dispatch <spec> row in the ## Search options table after --pick-team, noting it is repeatable, that refs follow the --exclude-repositories / --exclude-extracts format, and linking to the team grouping usage page.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions