Commit e1bc871
feat(web): Commit diffs (#1154)
* feat(web): scaffold commit diff routing
Adds a `commit` pathType to the browse routes
(`/browse/<repo>@<branch>/-/commit/<sha>[/<file>]`) that renders a
placeholder CommitDiffPanel. Refactors browse path helpers into a
discriminated `BrowseProps` union so commitSha is required only for
pathType: 'commit'.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(web): scaffold commit diff merge view
Wires up @codemirror/merge (via react-codemirror-merge) inside
CommitDiffPanel with a static before/after demo. Adds a CodeDiff
component that owns its language extension + view ref so each pane
can reconfigure its language compartment independently.
Also gates the react-grab dev scripts behind DEBUG_ENABLE_REACT_GRAP
so they don't load on every dev page render.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* refactor browse components into seperate folders
* feat(web): swap commit diff renderer for lightweight viewer
Replace the CodeMirror MergeView-based commit diff rendering with a DOM
based split-view that renders directly from git's hunks, inspired by
Chrome DevTools' DiffView. Per-file editor instances and the matching
getFileSource fetches are gone — a 50-file commit drops from ~100
network requests to 0, and per-row render cost from a full editor mount
to a synchronous Lezer highlight + grid emit.
- New `LightweightDiffViewer` builds a single 2-column subgrid with
hunk headers spanning both sides; each cell uses `subgrid` so line
numbers, markers, and content align across all rows.
- Pure helpers split out: `hunkParser` (body string → DiffLine[]),
`splitPairing` (DiffLine[] → SplitRow[]).
- `presentableDiff` from @codemirror/merge supplies character-level
intra-line diff highlighting on paired modifications.
- Lezer highlight code lifted from `lightweightCodeHighlighter` into
`lib/codeHighlight` so both files share the helper.
- Drop `react-codemirror-merge` and `commitDiffEditor`. Long lines wrap
via `whitespace-pre-wrap break-words` + `minmax(0, 1fr)` on the grid.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(web): polish commit diff layout and sticky behavior
- File path header now sticks to the top of the scroll viewport while
scrolling through that file's diff, using the negative-yOffset trick
to compensate for the virtualizer's translateY positioning. Same
pattern as searchResultsPanel/fileMatchContainer.
- Lightweight diff viewer's grid uses `minmax(<min>, max-content)` for
line-number and marker columns so they don't collapse to zero width
when one side of the diff is entirely blank (fully-added or
fully-deleted files), keeping the right pane aligned across files.
- Drop the column gap between left and right panes and instead draw a
`border-r` separator on the left cells for a cleaner divider.
- Hunk header gets an optional className so the first hunk renders with
just `border-b` (the file header above already provides the top
border), while subsequent hunks render with `border-y` between them.
- Drop the per-row footer padding in the virtualizer; rows now sit
flush against each other.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(web): add diffstat indicators and per-file actions to commit diff
- New `DiffStat` component renders GitHub-style additions/deletions
counts with a 5-square indicator scaled log-ish to total change size.
Added on the right of each file row header and on the right of the
"N files changed" subheader for the commit total. Hidden when there
are no line-level changes (pure renames).
- Each file row gets a `CopyIconButton` next to the path (copies
newPath, falling back to oldPath) and a `CommitActionLink` that
opens the file at the commit. Deleted files link to the old path
at the parent commit so the user lands on the file's last existing
state rather than a 404.
- `repoName`, `commitSha`, and `parentSha` are plumbed from the panel
through `FileDiffList` to `FileDiffRow` to support the new link.
- `computeChangeCounts` is memoized per file in the row.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* move logger out of utils
* feat(web): clickable history rows, multi-author commit header, file anchoring
History panel rows in both the bottom panel and the commits page are now
clickable — they navigate to the matching commit diff via router.push,
with closest('button, a') short-circuit so inner action buttons keep
their own behavior. Bottom-panel history rows also highlight via
bg-accent when their commit is the one currently being viewed.
Commit diff header now uses AuthorsAvatarGroup + getCommitAuthors +
formatAuthorsText, matching latestCommitInfo and historyRow — co-authors
parsed from the commit body show up correctly.
When the URL trailing path matches one of the commit's files, that file
is moved to the top of the FileDiffList rather than scrolled to. Avoids
estimateSize-based scroll inaccuracy and works regardless of which side
of a rename the URL points to.
Lightweight diff viewer short-circuits with "Diff too large to display"
for files containing lines over 1000 chars, matching the cutoff in
lightweightCodeHighlighter.
PathHeader's breadcrumb measurement reserved 175px for "copy button and
padding"; the actual reservation needed is ~40px. Reduced so breadcrumbs
no longer collapse prematurely on wide layouts.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* wip
* fix(web): polish PathHeader rendering for SHAs and empty paths
- Lift `truncateSha` (was a private helper in getDiffToolComponent) to
`lib/utils` so PathHeader can reuse it. The branch/ref display now
renders a 40-char SHA as `abc1234`, preserving any `^` / `~N` suffix.
- Hide the `·` separator and the path's CopyIconButton when there's no
path (repo root). Previously a dangling `·` and copy button rendered
with nothing between them.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(web): add optional path filter to /api/diff and get_diff tool
Adds a `path` query/tool parameter to restrict diff output to changes
touching a single file via git's `-- <pathspec>` separator. Refactors
the route handler to use the shared `getDiffRequestSchema`.
Fixes SOU-1154 (#1154)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(web): focused single-file commit diff view
- Move single-file commit diffs from `/-/commit/<sha>/<path>` to
`/-/blob/<path>?ref=<sha>&diff=true`, keeping the user's browsing
revision in the URL. `/-/commit/<sha>` still renders the full
multi-file diff.
- New `FocusedCommitDiffPanel` with status row (file status badge +
authors + relative commit date + "View full commit" + DiffStat +
exit-X) and path-filtered `getDiff` so only the single file's diff
is fetched.
- New preview banner in `CodePreviewPanel` when `?ref=` is set, with a
close button that strips the param.
- Make `PathHeader`'s revision clickable, linking to that ref's full
commit view.
- New `HoverPrefetchLink` defers Next.js prefetching until hover; used
in history rows to avoid firing many prefetches on render.
- Hide the bottom panel on `/-/commit/` views.
- Extract `getFileStatus` / `StatusBadge` to a shared `fileStatus.tsx`.
- Workaround Radix Tooltip + RSC re-render bug (drop `asChild` from
`<TooltipTrigger>`, add `key={commitSha}`) so X / Browse-files
buttons survive client navigation between commits.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feedback
* typo
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 178b9c0 commit e1bc871
49 files changed
Lines changed: 1749 additions & 357 deletions
File tree
- docs/api-reference
- packages
- web
- src
- app
- (app)
- browse
- [...path]
- components
- codePreviewPanel
- commitDiffPanel
- commitHistoryPanel
- treePreviewPanel
- components
- hooks
- components
- api/(server)/diff
- features
- chat/components/chatThread/tools
- git
- tools
- lib
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1585 | 1585 | | |
1586 | 1586 | | |
1587 | 1587 | | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
1588 | 1598 | | |
1589 | 1599 | | |
1590 | 1600 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| 249 | + | |
249 | 250 | | |
250 | 251 | | |
251 | 252 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
5 | 8 | | |
| 9 | + | |
| 10 | + | |
6 | 11 | | |
7 | 12 | | |
8 | 13 | | |
9 | 14 | | |
10 | 15 | | |
11 | 16 | | |
12 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
13 | 21 | | |
14 | 22 | | |
15 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
16 | 26 | | |
17 | 27 | | |
18 | 28 | | |
19 | 29 | | |
20 | | - | |
| 30 | + | |
21 | 31 | | |
22 | 32 | | |
23 | 33 | | |
| |||
53 | 63 | | |
54 | 64 | | |
55 | 65 | | |
56 | | - | |
| 66 | + | |
57 | 67 | | |
58 | 68 | | |
59 | 69 | | |
| |||
74 | 84 | | |
75 | 85 | | |
76 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
77 | 129 | | |
78 | 130 | | |
79 | 131 | | |
80 | 132 | | |
81 | 133 | | |
82 | | - | |
| 134 | + | |
83 | 135 | | |
84 | 136 | | |
85 | 137 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
| 14 | + | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
Lines changed: 55 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
Lines changed: 31 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
Lines changed: 97 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
0 commit comments