Skip to content

Render N-level headings in markdown/JSON output for the hierarchy tree - #187

Open
shouze wants to merge 2 commits into
feat/team-hierarchy-consolidatefrom
feat/team-hierarchy-output
Open

Render N-level headings in markdown/JSON output for the hierarchy tree#187
shouze wants to merge 2 commits into
feat/team-hierarchy-consolidatefrom
feat/team-hierarchy-output

Conversation

@shouze

@shouze shouze commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

How did you verify your code works?

@github-actions

Copy link
Copy Markdown

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

96.41%

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.71%100%98.41%100%
   output.ts99.34%100%95.83%99.64%84
   regex.ts99.39%100%100%99.34%329
   render.ts89.82%100%88.24%89.89%172, 196–201, 203–205, 207–208, 229, 417–418, 442–444, 510–514, 526–527, 532–539, 541–549, 551–552
   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.ts97.58%100%100%97.44%168, 54–55
   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 hierarchy-aware metadata and nested team headings to Markdown/JSON output.

Changes:

  • Adds sectionPath and hierarchy flattening.
  • Renders nested Markdown headings and JSON paths.
  • Extends replay options and adds tests.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Summary Review notes
src/types.ts Defines hierarchy path metadata. No blocking comment supplied.
src/output.ts Outputs nested headings and section paths. Requires changes: replay flags are not fully registered, and section markers can be lost for filtered repositories.
src/output.test.ts Tests Markdown, JSON, and replay output. No blocking comment supplied.
src/group.ts Flattens hierarchy sections with heading transitions. Requires changes: hierarchy grouping is not connected to the production CLI flow.
src/group.test.ts Tests hierarchy flattening. No blocking comment supplied.
Suppressed comments (2)

src/group.ts:376

  • When a hierarchy node has both direct groups and children, this early return traverses only the children and drops every repo in node.groups. nestOverlappingLabels can produce exactly that shape for an auto-nested parent (the parent keeps its own groups), so those repositories disappear from the flattened output. Emit the node's direct groups before descending into its children.
    if (node.children && node.children.length > 0) {
      for (const child of node.children) visit(child, path);
      return;

src/output.ts:65

  • consolidateTeamSections is destructured here, but the buildOutput dispatcher used by the CLI and TUI does not accept this property in its extraOptions, so the real output path can never pass the setting through to buildReplayCommand. Thread this option through the dispatcher and its callers; otherwise the replay command silently omits consolidation.
    consolidateTeamSections,

💡 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
Comment thread src/output.ts
Comment thread src/output.ts Outdated
@shouze
shouze force-pushed the feat/team-hierarchy-output branch from ddb5418 to b4eb5da Compare August 23, 2026 20:42
@github-actions

Copy link
Copy Markdown

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

96.42%

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.44%100%
   output.ts99.34%100%95.83%99.64%84
   regex.ts99.39%100%100%99.34%329
   render.ts89.82%100%88.24%89.89%172, 196–201, 203–205, 207–208, 229, 417–418, 442–444, 510–514, 526–527, 532–539, 541–549, 551–552
   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.ts97.58%100%100%97.44%168, 54–55
   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-output into feat/team-hierarchy-consolidate will be

96.42%

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.44%100%
   output.ts99.34%100%95.83%99.64%84
   regex.ts99.39%100%100%99.34%329
   render.ts89.82%100%88.24%89.89%172, 196–201, 203–205, 207–208, 229, 417–418, 442–444, 510–514, 526–527, 532–539, 541–549, 551–552
   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.ts97.58%100%100%97.44%168, 54–55
   selection.ts100%100%100%100%
   summary.ts100%100%100%100%
   team-pick.ts100%100%100%100%
   terminal.ts100%100%100%100%

shouze added a commit that referenced this pull request Aug 23, 2026
Addresses Copilot review on PR #187:
- flattenTeamHierarchy no longer drops a node's own groups when it also
  has overlap-nested children (emits the node's repos under its own
  heading before descending into children).
- buildMarkdownOutput now tracks pending sectionLabel/sectionPath
  transitions across ALL groups (not just visible ones), so a heading
  is never lost when the repo that first carried it gets filtered out
  (deselected or with no selected matches) — matches how the JSON
  cursor already behaved.
- buildOutput's extraOptions now forwards consolidateTeamSections so
  it reaches buildReplayCommand instead of being silently dropped.

CLI registration of --group-by-team-prefix-consolidate and wiring
groupByTeamHierarchy/flattenTeamHierarchy into the production search
path are intentionally out of scope here — tracked by issue #182.
@github-actions

Copy link
Copy Markdown

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

96.43%

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.ts89.82%100%88.24%89.89%172, 196–201, 203–205, 207–208, 229, 417–418, 442–444, 510–514, 526–527, 532–539, 541–549, 551–552
   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.ts97.58%100%100%97.44%168, 54–55
   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 August 23, 2026 20:51
shouze added a commit that referenced this pull request Aug 24, 2026
Addresses Copilot review on PR #187:
- flattenTeamHierarchy no longer drops a node's own groups when it also
  has overlap-nested children (emits the node's repos under its own
  heading before descending into children).
- buildMarkdownOutput now tracks pending sectionLabel/sectionPath
  transitions across ALL groups (not just visible ones), so a heading
  is never lost when the repo that first carried it gets filtered out
  (deselected or with no selected matches) — matches how the JSON
  cursor already behaved.
- buildOutput's extraOptions now forwards consolidateTeamSections so
  it reaches buildReplayCommand instead of being silently dropped.

CLI registration of --group-by-team-prefix-consolidate and wiring
groupByTeamHierarchy/flattenTeamHierarchy into the production search
path are intentionally out of scope here — tracked by issue #182.
@shouze
shouze force-pushed the feat/team-hierarchy-output branch from 72e052a to fe82d6c Compare August 24, 2026 00:10
@github-actions

Copy link
Copy Markdown

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

96.40%

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.ts89.70%100%88.24%89.76%176, 200–205, 207–209, 211–212, 233, 421–422, 446–448, 516–520, 532–533, 538–545, 547–555, 557–560
   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.ts97.58%100%100%97.44%168, 54–55
   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-output into feat/team-hierarchy-consolidate will be

96.40%

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.ts89.70%100%88.24%89.76%176, 200–205, 207–209, 211–212, 233, 421–422, 446–448, 516–520, 532–533, 538–545, 547–555, 557–560
   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.ts97.58%100%100%97.44%168, 54–55
   selection.ts100%100%100%100%
   summary.ts100%100%100%100%
   team-pick.ts100%100%100%100%
   terminal.ts100%100%100%100%

shouze added 2 commits August 24, 2026 02:10
Addresses Copilot review on PR #187:
- flattenTeamHierarchy no longer drops a node's own groups when it also
  has overlap-nested children (emits the node's repos under its own
  heading before descending into children).
- buildMarkdownOutput now tracks pending sectionLabel/sectionPath
  transitions across ALL groups (not just visible ones), so a heading
  is never lost when the repo that first carried it gets filtered out
  (deselected or with no selected matches) — matches how the JSON
  cursor already behaved.
- buildOutput's extraOptions now forwards consolidateTeamSections so
  it reaches buildReplayCommand instead of being silently dropped.

CLI registration of --group-by-team-prefix-consolidate and wiring
groupByTeamHierarchy/flattenTeamHierarchy into the production search
path are intentionally out of scope here — tracked by issue #182.
@shouze
shouze force-pushed the feat/team-hierarchy-output branch from fe82d6c to b19bdae Compare August 24, 2026 00:14
@github-actions

Copy link
Copy Markdown

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

96.40%

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.ts89.70%100%88.24%89.76%176, 200–205, 207–209, 211–212, 233, 421–422, 446–448, 516–520, 532–533, 538–545, 547–555, 557–560
   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.ts97.58%100%100%97.44%168, 54–55
   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-output into feat/team-hierarchy-consolidate will be

96.40%

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.ts89.70%100%88.24%89.76%176, 200–205, 207–209, 211–212, 233, 421–422, 446–448, 516–520, 532–533, 538–545, 547–555, 557–560
   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.ts97.58%100%100%97.44%168, 54–55
   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.

2 participants