# Enhanced file panel — diff display modes, inline comments, and in-browser file editing ## Why BooCode's right-rail file panel has a solid foundation: a file tree (read-only), a Git diff tab with unified display and stage/commit/discard. But it lacks features users expect from a modern code review surface: 1. **Side-by-side diff** — was deferred under YAGNI in v1. The current unified-only view is hard to read on wide files and wastes horizontal space on desktop. 2. **Hide whitespace** — meaningless whitespace changes clutter diffs in code-generation workflows. 3. **Wrap long lines** — unified diffs of long lines require horizontal scrolling. 4. **Expand/collapse all** — only per-file expand exists; bulk toggling is missing. 5. **Inline diff comments** — was explicitly out-of-scope in v1. The user cannot annotate diffs. 6. **In-browser file editing** — the file tree is read-only. Editing requires agent tool calls or terminal. ## What Changes ### Frontend - **GitDiffView.tsx** — toolbar row with: Unified/Split toggle, Hide whitespace toggle, Wrap lines toggle, Expand/Collapse all, Refresh (existing) - **Diff rendering** — split-layout renderer (two panels side-by-side, aligned line numbers), CSS `pre-wrap` for wrapped lines - **Inline comments** — `InlineReviewGutterCell` (hover → + button), `InlineReviewThread`, `InlineReviewEditor` (textarea saved via Zustand store) - **Comment storage** — Zustand store persisted to localStorage, keyed by diff context - **File editing** — double-click file in tree → inline textarea → Save/Cancel → server write API - **Preferences hook** — `useDiffPreferences` → `{ layout, wrapLines, hideWhitespace }` ### Server - **`git_diff.ts`** — add `ignoreWhitespace` param, pass `-w` to `git diff` - **New route** — `POST /api/projects/:id/write_file` with pathGuard security ### Infrastructure - No DB changes — comments client-side, file writes to disk - No new WS frames — uses existing `git_diff_refresh` event - No `@boocode/contracts` changes ## Risk - **Side-by-side diff rendering** — biggest rendering risk; Paseo's `diff-layout.ts` is the reference - **Inline comments** — lost on localStorage clear; acceptable for v1 - **File editing** — last-writer-wins for single-user is acceptable