Skip to content

feat(web): replace flat file list with file-tree in merge review diff#443

Open
arielshad wants to merge 6 commits intomainfrom
feat/file-tree-diff-view
Open

feat(web): replace flat file list with file-tree in merge review diff#443
arielshad wants to merge 6 commits intomainfrom
feat/file-tree-diff-view

Conversation

@arielshad
Copy link
Contributor

@arielshad arielshad commented Mar 21, 2026

Summary

  • Replace the flat file list in the merge review drawer with a hierarchical file-tree component using Magic UI's FileTree
  • Files are organized into a collapsible directory structure with single-child folder path collapsing (e.g. packages/core/src/)
  • Each file shows its git status (modified/added/deleted/renamed) via color-coded icons with addition/deletion counts
  • Clicking a file expands inline to show the diff hunks with syntax-highlighted additions and deletions

Fix for Rejection Feedback

The initial implementation expanded ALL folders by default, making the tree visually indistinguishable from a flat list. This fix:

  • Only expands top-level folders — deeper folders start collapsed, showing the tree hierarchy clearly
  • Shows file count badges on each folder (e.g. src (4), components (1))
  • Makes folders clickable — removed isSelectable={false} which was preventing folder expand/collapse
  • Adds visual differentiation — folders use text-muted-foreground color to distinguish from files

Changes

  • New component: src/presentation/web/components/ui/file-tree.tsx — Magic UI FileTree component with folder/file icons and tree indicators
  • Updated component: src/presentation/web/components/common/merge-review/diff-view.tsx — Replaced flat file list with buildFileTree() that groups files into a hierarchical tree with collapsed folders showing file counts
  • Storybook stories: Added stories for both FileTree and DiffView components covering default, deep nesting, and root-level file scenarios
  • Unit tests: Tests covering buildFileTree, DiffView rendering, file expansion, folder expansion, renamed files, and tree structure

Evidence

Screenshot Description
file-tree-deep Merge review drawer with file tree showing 84 files
storybook-diff Storybook DiffView with all status types
storybook-tree Storybook FileTree component

Test plan

  • All 4527 unit tests passing (332 test files)
  • Build compiles without errors
  • Lint passes with zero warnings
  • Validate (lint + format + typecheck + tsp) passes
  • Storybook stories render correctly for FileTree and DiffView
  • CI pipeline passes all checks

🤖 Generated with Claude Code

arielshad and others added 5 commits March 21, 2026 08:31
Add the Magic UI file-tree component adapted for the project's radix-ui
setup. Includes Tree, Folder, File, CollapseButton sub-components with
accordion-based expand/collapse, selection tracking, and sorting.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace the flat list in the merge review DiffView component with a
hierarchical file tree using the Magic UI file-tree component. Files
are grouped by directory with collapsible folders, single-child folder
paths are collapsed, and clicking a file shows its diff hunks below
the tree. Status icons (added/modified/deleted/renamed) and line
counts are preserved on each file node.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fix multiline string formatting for oneLiner field that was breaking
the yaml parser due to unindented continuation line.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link

Dev Release Published

Artifact Version Install
npm 1.135.3-pr443.1bf56b0 npm install -g @shepai/cli@1.135.3-pr443.1bf56b0

Published from commit b4b3103 | View CI

… tree

Folders now start collapsed (only top-level expanded) so the tree
structure is visually obvious. Each folder displays a file count badge.
Removed isSelectable=false from folders so they can be clicked to
expand/collapse. Previously all folders were expanded by default which
made the tree look identical to a flat file list.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link

Dev Release Published

Artifact Version Install
npm 1.136.0-pr443.863a0ce npm install -g @shepai/cli@1.136.0-pr443.863a0ce

Published from commit 70ca5be | View CI

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.

1 participant