Skip to content

Add --pick-team-auto: auto-resolve combined sections by common prefix - #199

Merged
shouze merged 2 commits into
feat/team-hierarchy-remove-consolidatefrom
feat/team-hierarchy-pick-team-auto
Sep 19, 2026
Merged

shouze merged 2 commits into
feat/team-hierarchy-remove-consolidatefrom
feat/team-hierarchy-pick-team-auto

Conversation

@shouze

@shouze shouze commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds --pick-team-auto: automatically resolves combined team sections whose team names share a common prefix, at any hierarchy depth, without requiring an explicit --pick-team.

  • For each combined section ("a + b"), if exactly one team name is a literal string-prefix of every other team name in the combo (e.g. gamme-lead-client for "gamme-lead-client + gamme-lead-client-p1"), auto-resolve to that team.
  • Combos with no such common-prefix team (e.g. "squad-frontend + squad-mobile") are left combined and unresolved — same as today, --pick-team still works for these.
  • Auto-pick runs after explicit --pick-team assignments, so an explicit pick for the same section always wins.
  • src/group.ts: new autoPickTeamsByCommonPrefix (+ private findCommonPrefixTeam helper).
  • github-code-search.ts: new CLI flag, wired before the "unresolved combined sections" stderr note (now also triggered by --pick-team-auto).
  • src/output.ts / src/tui.ts: threaded pickTeamAuto through ReplayOptions / buildReplayCommand / runInteractive so a session using the flag replays identically.
  • src/completions.ts: new completion entry.
  • Docs: new "Auto-pick by common prefix" section replacing the removed consolidated-rendering one, and the CLI option row.

Closes #197. Depends on #198 (branch is stacked on top of it).

How did you verify your code works?

  • New unit tests in src/group.test.ts covering: single common-prefix winner, no common prefix (left combined), 3+-way combos (shortest-prefix wins), nested (non-top-level) sections, explicit-pick-wins-over-auto, purity, and no-op when nothing is combined.
  • New tests in src/output.test.ts / src/completions.test.ts for replay-command emission and completion scripts.
  • bun test (990 passing), bun run lint, bun run format:check, bun run knip, bun run build.ts all green.

@github-actions

Copy link
Copy Markdown
Contributor

Coverage after merging feat/team-hierarchy-pick-team-auto into feat/team-hierarchy-remove-consolidate will be

96.84%

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.44%100%100%99.39%276
   group.ts99.09%100%98.18%99.28%487, 493, 572, 741
   output.ts99.37%100%95.83%99.66%84
   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 Aug 30, 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 f28b1f4 · full workflow run

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Coverage after merging feat/team-hierarchy-pick-team-auto into feat/team-hierarchy-remove-consolidate will be

96.84%

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.44%100%100%99.39%276
   group.ts99.09%100%98.18%99.28%487, 493, 572, 741
   output.ts99.37%100%95.83%99.66%84
   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%

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

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

autoPickTeamsByCommonPrefix() can silently skip resolving nested combined sections because it iterates combined paths in an order that can invalidate descendant paths after a parent resolution.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds a new --pick-team-auto flag to reduce manual --pick-team assignments by automatically resolving combined team sections when one candidate team name is a literal prefix of all others, and threads this flag through replay/interactive flows, completions, docs, and tests.

Changes:

  • Introduces autoPickTeamsByCommonPrefix() in src/group.ts and wires it into the CLI flow (github-code-search.ts) after explicit --pick-team resolutions.
  • Threads pickTeamAuto through replay command generation (src/output.ts) and interactive replay (src/tui.ts), with corresponding unit tests.
  • Updates shell completions and documentation to expose and explain --pick-team-auto.
File Description
src/​tui.ts Threads pickTeamAuto into interactive replay options.
src/​output.ts Adds pickTeamAuto to ReplayOptions and emits --pick-team-auto in replay commands.
src/​output.test.ts Adds test coverage for replay-command emission and JSON replay threading.
src/​group.ts Adds auto-pick logic for resolving combined sections by common-prefix.
src/​group.test.ts Adds unit tests for auto-pick behavior across multiple scenarios and nesting.
src/​completions.ts Adds completion metadata for the new flag.
src/​completions.test.ts Verifies completion scripts include the new flag.
github-code-search.ts Adds CLI flag, applies auto-pick, and threads it into output + interactive replay.
docs/​usage/​team-grouping.md Documents the new auto-pick behavior and usage.
docs/​reference/​cli-options.md Adds the CLI options table row for --pick-team-auto.

💡 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
Auto-resolves a combined team section (e.g. "gamme-lead-client +
gamme-lead-client-p1") to whichever team name is a literal prefix of
every other team name in the combo, at any hierarchy depth. Combos
with no common-prefix team are left combined/unresolved, and an
explicit --pick-team for the same section always wins (auto-pick
runs after explicit assignments).

Closes #197
- Auto-nesting of an overlapping single-team label inserts an extra
  heading level beyond the declared chain depth (documents intended
  interaction of 2 separate mechanisms, not a bug).
- A repo matching only a 2nd-level chain prefix (e.g. squad-) with no
  1st-level match (gamme-) is invisible to that chain and falls
  through to a later independent chain (chapter-) instead.
- --pick-team-auto correctly leaves combos unresolved when no single
  candidate is a literal prefix of every other candidate, even when
  several combos share some team members.
@shouze
shouze force-pushed the feat/team-hierarchy-pick-team-auto branch from 3542751 to 845771d Compare September 19, 2026 10:26
@github-actions

Copy link
Copy Markdown
Contributor

Coverage after merging feat/team-hierarchy-pick-team-auto into feat/team-hierarchy-remove-consolidate will be

96.84%

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.44%100%100%99.39%276
   group.ts99.09%100%98.18%99.28%487, 493, 572, 741
   output.ts99.37%100%95.83%99.66%84
   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%

@shouze
shouze merged commit df81d56 into main Sep 19, 2026
8 checks passed
@shouze
shouze deleted the feat/team-hierarchy-pick-team-auto 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.

[9/10] --pick-team-auto: auto-resolve combined sections by common prefix

2 participants