graph TD
R1["gamme-lead-client (level 1)"] --> N1["gamme-lead-client-p1 (nested, same level, auto-detected overlap)"]
R1 --> N2["squad-dashboard (level 2, chain gamme-/squad-)"]
R2["gamme-client (level 1)"] --> N3["squad-frontend (level 2)"]
N3 --> N4["other (level 3, no chapter- match at that node)"]
R3["chapter-backend (level 1, independent chain)"]
Context
groupByTeamPrefix()in src/group.ts is flat and single-level: each prefix in the comma-separated--group-by-team-prefixlist is processed sequentially against the remaining repo pool, producing a flatTeamSection[]({ label, groups }) always ending with an"other"section.TeamSectionin src/types.ts has no concept of depth or nesting. This is the foundation every other sub-issue in this EPIC builds on.Part of EPIC #125.
Solution
TeamSection(src/types.ts) into a tree node, e.g.{ label, groups, level, children?: TeamSection[] }(exact shape decided during implementation; keepRepoGroup/sectionLabelround-trip compatible with downstream flatten/rebuild helpers).groupByTeamHierarchy(groups, chains)) that takes an already-structured input (array of prefix chains, each chain an array of prefix strings representing one level per depth - CLI string parsing itself is issue [6/7]'s responsibility, not this one).groupByTeamPrefix) at each depth, scoped to the parent level's group.gamme-lead-clientis a prefix ofgamme-lead-client-p1) and nest the latter under the former automatically, instead of listing them as unrelated siblings at the same depth.groupByTeamPrefixis kept as a degenerate 1-level case or fully replaced; document the decision in the PR (backward compatibility is not required here per EPIC scope).Example tree shape
graph TD R1["gamme-lead-client (level 1)"] --> N1["gamme-lead-client-p1 (nested, same level, auto-detected overlap)"] R1 --> N2["squad-dashboard (level 2, chain gamme-/squad-)"] R2["gamme-client (level 1)"] --> N3["squad-frontend (level 2)"] N3 --> N4["other (level 3, no chapter- match at that node)"] R3["chapter-backend (level 1, independent chain)"]Acceptance Criteria
["gamme-", "squad-"]) groups repos first bygamme-matches, then sub-groups each resulting bucket bysquad-matches."other"node at that depth (mirroring today's behavior).gamme-lead-clientparent,gamme-lead-client-p1child).Definition of Done
src/group.test.ts: 2-level, 3-level, overlapping-name nesting, empty/no-match edge cases.bun test,bun run lint,bun run format:check,bun run knip,bun run build.tsall green.