@in-the-loop-labs/pair-review 4.1.1 → 5.0.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 (70) hide show
  1. package/README.md +81 -13
  2. package/package.json +6 -2
  3. package/plugin/.claude-plugin/plugin.json +1 -1
  4. package/plugin-code-critic/.claude-plugin/plugin.json +1 -1
  5. package/plugin-pair-loop/.claude-plugin/plugin.json +1 -1
  6. package/plugin-pair-loop/skills/loop/SKILL.md +17 -8
  7. package/public/css/ai-summary-modal.css +1 -1
  8. package/public/css/analysis-config.css +33 -49
  9. package/public/css/council-card.css +118 -0
  10. package/public/css/council-dropdown.css +164 -0
  11. package/public/css/pr.css +666 -394
  12. package/public/css/repo-settings.css +15 -305
  13. package/public/css/settings.css +1141 -0
  14. package/public/css/snippet-manager.css +233 -0
  15. package/public/index.html +40 -59
  16. package/public/js/components/AIPanel.js +82 -16
  17. package/public/js/components/ChatPanel.js +401 -5
  18. package/public/js/components/CouncilCard.js +202 -0
  19. package/public/js/components/CouncilDropdown.js +292 -0
  20. package/public/js/components/DiffOptionsDropdown.js +177 -4
  21. package/public/js/components/SnippetManager.js +463 -0
  22. package/public/js/index.js +7 -30
  23. package/public/js/local.js +20 -2
  24. package/public/js/modules/comment-manager.js +8 -1
  25. package/public/js/modules/comment-minimizer.js +249 -190
  26. package/public/js/modules/external-comment-manager.js +414 -48
  27. package/public/js/modules/file-comment-manager.js +28 -21
  28. package/public/js/modules/hunk-summary-renderer.js +155 -29
  29. package/public/js/modules/pierre-bridge.js +2513 -0
  30. package/public/js/modules/pierre-context.js +345 -0
  31. package/public/js/modules/suggestion-manager.js +176 -20
  32. package/public/js/modules/tour-renderer.js +400 -184
  33. package/public/js/pr.js +1434 -150
  34. package/public/js/repo-settings.js +60 -284
  35. package/public/js/settings.js +1086 -0
  36. package/public/js/theme-bootstrap.js +40 -0
  37. package/public/js/theme.js +247 -0
  38. package/public/js/utils/provider-model.js +3 -3
  39. package/public/js/utils/suggestion-ui.js +157 -8
  40. package/public/local.html +20 -31
  41. package/public/pr.html +14 -23
  42. package/public/repo-settings.html +24 -14
  43. package/public/settings.html +138 -0
  44. package/public/setup.html +8 -13
  45. package/src/chat/api-reference.js +9 -5
  46. package/src/chat/prompt-builder.js +8 -1
  47. package/src/config.js +15 -6
  48. package/src/database.js +307 -14
  49. package/src/external/github-adapter.js +39 -5
  50. package/src/headless/delegate.js +682 -0
  51. package/src/local-review.js +10 -10
  52. package/src/local-scope.js +9 -0
  53. package/src/main.js +276 -157
  54. package/src/mcp-stdio.js +24 -1
  55. package/src/review-config.js +93 -25
  56. package/src/routes/chat.js +2 -2
  57. package/src/routes/config.js +12 -10
  58. package/src/routes/external-comments.js +5 -1
  59. package/src/routes/local.js +2 -4
  60. package/src/routes/mcp.js +18 -13
  61. package/src/routes/reviews.js +223 -4
  62. package/src/routes/settings.js +252 -0
  63. package/src/routes/setup.js +80 -1
  64. package/src/routes/shared.js +31 -29
  65. package/src/routes/snippets.js +154 -0
  66. package/src/routes/stack-analysis.js +17 -14
  67. package/src/server.js +86 -18
  68. package/src/settings/global-settings-service.js +472 -0
  69. package/src/settings/registry.js +624 -0
  70. package/src/utils/db-identity.js +44 -0
@@ -0,0 +1,233 @@
1
+ /* Copyright 2026 Tim Perkins (tjwp) | SPDX-License-Identifier: Apache-2.0 */
2
+
3
+ /*
4
+ * Styles for the SnippetManager component (public/js/components/SnippetManager.js).
5
+ * Loaded on the settings page (inline mount) and on the PR/local pages (for the
6
+ * chat-picker modal). Colors reference the shared CSS custom properties defined
7
+ * by pr.css so light and dark themes both work.
8
+ */
9
+
10
+ /* ─── Inline manager ──────────────────────────────────────────────────────── */
11
+
12
+ .snippet-manager {
13
+ display: flex;
14
+ flex-direction: column;
15
+ gap: 12px;
16
+ }
17
+
18
+ .snippet-manager__loading,
19
+ .snippet-manager__empty {
20
+ color: var(--color-text-secondary, #57606a);
21
+ font-size: 13px;
22
+ padding: 8px 0;
23
+ }
24
+
25
+ .snippet-manager__error {
26
+ color: var(--color-danger, #cf222e);
27
+ font-size: 13px;
28
+ padding: 8px 12px;
29
+ border: 1px solid var(--color-danger, #cf222e);
30
+ border-radius: var(--radius-md, 6px);
31
+ background: var(--color-bg-secondary, #f6f8fa);
32
+ }
33
+
34
+ .snippet-manager__list-wrap {
35
+ display: flex;
36
+ flex-direction: column;
37
+ gap: 10px;
38
+ }
39
+
40
+ .snippet-manager__list {
41
+ display: flex;
42
+ flex-direction: column;
43
+ border: 1px solid var(--color-border-primary, #d1d9e0);
44
+ border-radius: var(--radius-md, 6px);
45
+ overflow: hidden;
46
+ }
47
+
48
+ .snippet-manager__row {
49
+ display: flex;
50
+ align-items: center;
51
+ gap: 12px;
52
+ padding: 8px 12px;
53
+ border-bottom: 1px solid var(--color-border-primary, #d1d9e0);
54
+ background: var(--color-bg-primary, #ffffff);
55
+ }
56
+
57
+ .snippet-manager__row:last-child {
58
+ border-bottom: none;
59
+ }
60
+
61
+ .snippet-manager__preview {
62
+ flex: 1 1 auto;
63
+ min-width: 0;
64
+ white-space: nowrap;
65
+ overflow: hidden;
66
+ text-overflow: ellipsis;
67
+ font-size: 13px;
68
+ color: var(--color-text-primary, #1f2328);
69
+ font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
70
+ }
71
+
72
+ .snippet-manager__row-actions {
73
+ flex: 0 0 auto;
74
+ display: flex;
75
+ gap: 6px;
76
+ }
77
+
78
+ .snippet-manager__row-btn,
79
+ .snippet-manager__add-btn,
80
+ .snippet-manager__save-btn,
81
+ .snippet-manager__cancel-btn {
82
+ font-size: 12px;
83
+ padding: 4px 10px;
84
+ border-radius: var(--radius-md, 6px);
85
+ border: 1px solid var(--color-border-primary, #d1d9e0);
86
+ background: var(--color-bg-secondary, #f6f8fa);
87
+ color: var(--color-text-primary, #1f2328);
88
+ cursor: pointer;
89
+ }
90
+
91
+ .snippet-manager__row-btn:hover,
92
+ .snippet-manager__add-btn:hover,
93
+ .snippet-manager__cancel-btn:hover {
94
+ background: var(--color-bg-tertiary, #eaeef2);
95
+ }
96
+
97
+ .snippet-manager__delete-btn:hover {
98
+ border-color: var(--color-danger, #cf222e);
99
+ color: var(--color-danger, #cf222e);
100
+ }
101
+
102
+ .snippet-manager__add-btn {
103
+ align-self: flex-start;
104
+ }
105
+
106
+ .snippet-manager__save-btn {
107
+ background: var(--color-accent-primary, #0969da);
108
+ border-color: var(--color-accent-primary, #0969da);
109
+ color: #ffffff;
110
+ font-weight: 600;
111
+ }
112
+
113
+ .snippet-manager__save-btn:hover {
114
+ background: var(--color-accent-hover, var(--color-accent-primary, #0860ca));
115
+ }
116
+
117
+ .snippet-manager__save-btn:disabled {
118
+ opacity: 0.55;
119
+ cursor: not-allowed;
120
+ }
121
+
122
+ /* ─── Add / edit form ─────────────────────────────────────────────────────── */
123
+
124
+ .snippet-manager__form {
125
+ display: flex;
126
+ flex-direction: column;
127
+ gap: 8px;
128
+ }
129
+
130
+ .snippet-manager__form-label {
131
+ font-size: 13px;
132
+ font-weight: 600;
133
+ color: var(--color-text-primary, #1f2328);
134
+ }
135
+
136
+ .snippet-manager__textarea {
137
+ width: 100%;
138
+ box-sizing: border-box;
139
+ resize: vertical;
140
+ min-height: 96px;
141
+ padding: 8px 10px;
142
+ font-size: 13px;
143
+ line-height: 1.5;
144
+ border-radius: var(--radius-md, 6px);
145
+ border: 1px solid var(--color-border-primary, #d1d9e0);
146
+ background: var(--color-bg-primary, #ffffff);
147
+ color: var(--color-text-primary, #1f2328);
148
+ font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
149
+ }
150
+
151
+ .snippet-manager__textarea:focus {
152
+ outline: none;
153
+ border-color: var(--color-accent-primary, #0969da);
154
+ box-shadow: 0 0 0 3px var(--color-accent-subtle, rgba(9, 105, 218, 0.1));
155
+ }
156
+
157
+ .snippet-manager__form-actions {
158
+ display: flex;
159
+ gap: 8px;
160
+ }
161
+
162
+ /* ─── Modal shell ─────────────────────────────────────────────────────────── */
163
+
164
+ /*
165
+ * Self-contained modal styling so the picker modal works on any page, whether
166
+ * or not another stylesheet also defines `.modal-overlay`. Scoped to the
167
+ * snippet-manager-modal class to avoid overriding other modals.
168
+ */
169
+ .snippet-manager-modal {
170
+ position: fixed;
171
+ inset: 0;
172
+ z-index: 1000;
173
+ display: flex;
174
+ align-items: center;
175
+ justify-content: center;
176
+ }
177
+
178
+ .snippet-manager-modal .modal-backdrop {
179
+ position: absolute;
180
+ inset: 0;
181
+ background: rgba(0, 0, 0, 0.5);
182
+ cursor: pointer;
183
+ }
184
+
185
+ .snippet-manager-modal__container {
186
+ position: relative;
187
+ width: min(560px, 92vw);
188
+ max-height: 82vh;
189
+ display: flex;
190
+ flex-direction: column;
191
+ overflow: hidden;
192
+ background: var(--color-bg-primary, #ffffff);
193
+ border: 1px solid var(--color-border-primary, #d1d9e0);
194
+ border-radius: var(--radius-lg, 12px);
195
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
196
+ }
197
+
198
+ .snippet-manager-modal__header {
199
+ display: flex;
200
+ align-items: center;
201
+ justify-content: space-between;
202
+ padding: 16px 20px;
203
+ border-bottom: 1px solid var(--color-border-primary, #d1d9e0);
204
+ }
205
+
206
+ .snippet-manager-modal__header h3 {
207
+ margin: 0;
208
+ font-size: 16px;
209
+ font-weight: 600;
210
+ color: var(--color-text-primary, #1f2328);
211
+ }
212
+
213
+ .snippet-manager-modal__close {
214
+ display: inline-flex;
215
+ align-items: center;
216
+ justify-content: center;
217
+ padding: 4px;
218
+ border: none;
219
+ background: none;
220
+ color: var(--color-text-secondary, #57606a);
221
+ cursor: pointer;
222
+ border-radius: var(--radius-md, 6px);
223
+ }
224
+
225
+ .snippet-manager-modal__close:hover {
226
+ background: var(--color-bg-tertiary, #eaeef2);
227
+ color: var(--color-text-primary, #1f2328);
228
+ }
229
+
230
+ .snippet-manager-modal__body {
231
+ padding: 16px 20px;
232
+ overflow-y: auto;
233
+ }
package/public/index.html CHANGED
@@ -1,12 +1,8 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en" data-theme="light">
3
3
  <head>
4
+ <script src="/js/theme-bootstrap.js"></script>
4
5
  <script>
5
- // Initialize theme immediately to prevent flash
6
- (function() {
7
- const savedTheme = localStorage.getItem('theme') || 'light';
8
- document.documentElement.setAttribute('data-theme', savedTheme);
9
- })();
10
6
  window.__pairReview = window.__pairReview || {};
11
7
  window.__pairReview.toGraphiteUrl = function(githubUrl) {
12
8
  return githubUrl.replace(
@@ -21,17 +17,13 @@
21
17
  <title>Pair Review</title>
22
18
  <link rel="icon" type="image/png" href="/favicon.png">
23
19
 
24
- <!-- Google Fonts: DM Sans and JetBrains Mono -->
25
- <link rel="preconnect" href="https://fonts.googleapis.com">
26
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
27
- <link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
28
20
  <link rel="stylesheet" href="/css/analysis-config.css">
29
21
 
30
22
  <style>
31
23
  :root {
32
24
  /* Typography */
33
- --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
34
- --font-mono: 'JetBrains Mono', 'SF Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
25
+ --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
26
+ --font-mono: ui-monospace, 'SF Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
35
27
 
36
28
  /* Layout dimensions */
37
29
  --header-height: 64px;
@@ -213,7 +205,7 @@
213
205
  border-radius: var(--radius-md);
214
206
  border: none;
215
207
  cursor: pointer;
216
- transition: all var(--transition-fast);
208
+ transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
217
209
  white-space: nowrap;
218
210
  text-decoration: none;
219
211
  }
@@ -250,6 +242,22 @@
250
242
  color: var(--color-text-primary);
251
243
  }
252
244
 
245
+ /* Settings (gear) button */
246
+ #settings-btn {
247
+ display: inline-flex;
248
+ align-items: center;
249
+ justify-content: center;
250
+ text-decoration: none;
251
+ background: transparent;
252
+ border: 1px solid var(--color-border-primary);
253
+ color: var(--color-text-secondary);
254
+ }
255
+
256
+ #settings-btn:hover {
257
+ background: var(--color-bg-secondary);
258
+ color: var(--color-text-primary);
259
+ }
260
+
253
261
  /* Help Modal */
254
262
  .help-modal-overlay {
255
263
  position: fixed;
@@ -320,7 +328,7 @@
320
328
  border-radius: var(--radius-md);
321
329
  color: var(--color-text-tertiary);
322
330
  cursor: pointer;
323
- transition: all var(--transition-fast);
331
+ transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
324
332
  }
325
333
 
326
334
  .help-modal-close:hover {
@@ -390,24 +398,6 @@
390
398
  line-height: 1.6;
391
399
  }
392
400
 
393
- [data-theme="dark"] .theme-icon-light {
394
- display: none !important;
395
- }
396
-
397
- [data-theme="dark"] .theme-icon-dark {
398
- display: block !important;
399
- }
400
-
401
- [data-theme="light"] .theme-icon-dark,
402
- :root:not([data-theme="dark"]) .theme-icon-dark {
403
- display: none !important;
404
- }
405
-
406
- [data-theme="light"] .theme-icon-light,
407
- :root:not([data-theme="dark"]) .theme-icon-light {
408
- display: block !important;
409
- }
410
-
411
401
  /* Main content area */
412
402
  .main-content {
413
403
  flex: 1;
@@ -456,7 +446,7 @@
456
446
  }
457
447
 
458
448
  .start-review-input:focus {
459
- box-shadow: 0 0 0 4px var(--ai-glow), 0 0 12px var(--ai-glow);
449
+ box-shadow: 0 0 0 4px var(--ai-glow);
460
450
  }
461
451
 
462
452
  .start-review-input::placeholder {
@@ -509,20 +499,6 @@
509
499
  border-color: #d97706;
510
500
  }
511
501
 
512
- .start-review-btn-analyze {
513
- transition: background-color var(--transition-fast), border-color var(--transition-fast), box-shadow 0.3s ease;
514
- }
515
-
516
- .start-review-btn-analyze:hover:not(:disabled) {
517
- box-shadow: 0 0 8px rgba(217, 119, 6, 0.35), 0 0 20px rgba(251, 191, 36, 0.15);
518
- animation: glow-pulse 2s ease-in-out infinite;
519
- }
520
-
521
- @keyframes glow-pulse {
522
- 0%, 100% { box-shadow: 0 0 8px rgba(217, 119, 6, 0.35), 0 0 20px rgba(251, 191, 36, 0.15); }
523
- 50% { box-shadow: 0 0 12px rgba(217, 119, 6, 0.5), 0 0 28px rgba(251, 191, 36, 0.25); }
524
- }
525
-
526
502
  .btn-browse {
527
503
  background-color: var(--ai-subtle);
528
504
  color: var(--ai-primary);
@@ -753,7 +729,7 @@
753
729
  border-radius: var(--radius-md);
754
730
  color: var(--color-text-tertiary);
755
731
  cursor: pointer;
756
- transition: all var(--transition-fast);
732
+ transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
757
733
  }
758
734
 
759
735
  .btn-delete-review:hover {
@@ -785,7 +761,7 @@
785
761
  border-radius: var(--radius-md);
786
762
  color: var(--color-text-tertiary);
787
763
  cursor: pointer;
788
- transition: all var(--transition-fast);
764
+ transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
789
765
  text-decoration: none;
790
766
  }
791
767
 
@@ -837,7 +813,7 @@
837
813
  border: 1px solid var(--color-border-primary);
838
814
  border-radius: var(--radius-md);
839
815
  cursor: pointer;
840
- transition: all var(--transition-fast);
816
+ transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
841
817
  }
842
818
 
843
819
  .btn-show-more:hover:not(:disabled) {
@@ -890,7 +866,7 @@
890
866
  border: none;
891
867
  border-bottom: 2px solid transparent;
892
868
  cursor: pointer;
893
- transition: all var(--transition-fast);
869
+ transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
894
870
  white-space: nowrap;
895
871
  }
896
872
 
@@ -944,7 +920,7 @@
944
920
  border-radius: var(--radius-md);
945
921
  color: var(--color-text-tertiary);
946
922
  cursor: pointer;
947
- transition: all var(--transition-fast);
923
+ transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
948
924
  }
949
925
 
950
926
  .btn-refresh:hover {
@@ -1006,7 +982,7 @@
1006
982
  border-radius: var(--radius-md);
1007
983
  color: var(--color-text-tertiary);
1008
984
  cursor: pointer;
1009
- transition: all var(--transition-fast);
985
+ transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
1010
986
  }
1011
987
 
1012
988
  .team-filter-apply:hover,
@@ -1103,7 +1079,7 @@
1103
1079
  border-radius: var(--radius-md);
1104
1080
  color: var(--color-text-tertiary);
1105
1081
  cursor: pointer;
1106
- transition: all var(--transition-fast);
1082
+ transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
1107
1083
  }
1108
1084
 
1109
1085
  .btn-delete-session:hover {
@@ -1181,7 +1157,7 @@
1181
1157
  border: 1px solid var(--color-border-primary);
1182
1158
  border-radius: var(--radius-md);
1183
1159
  cursor: pointer;
1184
- transition: all var(--transition-fast);
1160
+ transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
1185
1161
  }
1186
1162
 
1187
1163
  .btn-select-toggle:hover {
@@ -1382,14 +1358,18 @@
1382
1358
  </a>
1383
1359
  </div>
1384
1360
  <div class="header-right">
1385
- <button class="btn btn-icon" id="theme-toggle" title="Toggle theme">
1386
- <svg class="theme-icon-light" viewBox="0 0 16 16" fill="currentColor" width="16" height="16">
1361
+ <button class="btn btn-icon" id="theme-toggle" title="Toggle theme" aria-label="Toggle theme">
1362
+ <!-- Placeholder icon; the shared helper (js/theme.js) swaps in the icon for the active preference (light/dark/system). -->
1363
+ <svg viewBox="0 0 16 16" fill="currentColor" width="16" height="16" aria-hidden="true">
1387
1364
  <path d="M8 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8Zm0-1.5a2.5 2.5 0 1 1 0-5 2.5 2.5 0 0 1 0 5Zm0-10.5a.75.75 0 0 1 .75.75v1.5a.75.75 0 0 1-1.5 0V.75A.75.75 0 0 1 8 0Zm0 13a.75.75 0 0 1 .75.75v1.5a.75.75 0 0 1-1.5 0v-1.5A.75.75 0 0 1 8 13ZM2.343 2.343a.75.75 0 0 1 1.061 0l1.06 1.061a.75.75 0 0 1-1.06 1.06l-1.06-1.06a.75.75 0 0 1 0-1.06Zm9.193 9.193a.75.75 0 0 1 1.06 0l1.061 1.06a.75.75 0 0 1-1.06 1.061l-1.061-1.06a.75.75 0 0 1 0-1.061ZM16 8a.75.75 0 0 1-.75.75h-1.5a.75.75 0 0 1 0-1.5h1.5A.75.75 0 0 1 16 8ZM3 8a.75.75 0 0 1-.75.75H.75a.75.75 0 0 1 0-1.5h1.5A.75.75 0 0 1 3 8Zm10.657-5.657a.75.75 0 0 1 0 1.061l-1.061 1.06a.75.75 0 1 1-1.06-1.06l1.06-1.06a.75.75 0 0 1 1.06 0Zm-9.193 9.193a.75.75 0 0 1 0 1.06l-1.06 1.061a.75.75 0 0 1-1.061-1.06l1.06-1.061a.75.75 0 0 1 1.061 0Z"/>
1388
1365
  </svg>
1389
- <svg class="theme-icon-dark" viewBox="0 0 16 16" fill="currentColor" width="16" height="16" style="display: none;">
1390
- <path d="M9.598 1.591a.749.749 0 0 1 .785-.175 7.001 7.001 0 1 1-8.967 8.967.75.75 0 0 1 .961-.96 5.5 5.5 0 0 0 7.046-7.046.75.75 0 0 1 .175-.786Z"/>
1391
- </svg>
1392
1366
  </button>
1367
+ <a class="btn btn-icon" id="settings-btn" href="/settings" title="Global settings" aria-label="Open global settings">
1368
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16">
1369
+ <circle cx="12" cy="12" r="3"/>
1370
+ <path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/>
1371
+ </svg>
1372
+ </a>
1393
1373
  <button class="btn btn-icon" id="help-btn" title="Help" aria-label="Open help modal">?</button>
1394
1374
  </div>
1395
1375
  </header>
@@ -1590,6 +1570,7 @@
1590
1570
  <script src="/js/components/AnalysisConfigModal.js"></script>
1591
1571
  <script src="/js/components/VoiceCentricConfigTab.js"></script>
1592
1572
  <script src="/js/components/AdvancedConfigTab.js"></script>
1573
+ <script src="/js/theme.js"></script>
1593
1574
  <script src="/js/index.js"></script>
1594
1575
  </body>
1595
1576
  </html>
@@ -998,6 +998,7 @@ class AIPanel {
998
998
  line_start: comment?.line_start ?? (fallbackDataset.commentLineStart ? parseInt(fallbackDataset.commentLineStart, 10) : null),
999
999
  line_end: comment?.line_end ?? (fallbackDataset.commentLineEnd ? parseInt(fallbackDataset.commentLineEnd, 10) : null),
1000
1000
  parentId: comment?.parent_id ?? (fallbackDataset.commentParentId ? parseInt(fallbackDataset.commentParentId, 10) : null),
1001
+ side: comment?.side || fallbackDataset.commentSide || 'RIGHT',
1001
1002
  source: 'user',
1002
1003
  isFileLevel: comment?.is_file_level === 1 || comment?.is_file_level === true
1003
1004
  });
@@ -1084,7 +1085,7 @@ class AIPanel {
1084
1085
  file: finding.file || file,
1085
1086
  line_start: finding.line_start ?? null,
1086
1087
  line_end: finding.line_end ?? null,
1087
- side: 'RIGHT',
1088
+ side: finding.side || 'RIGHT',
1088
1089
  reasoning: null
1089
1090
  };
1090
1091
  }
@@ -1181,9 +1182,20 @@ class AIPanel {
1181
1182
 
1182
1183
  /**
1183
1184
  * Scroll to an AI finding/suggestion in the diff view
1185
+ * @param {string} findingId
1186
+ * @param {string} file
1187
+ * @param {number|string} line
1188
+ * @param {('LEFT'|'RIGHT')} [side] - Diff side; resolved from the finding
1189
+ * model (finding.side) when omitted, defaulting to 'RIGHT'.
1184
1190
  */
1185
- async scrollToFinding(findingId, file, line) {
1191
+ async scrollToFinding(findingId, file, line, side) {
1186
1192
  const myGen = ++this._navGen;
1193
+ // Resolve the diff side: explicit arg wins, else the finding's own side,
1194
+ // else RIGHT. Deletions live on the LEFT, so a hardcoded RIGHT would
1195
+ // reveal the wrong line for deletion-side findings.
1196
+ const resolvedSide = side
1197
+ || this.findings?.find(f => String(f.id) === String(findingId))?.side
1198
+ || 'RIGHT';
1187
1199
  // Expand the file first if it's collapsed
1188
1200
  const expansion = this.expandFileIfCollapsed(file);
1189
1201
  if (expansion && typeof expansion.then === 'function') await expansion;
@@ -1195,7 +1207,15 @@ class AIPanel {
1195
1207
  try { await window.prManager.ensureFileBodyRendered(file); } catch { /* best effort */ }
1196
1208
  }
1197
1209
 
1198
- const doScroll = () => {
1210
+ const doScroll = async () => {
1211
+ // Reveal the target line first — for Pierre-rendered files this
1212
+ // materializes deferred diffs and expands collapsed gaps.
1213
+ if (file && line && window.prManager?.ensureLinesVisible) {
1214
+ await window.prManager.ensureLinesVisible([
1215
+ { file, line_start: parseInt(line, 10), line_end: parseInt(line, 10), side: resolvedSide }
1216
+ ]);
1217
+ }
1218
+
1199
1219
  let targetSuggestion = null;
1200
1220
 
1201
1221
  // First, try to find by exact ID match (most reliable)
@@ -1266,9 +1286,19 @@ class AIPanel {
1266
1286
 
1267
1287
  /**
1268
1288
  * Scroll to a user comment in the diff view
1289
+ * @param {string} commentId
1290
+ * @param {string} file
1291
+ * @param {number|string} line
1292
+ * @param {('LEFT'|'RIGHT')} [side] - Diff side; resolved from the comment
1293
+ * model (comment.side) when omitted, defaulting to 'RIGHT'.
1269
1294
  */
1270
- async scrollToComment(commentId, file, line) {
1295
+ async scrollToComment(commentId, file, line, side) {
1271
1296
  const myGen = ++this._navGen;
1297
+ // Resolve the diff side: explicit arg wins, else the comment's own side,
1298
+ // else RIGHT.
1299
+ const resolvedSide = side
1300
+ || this.comments?.find(c => String(c.id) === String(commentId))?.side
1301
+ || 'RIGHT';
1272
1302
  // Expand the file first if it's collapsed
1273
1303
  const expansion = this.expandFileIfCollapsed(file);
1274
1304
  if (expansion && typeof expansion.then === 'function') await expansion;
@@ -1278,7 +1308,13 @@ class AIPanel {
1278
1308
  try { await window.prManager.ensureFileBodyRendered(file); } catch { /* best effort */ }
1279
1309
  }
1280
1310
 
1281
- const doScroll = () => {
1311
+ const doScroll = async () => {
1312
+ if (file && line && window.prManager?.ensureLinesVisible) {
1313
+ await window.prManager.ensureLinesVisible([
1314
+ { file, line_start: parseInt(line, 10), line_end: parseInt(line, 10), side: resolvedSide }
1315
+ ]);
1316
+ }
1317
+
1282
1318
  let targetElement = null;
1283
1319
  let isFileLevel = false;
1284
1320
 
@@ -1301,14 +1337,17 @@ class AIPanel {
1301
1337
  }
1302
1338
  }
1303
1339
 
1304
- // For line-level comments, try to find by exact comment ID
1340
+ // For line-level comments, try to find by exact comment ID.
1341
+ // Legacy path uses .user-comment-row (table rows), annotation path
1342
+ // uses [data-comment-id] on light-DOM divs slotted into @pierre/diffs.
1305
1343
  if (!targetElement && commentId) {
1306
- targetElement = document.querySelector(`.user-comment-row[data-comment-id="${commentId}"]`);
1344
+ targetElement = document.querySelector(`.user-comment-row[data-comment-id="${commentId}"]`)
1345
+ || document.querySelector(`[data-comment-id="${commentId}"]`);
1307
1346
  }
1308
1347
 
1309
1348
  // Fallback: find by file and line if no direct match
1310
1349
  if (!targetElement && file && line) {
1311
- const commentRows = document.querySelectorAll('.user-comment-row');
1350
+ const commentRows = document.querySelectorAll('.user-comment-row, [data-comment-id]');
1312
1351
  for (const row of commentRows) {
1313
1352
  if (row.dataset.file === file && row.dataset.lineStart === line) {
1314
1353
  targetElement = row;
@@ -1326,8 +1365,9 @@ class AIPanel {
1326
1365
  scrollTarget = diffRow || targetElement;
1327
1366
  }
1328
1367
  this._scrollDiffTarget(scrollTarget);
1329
- // Add highlight effect
1330
- const commentDiv = isFileLevel ? targetElement : targetElement.querySelector('.user-comment');
1368
+ // Add highlight effect — find .user-comment inside (works for both
1369
+ // legacy rows and @pierre/diffs annotation divs)
1370
+ const commentDiv = isFileLevel ? targetElement : (targetElement.querySelector('.user-comment') || targetElement);
1331
1371
  if (commentDiv) {
1332
1372
  commentDiv.classList.add('highlight-flash');
1333
1373
  setTimeout(() => commentDiv.classList.remove('highlight-flash'), 2000);
@@ -1583,6 +1623,14 @@ class AIPanel {
1583
1623
  const category = finding.category || finding.type || '';
1584
1624
  const isActive = finding.status !== 'dismissed' && finding.status !== 'adopted';
1585
1625
 
1626
+ // Dismissal reason: only shown for dismissed findings that carry one.
1627
+ // Full text goes in the item tooltip; a truncated muted line renders
1628
+ // under the title.
1629
+ const dismissalReason = finding.status === 'dismissed' ? (finding.status_reason || '') : '';
1630
+ const itemTitle = dismissalReason
1631
+ ? (fullLocation ? `${fullLocation} — ${dismissalReason}` : dismissalReason)
1632
+ : fullLocation;
1633
+
1586
1634
  // Use star icon for praise, dot for other types
1587
1635
  const indicator = type === 'praise'
1588
1636
  ? `<span class="finding-star">${this.getTypeIcon('praise')}</span>`
@@ -1627,12 +1675,13 @@ class AIPanel {
1627
1675
 
1628
1676
  return `
1629
1677
  <div class="finding-item-wrapper">
1630
- <button class="finding-item finding-${type} ${statusClass}" data-index="${index}" data-id="${finding.id || ''}" data-file="${finding.file || ''}" data-line="${lineNum || ''}" data-item-type="finding" title="${fullLocation}">
1678
+ <button class="finding-item finding-${type} ${statusClass}" data-index="${index}" data-id="${finding.id || ''}" data-file="${finding.file || ''}" data-line="${lineNum || ''}" data-item-type="finding" title="${window.escapeHtmlAttribute(itemTitle)}">
1631
1679
  ${indicator}
1632
1680
  <div class="finding-content">
1633
1681
  <span class="finding-title">${this.escapeHtml(title)}</span>
1634
1682
  ${category || finding.severity ? `<span class="finding-meta">${category ? `<span class="finding-category">${this.escapeHtml(category)}</span>` : ''}${finding.severity ? `<span class="severity-badge severity-${finding.severity}">${this.escapeHtml(finding.severity.toUpperCase())}</span>` : ''}</span>` : ''}
1635
1683
  ${fileName ? `<span class="finding-location">${this.escapeHtml(fileName)}</span>` : ''}
1684
+ ${dismissalReason ? `<span class="finding-dismissal-reason">${this.escapeHtml(this.truncateText(dismissalReason, 60))}</span>` : ''}
1636
1685
  </div>
1637
1686
  </button>
1638
1687
  ${quickActions}
@@ -1693,7 +1742,7 @@ class AIPanel {
1693
1742
  if (!isDismissed && document.documentElement.getAttribute('data-chat') === 'available') {
1694
1743
  chatAction = `
1695
1744
  <div class="finding-chat-action">
1696
- <button class="quick-action-btn quick-action-chat" data-comment-id="${comment.id}" data-comment-file="${this.escapeHtml(comment.file || '')}" data-comment-line-start="${comment.line_start ?? ''}" data-comment-line-end="${comment.line_end ?? ''}" data-comment-parent-id="${comment.parent_id || ''}" title="Chat" aria-label="Chat about comment">
1745
+ <button class="quick-action-btn quick-action-chat" data-comment-id="${comment.id}" data-comment-file="${this.escapeHtml(comment.file || '')}" data-comment-line-start="${comment.line_start ?? ''}" data-comment-line-end="${comment.line_end ?? ''}" data-comment-parent-id="${comment.parent_id || ''}" data-comment-side="${comment.side || 'RIGHT'}" title="Chat" aria-label="Chat about comment">
1697
1746
  <svg viewBox="0 0 16 16" fill="currentColor" width="12" height="12"><path d="M1.75 1h8.5c.966 0 1.75.784 1.75 1.75v5.5A1.75 1.75 0 0 1 10.25 10H7.061l-2.574 2.573A1.458 1.458 0 0 1 2 11.543V10h-.25A1.75 1.75 0 0 1 0 8.25v-5.5C0 1.784.784 1 1.75 1ZM1.5 2.75v5.5c0 .138.112.25.25.25h1a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h3.5a.25.25 0 0 0 .25-.25v-5.5a.25.25 0 0 0-.25-.25h-8.5a.25.25 0 0 0-.25.25Zm13 2a.25.25 0 0 0-.25-.25h-.5a.75.75 0 0 1 0-1.5h.5c.966 0 1.75.784 1.75 1.75v5.5A1.75 1.75 0 0 1 14.25 12H14v1.543a1.458 1.458 0 0 1-2.487 1.03L9.22 12.28a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215l2.22 2.22v-2.19a.75.75 0 0 1 .75-.75h1a.25.25 0 0 0 .25-.25Z"/></svg>
1698
1747
  </button>
1699
1748
  </div>
@@ -1741,7 +1790,11 @@ class AIPanel {
1741
1790
 
1742
1791
  const fileName = thread.file ? thread.file.split('/').pop() : null;
1743
1792
  const lineNum = thread.line_start;
1744
- const fullLocation = fileName ? `${fileName}${lineNum ? ':' + lineNum : ''}` : '';
1793
+ // File-level threads (GitHub subject_type='file') have no line — label
1794
+ // them "(file)" like native file-level comments instead of a line no.
1795
+ const isFileLevel = thread.is_file_level === 1 || thread.is_file_level === true;
1796
+ const locationSuffix = lineNum ? ':' + lineNum : (isFileLevel ? ' (file)' : '');
1797
+ const fullLocation = fileName ? `${fileName}${locationSuffix}` : '';
1745
1798
 
1746
1799
  const replies = Array.isArray(thread.replies) ? thread.replies : [];
1747
1800
  // Strict count of comments in the thread (root + replies). Always
@@ -1788,7 +1841,7 @@ class AIPanel {
1788
1841
  <div class="finding-content">
1789
1842
  <span class="finding-title"><span class="external-list-author">${this.escapeHtml(author)}</span><span class="external-list-snippet">${snippet ? ' — ' + this.escapeHtml(snippet) : ''}</span></span>
1790
1843
  ${thread.is_outdated ? '<span class="finding-meta"><span class="external-list-outdated-badge">outdated</span></span>' : ''}
1791
- ${fileName ? `<span class="finding-location">${this.escapeHtml(fileName)}${lineNum ? ':' + lineNum : ''}</span>` : ''}
1844
+ ${fileName ? `<span class="finding-location">${this.escapeHtml(fileName)}${locationSuffix}</span>` : ''}
1792
1845
  </div>
1793
1846
  </button>
1794
1847
  ${chatAction}
@@ -1864,6 +1917,19 @@ class AIPanel {
1864
1917
  findingEl.classList.add('finding-active');
1865
1918
  }
1866
1919
 
1920
+ // Leaving the dismissed state: strip the stale dismissal-reason line
1921
+ // and reset the tooltip to the plain location. renderFindingItem only
1922
+ // adds these for dismissed findings, so an in-place status swap must
1923
+ // undo them here (the finding may keep a status_reason in the array).
1924
+ if (status !== 'dismissed') {
1925
+ const reasonSpan = findingEl.querySelector('.finding-dismissal-reason');
1926
+ if (reasonSpan) reasonSpan.remove();
1927
+ const filePath = finding?.file || findingEl.dataset.file || '';
1928
+ const fileName = filePath ? filePath.split('/').pop() : null;
1929
+ const lineNum = finding?.line_start || findingEl.dataset.line || '';
1930
+ findingEl.title = fileName ? `${fileName}${lineNum ? ':' + lineNum : ''}` : '';
1931
+ }
1932
+
1867
1933
  const wrapper = findingEl.closest('.finding-item-wrapper');
1868
1934
  if (!wrapper) {
1869
1935
  console.warn(`AIPanel.updateFindingStatus: wrapper element not found for finding ${findingId}. DOM structure may have changed.`);
@@ -2254,11 +2320,11 @@ class AIPanel {
2254
2320
  const line = item.line_start;
2255
2321
 
2256
2322
  if (item._itemType === 'comment') {
2257
- this.scrollToComment(itemId, file, line);
2323
+ this.scrollToComment(itemId, file, line, item.side);
2258
2324
  } else if (item._itemType === 'external') {
2259
2325
  this.scrollToExternalThread(itemId, item.source, file, line);
2260
2326
  } else {
2261
- this.scrollToFinding(itemId, file, line);
2327
+ this.scrollToFinding(itemId, file, line, item.side);
2262
2328
  }
2263
2329
  }
2264
2330