Skip to content

Render nested section headers with per-level indentation in the TUI - #188

Open
shouze wants to merge 1 commit into
feat/team-hierarchy-outputfrom
feat/team-hierarchy-tui
Open

Render nested section headers with per-level indentation in the TUI#188
shouze wants to merge 1 commit into
feat/team-hierarchy-outputfrom
feat/team-hierarchy-tui

Conversation

@shouze

@shouze shouze commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds depth-aware rendering and navigation for nested team-hierarchy headings
in the interactive TUI, building on the sectionPath markers introduced in
#179.

  • Row gains sectionLevel (0 for flat groupByTeamPrefix sections, N for
    groupByTeamHierarchy nesting depth).
  • buildRows emits one "section" row per new heading transition in a
    hierarchical sectionPath — diffed against the last heading actually
    rendered, so a sibling leaf under an unchanged ancestor doesn't repeat that
    ancestor's heading. A pending heading is still carried across filtered-out
    repos, mirroring the existing flat sectionLabel behavior (and using the
    same "pending across skips" pattern already established there).
  • renderGroups indents each section heading by 2 spaces per level. Pick-mode
    bar and the multi-team hint ([p: pick team]) keep working unchanged at
    whichever level is a combined section — no changes needed to that logic
    itself, just width-budget accounting for the added indent.
  • Mouse hit-testing (mouse-hit.ts) and row-height accounting
    (rowTerminalLines, isCursorVisible, normalizeScrollOffset) needed no
    changes: a section row's cost/geometry is independent of its nesting depth,
    so navigation, scrolling, and clicks work unchanged across depths.

--pick-team addressing across hierarchy levels (path-based section
identifiers) and CLI wiring are intentionally out of scope here — tracked by
issues #181 and #182.

Closes #180

How to test

bun test src/render.test.ts src/render/mouse-hit.test.ts

New tests cover: one row per sectionPath entry, no repeated ancestor heading
for sibling leaves, pending heading carried across a filtered-out first repo,
and per-level indentation (0/1/2 levels) in the rendered output.

Validation

  • bun test (917 pass)
  • bun run lint
  • bun run format:check
  • bun run knip
  • bun run build.ts

@shouze
shouze requested a lite review from Copilot August 23, 2026 20:54
@shouze
shouze marked this pull request as ready for review August 23, 2026 20:54
@github-actions

Copy link
Copy Markdown

Coverage after merging feat/team-hierarchy-tui into feat/team-hierarchy-output will be

96.34%

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.42%100%100%99.37%270
   group.ts99.72%100%98.46%100%
   output.ts99.37%100%95.83%99.66%84
   regex.ts99.39%100%100%99.34%329
   render.ts88.70%100%88.24%88.71%172, 196–201, 203–205, 207–208, 229, 417–418, 442–444, 516–520, 532–537, 542–549, 551–559, 561–564
   scroll-cooldown.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.35%100%100%99.31%208
   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.

Pull request overview

Adds depth-aware section header rows to the interactive TUI so nested team-hierarchy headings can be rendered (and navigated) with per-level indentation, building on the existing sectionPath diff markers from the hierarchy flattener.

Changes:

  • Extend Row with sectionLevel and have buildRows emit one section row per hierarchical heading transition (while carrying pending headings across filtered-out repos).
  • Update renderGroups to indent section headers by 2 spaces per nesting level and adjust width budgeting to avoid wrapping.
  • Add unit tests covering hierarchical row emission, ancestor non-repetition, pending heading carryover under filtering, and indentation in rendered output.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/types.ts Adds Row.sectionLevel to represent nesting depth for section rows.
src/render/rows.ts Enhances buildRows to emit hierarchical section rows from sectionPath transitions and preserve headings across filters.
src/render.ts Indents section headers by level and updates clipping/width calculations accordingly.
src/render.test.ts Adds test coverage for hierarchical section row emission and indentation rendering behavior.

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

- Row gains sectionLevel (0 for flat groupByTeamPrefix sections, N for
  groupByTeamHierarchy nesting depth).
- buildRows emits one section row per new heading transition in a
  hierarchical sectionPath, diffed against the last heading actually
  shown so unchanged ancestors aren't repeated for sibling leaves; a
  pending heading is still carried across filtered-out repos (mirrors
  the existing flat sectionLabel behavior).
- renderGroups indents each section heading by 2 spaces per level;
  pick-mode bar and the multi-team hint keep working unchanged at
  whichever level is a combined section.
- Mouse hit-testing (mouse-hit.ts) and row-height accounting
  (rowTerminalLines, isCursorVisible, normalizeScrollOffset) needed no
  changes: section row cost/geometry is independent of nesting depth.
@shouze
shouze force-pushed the feat/team-hierarchy-tui branch from 0f7d060 to 2dbdbdc Compare August 24, 2026 00:14
@github-actions

Copy link
Copy Markdown

Coverage after merging feat/team-hierarchy-tui into feat/team-hierarchy-output will be

96.38%

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.42%100%100%99.37%270
   group.ts99.72%100%98.46%100%
   output.ts99.37%100%95.83%99.66%84
   regex.ts99.39%100%100%99.34%329
   render.ts88.98%100%88.24%89.01%176, 200–205, 207–209, 211–212, 233, 421–422, 446–448, 522–526, 538–543, 548–555, 557–565, 567–570
   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.35%100%100%99.31%208
   selection.ts100%100%100%100%
   summary.ts100%100%100%100%
   team-pick.ts100%100%100%100%
   terminal.ts100%100%100%100%

1 similar comment
@github-actions

Copy link
Copy Markdown

Coverage after merging feat/team-hierarchy-tui into feat/team-hierarchy-output will be

96.38%

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.42%100%100%99.37%270
   group.ts99.72%100%98.46%100%
   output.ts99.37%100%95.83%99.66%84
   regex.ts99.39%100%100%99.34%329
   render.ts88.98%100%88.24%89.01%176, 200–205, 207–209, 211–212, 233, 421–422, 446–448, 522–526, 538–543, 548–555, 557–565, 567–570
   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.35%100%100%99.31%208
   selection.ts100%100%100%100%
   summary.ts100%100%100%100%
   team-pick.ts100%100%100%100%
   terminal.ts100%100%100%100%

@shouze shouze self-assigned this Aug 24, 2026
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.

[4/7] TUI rendering & navigation for N-level headers

2 participants