Repository navigation
[10/10] --exclude-team-prefixes: exclude noisy team-name prefixes from grouping #200
Description
Context
Real-world team structures can have many closely related, deeply-overlapping team names under one prefix (e.g. chapter-validators-core, chapter-validators-client, chapter-validators-frontend-client, chapter-validators, plus unrelated chapter-secops, chapter-head-of-frontend, ...). When several of these co-occur on the same repos, --group-by-team-prefix produces many distinct, hard-to-read combined sections ("a + b + c"), and --pick-team-auto (#197) cannot resolve most of them because no single candidate is a literal string-prefix of every other candidate in the combo (see the investigation test added in #197: chapter-secops + chapter-validators-core, chapter-head-of-frontend + chapter-secops + chapter-validators-core, chapter-secops + chapter-validators + chapter-validators-core all stay unresolved).
Rather than trying to build a more aggressive auto-merge heuristic (which risks silently discarding real team-membership information — e.g. collapsing 3 distinct combos that share only some members into one arbitrary label), the more principled fix is to let the user exclude noisy team-name prefixes from grouping entirely before combos are even formed. This directly reduces the number of ambiguous combined sections at the source, and makes the remaining ones easier for --pick-team / --pick-team-auto to handle.
Part of EPIC #125.
Solution
Add a new repeatable/comma-separated CLI option, --exclude-team-prefixes <prefixes> (plural, for naming consistency with --exclude-repositories / --exclude-extracts — note the original ask used the singular --exclude-team-prefix; confirm the final name before implementing), that filters out any team matching one of the given prefixes before groupByTeamHierarchy runs:
- A new pure function in
src/group.ts, e.g.excludeTeamsByPrefix(groups: RepoGroup[], excludePrefixes: string[]): RepoGroup[], returning newRepoGroupobjects withteamsfiltered to drop any team whose name starts with one ofexcludePrefixes(same case-sensitivestartsWithsemantics asbucketSingleLevel's prefix matching, for consistency with--group-by-team-prefix). - Wire it in
github-code-search.ts: parse the option (comma-separated, trimmed, same pattern as--exclude-repositories), and applyexcludeTeamsByPrefixtogroupsright afterg.teams = teamMap.get(...)is assigned and beforegroupByTeamHierarchy(groups, chains)is called. - A repo whose entire team list is excluded falls through to
"other", same as a repo with no matching team today — no special-casing needed beyond the filter itself. - Only applies with
--group-by-team-prefix(mirrors--pick-team/--pick-team-auto's existing "requires --group-by-team-prefix" guard and warning). - Update the replay command (
ReplayOptionsinsrc/output.ts) so a session using this flag reproduces identically. - Update
src/completions.ts,docs/usage/team-grouping.md, anddocs/reference/cli-options.md.
Acceptance Criteria
-
--exclude-team-prefixes "chapter-validators-"removes every team starting with that prefix from consideration for grouping, for every repo. - A repo left with zero matching teams after exclusion falls into
"other", exactly like a repo with no matching team today. - Excluding a prefix reduces (or eliminates) combined sections that were only ambiguous because of the excluded teams, without affecting sections unrelated to the excluded prefixes.
- Multiple exclude prefixes are supported (comma-separated).
- A warning is emitted (and the flag is a no-op) when used without
--group-by-team-prefix, mirroring--pick-team. - The replay command reproduces a session using this flag exactly.
Definition of Done
- Unit tests for
excludeTeamsByPrefixinsrc/group.test.ts: removes matching teams, keeps non-matching teams, drops a repo's entire team list correctly (falls to "other" after grouping), no-op with an empty exclude list, multiple prefixes, pure/no-mutation. - CLI wiring + replay-command test coverage (
src/output.test.ts,src/completions.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.
Activity
Add --exclude-team-prefixes: exclude noisy team-name prefixes from gr…