@pennyfarthing/cyclist 10.0.3 → 10.2.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 (154) hide show
  1. package/dist/api/agent-load.d.ts +3 -0
  2. package/dist/api/agent-load.d.ts.map +1 -0
  3. package/dist/api/agent-load.js +124 -0
  4. package/dist/api/agent-load.js.map +1 -0
  5. package/dist/api/code-markers.d.ts +9 -0
  6. package/dist/api/code-markers.d.ts.map +1 -0
  7. package/dist/api/code-markers.js +62 -0
  8. package/dist/api/code-markers.js.map +1 -0
  9. package/dist/api/complexity.d.ts +3 -0
  10. package/dist/api/complexity.d.ts.map +1 -0
  11. package/dist/api/complexity.js +47 -0
  12. package/dist/api/complexity.js.map +1 -0
  13. package/dist/api/dead-code.d.ts +3 -0
  14. package/dist/api/dead-code.d.ts.map +1 -0
  15. package/dist/api/dead-code.js +70 -0
  16. package/dist/api/dead-code.js.map +1 -0
  17. package/dist/api/dependencies.d.ts +3 -0
  18. package/dist/api/dependencies.d.ts.map +1 -0
  19. package/dist/api/dependencies.js +43 -0
  20. package/dist/api/dependencies.js.map +1 -0
  21. package/dist/api/git.d.ts +3 -2
  22. package/dist/api/git.d.ts.map +1 -1
  23. package/dist/api/git.js +11 -6
  24. package/dist/api/git.js.map +1 -1
  25. package/dist/api/health-score.d.ts +3 -0
  26. package/dist/api/health-score.d.ts.map +1 -0
  27. package/dist/api/health-score.js +47 -0
  28. package/dist/api/health-score.js.map +1 -0
  29. package/dist/api/hotspots.d.ts.map +1 -1
  30. package/dist/api/hotspots.js +9 -1
  31. package/dist/api/hotspots.js.map +1 -1
  32. package/dist/api/index.d.ts +7 -1
  33. package/dist/api/index.d.ts.map +1 -1
  34. package/dist/api/index.js +12 -2
  35. package/dist/api/index.js.map +1 -1
  36. package/dist/api/persona.d.ts +2 -0
  37. package/dist/api/persona.d.ts.map +1 -1
  38. package/dist/api/persona.js +19 -1
  39. package/dist/api/persona.js.map +1 -1
  40. package/dist/api/settings.js +1 -1
  41. package/dist/api/settings.js.map +1 -1
  42. package/dist/claude-service.d.ts +8 -2
  43. package/dist/claude-service.d.ts.map +1 -1
  44. package/dist/claude-service.js +21 -2
  45. package/dist/claude-service.js.map +1 -1
  46. package/dist/git-diff.d.ts.map +1 -1
  47. package/dist/git-diff.js +6 -5
  48. package/dist/git-diff.js.map +1 -1
  49. package/dist/main.d.ts.map +1 -1
  50. package/dist/main.js +11 -2
  51. package/dist/main.js.map +1 -1
  52. package/dist/plugin-loader.d.ts +49 -0
  53. package/dist/plugin-loader.d.ts.map +1 -0
  54. package/dist/plugin-loader.js +92 -0
  55. package/dist/plugin-loader.js.map +1 -0
  56. package/dist/preload.js +12 -1
  57. package/dist/preload.js.map +1 -1
  58. package/dist/prime.d.ts +3 -2
  59. package/dist/prime.d.ts.map +1 -1
  60. package/dist/prime.js +25 -8
  61. package/dist/prime.js.map +1 -1
  62. package/dist/public/css/react.css +1 -1
  63. package/dist/public/js/react/react.js +50 -39
  64. package/dist/server.d.ts.map +1 -1
  65. package/dist/server.js +19 -16
  66. package/dist/server.js.map +1 -1
  67. package/dist/sprint-data.d.ts +6 -0
  68. package/dist/sprint-data.d.ts.map +1 -1
  69. package/dist/sprint-data.js +118 -67
  70. package/dist/sprint-data.js.map +1 -1
  71. package/dist/story-parser.js +1 -1
  72. package/dist/story-parser.js.map +1 -1
  73. package/dist/theme-metadata.js +2 -2
  74. package/dist/theme-metadata.js.map +1 -1
  75. package/dist/websocket.d.ts +0 -6
  76. package/dist/websocket.d.ts.map +1 -1
  77. package/dist/websocket.js +36 -40
  78. package/dist/websocket.js.map +1 -1
  79. package/package.json +2 -1
  80. package/portraits/fifth-element/large/cornelius-54343.png +0 -0
  81. package/portraits/fifth-element/large/diva-53453.png +0 -0
  82. package/portraits/fifth-element/large/korben-34232.png +0 -0
  83. package/portraits/fifth-element/large/leeloo-54333.png +0 -0
  84. package/portraits/fifth-element/large/lindberg-34432.png +0 -0
  85. package/portraits/fifth-element/large/mondoshawan-55131.png +0 -0
  86. package/portraits/fifth-element/large/munro-25321.png +0 -0
  87. package/portraits/fifth-element/large/pacoli-45232.png +0 -0
  88. package/portraits/fifth-element/large/ruby-53544.png +0 -0
  89. package/portraits/fifth-element/large/zorg-45312.png +0 -0
  90. package/portraits/fifth-element/medium/cornelius-54343.png +0 -0
  91. package/portraits/fifth-element/medium/diva-53453.png +0 -0
  92. package/portraits/fifth-element/medium/korben-34232.png +0 -0
  93. package/portraits/fifth-element/medium/leeloo-54333.png +0 -0
  94. package/portraits/fifth-element/medium/lindberg-34432.png +0 -0
  95. package/portraits/fifth-element/medium/mondoshawan-55131.png +0 -0
  96. package/portraits/fifth-element/medium/munro-25321.png +0 -0
  97. package/portraits/fifth-element/medium/pacoli-45232.png +0 -0
  98. package/portraits/fifth-element/medium/ruby-53544.png +0 -0
  99. package/portraits/fifth-element/medium/zorg-45312.png +0 -0
  100. package/src/public/App.tsx +0 -2
  101. package/src/public/components/AgentLoadDialog.tsx +202 -0
  102. package/src/public/components/AgentPopup.tsx +3 -5
  103. package/src/public/components/ContextSparkline.tsx +56 -0
  104. package/src/public/components/ControlBar.tsx +140 -6
  105. package/src/public/components/DeadCodeDialog.tsx +169 -0
  106. package/src/public/components/DockviewWorkspace.tsx +0 -3
  107. package/src/public/components/FullFileTree.tsx +18 -4
  108. package/src/public/components/HealthGauge.tsx +181 -0
  109. package/src/public/components/MessageView.tsx +23 -6
  110. package/src/public/components/PersonaHeader.tsx +46 -3
  111. package/src/public/components/TandemPortrait.tsx +71 -0
  112. package/src/public/components/ToolCallBlock.tsx +21 -6
  113. package/src/public/components/dialogs/CodeMarkersDialog.tsx +169 -0
  114. package/src/public/components/dialogs/ComplexityDialog.tsx +163 -0
  115. package/src/public/components/dialogs/DependenciesDialog.tsx +120 -0
  116. package/src/public/components/dialogs/HotspotsDialog.tsx +451 -0
  117. package/src/public/components/dialogs/ToolDialog.tsx +43 -0
  118. package/src/public/components/panels/ACPanel.tsx +1 -1
  119. package/src/public/components/panels/AcceptanceCriteriaPanel.tsx +15 -30
  120. package/src/public/components/panels/DebugPanel.tsx +79 -3
  121. package/src/public/components/panels/GitPanel.tsx +25 -30
  122. package/src/public/components/panels/MessagePanel.tsx +44 -2
  123. package/src/public/components/panels/SettingsPanel.tsx +4 -4
  124. package/src/public/components/panels/SprintPanel.tsx +247 -123
  125. package/src/public/components/panels/index.ts +0 -1
  126. package/src/public/components/ui/dialog.tsx +3 -3
  127. package/src/public/css/theme-system.css +98 -11
  128. package/src/public/hooks/index.ts +4 -0
  129. package/src/public/hooks/useAgentLoad.ts +105 -0
  130. package/src/public/hooks/useCodeMarkers.ts +101 -0
  131. package/src/public/hooks/useColorScheme.ts +25 -10
  132. package/src/public/hooks/useComplexity.ts +80 -0
  133. package/src/public/hooks/useDeadCode.ts +99 -0
  134. package/src/public/hooks/useDependencies.ts +82 -0
  135. package/src/public/hooks/useHealthScore.ts +69 -0
  136. package/src/public/hooks/useHotspots.ts +11 -1
  137. package/src/public/hooks/usePersona.ts +26 -3
  138. package/src/public/hooks/useSprint.ts +7 -1
  139. package/src/public/styles/tailwind.css +389 -83
  140. package/src/public/utils/messageFilters.ts +77 -6
  141. package/src/public/utils/slash-commands.ts +3 -35
  142. package/dist/hooks/cyclist-pretooluse-hook.d.ts +0 -60
  143. package/dist/hooks/cyclist-pretooluse-hook.d.ts.map +0 -1
  144. package/dist/hooks/cyclist-pretooluse-hook.js +0 -57
  145. package/dist/hooks/cyclist-pretooluse-hook.js.map +0 -1
  146. package/dist/hooks/pretooluse-hook.d.ts +0 -89
  147. package/dist/hooks/pretooluse-hook.d.ts.map +0 -1
  148. package/dist/hooks/pretooluse-hook.js +0 -235
  149. package/dist/hooks/pretooluse-hook.js.map +0 -1
  150. package/dist/notification-sound.d.ts +0 -59
  151. package/dist/notification-sound.d.ts.map +0 -1
  152. package/dist/notification-sound.js +0 -219
  153. package/dist/notification-sound.js.map +0 -1
  154. package/src/public/types/electron.d.ts +0 -18
@@ -0,0 +1,451 @@
1
+ /**
2
+ * HotspotsDialog - Git history hotspot detector in a dialog
3
+ *
4
+ * Story: MSSCI-14442 - Migrate HotspotsPanel into HotspotsDialog
5
+ * Epic: epic-79 (Dialog Infrastructure + Hotspot Refactor)
6
+ *
7
+ * Migrated from HotspotsPanel — uses ToolDialog wrapper from 79-1.
8
+ * Shows files and directories with highest change frequency, bug fix
9
+ * concentration, and multi-author churn. Sortable table with time window controls.
10
+ */
11
+
12
+ import React, { useState, useMemo, useCallback } from 'react';
13
+ import { Button } from '@/components/ui/button';
14
+ import { Badge } from '@/components/ui/badge';
15
+ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
16
+ import { Skeleton } from '@/components/ui/skeleton';
17
+ import { ToolDialog } from './ToolDialog';
18
+ import { useHotspots, FileHotspot, DirectoryHotspot, HotspotRepoResult } from '../../hooks/useHotspots';
19
+
20
+ export interface HotspotsDialogProps {
21
+ open: boolean;
22
+ onOpenChange: (open: boolean) => void;
23
+ }
24
+
25
+ type SortField = 'hotspot_score' | 'change_count' | 'bug_fix_count' | 'author_count' | 'churn' | 'path';
26
+ type SortDirection = 'asc' | 'desc';
27
+ type ViewMode = 'files' | 'dirs';
28
+
29
+ const TIME_WINDOWS = [30, 60, 90] as const;
30
+
31
+ const SOURCE_EXTENSIONS = new Set([
32
+ '.ts', '.tsx', '.js', '.jsx', '.py', '.md', '.css', '.scss', '.html',
33
+ ]);
34
+
35
+ const CONFIG_EXTENSIONS = new Set([
36
+ '.json', '.yaml', '.yml', '.toml', '.env',
37
+ ]);
38
+
39
+ function getExtension(path: string): string {
40
+ const basename = path.split('/').pop() || '';
41
+ // Handle dotfiles like .env
42
+ if (basename.startsWith('.') && !basename.includes('.', 1)) {
43
+ return '.' + basename.slice(1);
44
+ }
45
+ const dotIndex = basename.lastIndexOf('.');
46
+ return dotIndex > 0 ? basename.slice(dotIndex) : '';
47
+ }
48
+
49
+ function matchesFilter(path: string, codeOnly: boolean, includeConfig: boolean): boolean {
50
+ if (!codeOnly) return true;
51
+ const ext = getExtension(path);
52
+ if (SOURCE_EXTENSIONS.has(ext)) return true;
53
+ if (includeConfig && CONFIG_EXTENSIONS.has(ext)) return true;
54
+ return false;
55
+ }
56
+
57
+ function SortableHeader({
58
+ label,
59
+ field,
60
+ currentSort,
61
+ currentDirection,
62
+ onSort,
63
+ align = 'right',
64
+ }: {
65
+ label: string;
66
+ field: SortField;
67
+ currentSort: SortField;
68
+ currentDirection: SortDirection;
69
+ onSort: (field: SortField) => void;
70
+ align?: 'left' | 'right';
71
+ }) {
72
+ const isActive = currentSort === field;
73
+ const arrow = isActive ? (currentDirection === 'desc' ? ' v' : ' ^') : '';
74
+
75
+ return (
76
+ <th
77
+ className={`text-xs font-medium uppercase tracking-wider text-[var(--text-muted)] pb-2 cursor-pointer select-none ${align === 'left' ? 'text-left' : 'text-right'} ${isActive ? 'text-[var(--text-primary)]' : ''}`}
78
+ onClick={() => onSort(field)}
79
+ role="columnheader"
80
+ aria-sort={isActive ? (currentDirection === 'desc' ? 'descending' : 'ascending') : 'none'}
81
+ >
82
+ {label}{arrow}
83
+ </th>
84
+ );
85
+ }
86
+
87
+ function FileTable({
88
+ hotspots,
89
+ sortField,
90
+ sortDirection,
91
+ onSort,
92
+ }: {
93
+ hotspots: FileHotspot[];
94
+ sortField: SortField;
95
+ sortDirection: SortDirection;
96
+ onSort: (field: SortField) => void;
97
+ }) {
98
+ const sorted = useMemo(() => {
99
+ const items = [...hotspots];
100
+ items.sort((a, b) => {
101
+ const aVal = a[sortField as keyof FileHotspot];
102
+ const bVal = b[sortField as keyof FileHotspot];
103
+ if (typeof aVal === 'number' && typeof bVal === 'number') {
104
+ return sortDirection === 'desc' ? bVal - aVal : aVal - bVal;
105
+ }
106
+ const aStr = String(aVal);
107
+ const bStr = String(bVal);
108
+ return sortDirection === 'desc' ? bStr.localeCompare(aStr) : aStr.localeCompare(bStr);
109
+ });
110
+ return items;
111
+ }, [hotspots, sortField, sortDirection]);
112
+
113
+ return (
114
+ <table className="w-full text-sm" role="table">
115
+ <thead>
116
+ <tr className="border-b border-[var(--border)]">
117
+ <SortableHeader label="Score" field="hotspot_score" currentSort={sortField} currentDirection={sortDirection} onSort={onSort} />
118
+ <SortableHeader label="Changes" field="change_count" currentSort={sortField} currentDirection={sortDirection} onSort={onSort} />
119
+ <SortableHeader label="Fixes" field="bug_fix_count" currentSort={sortField} currentDirection={sortDirection} onSort={onSort} />
120
+ <SortableHeader label="Authors" field="author_count" currentSort={sortField} currentDirection={sortDirection} onSort={onSort} />
121
+ <SortableHeader label="Churn" field="churn" currentSort={sortField} currentDirection={sortDirection} onSort={onSort} />
122
+ <SortableHeader label="File" field="path" currentSort={sortField} currentDirection={sortDirection} onSort={onSort} align="left" />
123
+ </tr>
124
+ </thead>
125
+ <tbody>
126
+ {sorted.map((h) => (
127
+ <tr key={h.path} className="text-[var(--text-primary)]">
128
+ <td className="text-right py-1.5">
129
+ <Badge variant={h.hotspot_score >= 50 ? 'destructive' : h.hotspot_score >= 25 ? 'outline' : 'secondary'}>
130
+ {h.hotspot_score.toFixed(1)}
131
+ </Badge>
132
+ </td>
133
+ <td className="text-right py-1.5 tabular-nums font-mono">{h.change_count}</td>
134
+ <td className="text-right py-1.5 tabular-nums font-mono">{h.bug_fix_count}</td>
135
+ <td className="text-right py-1.5 tabular-nums font-mono">{h.author_count}</td>
136
+ <td className="text-right py-1.5 tabular-nums font-mono">{h.churn}</td>
137
+ <td className="text-left py-1.5">
138
+ <Tooltip>
139
+ <TooltipTrigger asChild>
140
+ <span className="truncate max-w-xs inline-block align-bottom font-mono text-xs">{h.path}</span>
141
+ </TooltipTrigger>
142
+ <TooltipContent>{h.path}</TooltipContent>
143
+ </Tooltip>
144
+ </td>
145
+ </tr>
146
+ ))}
147
+ </tbody>
148
+ </table>
149
+ );
150
+ }
151
+
152
+ function DirTable({
153
+ hotspots,
154
+ sortField,
155
+ sortDirection,
156
+ onSort,
157
+ }: {
158
+ hotspots: DirectoryHotspot[];
159
+ sortField: SortField;
160
+ sortDirection: SortDirection;
161
+ onSort: (field: SortField) => void;
162
+ }) {
163
+ const sorted = useMemo(() => {
164
+ const items = [...hotspots];
165
+ items.sort((a, b) => {
166
+ const fieldMap: Record<string, keyof DirectoryHotspot> = {
167
+ change_count: 'total_changes',
168
+ bug_fix_count: 'total_bug_fixes',
169
+ author_count: 'avg_author_count',
170
+ churn: 'file_count',
171
+ };
172
+ const key = (fieldMap[sortField] || sortField) as keyof DirectoryHotspot;
173
+ const aVal = a[key];
174
+ const bVal = b[key];
175
+ if (typeof aVal === 'number' && typeof bVal === 'number') {
176
+ return sortDirection === 'desc' ? bVal - aVal : aVal - bVal;
177
+ }
178
+ return sortDirection === 'desc'
179
+ ? String(bVal).localeCompare(String(aVal))
180
+ : String(aVal).localeCompare(String(bVal));
181
+ });
182
+ return items;
183
+ }, [hotspots, sortField, sortDirection]);
184
+
185
+ return (
186
+ <table className="w-full text-sm" role="table">
187
+ <thead>
188
+ <tr className="border-b border-[var(--border)]">
189
+ <SortableHeader label="Score" field="hotspot_score" currentSort={sortField} currentDirection={sortDirection} onSort={onSort} />
190
+ <SortableHeader label="Changes" field="change_count" currentSort={sortField} currentDirection={sortDirection} onSort={onSort} />
191
+ <SortableHeader label="Fixes" field="bug_fix_count" currentSort={sortField} currentDirection={sortDirection} onSort={onSort} />
192
+ <SortableHeader label="Authors" field="author_count" currentSort={sortField} currentDirection={sortDirection} onSort={onSort} />
193
+ <SortableHeader label="Files" field="churn" currentSort={sortField} currentDirection={sortDirection} onSort={onSort} />
194
+ <SortableHeader label="Directory" field="path" currentSort={sortField} currentDirection={sortDirection} onSort={onSort} align="left" />
195
+ </tr>
196
+ </thead>
197
+ <tbody>
198
+ {sorted.map((d) => (
199
+ <tr key={d.path} className="text-[var(--text-primary)]">
200
+ <td className="text-right py-1.5">
201
+ <Badge variant={d.hotspot_score >= 50 ? 'destructive' : d.hotspot_score >= 25 ? 'outline' : 'secondary'}>
202
+ {d.hotspot_score.toFixed(1)}
203
+ </Badge>
204
+ </td>
205
+ <td className="text-right py-1.5 tabular-nums font-mono">{d.total_changes}</td>
206
+ <td className="text-right py-1.5 tabular-nums font-mono">{d.total_bug_fixes}</td>
207
+ <td className="text-right py-1.5 tabular-nums font-mono">{d.avg_author_count.toFixed(1)}</td>
208
+ <td className="text-right py-1.5 tabular-nums font-mono">{d.file_count}</td>
209
+ <td className="text-left py-1.5">
210
+ <Tooltip>
211
+ <TooltipTrigger asChild>
212
+ <span className="truncate max-w-xs inline-block align-bottom font-mono text-xs">{d.path}</span>
213
+ </TooltipTrigger>
214
+ <TooltipContent>{d.path}</TooltipContent>
215
+ </Tooltip>
216
+ </td>
217
+ </tr>
218
+ ))}
219
+ </tbody>
220
+ </table>
221
+ );
222
+ }
223
+
224
+ export function HotspotsDialog({ open, onOpenChange }: HotspotsDialogProps): React.ReactElement {
225
+ const [days, setDays] = useState<number>(90);
226
+ const [viewMode, setViewMode] = useState<ViewMode>('files');
227
+ const [sortField, setSortField] = useState<SortField>('hotspot_score');
228
+ const [sortDirection, setSortDirection] = useState<SortDirection>('desc');
229
+ const [includeOrchestrator, setIncludeOrchestrator] = useState(false);
230
+ const [codeOnly, setCodeOnly] = useState(false);
231
+ const [includeConfig, setIncludeConfig] = useState(false);
232
+
233
+ const { data, isLoading, error, refresh } = useHotspots({ days, includeOrchestrator });
234
+
235
+ const handleSort = useCallback((field: SortField) => {
236
+ setSortField((prev) => {
237
+ if (prev === field) {
238
+ setSortDirection((d) => (d === 'desc' ? 'asc' : 'desc'));
239
+ return prev;
240
+ }
241
+ setSortDirection('desc');
242
+ return field;
243
+ });
244
+ }, []);
245
+
246
+ const repoResults: HotspotRepoResult[] = useMemo(() => {
247
+ if (!data) return [];
248
+ if (data.repo_results) return data.repo_results;
249
+ if (data.file_hotspots) {
250
+ return [{
251
+ success: data.success,
252
+ repo_name: data.repo_name || '',
253
+ repo_path: data.repo_path || '',
254
+ time_window_days: data.time_window_days || days,
255
+ commit_count: data.commit_count || 0,
256
+ file_hotspots: data.file_hotspots || [],
257
+ directory_hotspots: data.directory_hotspots || [],
258
+ }];
259
+ }
260
+ return [];
261
+ }, [data, days]);
262
+
263
+ const allFiles = useMemo(() => {
264
+ const files: FileHotspot[] = [];
265
+ for (const r of repoResults) {
266
+ if (r.success) files.push(...r.file_hotspots);
267
+ }
268
+ return files;
269
+ }, [repoResults]);
270
+
271
+ const allDirs = useMemo(() => {
272
+ const dirs: DirectoryHotspot[] = [];
273
+ for (const r of repoResults) {
274
+ if (r.success) dirs.push(...r.directory_hotspots);
275
+ }
276
+ return dirs;
277
+ }, [repoResults]);
278
+
279
+ const filteredFiles = useMemo(
280
+ () => allFiles.filter((f) => matchesFilter(f.path, codeOnly, includeConfig)),
281
+ [allFiles, codeOnly, includeConfig],
282
+ );
283
+
284
+ const filteredDirs = useMemo(
285
+ () => allDirs.filter((d) => matchesFilter(d.path, codeOnly, includeConfig)),
286
+ [allDirs, codeOnly, includeConfig],
287
+ );
288
+
289
+ const totalCommits = repoResults.reduce((sum, r) => sum + (r.commit_count || 0), 0);
290
+
291
+ const renderContent = () => {
292
+ if (isLoading) {
293
+ return (
294
+ <div className="hotspots-panel loading" data-testid="hotspots-panel">
295
+ <div className="space-y-3 p-2">
296
+ <Skeleton className="h-4 w-40" />
297
+ <Skeleton className="h-3 w-full" />
298
+ <Skeleton className="h-3 w-full" />
299
+ <Skeleton className="h-3 w-3/4" />
300
+ <Skeleton className="h-3 w-full" />
301
+ <Skeleton className="h-3 w-5/6" />
302
+ </div>
303
+ </div>
304
+ );
305
+ }
306
+
307
+ if (error) {
308
+ return (
309
+ <div className="hotspots-panel error" data-testid="hotspots-panel">
310
+ <div className="error-message">{error.message}</div>
311
+ <Button variant="outline" size="sm" onClick={refresh}>Retry</Button>
312
+ </div>
313
+ );
314
+ }
315
+
316
+ return (
317
+ <TooltipProvider delayDuration={300}>
318
+ <div className="hotspots-panel" data-testid="hotspots-panel">
319
+ <div className="space-y-3">
320
+ <div className="flex flex-wrap items-center gap-x-4 gap-y-2">
321
+ <div className="flex gap-1">
322
+ {TIME_WINDOWS.map((w) => (
323
+ <Button
324
+ key={w}
325
+ variant={days === w ? 'default' : 'outline'}
326
+ size="sm"
327
+ onClick={() => setDays(w)}
328
+ >
329
+ {w}d
330
+ </Button>
331
+ ))}
332
+ </div>
333
+
334
+ <div className="flex gap-1">
335
+ <Button
336
+ variant={viewMode === 'files' ? 'default' : 'outline'}
337
+ size="sm"
338
+ onClick={() => setViewMode('files')}
339
+ >
340
+ Files
341
+ </Button>
342
+ <Button
343
+ variant={viewMode === 'dirs' ? 'default' : 'outline'}
344
+ size="sm"
345
+ onClick={() => setViewMode('dirs')}
346
+ >
347
+ Dirs
348
+ </Button>
349
+ </div>
350
+
351
+ <div className="ml-auto">
352
+ <Tooltip>
353
+ <TooltipTrigger asChild>
354
+ <Button variant="outline" size="sm" onClick={refresh}>
355
+ Analyze
356
+ </Button>
357
+ </TooltipTrigger>
358
+ <TooltipContent>Run hotspot analysis</TooltipContent>
359
+ </Tooltip>
360
+ </div>
361
+ </div>
362
+
363
+ <div className="flex flex-wrap items-center gap-x-6 gap-y-2">
364
+ <label className="flex items-center gap-2 text-sm text-[var(--text-secondary)] cursor-pointer">
365
+ <input
366
+ type="checkbox"
367
+ checked={includeOrchestrator}
368
+ onChange={(e) => setIncludeOrchestrator(e.target.checked)}
369
+ />
370
+ Include orchestrator
371
+ </label>
372
+
373
+ <label className="flex items-center gap-2 text-sm text-[var(--text-secondary)] cursor-pointer">
374
+ <input
375
+ type="checkbox"
376
+ aria-label="Code only"
377
+ checked={codeOnly}
378
+ onChange={(e) => setCodeOnly(e.target.checked)}
379
+ />
380
+ Code only
381
+ </label>
382
+
383
+ <label className="flex items-center gap-2 text-sm text-[var(--text-secondary)] cursor-pointer">
384
+ <input
385
+ type="checkbox"
386
+ aria-label="Include config"
387
+ checked={includeConfig}
388
+ disabled={!codeOnly}
389
+ onChange={(e) => setIncludeConfig(e.target.checked)}
390
+ className="disabled:opacity-40"
391
+ />
392
+ <span className={!codeOnly ? 'opacity-40' : ''}>Include config</span>
393
+ </label>
394
+ </div>
395
+ </div>
396
+
397
+ {data && (
398
+ <div className="flex gap-4 text-xs text-[var(--text-muted)]">
399
+ <span>{totalCommits} commits</span>
400
+ <span>{filteredFiles.length} files</span>
401
+ <span>{filteredDirs.length} dirs</span>
402
+ </div>
403
+ )}
404
+
405
+ {!data && (
406
+ <div className="text-center py-12 text-[var(--text-muted)]">
407
+ Click <strong>Analyze</strong> to detect code hotspots
408
+ </div>
409
+ )}
410
+
411
+ {data && viewMode === 'files' && (
412
+ filteredFiles.length > 0 ? (
413
+ <FileTable
414
+ hotspots={filteredFiles.slice(0, 50)}
415
+ sortField={sortField}
416
+ sortDirection={sortDirection}
417
+ onSort={handleSort}
418
+ />
419
+ ) : (
420
+ <div className="text-center py-12 text-[var(--text-muted)]">No file hotspots found</div>
421
+ )
422
+ )}
423
+
424
+ {data && viewMode === 'dirs' && (
425
+ filteredDirs.length > 0 ? (
426
+ <DirTable
427
+ hotspots={filteredDirs.slice(0, 50)}
428
+ sortField={sortField}
429
+ sortDirection={sortDirection}
430
+ onSort={handleSort}
431
+ />
432
+ ) : (
433
+ <div className="text-center py-12 text-[var(--text-muted)]">No directory hotspots found</div>
434
+ )
435
+ )}
436
+ </div>
437
+ </TooltipProvider>
438
+ );
439
+ };
440
+
441
+ return (
442
+ <ToolDialog
443
+ open={open}
444
+ onOpenChange={onOpenChange}
445
+ title="Hotspots"
446
+ description="Files and directories ranked by change frequency and complexity"
447
+ >
448
+ {renderContent()}
449
+ </ToolDialog>
450
+ );
451
+ }
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ import {
3
+ Dialog,
4
+ DialogContent,
5
+ DialogHeader,
6
+ DialogFooter,
7
+ DialogTitle,
8
+ DialogDescription,
9
+ } from '@/components/ui/dialog';
10
+ import { cn } from '@/lib/utils';
11
+
12
+ export interface ToolDialogProps {
13
+ open: boolean;
14
+ onOpenChange: (open: boolean) => void;
15
+ title: string;
16
+ description?: string;
17
+ footer?: React.ReactNode;
18
+ className?: string;
19
+ children: React.ReactNode;
20
+ }
21
+
22
+ export function ToolDialog({
23
+ open,
24
+ onOpenChange,
25
+ title,
26
+ description,
27
+ footer,
28
+ className,
29
+ children,
30
+ }: ToolDialogProps): React.ReactElement {
31
+ return (
32
+ <Dialog open={open} onOpenChange={onOpenChange}>
33
+ <DialogContent className={cn('max-w-5xl max-h-[80vh] overflow-y-auto', className)}>
34
+ <DialogHeader>
35
+ <DialogTitle>{title}</DialogTitle>
36
+ {description && <DialogDescription>{description}</DialogDescription>}
37
+ </DialogHeader>
38
+ {children}
39
+ {footer && <DialogFooter>{footer}</DialogFooter>}
40
+ </DialogContent>
41
+ </Dialog>
42
+ );
43
+ }
@@ -73,12 +73,12 @@ export function ACPanel(): React.ReactElement {
73
73
  return (
74
74
  <div className="ac-panel" data-testid="ac-panel">
75
75
  <div className="ac-content">
76
+ <span className="progress-text">{completedCount}/{totalCount}</span>
76
77
  <div className="progress-bar-container">
77
78
  <div
78
79
  className="progress-bar"
79
80
  style={{ width: `${(completedCount / totalCount) * 100}%` }}
80
81
  />
81
- <span className="progress-text">{completedCount}/{totalCount}</span>
82
82
  </div>
83
83
  <div className="ac-list">
84
84
  {criteria.map((item, index) => (
@@ -22,13 +22,11 @@ export interface AcceptanceCriteriaPanelProps {
22
22
  * Individual acceptance criteria item
23
23
  */
24
24
  function CriteriaItemView({ item }: { item: CriteriaItem }): React.ReactElement {
25
- const statusClass = item.completed ? 'ac-item ac-done' : 'ac-item';
26
- const icon = item.completed ? '✓' : '○';
27
-
25
+ const statusClass = `todo-item ${item.completed ? 'todo-completed' : ''}`;
28
26
  return (
29
27
  <div className={statusClass}>
30
- <span className="ac-icon">{icon}</span>
31
- <span className="ac-text">{item.text}</span>
28
+ <span className="todo-status">{item.completed ? '\u2713' : '\u25CB'}</span>
29
+ <span className="todo-subject">{item.text}</span>
32
30
  </div>
33
31
  );
34
32
  }
@@ -38,13 +36,11 @@ function CriteriaItemView({ item }: { item: CriteriaItem }): React.ReactElement
38
36
  */
39
37
  export function AcceptanceCriteriaPanel({
40
38
  criteria,
41
- collapsed = false,
42
- onToggle,
43
39
  }: AcceptanceCriteriaPanelProps): React.ReactElement {
44
40
  // Handle empty state
45
41
  if (!criteria || criteria.length === 0) {
46
42
  return (
47
- <div className="ac-panel empty" data-testid="ac-panel">
43
+ <div className="todo-panel" data-testid="ac-panel">
48
44
  <div className="placeholder">No acceptance criteria</div>
49
45
  </div>
50
46
  );
@@ -53,29 +49,18 @@ export function AcceptanceCriteriaPanel({
53
49
  // Calculate progress
54
50
  const completedCount = criteria.filter(c => c.completed).length;
55
51
  const totalCount = criteria.length;
56
- const progressText = `${completedCount}/${totalCount}`;
57
-
58
- // Handle collapsed state
59
- if (collapsed) {
60
- return (
61
- <div className="ac-panel collapsed" data-testid="ac-panel">
62
- <div className="ac-header" onClick={onToggle}>
63
- <span className="ac-title">Acceptance Criteria</span>
64
- <span className="ac-progress">{progressText}</span>
65
- <span className="ac-expand">▶</span>
66
- </div>
67
- </div>
68
- );
69
- }
52
+ const progressPercent = totalCount > 0 ? Math.round((completedCount / totalCount) * 100) : 0;
70
53
 
71
54
  return (
72
- <div className="ac-panel" data-testid="ac-panel">
73
- <div className="ac-header" onClick={onToggle}>
74
- <span className="ac-title">Acceptance Criteria</span>
75
- <span className="ac-progress">{progressText}</span>
76
- {onToggle && <span className="ac-expand">▼</span>}
55
+ <div className="todo-panel" data-testid="ac-panel">
56
+ <div className="progress-bar-container">
57
+ <div
58
+ className="progress-bar"
59
+ style={{ width: `${progressPercent}%` }}
60
+ />
61
+ <span className="progress-text">{completedCount}/{totalCount}</span>
77
62
  </div>
78
- <div className="ac-list">
63
+ <div className="todo-section">
79
64
  {criteria.map((item, index) => (
80
65
  <CriteriaItemView key={index} item={item} />
81
66
  ))}
@@ -94,7 +79,7 @@ export function ConnectedAcceptanceCriteriaPanel(): React.ReactElement {
94
79
 
95
80
  if (isLoading) {
96
81
  return (
97
- <div className="ac-panel loading" data-testid="ac-panel">
82
+ <div className="todo-panel loading" data-testid="ac-panel">
98
83
  <div className="space-y-2 p-2">
99
84
  <Skeleton className="h-3 w-full" />
100
85
  <Skeleton className="h-4 w-3/4" />
@@ -107,7 +92,7 @@ export function ConnectedAcceptanceCriteriaPanel(): React.ReactElement {
107
92
 
108
93
  if (error) {
109
94
  return (
110
- <div className="ac-panel error" data-testid="ac-panel">
95
+ <div className="todo-panel error" data-testid="ac-panel">
111
96
  <div className="error-message">{error.message}</div>
112
97
  </div>
113
98
  );