diffity 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/.claude/settings.local.json +11 -0
  2. package/LICENSE +21 -0
  3. package/README.md +71 -0
  4. package/development.md +156 -0
  5. package/package.json +32 -0
  6. package/packages/cli/build.js +38 -0
  7. package/packages/cli/package.json +51 -0
  8. package/packages/cli/src/agent.ts +187 -0
  9. package/packages/cli/src/db.ts +58 -0
  10. package/packages/cli/src/index.ts +196 -0
  11. package/packages/cli/src/review-routes.ts +150 -0
  12. package/packages/cli/src/server.ts +370 -0
  13. package/packages/cli/src/session.ts +48 -0
  14. package/packages/cli/src/threads.ts +238 -0
  15. package/packages/cli/tsconfig.json +13 -0
  16. package/packages/git/package.json +24 -0
  17. package/packages/git/src/commits.ts +28 -0
  18. package/packages/git/src/diff.ts +97 -0
  19. package/packages/git/src/exec.ts +35 -0
  20. package/packages/git/src/index.ts +5 -0
  21. package/packages/git/src/repo.ts +63 -0
  22. package/packages/git/src/status.ts +9 -0
  23. package/packages/git/src/types.ts +12 -0
  24. package/packages/git/tsconfig.json +9 -0
  25. package/packages/parser/package.json +26 -0
  26. package/packages/parser/src/index.ts +12 -0
  27. package/packages/parser/src/parse.ts +299 -0
  28. package/packages/parser/src/types.ts +52 -0
  29. package/packages/parser/src/word-diff.ts +155 -0
  30. package/packages/parser/tests/fixtures/binary-deleted.diff +4 -0
  31. package/packages/parser/tests/fixtures/binary-file.diff +4 -0
  32. package/packages/parser/tests/fixtures/binary-modified.diff +3 -0
  33. package/packages/parser/tests/fixtures/copied-file.diff +12 -0
  34. package/packages/parser/tests/fixtures/deleted-file.diff +9 -0
  35. package/packages/parser/tests/fixtures/empty.diff +0 -0
  36. package/packages/parser/tests/fixtures/hunk-with-context.diff +12 -0
  37. package/packages/parser/tests/fixtures/mode-change-with-content.diff +10 -0
  38. package/packages/parser/tests/fixtures/mode-change.diff +3 -0
  39. package/packages/parser/tests/fixtures/multi-file.diff +22 -0
  40. package/packages/parser/tests/fixtures/new-file.diff +9 -0
  41. package/packages/parser/tests/fixtures/no-newline.diff +10 -0
  42. package/packages/parser/tests/fixtures/renamed-file.diff +12 -0
  43. package/packages/parser/tests/fixtures/single-file-additions.diff +11 -0
  44. package/packages/parser/tests/fixtures/single-file-deletions.diff +11 -0
  45. package/packages/parser/tests/fixtures/single-file-mixed.diff +15 -0
  46. package/packages/parser/tests/fixtures/single-file-multi-hunk.diff +22 -0
  47. package/packages/parser/tests/fixtures/spaces-in-path.diff +9 -0
  48. package/packages/parser/tests/fixtures/submodule.diff +7 -0
  49. package/packages/parser/tests/fixtures/unicode-content.diff +11 -0
  50. package/packages/parser/tests/parse.test.ts +312 -0
  51. package/packages/parser/tests/word-diff-integration.test.ts +52 -0
  52. package/packages/parser/tests/word-diff.test.ts +121 -0
  53. package/packages/parser/tsconfig.json +10 -0
  54. package/packages/skills/diffity-resolve/SKILL.md +55 -0
  55. package/packages/skills/diffity-review/SKILL.md +74 -0
  56. package/packages/skills/diffity-start/SKILL.md +25 -0
  57. package/packages/ui/index.html +13 -0
  58. package/packages/ui/package.json +35 -0
  59. package/packages/ui/public/brand.svg +12 -0
  60. package/packages/ui/public/favicon.svg +15 -0
  61. package/packages/ui/src/app.tsx +14 -0
  62. package/packages/ui/src/components/comment-bubble.tsx +78 -0
  63. package/packages/ui/src/components/comment-form-row.tsx +58 -0
  64. package/packages/ui/src/components/comment-form.tsx +78 -0
  65. package/packages/ui/src/components/comment-line-number.tsx +60 -0
  66. package/packages/ui/src/components/comment-thread.tsx +209 -0
  67. package/packages/ui/src/components/commit-list.tsx +100 -0
  68. package/packages/ui/src/components/dashboard.tsx +84 -0
  69. package/packages/ui/src/components/diff-line.tsx +90 -0
  70. package/packages/ui/src/components/diff-page.tsx +332 -0
  71. package/packages/ui/src/components/diff-stats.tsx +20 -0
  72. package/packages/ui/src/components/diff-view.tsx +278 -0
  73. package/packages/ui/src/components/expand-row.tsx +45 -0
  74. package/packages/ui/src/components/file-block.tsx +536 -0
  75. package/packages/ui/src/components/file-tree-item.tsx +84 -0
  76. package/packages/ui/src/components/file-tree.tsx +72 -0
  77. package/packages/ui/src/components/general-comments.tsx +174 -0
  78. package/packages/ui/src/components/hunk-block-split.tsx +357 -0
  79. package/packages/ui/src/components/hunk-block.tsx +161 -0
  80. package/packages/ui/src/components/hunk-header.tsx +144 -0
  81. package/packages/ui/src/components/hunk-with-gap.tsx +113 -0
  82. package/packages/ui/src/components/icons/arrow-down-icon.tsx +7 -0
  83. package/packages/ui/src/components/icons/arrow-up-icon.tsx +7 -0
  84. package/packages/ui/src/components/icons/check-circle-icon.tsx +8 -0
  85. package/packages/ui/src/components/icons/check-icon.tsx +9 -0
  86. package/packages/ui/src/components/icons/chevron-down-icon.tsx +11 -0
  87. package/packages/ui/src/components/icons/chevron-icon.tsx +20 -0
  88. package/packages/ui/src/components/icons/chevron-up-down-icon.tsx +7 -0
  89. package/packages/ui/src/components/icons/chevron-up-icon.tsx +11 -0
  90. package/packages/ui/src/components/icons/comment-icon.tsx +9 -0
  91. package/packages/ui/src/components/icons/copy-icon.tsx +10 -0
  92. package/packages/ui/src/components/icons/eye-icon.tsx +10 -0
  93. package/packages/ui/src/components/icons/eye-off-icon.tsx +12 -0
  94. package/packages/ui/src/components/icons/file-icon.tsx +7 -0
  95. package/packages/ui/src/components/icons/folder-icon.tsx +19 -0
  96. package/packages/ui/src/components/icons/git-branch-icon.tsx +13 -0
  97. package/packages/ui/src/components/icons/keyboard-icon.tsx +13 -0
  98. package/packages/ui/src/components/icons/moon-icon.tsx +9 -0
  99. package/packages/ui/src/components/icons/plus-icon.tsx +9 -0
  100. package/packages/ui/src/components/icons/search-icon.tsx +10 -0
  101. package/packages/ui/src/components/icons/sidebar-icon.tsx +10 -0
  102. package/packages/ui/src/components/icons/spinner.tsx +7 -0
  103. package/packages/ui/src/components/icons/split-view-icon.tsx +10 -0
  104. package/packages/ui/src/components/icons/sun-icon.tsx +17 -0
  105. package/packages/ui/src/components/icons/trash-icon.tsx +11 -0
  106. package/packages/ui/src/components/icons/undo-icon.tsx +9 -0
  107. package/packages/ui/src/components/icons/unified-view-icon.tsx +12 -0
  108. package/packages/ui/src/components/icons/x-icon.tsx +10 -0
  109. package/packages/ui/src/components/line-number-cell.tsx +18 -0
  110. package/packages/ui/src/components/markdown-content.tsx +139 -0
  111. package/packages/ui/src/components/orphaned-threads.tsx +80 -0
  112. package/packages/ui/src/components/overview-file-list.tsx +57 -0
  113. package/packages/ui/src/components/render-expansion-rows.tsx +47 -0
  114. package/packages/ui/src/components/shortcut-modal.tsx +93 -0
  115. package/packages/ui/src/components/sidebar.tsx +80 -0
  116. package/packages/ui/src/components/skeleton.tsx +9 -0
  117. package/packages/ui/src/components/stale-diff-banner.tsx +21 -0
  118. package/packages/ui/src/components/summary-bar.tsx +39 -0
  119. package/packages/ui/src/components/toolbar.tsx +246 -0
  120. package/packages/ui/src/components/ui/badge.tsx +17 -0
  121. package/packages/ui/src/components/ui/confirm-dialog.tsx +52 -0
  122. package/packages/ui/src/components/ui/icon-button.tsx +23 -0
  123. package/packages/ui/src/components/ui/status-badge.tsx +57 -0
  124. package/packages/ui/src/components/ui/thread-badge.tsx +35 -0
  125. package/packages/ui/src/components/word-diff.tsx +126 -0
  126. package/packages/ui/src/hooks/use-comment-actions.ts +97 -0
  127. package/packages/ui/src/hooks/use-commits.ts +12 -0
  128. package/packages/ui/src/hooks/use-copy.ts +18 -0
  129. package/packages/ui/src/hooks/use-diff-staleness.ts +58 -0
  130. package/packages/ui/src/hooks/use-diff.ts +12 -0
  131. package/packages/ui/src/hooks/use-highlighter.ts +190 -0
  132. package/packages/ui/src/hooks/use-info.ts +12 -0
  133. package/packages/ui/src/hooks/use-keyboard.ts +55 -0
  134. package/packages/ui/src/hooks/use-line-selection.ts +157 -0
  135. package/packages/ui/src/hooks/use-overview.ts +12 -0
  136. package/packages/ui/src/hooks/use-review-threads.ts +12 -0
  137. package/packages/ui/src/hooks/use-search-params.ts +26 -0
  138. package/packages/ui/src/hooks/use-theme.ts +34 -0
  139. package/packages/ui/src/hooks/use-thread-navigation.ts +43 -0
  140. package/packages/ui/src/lib/api.ts +232 -0
  141. package/packages/ui/src/lib/cn.ts +6 -0
  142. package/packages/ui/src/lib/context-expansion.ts +122 -0
  143. package/packages/ui/src/lib/diff-utils.ts +268 -0
  144. package/packages/ui/src/lib/dom-utils.ts +13 -0
  145. package/packages/ui/src/lib/file-tree.ts +122 -0
  146. package/packages/ui/src/lib/query-client.ts +10 -0
  147. package/packages/ui/src/lib/render-content.tsx +23 -0
  148. package/packages/ui/src/lib/syntax-token.ts +4 -0
  149. package/packages/ui/src/main.tsx +14 -0
  150. package/packages/ui/src/queries/commits.ts +9 -0
  151. package/packages/ui/src/queries/diff.ts +9 -0
  152. package/packages/ui/src/queries/file.ts +10 -0
  153. package/packages/ui/src/queries/info.ts +9 -0
  154. package/packages/ui/src/queries/overview.ts +9 -0
  155. package/packages/ui/src/styles/app.css +178 -0
  156. package/packages/ui/src/types/comment.ts +61 -0
  157. package/packages/ui/src/vite-env.d.ts +1 -0
  158. package/packages/ui/tests/context-expansion.test.ts +279 -0
  159. package/packages/ui/tests/diff-utils.test.ts +409 -0
  160. package/packages/ui/tsconfig.json +14 -0
  161. package/packages/ui/vite.config.ts +23 -0
  162. package/scripts/build-skills.ts +26 -0
  163. package/scripts/build.ts +15 -0
  164. package/scripts/dev.ts +32 -0
  165. package/scripts/lib/transformers/claude-code.ts +11 -0
  166. package/scripts/lib/transformers/codex.ts +17 -0
  167. package/scripts/lib/transformers/cursor.ts +17 -0
  168. package/scripts/lib/transformers/index.ts +3 -0
  169. package/scripts/lib/utils.ts +70 -0
  170. package/scripts/link-dev.ts +54 -0
  171. package/skills/diffity-resolve/SKILL.md +55 -0
  172. package/skills/diffity-review/SKILL.md +74 -0
  173. package/skills/diffity-start/SKILL.md +27 -0
  174. package/tsconfig.json +22 -0
@@ -0,0 +1,122 @@
1
+ import type { DiffFile } from '@diffity/parser';
2
+ import { getFilePath } from './diff-utils';
3
+
4
+ export interface FileNode {
5
+ type: 'file';
6
+ name: string;
7
+ path: string;
8
+ file: DiffFile;
9
+ }
10
+
11
+ export interface DirNode {
12
+ type: 'dir';
13
+ name: string;
14
+ path: string;
15
+ children: TreeNode[];
16
+ }
17
+
18
+ export type TreeNode = FileNode | DirNode;
19
+
20
+ function getOrCreateDir(children: TreeNode[], name: string, path: string): DirNode {
21
+ let dir = children.find(c => c.type === 'dir' && c.name === name) as DirNode | undefined;
22
+ if (!dir) {
23
+ dir = { type: 'dir', name, path, children: [] };
24
+ children.push(dir);
25
+ }
26
+ return dir;
27
+ }
28
+
29
+ export function buildFileTree(files: DiffFile[]): TreeNode[] {
30
+ const root: TreeNode[] = [];
31
+
32
+ for (const file of files) {
33
+ const fullPath = getFilePath(file);
34
+ const parts = fullPath.split('/');
35
+
36
+ let currentChildren = root;
37
+ for (let i = 0; i < parts.length - 1; i++) {
38
+ const dirPath = parts.slice(0, i + 1).join('/');
39
+ const dir = getOrCreateDir(currentChildren, parts[i], dirPath);
40
+ currentChildren = dir.children;
41
+ }
42
+
43
+ currentChildren.push({
44
+ type: 'file',
45
+ name: parts[parts.length - 1],
46
+ path: fullPath,
47
+ file,
48
+ });
49
+ }
50
+
51
+ return root;
52
+ }
53
+
54
+ export function collapseSingleChildDirs(nodes: TreeNode[]): TreeNode[] {
55
+ return nodes.map(node => {
56
+ if (node.type !== 'dir') {
57
+ return node;
58
+ }
59
+
60
+ let current = node;
61
+ let collapsedName = current.name;
62
+
63
+ while (current.children.length === 1 && current.children[0].type === 'dir') {
64
+ current = current.children[0] as DirNode;
65
+ collapsedName += '/' + current.name;
66
+ }
67
+
68
+ return {
69
+ type: 'dir' as const,
70
+ name: collapsedName,
71
+ path: current.path,
72
+ children: collapseSingleChildDirs(current.children),
73
+ };
74
+ });
75
+ }
76
+
77
+ export function sortTree(nodes: TreeNode[]): TreeNode[] {
78
+ const sorted = [...nodes].sort((a, b) => {
79
+ if (a.type !== b.type) {
80
+ return a.type === 'dir' ? -1 : 1;
81
+ }
82
+ return a.name.localeCompare(b.name);
83
+ });
84
+
85
+ return sorted.map(node => {
86
+ if (node.type === 'dir') {
87
+ return { ...node, children: sortTree(node.children) };
88
+ }
89
+ return node;
90
+ });
91
+ }
92
+
93
+ export function filterTree(nodes: TreeNode[], search: string): TreeNode[] {
94
+ const lower = search.toLowerCase();
95
+ const result: TreeNode[] = [];
96
+
97
+ for (const node of nodes) {
98
+ if (node.type === 'file') {
99
+ if (node.path.toLowerCase().includes(lower)) {
100
+ result.push(node);
101
+ }
102
+ } else {
103
+ const filteredChildren = filterTree(node.children, search);
104
+ if (filteredChildren.length > 0) {
105
+ result.push({ ...node, children: filteredChildren });
106
+ }
107
+ }
108
+ }
109
+
110
+ return result;
111
+ }
112
+
113
+ export function collectAllDirPaths(nodes: TreeNode[]): string[] {
114
+ const paths: string[] = [];
115
+ for (const node of nodes) {
116
+ if (node.type === 'dir') {
117
+ paths.push(node.path);
118
+ paths.push(...collectAllDirPaths(node.children));
119
+ }
120
+ }
121
+ return paths;
122
+ }
@@ -0,0 +1,10 @@
1
+ import { QueryClient } from '@tanstack/react-query';
2
+
3
+ export const queryClient = new QueryClient({
4
+ defaultOptions: {
5
+ queries: {
6
+ retry: false,
7
+ refetchOnWindowFocus: false,
8
+ },
9
+ },
10
+ });
@@ -0,0 +1,23 @@
1
+ import type { DiffLine } from '@diffity/parser';
2
+ import { WordDiff } from '../components/word-diff';
3
+ import type { SyntaxToken } from '../lib/syntax-token';
4
+
5
+ export function renderContent(line: DiffLine, syntaxTokens?: SyntaxToken[]) {
6
+ if (line.wordDiff && line.wordDiff.length > 0) {
7
+ return <WordDiff line={line} syntaxTokens={syntaxTokens} />;
8
+ }
9
+
10
+ if (syntaxTokens && syntaxTokens.length > 0) {
11
+ return (
12
+ <>
13
+ {syntaxTokens.map((token, i) => (
14
+ <span key={i} style={token.color ? { color: token.color } : undefined}>
15
+ {token.text}
16
+ </span>
17
+ ))}
18
+ </>
19
+ );
20
+ }
21
+
22
+ return <span>{line.content || '\n'}</span>;
23
+ }
@@ -0,0 +1,4 @@
1
+ export interface SyntaxToken {
2
+ text: string;
3
+ color?: string;
4
+ }
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom/client';
3
+ import { QueryClientProvider } from '@tanstack/react-query';
4
+ import { queryClient } from './lib/query-client';
5
+ import { App } from './app';
6
+ import './styles/app.css';
7
+
8
+ ReactDOM.createRoot(document.getElementById('root')!).render(
9
+ <React.StrictMode>
10
+ <QueryClientProvider client={queryClient}>
11
+ <App />
12
+ </QueryClientProvider>
13
+ </React.StrictMode>
14
+ );
@@ -0,0 +1,9 @@
1
+ import { queryOptions } from '@tanstack/react-query';
2
+ import { fetchCommits } from '../lib/api';
3
+
4
+ export function commitsOptions() {
5
+ return queryOptions({
6
+ queryKey: ['commits'],
7
+ queryFn: () => fetchCommits(0, 10),
8
+ });
9
+ }
@@ -0,0 +1,9 @@
1
+ import { queryOptions } from '@tanstack/react-query';
2
+ import { fetchDiff } from '../lib/api';
3
+
4
+ export function diffOptions(hideWhitespace: boolean, ref?: string) {
5
+ return queryOptions({
6
+ queryKey: ['diff', hideWhitespace, ref ?? null],
7
+ queryFn: () => fetchDiff(hideWhitespace, ref),
8
+ });
9
+ }
@@ -0,0 +1,10 @@
1
+ import { queryOptions } from '@tanstack/react-query';
2
+ import { fetchFileContent } from '../lib/api';
3
+
4
+ export function fileContentOptions(filePath: string, enabled: boolean, ref?: string) {
5
+ return queryOptions({
6
+ queryKey: ['file-content', filePath, ref],
7
+ queryFn: () => fetchFileContent(filePath, ref),
8
+ enabled,
9
+ });
10
+ }
@@ -0,0 +1,9 @@
1
+ import { queryOptions } from '@tanstack/react-query';
2
+ import { fetchRepoInfo } from '../lib/api';
3
+
4
+ export function repoInfoOptions(ref?: string) {
5
+ return queryOptions({
6
+ queryKey: ['repo-info', ref],
7
+ queryFn: () => fetchRepoInfo(ref),
8
+ });
9
+ }
@@ -0,0 +1,9 @@
1
+ import { queryOptions } from '@tanstack/react-query';
2
+ import { fetchOverview } from '../lib/api';
3
+
4
+ export function overviewOptions() {
5
+ return queryOptions({
6
+ queryKey: ['overview'],
7
+ queryFn: fetchOverview,
8
+ });
9
+ }
@@ -0,0 +1,178 @@
1
+ @import "tailwindcss";
2
+
3
+ @theme {
4
+ --font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', 'JetBrains Mono',
5
+ 'Consolas', 'Menlo', monospace;
6
+ --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans',
7
+ Helvetica, Arial, sans-serif;
8
+
9
+ --color-bg: #ffffff;
10
+ --color-bg-secondary: #f6f8fa;
11
+ --color-bg-tertiary: #eaeef2;
12
+ --color-border: #d0d7de;
13
+ --color-border-muted: #d8dee4;
14
+
15
+ --color-text: #1f2328;
16
+ --color-text-secondary: #656d76;
17
+ --color-text-muted: #8b949e;
18
+
19
+ --color-diff-add-bg: #dafbe1;
20
+ --color-diff-add-line: #ccffd8;
21
+ --color-diff-add-word: #abf2bc;
22
+ --color-diff-del-bg: #ffebe9;
23
+ --color-diff-del-line: #ffd7d5;
24
+ --color-diff-del-word: #ff818266;
25
+ --color-diff-hunk-bg: #ddf4ff;
26
+ --color-diff-hunk-text: #0969da;
27
+ --color-diff-expanded-bg: #f6fcff;
28
+ --color-diff-expanded-gutter: #edf7ff;
29
+ --color-diff-comment-bg: #fff8c5;
30
+ --color-diff-comment-gutter: #ecd364;
31
+
32
+ --color-accent: #0969da;
33
+ --color-accent-hover: #0550ae;
34
+
35
+ --color-added: #1a7f37;
36
+ --color-deleted: #cf222e;
37
+ --color-modified: #9a6700;
38
+ --color-renamed: #0969da;
39
+
40
+ --color-hover: rgba(208, 215, 222, 0.32);
41
+ --color-active: rgba(208, 215, 222, 0.48);
42
+
43
+ --shadow-sticky: 0 1px 2px rgba(27, 31, 36, 0.08);
44
+ --shadow-md: 0 2px 8px rgba(140, 149, 159, 0.12);
45
+ }
46
+
47
+ [data-theme='dark'] {
48
+ --color-bg: #171717;
49
+ --color-bg-secondary: #1a1a1a;
50
+ --color-bg-tertiary: #262626;
51
+ --color-border: #262626;
52
+ --color-border-muted: #1f1f1f;
53
+
54
+ --color-text: #e5e5e5;
55
+ --color-text-secondary: #a3a3a3;
56
+ --color-text-muted: #737373;
57
+
58
+ --color-diff-add-bg: rgba(34, 197, 94, 0.1);
59
+ --color-diff-add-line: rgba(34, 197, 94, 0.18);
60
+ --color-diff-add-word: rgba(34, 197, 94, 0.35);
61
+ --color-diff-del-bg: rgba(239, 68, 68, 0.1);
62
+ --color-diff-del-line: rgba(239, 68, 68, 0.18);
63
+ --color-diff-del-word: rgba(239, 68, 68, 0.35);
64
+ --color-diff-hunk-bg: rgba(96, 165, 250, 0.1);
65
+ --color-diff-hunk-text: #60a5fa;
66
+ --color-diff-expanded-bg: rgba(96, 165, 250, 0.05);
67
+ --color-diff-expanded-gutter: rgba(96, 165, 250, 0.08);
68
+ --color-diff-comment-bg: rgba(234, 179, 8, 0.1);
69
+ --color-diff-comment-gutter: rgba(234, 179, 8, 0.3);
70
+
71
+ --color-accent: #60a5fa;
72
+ --color-accent-hover: #93c5fd;
73
+
74
+ --color-added: #4ade80;
75
+ --color-deleted: #f87171;
76
+ --color-modified: #facc15;
77
+ --color-renamed: #60a5fa;
78
+
79
+ --color-hover: rgba(161, 161, 170, 0.1);
80
+ --color-active: rgba(161, 161, 170, 0.18);
81
+
82
+ --shadow-sticky: 0 1px 2px rgba(0, 0, 0, 0.4);
83
+ --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.5);
84
+ }
85
+
86
+ * {
87
+ scrollbar-width: thin;
88
+ scrollbar-color: var(--color-border) var(--color-bg-secondary);
89
+ }
90
+
91
+ dialog {
92
+ background: var(--color-bg);
93
+ color: var(--color-text);
94
+ }
95
+
96
+ ::-webkit-scrollbar {
97
+ width: 8px;
98
+ height: 8px;
99
+ }
100
+
101
+ ::-webkit-scrollbar-track {
102
+ background: var(--color-bg-secondary);
103
+ }
104
+
105
+ ::-webkit-scrollbar-thumb {
106
+ background: var(--color-border);
107
+ border-radius: 4px;
108
+ }
109
+
110
+ ::-webkit-scrollbar-thumb:hover {
111
+ background: var(--color-text-muted);
112
+ }
113
+
114
+ @keyframes slide-down {
115
+ from {
116
+ transform: translateY(-100%);
117
+ opacity: 0;
118
+ }
119
+ to {
120
+ transform: translateY(0);
121
+ opacity: 1;
122
+ }
123
+ }
124
+
125
+ .animate-slide-down {
126
+ animation: slide-down 0.2s ease-out;
127
+ }
128
+
129
+ @keyframes flash-highlight {
130
+ 0% {
131
+ background-color: var(--color-diff-comment-bg);
132
+ }
133
+ 100% {
134
+ background-color: var(--color-bg-secondary);
135
+ }
136
+ }
137
+
138
+ @keyframes flash-highlight-border {
139
+ 0% {
140
+ border-color: var(--color-modified);
141
+ }
142
+ 100% {
143
+ border-color: var(--color-border);
144
+ }
145
+ }
146
+
147
+ .animate-flash-highlight {
148
+ animation: flash-highlight 1.5s ease-out forwards;
149
+ }
150
+
151
+ .animate-flash-highlight-border {
152
+ animation: flash-highlight-border 1.5s ease-out forwards;
153
+ }
154
+
155
+ @keyframes flash-thread {
156
+ 0% {
157
+ background-color: var(--color-diff-comment-bg);
158
+ }
159
+ 100% {
160
+ background-color: transparent;
161
+ }
162
+ }
163
+
164
+ .flash-thread .thread-card {
165
+ animation: flash-thread 1.5s ease-out forwards;
166
+ }
167
+
168
+ .diff-empty-cell {
169
+ background:
170
+ repeating-linear-gradient(
171
+ -45deg,
172
+ transparent,
173
+ transparent calc(3px * 1.414),
174
+ var(--color-bg-tertiary) calc(3px * 1.414),
175
+ var(--color-bg-tertiary) calc(4px * 1.414)
176
+ ),
177
+ var(--color-bg-secondary);
178
+ }
@@ -0,0 +1,61 @@
1
+ export const GENERAL_THREAD_FILE_PATH = '__general__';
2
+
3
+ export interface CommentAuthor {
4
+ name: string;
5
+ avatarUrl?: string;
6
+ type: 'user' | 'agent';
7
+ }
8
+
9
+ export interface Comment {
10
+ id: string;
11
+ author: CommentAuthor;
12
+ body: string;
13
+ createdAt: string;
14
+ }
15
+
16
+ export type CommentSide = 'old' | 'new';
17
+
18
+ export type ThreadStatus = 'open' | 'resolved' | 'dismissed';
19
+
20
+ export interface CommentThread {
21
+ id: string;
22
+ filePath: string;
23
+ side: CommentSide;
24
+ startLine: number;
25
+ endLine: number;
26
+ comments: Comment[];
27
+ status: ThreadStatus;
28
+ anchorContent?: string;
29
+ updatedAt?: string;
30
+ sessionId?: string;
31
+ }
32
+
33
+ export function isThreadResolved(thread: CommentThread): boolean {
34
+ return thread.status === 'resolved' || thread.status === 'dismissed';
35
+ }
36
+
37
+ export interface LineSelection {
38
+ filePath: string;
39
+ side: CommentSide;
40
+ startLine: number;
41
+ endLine: number;
42
+ }
43
+
44
+ export interface LineRenderProps {
45
+ isLineSelected?: (line: number, side: CommentSide) => boolean;
46
+ onLineMouseDown?: (line: number, side: CommentSide) => void;
47
+ onLineMouseEnter?: (line: number, side: CommentSide) => void;
48
+ onCommentClick?: (line: number, side: CommentSide) => void;
49
+ threads?: CommentThread[];
50
+ pendingSelection?: LineSelection | null;
51
+ currentAuthor?: CommentAuthor;
52
+ onAddThread?: (filePath: string, side: CommentSide, startLine: number, endLine: number, body: string, author: CommentAuthor) => void;
53
+ onCancelPending?: () => void;
54
+ filePath?: string;
55
+ onReply?: (threadId: string, body: string, author: CommentAuthor) => void;
56
+ onResolve?: (threadId: string) => void;
57
+ onUnresolve?: (threadId: string) => void;
58
+ onDeleteComment?: (threadId: string, commentId: string) => void;
59
+ onDeleteThread?: (threadId: string) => void;
60
+ getOriginalCode?: (side: CommentSide, startLine: number, endLine: number) => string;
61
+ }
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />