Context
Resolving a combined/ambiguous team section (e.g. "gamme-lead-client + gamme-lead-client-p1", produced when a repo matches 2+ teams at the same hierarchy level) currently always requires a manual --pick-team "combined label"=chosenTeam assignment (or the interactive p pick mode in the TUI) — see applyTeamPickInTree / resolvePickTeamAssignment in src/group.ts and github-code-search.ts.
Many of these combinations are not actually ambiguous: when one of the combined team names is a literal string-prefix of every other team name in the combo (e.g. gamme-lead-client is a prefix of gamme-lead-client-p1), the "parent" team is the obvious, unambiguous owner. Today this case is not auto-resolved because nestOverlappingLabels explicitly skips any label containing " + " (see its docstring: "Combined-label sections … are never auto-nested"), so the user still has to type the pick manually even though the answer is derivable from the names alone.
This replaces --group-by-team-prefix-consolidate (removed in a sibling issue) as the actual answer to the "reduce manual pick-team busywork" need.
Part of EPIC #125.
Solution
Add a new boolean CLI flag, --pick-team-auto, that automatically resolves combined sections at every hierarchy level using a smallest-common-prefix strategy:
- For each combined section (label containing
" + ") at any depth, split the label back into its constituent team names.
- If exactly one of those team names is a literal string-prefix of all the others (the "smallest common prefix" that is itself one of the real candidate names — reusing the same prefix-comparison logic as
nestOverlappingLabels), automatically resolve the section to that team, equivalent to an implicit applyTeamPickInTree(sections, path, thatTeam).
- If no team name in the combo is a prefix of all the others (e.g.
"squad-frontend + squad-mobile"), leave the section combined and unresolved — same as today. --pick-team remains available (and necessary) for these genuinely ambiguous cases.
- Apply auto-pick before processing any explicit
--pick-team assignments, and let explicit --pick-team assignments always win when they target the same section (an explicit pick is a deliberate override of the automatic default).
- Extend
resolvePickTeamAssignment's stderr messaging so the "N combined sections still unresolved" note only counts sections that auto-pick could not resolve.
- Thread the flag through the replay command (
ReplayOptions in src/output.ts) so a session that used --pick-team-auto reproduces identically.
- Update
docs/usage/team-grouping.md (new subsection, replacing "Advanced: consolidated rendering") and docs/reference/cli-options.md.
Acceptance Criteria
Definition of Done
Context
Resolving a combined/ambiguous team section (e.g.
"gamme-lead-client + gamme-lead-client-p1", produced when a repo matches 2+ teams at the same hierarchy level) currently always requires a manual--pick-team "combined label"=chosenTeamassignment (or the interactiveppick mode in the TUI) — seeapplyTeamPickInTree/resolvePickTeamAssignmentin src/group.ts and github-code-search.ts.Many of these combinations are not actually ambiguous: when one of the combined team names is a literal string-prefix of every other team name in the combo (e.g.
gamme-lead-clientis a prefix ofgamme-lead-client-p1), the "parent" team is the obvious, unambiguous owner. Today this case is not auto-resolved becausenestOverlappingLabelsexplicitly skips any label containing" + "(see its docstring: "Combined-label sections … are never auto-nested"), so the user still has to type the pick manually even though the answer is derivable from the names alone.This replaces
--group-by-team-prefix-consolidate(removed in a sibling issue) as the actual answer to the "reduce manual pick-team busywork" need.Part of EPIC #125.
Solution
Add a new boolean CLI flag,
--pick-team-auto, that automatically resolves combined sections at every hierarchy level using a smallest-common-prefix strategy:" + ") at any depth, split the label back into its constituent team names.nestOverlappingLabels), automatically resolve the section to that team, equivalent to an implicitapplyTeamPickInTree(sections, path, thatTeam)."squad-frontend + squad-mobile"), leave the section combined and unresolved — same as today.--pick-teamremains available (and necessary) for these genuinely ambiguous cases.--pick-teamassignments, and let explicit--pick-teamassignments always win when they target the same section (an explicit pick is a deliberate override of the automatic default).resolvePickTeamAssignment's stderr messaging so the "N combined sections still unresolved" note only counts sections that auto-pick could not resolve.ReplayOptionsin src/output.ts) so a session that used--pick-team-autoreproduces identically.docs/usage/team-grouping.md(new subsection, replacing "Advanced: consolidated rendering") anddocs/reference/cli-options.md.Acceptance Criteria
--pick-team-autoautomatically resolves a combined section whose team names share a common "parent" prefix, without requiring--pick-team.--pick-team-autoalone.--pick-teamassignment for the same section overrides the automatic resolution.--pick-team-autosessions exactly.--format jsonbehavior is unaffected by this flag beyond reflecting the resolved sections (no JSON-specific warning needed, unlike the removed consolidate flag — this changes the actual section membership, not just rendering).Definition of Done
src/group.test.tsfor the auto-pick resolution function, covering: single common-prefix winner, no common prefix (left combined), 3+-way combos, and nested (non-top-level) sections.src/output.test.ts).docs/usage/team-grouping.mdanddocs/reference/cli-options.mdupdated.bun test,bun run lint,bun run format:check,bun run knip,bun run build.tsall green.--group-by-team-prefix-consolidateremoval issue being merged first (avoids overlapping churn ingithub-code-search.ts/src/group.ts).