Skip to content

Add --exclude-team-prefixes: exclude noisy team-name prefixes from grouping - #201

Merged
shouze merged 5 commits into
feat/team-hierarchy-pick-team-autofrom
feat/team-hierarchy-exclude-team-prefixes
Sep 19, 2026
Merged

shouze merged 5 commits into
feat/team-hierarchy-pick-team-autofrom
feat/team-hierarchy-exclude-team-prefixes

Conversation

@shouze

@shouze shouze commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds --exclude-team-prefixes: filters teams matching given prefixes out of consideration before groupByTeamHierarchy runs, reducing ambiguous combined sections at the source rather than trying to resolve them after the fact.

  • src/group.ts: new pure excludeTeamsByPrefix(groups, excludePrefixes) — removes matching teams from each repo's teams list. Same case-sensitive startsWith semantics as --group-by-team-prefix's own matching, for consistency.
  • github-code-search.ts: new CLI flag (comma-separated, same parsing pattern as --exclude-repositories), applied right after team lists are attached and before groupByTeamHierarchy. Warns (no-op) when used without --group-by-team-prefix, mirroring --pick-team / --pick-team-auto.
  • src/output.ts / src/tui.ts: threaded excludeTeamPrefixes through ReplayOptions / buildReplayCommand / runInteractive so a session using the flag replays identically.
  • src/completions.ts: new completion entry.
  • Docs: new "Excluding noisy team prefixes" section in docs/usage/team-grouping.md and the CLI option row in docs/reference/cli-options.md.

A repo left with no matching team after exclusion falls into "other", exactly like a repo with no matching team today — no special-casing needed.

Closes #200. Depends on #198, #199 (branch is stacked on top of them).

How did you verify your code works?

  • New unit tests in src/group.test.ts for excludeTeamsByPrefix: removes matching teams, keeps non-matching teams, multiple prefixes, drops a repo's entire team list (falls to "other" once grouped), no-op with empty exclude list, purity/no-mutation.
  • New tests in src/output.test.ts / src/completions.test.ts for replay-command emission and completion scripts.
  • Manual smoke test: github-code-search help query shows the new flag with correct help text.
  • bun test (1006 passing), bun run lint, bun run format:check, bun run knip, bun run build.ts all green.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Coverage after merging feat/team-hierarchy-exclude-team-prefixes into feat/team-hierarchy-pick-team-auto will be

96.86%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   aggregate.ts100%100%100%100%
   api-utils.ts93.20%100%93.75%93.13%101–103, 65, 73, 86–87, 91–92
   api.ts94.74%100%100%94.07%340–344, 405, 422, 63–69
   cache.ts94.67%100%100%94.29%139–141, 39
   completions.ts99.46%100%100%99.41%282
   group.ts99.11%100%98.25%99.28%511, 517, 596, 765
   output.ts99.38%100%95.83%99.66%88
   regex.ts99.39%100%100%99.34%329
   render.ts90.99%100%88.24%91.09%177, 201–206, 208–210, 212–213, 234, 427–428, 528–532, 562–569, 571–579, 581–584
   scroll-cooldown.ts100%100%100%100%
   style.ts100%100%100%100%
   upgrade.ts88.38%100%94.44%87.89%128, 131, 133, 153, 167–168, 188–195, 198–204, 209, 214, 250–253
src/render
   filter-match.ts97.44%100%92.31%100%
   filter.ts100%100%100%100%
   highlight.ts96.63%100%90.40%99.31%284–285
   layout-constants.ts100%100%100%100%
   mouse-hit.ts100%100%100%100%
   mouse.ts100%100%100%100%
   rows.ts99.42%100%100%99.38%239
   selection.ts100%100%100%100%
   summary.ts100%100%100%100%
   team-pick.ts100%100%100%100%
   terminal.ts100%100%100%100%

@github-actions

github-actions Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

🔦 Lighthouse Report

Page ⚡ Perf ♿ A11y 🛡️ BP 🔍 SEO Report
/github-code-search/ 🟢 96 (≥96) 🟢 100 (≥99) 🟢 100 (≥99) 🟢 100 (≥99) 🔗 view
/github-code-search/getting-started/ 🟢 99 (≥96) 🟢 100 (≥99) 🟢 100 (≥99) 🟢 100 (≥99) 🔗 view

Thresholds: Perf ≥ 96 · A11y ≥ 99 · BP ≥ 99 · SEO ≥ 99
commit 42c0583 · full workflow run

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Coverage after merging feat/team-hierarchy-exclude-team-prefixes into feat/team-hierarchy-pick-team-auto will be

96.86%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   aggregate.ts100%100%100%100%
   api-utils.ts93.20%100%93.75%93.13%101–103, 65, 73, 86–87, 91–92
   api.ts94.74%100%100%94.07%340–344, 405, 422, 63–69
   cache.ts94.67%100%100%94.29%139–141, 39
   completions.ts99.46%100%100%99.41%282
   group.ts99.11%100%98.25%99.28%511, 517, 596, 765
   output.ts99.38%100%95.83%99.66%88
   regex.ts99.39%100%100%99.34%329
   render.ts90.99%100%88.24%91.09%177, 201–206, 208–210, 212–213, 234, 427–428, 528–532, 562–569, 571–579, 581–584
   scroll-cooldown.ts100%100%100%100%
   style.ts100%100%100%100%
   upgrade.ts88.38%100%94.44%87.89%128, 131, 133, 153, 167–168, 188–195, 198–204, 209, 214, 250–253
src/render
   filter-match.ts97.44%100%92.31%100%
   filter.ts100%100%100%100%
   highlight.ts96.63%100%90.40%99.31%284–285
   layout-constants.ts100%100%100%100%
   mouse-hit.ts100%100%100%100%
   mouse.ts100%100%100%100%
   rows.ts99.42%100%100%99.38%239
   selection.ts100%100%100%100%
   summary.ts100%100%100%100%
   team-pick.ts100%100%100%100%
   terminal.ts100%100%100%100%

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Coverage after merging feat/team-hierarchy-exclude-team-prefixes into feat/team-hierarchy-pick-team-auto will be

96.78%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   aggregate.ts100%100%100%100%
   api-utils.ts93.20%100%93.75%93.13%101–103, 65, 73, 86–87, 91–92
   api.ts94.74%100%100%94.07%340–344, 405, 422, 63–69
   cache.ts94.67%100%100%94.29%139–141, 39
   completions.ts99.46%100%100%99.41%282
   group.ts98.69%100%98.28%98.78%278–280, 540, 546, 625, 794
   output.ts99.38%100%95.83%99.66%88
   regex.ts99.39%100%100%99.34%329
   render.ts90.99%100%88.24%91.09%177, 201–206, 208–210, 212–213, 234, 427–428, 528–532, 562–569, 571–579, 581–584
   scroll-cooldown.ts100%100%100%100%
   style.ts100%100%100%100%
   upgrade.ts88.38%100%94.44%87.89%128, 131, 133, 153, 167–168, 188–195, 198–204, 209, 214, 250–253
src/render
   filter-match.ts97.44%100%92.31%100%
   filter.ts100%100%100%100%
   highlight.ts96.63%100%90.40%99.31%284–285
   layout-constants.ts100%100%100%100%
   mouse-hit.ts100%100%100%100%
   mouse.ts100%100%100%100%
   rows.ts99.42%100%100%99.38%239
   selection.ts100%100%100%100%
   summary.ts100%100%100%100%
   team-pick.ts100%100%100%100%
   terminal.ts100%100%100%100%

@github-actions

Copy link
Copy Markdown
Contributor

Coverage after merging feat/team-hierarchy-exclude-team-prefixes into feat/team-hierarchy-pick-team-auto will be

96.87%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   aggregate.ts100%100%100%100%
   api-utils.ts93.20%100%93.75%93.13%101–103, 65, 73, 86–87, 91–92
   api.ts94.74%100%100%94.07%340–344, 405, 422, 63–69
   cache.ts94.67%100%100%94.29%139–141, 39
   completions.ts99.46%100%100%99.41%282
   group.ts98.93%100%98.37%99.04%278–280, 540, 546, 879
   output.ts99.38%100%95.83%99.66%88
   regex.ts99.42%100%100%99.38%360
   render.ts90.99%100%88.24%91.09%177, 201–206, 208–210, 212–213, 234, 427–428, 528–532, 562–569, 571–579, 581–584
   scroll-cooldown.ts100%100%100%100%
   style.ts100%100%100%100%
   upgrade.ts88.38%100%94.44%87.89%128, 131, 133, 153, 167–168, 188–195, 198–204, 209, 214, 250–253
src/render
   filter-match.ts97.44%100%92.31%100%
   filter.ts100%100%100%100%
   highlight.ts96.63%100%90.40%99.31%284–285
   layout-constants.ts100%100%100%100%
   mouse-hit.ts100%100%100%100%
   mouse.ts100%100%100%100%
   rows.ts99.42%100%100%99.38%239
   selection.ts100%100%100%100%
   summary.ts100%100%100%100%
   team-pick.ts100%100%100%100%
   terminal.ts100%100%100%100%

@shouze
shouze marked this pull request as ready for review September 19, 2026 09:26
Copilot AI lite review requested due to automatic review settings September 19, 2026 09:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Critical grouping behavior and moderate path-diagnostic issues remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

Adds --exclude-team-prefixes to filter noisy teams before hierarchy grouping, with CLI, replay, completion, tests, and documentation support.

Changes:

  • Adds team-prefix exclusion and grouping integration.
  • Updates replay commands, interactive mode, and shell completions.
  • Adds path wildcard diagnostics and documentation updates.
File Summary
src/​tui.ts Threads exclusion options through interactive replay.
src/​render.test.ts Updates hierarchy rendering fixtures.
src/​regex.ts Adds path wildcard diagnostics; review comments identify qualifier scanning and quote handling issues.
src/​regex.test.ts Tests path warning behavior.
src/​output.ts Adds replay option propagation.
src/​output.test.ts Tests replay command emission.
src/​group.ts Adds team filtering and hierarchy changes; review found critical membership and nested-combination issues.
src/​group.test.ts Tests exclusion and grouping behavior.
src/​completions.ts Adds CLI completion metadata.
src/​completions.test.ts Tests completion scripts.
github-code-search.ts Adds CLI option and workflow wiring.
docs/​usage/​team-grouping.md Documents excluding noisy team prefixes.
docs/​usage/​search-syntax.md Updates search syntax guidance.
docs/​usage/​output-formats.md Updates examples.
docs/​usage/​non-interactive-mode.md Updates examples.
docs/​usage/​interactive-mode.md Updates examples.
docs/​usage/​filtering.md Updates filtering examples.
docs/​reference/​cli-options.md Documents the new CLI option.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/group.ts Outdated
shouze added a commit that referenced this pull request Sep 19, 2026
Per Copilot review on PR #201: a team name being a string-prefix of
another matching team does NOT imply GitHub team membership in it —
memberships are independent. dropRedundantSubTeams silently discarded
matching teams from ALL grouping runs based on this false assumption
(e.g. chapter-architect-a dropped whenever chapter-architect was also
present), hiding real team memberships from users who never opted into
that behavior.

Removed dropRedundantSubTeams entirely; bucketSingleLevel now keeps
every matching team in the combined-section label. Noisy sub-team
prefixes remain reducible via the existing, explicit
--exclude-team-prefixes option. Updated the mega-combo test to assert
all teams are kept, added a companion test demonstrating the
--exclude-team-prefixes workaround, and corrected the affected
docs/usage/team-grouping.md paragraph.
@github-actions

Copy link
Copy Markdown
Contributor

Coverage after merging feat/team-hierarchy-exclude-team-prefixes into feat/team-hierarchy-pick-team-auto will be

96.86%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   aggregate.ts100%100%100%100%
   api-utils.ts93.20%100%93.75%93.13%101–103, 65, 73, 86–87, 91–92
   api.ts94.74%100%100%94.07%340–344, 405, 422, 63–69
   cache.ts94.67%100%100%94.29%139–141, 39
   completions.ts99.46%100%100%99.41%282
   group.ts98.92%100%98.33%99.03%263–265, 525, 531, 864
   output.ts99.38%100%95.83%99.66%88
   regex.ts99.42%100%100%99.38%360
   render.ts90.99%100%88.24%91.09%177, 201–206, 208–210, 212–213, 234, 427–428, 528–532, 562–569, 571–579, 581–584
   scroll-cooldown.ts100%100%100%100%
   style.ts100%100%100%100%
   upgrade.ts88.38%100%94.44%87.89%128, 131, 133, 153, 167–168, 188–195, 198–204, 209, 214, 250–253
src/render
   filter-match.ts97.44%100%92.31%100%
   filter.ts100%100%100%100%
   highlight.ts96.63%100%90.40%99.31%284–285
   layout-constants.ts100%100%100%100%
   mouse-hit.ts100%100%100%100%
   mouse.ts100%100%100%100%
   rows.ts99.42%100%100%99.38%239
   selection.ts100%100%100%100%
   summary.ts100%100%100%100%
   team-pick.ts100%100%100%100%
   terminal.ts100%100%100%100%

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Critical grouping and auto-pick findings, along with additional unresolved moderate issues, remain.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 High severity

Open (2)
Resolved since last review (1)
Previously missed (1)

In code that hasn't changed since last review

Low severity Document reference-preserving empty-prefix behavior

src/​group.ts:19

This documentation says the empty-prefix no-op still copies the repos, but the implementation returns the original groups array unchanged on that path. Please document the reference-preserving behavior accurately so callers do not rely on the stronger copy guarantee stated here.

Comment thread src/group.ts
Comment on lines +191 to +198
* Combines sections whose single-team `label` is a proper prefix of another
* single-team label at the same `level` (e.g. `tribe-a` and `tribe-a-p1`)
* into one section labelled like a multi-team combo (`"tribe-a + tribe-a-p1"`,
* teams sorted and joined), merging their `groups` — instead of nesting them
* into extra heading levels. This lets `--pick-team` / `--pick-team-auto`
* resolve them exactly like any other combined section. Combined-label
* (`"a + b"`) and `"other"` sections are left untouched. Cascading overlaps
* (A prefix of B prefix of C) merge into a single combined section for the
Comment thread src/group.ts
Comment on lines +741 to +745
* 2. Any combo still unresolved is clustered against its siblings (combos
* under the same parent path): the team that recurs in the most of them
* (at least 2) wins, and every combo containing it merges into a single
* section named after that team. Combos that never share a recurring team
* with a sibling combo are left combined and unresolved (e.g. `"squad-
…ouping

Filters teams matching given prefixes out of consideration before
groupByTeamHierarchy runs, reducing ambiguous combined sections at
the source rather than trying to resolve them after the fact (e.g.
many chapter-validators-* sub-teams). A repo left with no matching
team after exclusion falls into 'other', same as today. Only applies
with --group-by-team-prefix; threaded through the replay command.

Closes #200
Replaces gamme- (Fulll-specific French term) with tribe- (Spotify
model terminology) across docs, CLI help text, and tests, and
genericizes explicit product/business squad names (squad-dashboard,
squad-billing, squad-demat, squad-accounting, squad-bank) to
squad-a/b/c/d. chapter- and its specialty names (chapter-backend,
chapter-architect, etc.) are kept as-is since they already read as
generic engineering domains, not organization-specific identifiers.
…t sub-teams

- groupByTeamHierarchy now tries every level of a chain in order against
  what earlier levels of that same chain haven't claimed, so a repo
  matching only squad- (not tribe-) in a tribe-/squad- chain is captured
  directly instead of falling through to a later chain or 'other'.
- Overlapping single-team labels (e.g. tribe-a / tribe-a-p1) are now
  combined into one section ("tribe-a + tribe-a-p1"), like a multi-team
  combo, instead of nested into an extra heading level the declared
  chain didn't ask for. --pick-team / --pick-team-auto resolve it the
  same way as any other combo.
- bucketSingleLevel now drops a team that is a proper prefix-extension
  of another team already matched by the same repo (e.g.
  chapter-architect-a when chapter-architect is also present), reducing
  unwieldy N-way combos down to their genuinely distinct members before
  the label is even formed.

Removed the now-dead nestOverlappingLabels/assignLevels in favor of a
flat, union-find-based combineOverlappingLabels. Updated/added group.ts
tests to reproduce all 3 reported bugs and confirm the fixes, and
updated docs/usage/team-grouping.md accordingly.
- autoPickTeamsByCommonPrefix now clusters combined sections that share a
  recurring team across siblings under the same parent, even when no
  candidate is a literal prefix of the others (e.g. chapter-architect +
  chapter-frontend and chapter-architect + chapter-backend-node both
  resolve to chapter-architect).
- Add detectPathWildcardLimitation(): warns on stderr when a path: qualifier
  contains a * wildcard, since GitHub's code search API silently ignores it
  instead of expanding it as a glob (use language:/extension: instead).
  Documented in docs/usage/search-syntax.md.
- Replace remaining generic/gamme leftovers and illustrative fulll/<repo>
  example names across docs/usage/*.md with fully generic placeholders.
Per Copilot review on PR #201: a team name being a string-prefix of
another matching team does NOT imply GitHub team membership in it —
memberships are independent. dropRedundantSubTeams silently discarded
matching teams from ALL grouping runs based on this false assumption
(e.g. chapter-architect-a dropped whenever chapter-architect was also
present), hiding real team memberships from users who never opted into
that behavior.

Removed dropRedundantSubTeams entirely; bucketSingleLevel now keeps
every matching team in the combined-section label. Noisy sub-team
prefixes remain reducible via the existing, explicit
--exclude-team-prefixes option. Updated the mega-combo test to assert
all teams are kept, added a companion test demonstrating the
--exclude-team-prefixes workaround, and corrected the affected
docs/usage/team-grouping.md paragraph.
@shouze
shouze force-pushed the feat/team-hierarchy-exclude-team-prefixes branch from 74fdc72 to 7d68a79 Compare September 19, 2026 10:26
@github-actions

Copy link
Copy Markdown
Contributor

Coverage after merging feat/team-hierarchy-exclude-team-prefixes into feat/team-hierarchy-pick-team-auto will be

96.86%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   aggregate.ts100%100%100%100%
   api-utils.ts93.20%100%93.75%93.13%101–103, 65, 73, 86–87, 91–92
   api.ts94.74%100%100%94.07%340–344, 405, 422, 63–69
   cache.ts94.67%100%100%94.29%139–141, 39
   completions.ts99.46%100%100%99.41%282
   group.ts98.92%100%98.33%99.03%263–265, 525, 531, 864
   output.ts99.38%100%95.83%99.66%88
   regex.ts99.42%100%100%99.38%360
   render.ts90.99%100%88.24%91.09%177, 201–206, 208–210, 212–213, 234, 427–428, 528–532, 562–569, 571–579, 581–584
   scroll-cooldown.ts100%100%100%100%
   style.ts100%100%100%100%
   upgrade.ts88.38%100%94.44%87.89%128, 131, 133, 153, 167–168, 188–195, 198–204, 209, 214, 250–253
src/render
   filter-match.ts97.44%100%92.31%100%
   filter.ts100%100%100%100%
   highlight.ts96.63%100%90.40%99.31%284–285
   layout-constants.ts100%100%100%100%
   mouse-hit.ts100%100%100%100%
   mouse.ts100%100%100%100%
   rows.ts99.42%100%100%99.38%239
   selection.ts100%100%100%100%
   summary.ts100%100%100%100%
   team-pick.ts100%100%100%100%
   terminal.ts100%100%100%100%

@shouze
shouze merged commit df81d56 into main Sep 19, 2026
8 checks passed
@shouze
shouze deleted the feat/team-hierarchy-exclude-team-prefixes branch September 19, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[10/10] --exclude-team-prefixes: exclude noisy team-name prefixes from grouping

2 participants