Skip to content

Vendor shared file tree + resizable picker from monorepo#63

Open
dastratakos wants to merge 1 commit into
mainfrom
dastratakos/cli-shared-file-tree
Open

Vendor shared file tree + resizable picker from monorepo#63
dastratakos wants to merge 1 commit into
mainfrom
dastratakos/cli-shared-file-tree

Conversation

@dastratakos
Copy link
Copy Markdown
Contributor

@dastratakos dastratakos commented Jun 2, 2026

Summary

Syncs the CLI's file picker and chapter detail sidebar with the monorepo file-tree overhauls that landed after the CLI was forked (~May 27). Brings the CLI up to the shared file tree architecture and the resizable panel hook.

Ports three monorepo PRs:

  • #980 — extract one shared FileTree (+ FileFilterInput) rendered by both the Files-changed picker and the chapter detail sidebar. Previously the CLI's chapter sidebar used a flat FileViewRow list and the file picker had its own inlined tree reimplementation — two divergent copies, now one.
  • #984 — order the collapsed picker indicators by file-tree order instead of raw API order.
  • #985 — shared useResizablePanel hook + chapter-panel-constants; CollapsiblePicker gains an opt-in resize handle and the chapter side panel drops its hand-rolled drag logic.

Changes

  • New: lib/use-resizable-panel.ts, components/chapter/chapter-panel-constants.ts, components/files/file-tree.tsx, components/files/file-filter-input.tsx (vendored from the monorepo, imports adapted to @/lib/*).
  • Rewritten: file-picker.tsx (thin wrapper over FileTree), chapter-file-list.tsx (renders FileTree instead of a flat list), collapsible-picker.tsx (internal collapse state + shortcutKey + resize + ShortcutTooltip), chapter-side-panel.tsx (uses useResizablePanel).
  • Deleted: components/chapter/file-view-row.tsx — its last consumer (the chapters index page) now renders a small local FilePathRow.
  • Adaptations for the CLI: FILE_VIEWED_STATE moved into lib/diff-types; comment counts are absent so callers pass an empty map; CollapsiblePicker drops the command-board event the CLI lacks. The chapter sidebar now passes focusedFilePath so the tree highlights the active file.

Testing

  • pnpm typecheck
  • pnpm lint ✅ (clean, no warnings)
  • pnpm test ✅ 299/299
  • pnpm build

Open in Stage

Summary by cubic

Ports the monorepo’s shared file tree and resizable panel to the CLI, unifying the file picker and chapter sidebar. This removes duplicate implementations and adds filtering, resize, and consistent ordering.

  • New Features

    • Shared FileTree and FileFilterInput used by the file picker and chapter sidebar; highlights the focused file and supports “viewed” toggles.
    • CollapsiblePicker gains opt-in resize via useResizablePanel, keyboard shortcut toggle, and hover preview that respects the resized width.
    • Collapsed picker indicators now follow file-tree order (not raw API order).
  • Refactors

    • Chapter side panel switches to useResizablePanel and shared chapter-panel-constants; removes custom drag logic.
    • FILE_VIEWED_STATE moved to @/lib/diff-types; CLI passes an empty comment-count map; drops command-board event.
    • file-view-row.tsx removed; chapters index now renders a small local FilePathRow.

Written for commit f02bf49. Summary will update on new commits.

Review in cubic

Syncs the CLI's file picker / chapter sidebar with the monorepo overhauls
that landed after the fork:

- #980: extract a single shared FileTree (+ FileFilterInput) rendered by
  both the Files-changed picker and the chapter detail sidebar. Replaces
  the chapter sidebar's flat FileViewRow list and the file picker's own
  inlined tree reimplementation.
- #984: order the collapsed picker indicators by file-tree order rather
  than raw API order.
- #985: add a shared useResizablePanel hook + chapter-panel-constants;
  CollapsiblePicker gains an opt-in resize handle and the chapter side
  panel drops its hand-rolled drag logic for the hook.

Adaptations for the CLI: imports rewritten to @/lib/*; FILE_VIEWED_STATE
moved into lib/diff-types; comment counts are absent so callers pass an
empty map; CollapsiblePicker drops the command-board event the CLI lacks.
file-view-row.tsx is deleted (its last consumer, the chapters index page,
now renders a small local FilePathRow).

Typecheck, lint, test (299), and build all pass.
@stage-review
Copy link
Copy Markdown

stage-review Bot commented Jun 2, 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.

1 participant