Skip to content

feat: hierarchical folder tree in code review sidebar#246

Merged
backnotprop merged 1 commit intomainfrom
feat/file-tree-hierarchy
Mar 8, 2026
Merged

feat: hierarchical folder tree in code review sidebar#246
backnotprop merged 1 commit intomainfrom
feat/file-tree-hierarchy

Conversation

@backnotprop
Copy link
Owner

Summary

  • Groups changed files by directory in the code review sidebar with collapsible folder nodes
  • Folders show aggregate +N/-M stats and auto-expand when navigating with j/k keys
  • Single-child directories collapse (e.g., src/utils/ as one node); single-directory diffs fall back to the existing flat list

Closes #161

Implementation

  • buildFileTree.ts: Pure utility — trie construction, single-child collapsing, folder sorting (folders first, alphabetical)
  • FileTreeNode.tsx: Recursive component following VaultBrowser's TreeNode pattern — depth-based padding, chevron expand/collapse, Tailwind-only (no new CSS classes)
  • FileTree.tsx: Wires tree building via useMemo, manages expand/collapse state, pre-computes annotation counts as Map<string, number> for O(1) lookups

All existing functionality preserved: keyboard nav, viewed tracking, hide-viewed filter, diff dropdown, stats footer.

Test plan

  • plannotator review from a repo with multi-directory changes — verify folder grouping, expand/collapse, aggregate stats
  • plannotator review from a repo with single-directory changes — verify flat fallback (no folder wrapper)
  • j/k keyboard nav — verify auto-expand of collapsed ancestor folders
  • Hide viewed files — verify empty folders are hidden
  • Diff type switch — verify tree rebuilds with all folders expanded

🤖 Generated with Claude Code

Group changed files by directory with collapsible folders, aggregate
+/- stats per folder, and auto-expand on keyboard navigation.
Single-child directories collapse (e.g., src/utils/ as one node).
Falls back to flat list for single-directory diffs.

Closes #161

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@backnotprop
Copy link
Owner Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

@backnotprop backnotprop merged commit 47bfc4b into main Mar 8, 2026
3 checks passed
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.

[Feature Request] Add file tree view during code review

1 participant