@in-the-loop-labs/pair-review 4.1.1 → 5.0.1

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 (71) 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 +668 -393
  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/diff-renderer.js +16 -4
  27. package/public/js/modules/external-comment-manager.js +414 -48
  28. package/public/js/modules/file-comment-manager.js +28 -21
  29. package/public/js/modules/hunk-summary-renderer.js +155 -29
  30. package/public/js/modules/pierre-bridge.js +2513 -0
  31. package/public/js/modules/pierre-context.js +345 -0
  32. package/public/js/modules/suggestion-manager.js +176 -20
  33. package/public/js/modules/tour-renderer.js +400 -184
  34. package/public/js/pr.js +1614 -158
  35. package/public/js/repo-settings.js +60 -284
  36. package/public/js/settings.js +1086 -0
  37. package/public/js/theme-bootstrap.js +40 -0
  38. package/public/js/theme.js +247 -0
  39. package/public/js/utils/provider-model.js +3 -3
  40. package/public/js/utils/suggestion-ui.js +157 -8
  41. package/public/local.html +20 -31
  42. package/public/pr.html +14 -23
  43. package/public/repo-settings.html +24 -14
  44. package/public/settings.html +138 -0
  45. package/public/setup.html +8 -13
  46. package/src/chat/api-reference.js +9 -5
  47. package/src/chat/prompt-builder.js +8 -1
  48. package/src/config.js +15 -6
  49. package/src/database.js +307 -14
  50. package/src/external/github-adapter.js +39 -5
  51. package/src/headless/delegate.js +682 -0
  52. package/src/local-review.js +10 -10
  53. package/src/local-scope.js +9 -0
  54. package/src/main.js +276 -157
  55. package/src/mcp-stdio.js +24 -1
  56. package/src/review-config.js +93 -25
  57. package/src/routes/chat.js +2 -2
  58. package/src/routes/config.js +12 -10
  59. package/src/routes/external-comments.js +5 -1
  60. package/src/routes/local.js +2 -4
  61. package/src/routes/mcp.js +18 -13
  62. package/src/routes/reviews.js +223 -4
  63. package/src/routes/settings.js +252 -0
  64. package/src/routes/setup.js +80 -1
  65. package/src/routes/shared.js +31 -29
  66. package/src/routes/snippets.js +154 -0
  67. package/src/routes/stack-analysis.js +17 -14
  68. package/src/server.js +86 -18
  69. package/src/settings/global-settings-service.js +472 -0
  70. package/src/settings/registry.js +624 -0
  71. package/src/utils/db-identity.js +44 -0
package/public/pr.html CHANGED
@@ -1,12 +1,8 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en" data-theme="light" data-chat="disabled">
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
  // Fetch chat availability early so PanelGroup sees the correct state
11
7
  fetch('/api/config').then(r => r.ok ? r.json() : null).then(config => {
12
8
  if (!config) return;
@@ -41,18 +37,14 @@
41
37
  <title>Pair Review - PR Review</title>
42
38
  <link rel="icon" type="image/png" href="/favicon.png">
43
39
 
44
- <!-- Google Fonts: DM Sans and JetBrains Mono -->
45
- <link rel="preconnect" href="https://fonts.googleapis.com">
46
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
47
- <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">
48
-
49
40
  <!-- PR Display Styles -->
50
41
  <link rel="stylesheet" href="/css/pr.css">
51
42
  <link rel="stylesheet" href="/css/ai-summary-modal.css">
52
43
  <link rel="stylesheet" href="/css/analysis-config.css">
44
+ <link rel="stylesheet" href="/css/snippet-manager.css">
53
45
  <link rel="stylesheet" href="/css/styles.css">
54
46
 
55
- <!-- Highlight.js for syntax highlighting -->
47
+ <!-- Highlight.js for syntax highlighting (legacy/context-file rendering; diffs use @pierre/diffs Shiki) -->
56
48
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github.min.css" media="(prefers-color-scheme: light)">
57
49
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css" media="(prefers-color-scheme: dark)">
58
50
 
@@ -64,7 +56,7 @@
64
56
  }
65
57
 
66
58
  body {
67
- font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
59
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
68
60
  background-color: #f6f8fa;
69
61
  color: #24292f;
70
62
  line-height: 1.5;
@@ -126,13 +118,11 @@
126
118
  <path d="M8 0a8 8 0 0 1 8 8h-2A6 6 0 0 0 8 2V0Z"/>
127
119
  </svg>
128
120
  </button>
129
- <button class="btn btn-icon" id="theme-toggle" title="Toggle theme">
130
- <svg class="theme-icon-light" viewBox="0 0 16 16" fill="currentColor" width="16" height="16">
121
+ <button class="btn btn-icon" id="theme-toggle" title="Toggle theme" aria-label="Toggle theme">
122
+ <!-- Placeholder icon; the shared helper (js/theme.js) swaps in the icon for the active preference (light/dark/system). -->
123
+ <svg viewBox="0 0 16 16" fill="currentColor" width="16" height="16" aria-hidden="true">
131
124
  <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"/>
132
125
  </svg>
133
- <svg class="theme-icon-dark" viewBox="0 0 16 16" fill="currentColor" width="16" height="16" style="display: none;">
134
- <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"/>
135
- </svg>
136
126
  </button>
137
127
  <button class="btn btn-icon" id="notification-toggle" title="Notification sounds">
138
128
  <svg class="bell-icon-on" viewBox="0 0 16 16" fill="currentColor" width="16" height="16">
@@ -232,9 +222,6 @@
232
222
  <div class="diff-stats" id="diff-stats"></div>
233
223
  <div class="toolbar-actions">
234
224
  <button class="btn btn-sm btn-secondary" id="analyze-btn" title="Analyze with AI">
235
- <svg class="analyze-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="14" height="14">
236
- <path d="M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09z"/>
237
- </svg>
238
225
  <span class="btn-text">Analyze</span>
239
226
  </button>
240
227
  <button class="btn btn-sm btn-icon btn-summary-toggle" id="summary-toggle-btn" title="Hide hunk summaries" aria-label="Toggle hunk summaries" aria-pressed="true" style="display: none;">
@@ -374,10 +361,10 @@
374
361
  </div>
375
362
  </div>
376
363
 
377
- <!-- Diff2Html Library -->
378
- <script src="https://cdn.jsdelivr.net/npm/diff2html@3.4.47/bundles/js/diff2html.min.js"></script>
364
+ <!-- @pierre/diffs - Diff rendering with Shiki syntax highlighting -->
365
+ <script src="/js/vendor/pierre-diffs.js"></script>
379
366
 
380
- <!-- Highlight.js for syntax highlighting -->
367
+ <!-- Highlight.js for legacy/context-file syntax highlighting -->
381
368
  <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
382
369
  <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/elixir.min.js"></script>
383
370
 
@@ -449,6 +436,8 @@
449
436
  <script src="/js/modules/hunk-parser.js"></script>
450
437
  <script src="/js/modules/line-tracker.js"></script>
451
438
  <script src="/js/modules/diff-renderer.js"></script>
439
+ <script src="/js/modules/pierre-context.js"></script>
440
+ <script src="/js/modules/pierre-bridge.js"></script>
452
441
  <script src="/js/modules/comment-manager.js"></script>
453
442
  <script src="/js/modules/suggestion-manager.js"></script>
454
443
  <script src="/js/modules/comment-minimizer.js"></script>
@@ -463,6 +452,7 @@
463
452
  <script src="/js/components/TourBar.js"></script>
464
453
 
465
454
  <!-- Chat Panel Component -->
455
+ <script src="/js/components/SnippetManager.js"></script>
466
456
  <script src="/js/components/ChatPanel.js"></script>
467
457
 
468
458
  <!-- External review-comment renderer (must load after chat-panel + comment-manager) -->
@@ -480,6 +470,7 @@
480
470
  <script src="/js/repo-links.js"></script>
481
471
 
482
472
  <!-- PR JavaScript -->
473
+ <script src="/js/theme.js"></script>
483
474
  <script src="/js/pr.js"></script>
484
475
  </body>
485
476
  </html>
@@ -1,19 +1,15 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en" data-theme="light">
3
3
  <head>
4
- <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
- </script>
4
+ <script src="/js/theme-bootstrap.js"></script>
11
5
  <meta charset="UTF-8">
12
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
13
7
  <title>Repository Settings - Pair Review</title>
14
8
  <link rel="icon" type="image/png" href="/favicon.png">
15
9
  <link rel="stylesheet" href="/css/pr.css">
16
10
  <link rel="stylesheet" href="/css/analysis-config.css">
11
+ <link rel="stylesheet" href="/css/council-dropdown.css">
12
+ <link rel="stylesheet" href="/css/council-card.css">
17
13
  <link rel="stylesheet" href="/css/repo-settings.css">
18
14
  </head>
19
15
  <body>
@@ -64,13 +60,24 @@
64
60
  <!-- Main Content -->
65
61
  <main class="settings-main">
66
62
  <div class="settings-container">
67
- <!-- Back to PR link (shown when navigating from a PR page) -->
68
- <a href="#" class="back-to-pr" id="back-to-pr" style="display: none;">
69
- <svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
70
- <path fill-rule="evenodd" d="M7.78 12.53a.75.75 0 01-1.06 0L2.47 8.28a.75.75 0 010-1.06l4.25-4.25a.75.75 0 011.06 1.06L4.81 7h7.44a.75.75 0 010 1.5H4.81l2.97 2.97a.75.75 0 010 1.06z"/>
71
- </svg>
72
- <span id="back-to-pr-text">Return to PR</span>
73
- </a>
63
+ <!-- Top nav links -->
64
+ <div class="settings-top-links" style="display: flex; gap: 12px; flex-wrap: wrap; align-items: center;">
65
+ <!-- Back to PR link (shown when navigating from a PR page) -->
66
+ <a href="#" class="back-to-pr" id="back-to-pr" style="display: none;">
67
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
68
+ <path fill-rule="evenodd" d="M7.78 12.53a.75.75 0 01-1.06 0L2.47 8.28a.75.75 0 010-1.06l4.25-4.25a.75.75 0 011.06 1.06L4.81 7h7.44a.75.75 0 010 1.5H4.81l2.97 2.97a.75.75 0 010 1.06z"/>
69
+ </svg>
70
+ <span id="back-to-pr-text">Return to PR</span>
71
+ </a>
72
+ <!-- Global settings link (always shown) -->
73
+ <a href="/settings" class="back-to-pr" id="global-settings-link">
74
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
75
+ <circle cx="12" cy="12" r="3"/>
76
+ <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"/>
77
+ </svg>
78
+ <span>Global settings</span>
79
+ </a>
80
+ </div>
74
81
 
75
82
  <!-- Page Header -->
76
83
  <div class="page-header">
@@ -307,6 +314,9 @@ Examples:
307
314
 
308
315
  <!-- JavaScript -->
309
316
  <script src="/js/utils/tier-icons.js"></script>
317
+ <script src="/js/components/CouncilDropdown.js"></script>
318
+ <script src="/js/components/CouncilCard.js"></script>
319
+ <script src="/js/theme.js"></script>
310
320
  <script src="/js/repo-settings.js"></script>
311
321
  </body>
312
322
  </html>
@@ -0,0 +1,138 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en" data-theme="light">
3
+ <head>
4
+ <script src="/js/theme-bootstrap.js"></script>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>Global Settings - Pair Review</title>
8
+ <link rel="icon" type="image/png" href="/favicon.png">
9
+ <link rel="stylesheet" href="/css/pr.css">
10
+ <link rel="stylesheet" href="/css/council-dropdown.css">
11
+ <link rel="stylesheet" href="/css/council-card.css">
12
+ <link rel="stylesheet" href="/css/snippet-manager.css">
13
+ <link rel="stylesheet" href="/css/settings.css">
14
+ </head>
15
+ <body>
16
+ <!-- Main Container -->
17
+ <div class="settings-page" id="settings-page">
18
+ <!-- Top Navigation Bar -->
19
+ <header class="settings-nav">
20
+ <div class="nav-content">
21
+ <a href="/" class="nav-logo">
22
+ <svg class="logo-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" width="24" height="24">
23
+ <path transform="rotate(-50 12 12)" d="M18.178 8c5.096 0 5.096 8 0 8-5.095 0-7.133-8-12.356-8-5.096 0-5.096 8 0 8 5.223 0 7.26-8 12.356-8z"/>
24
+ </svg>
25
+ <span class="logo-text">pair<strong>review</strong></span>
26
+ </a>
27
+ <nav class="breadcrumb" aria-label="Breadcrumb">
28
+ <ol>
29
+ <li><a href="/">Repositories</a></li>
30
+ <li class="separator">
31
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
32
+ <path d="M6.22 3.22a.75.75 0 011.06 0l4.25 4.25a.75.75 0 010 1.06l-4.25 4.25a.75.75 0 01-1.06-1.06L9.94 8 6.22 4.28a.75.75 0 010-1.06z"/>
33
+ </svg>
34
+ </li>
35
+ <li class="current" aria-current="page">Global Settings</li>
36
+ </ol>
37
+ </nav>
38
+ <button class="theme-toggle" id="theme-toggle" title="Toggle theme">
39
+ <svg class="sun-icon" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
40
+ <circle cx="12" cy="12" r="5"/>
41
+ <line x1="12" y1="1" x2="12" y2="3"/>
42
+ <line x1="12" y1="21" x2="12" y2="23"/>
43
+ <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/>
44
+ <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/>
45
+ <line x1="1" y1="12" x2="3" y2="12"/>
46
+ <line x1="21" y1="12" x2="23" y2="12"/>
47
+ <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/>
48
+ <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>
49
+ </svg>
50
+ </button>
51
+ </div>
52
+ </header>
53
+
54
+ <!-- Main Content -->
55
+ <main class="settings-main">
56
+ <div class="settings-container">
57
+ <!-- Page Header -->
58
+ <div class="page-header">
59
+ <div class="header-icon">
60
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
61
+ <circle cx="12" cy="12" r="3"/>
62
+ <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"/>
63
+ </svg>
64
+ </div>
65
+ <div class="header-text">
66
+ <h1>Global Settings</h1>
67
+ <p class="header-subtitle">
68
+ Application-wide defaults. In-app changes are saved to the local database and never written to your config files.
69
+ </p>
70
+ </div>
71
+ </div>
72
+
73
+ <!-- Precedence explainer -->
74
+ <div class="settings-precedence-note">
75
+ <svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor">
76
+ <path d="M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8zm6.5-.25A.75.75 0 017.25 7h1a.75.75 0 01.75.75v2.75h.25a.75.75 0 010 1.5h-2a.75.75 0 010-1.5h.25v-2h-.25a.75.75 0 01-.75-.75zM8 6a1 1 0 100-2 1 1 0 000 2z"/>
77
+ </svg>
78
+ <span>
79
+ Each setting shows its effective value and where it comes from. Precedence, highest to lowest:
80
+ <strong>in-app</strong> &rsaquo; environment &rsaquo; project config &rsaquo; global config &rsaquo; managed &rsaquo; built-in default.
81
+ A <span class="source-badge source-badge--default">default</span> badge means the value is not explicitly set anywhere.
82
+ </span>
83
+ </div>
84
+
85
+ <!-- Two-column layout: section nav + content -->
86
+ <div class="settings-layout">
87
+ <!-- Section navigation (built dynamically from rendered sections) -->
88
+ <nav class="settings-sidebar" aria-label="Settings sections">
89
+ <div class="settings-nav-list" id="settings-nav-list"></div>
90
+ </nav>
91
+
92
+ <div class="settings-content">
93
+ <!-- Loading / error state -->
94
+ <div class="settings-loading" id="settings-loading">Loading settings&hellip;</div>
95
+ <div class="settings-error" id="settings-error" style="display: none;"></div>
96
+
97
+ <!-- Setting sections rendered dynamically -->
98
+ <div id="settings-sections"></div>
99
+
100
+ <!-- Chat Snippets section -->
101
+ <section class="settings-section" id="snippets-section">
102
+ <div class="section-header">
103
+ <h2>Chat Snippets</h2>
104
+ <p class="section-description">
105
+ Reusable prompt snippets available from the chat input on any review.
106
+ </p>
107
+ </div>
108
+ <div id="snippets-manager"></div>
109
+ </section>
110
+
111
+ <!-- Repositories section (kept last so scrollspy's bottom
112
+ guard has a stable terminal section) -->
113
+ <section class="settings-section" id="repos-section" style="display: none;">
114
+ <div class="section-header">
115
+ <h2>Repositories</h2>
116
+ <p class="section-description">
117
+ Repositories with their own settings or a known local checkout. Click one to configure its defaults.
118
+ </p>
119
+ </div>
120
+ <div id="repos-list"></div>
121
+ </section>
122
+ </div>
123
+ </div>
124
+ </div>
125
+ </main>
126
+ </div>
127
+
128
+ <!-- Toast Container -->
129
+ <div class="toast-container" id="toast-container"></div>
130
+
131
+ <!-- JavaScript -->
132
+ <script src="/js/components/CouncilDropdown.js"></script>
133
+ <script src="/js/components/CouncilCard.js"></script>
134
+ <script src="/js/components/SnippetManager.js"></script>
135
+ <script src="/js/theme.js"></script>
136
+ <script src="/js/settings.js"></script>
137
+ </body>
138
+ </html>
package/public/setup.html CHANGED
@@ -1,26 +1,17 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en" data-theme="light">
3
3
  <head>
4
- <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
- </script>
4
+ <script src="/js/theme-bootstrap.js"></script>
11
5
  <meta charset="UTF-8">
12
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
13
7
  <title>Setting up review... - Pair Review</title>
14
8
  <link rel="icon" type="image/png" href="/favicon.png">
15
- <link rel="preconnect" href="https://fonts.googleapis.com">
16
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
17
- <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">
18
9
 
19
10
  <style>
20
11
  /* ── Theme Variables ── */
21
12
  :root {
22
- --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
23
- --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
13
+ --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
14
+ --font-mono: ui-monospace, 'SF Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
24
15
 
25
16
  --transition-fast: 0.1s ease;
26
17
  --transition-default: 0.2s ease;
@@ -373,7 +364,7 @@
373
364
  border-radius: var(--radius-md);
374
365
  border: 1px solid transparent;
375
366
  cursor: pointer;
376
- transition: all var(--transition-fast);
367
+ transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
377
368
  text-decoration: none;
378
369
  white-space: nowrap;
379
370
  }
@@ -531,6 +522,10 @@
531
522
  <script src="/js/components/UpdateBanner.js"></script>
532
523
  <script src="/js/utils/notification-sounds.js"></script>
533
524
  <script src="/js/utils/analyze-params.js"></script>
525
+ <!-- Theme helper: this page has no toggle button, but setup() still tracks
526
+ live OS light/dark changes when the preference is 'system'. -->
527
+ <script src="/js/theme.js"></script>
528
+ <script>window.PairReviewTheme.setup();</script>
534
529
 
535
530
  <script>
536
531
  // Copyright 2026 Tim Perkins (tjwp) | SPDX-License-Identifier: Apache-2.0
@@ -127,7 +127,7 @@ curl -s -X PUT http://localhost:{{PORT}}/api/reviews/{{REVIEW_ID}}/comments/COMM
127
127
 
128
128
  > **Terminology note:** The UI refers to this operation as "dismiss." When a user asks to "dismiss a comment," use this DELETE endpoint.
129
129
 
130
- Soft-deletes the comment. If the comment was adopted from an AI suggestion, the parent suggestion is automatically transitioned to "dismissed" status.
130
+ Soft-deletes the comment. If the comment was adopted from an AI suggestion, the parent suggestion is automatically transitioned to "dismissed" status with an auto-generated \`status_reason\` noting the adopted comment was deleted.
131
131
 
132
132
  \`\`\`bash
133
133
  curl -s -X DELETE http://localhost:{{PORT}}/api/reviews/{{REVIEW_ID}}/comments/COMMENT_ID
@@ -169,7 +169,9 @@ Optional query params:
169
169
  - \`levels\` — comma-separated list of levels: \`"final"\`, \`"1"\`, \`"2"\`, \`"3"\`. Default: \`"final"\` (orchestrated suggestions only).
170
170
  - \`runId\` — specific analysis run UUID. Default: latest run.
171
171
 
172
- **Response:** \`{ "suggestions": [{ "id": 1, "file": "...", "line_start": 10, "type": "bug", "title": "...", "body": "...", "status": "active", ... }] }\`
172
+ **Response:** \`{ "suggestions": [{ "id": 1, "file": "...", "line_start": 10, "type": "bug", "title": "...", "body": "...", "status": "active", "status_reason": null, ... }] }\`
173
+
174
+ Each suggestion carries \`status_reason\` (string|null) — the explanation stored when it was dismissed (see "Update AI suggestion status"), or \`null\`.
173
175
 
174
176
  ### Check if suggestions exist
175
177
 
@@ -186,14 +188,16 @@ Optional query param: \`runId\` (specific analysis run UUID).
186
188
  \`\`\`bash
187
189
  curl -s -X POST http://localhost:{{PORT}}/api/reviews/{{REVIEW_ID}}/suggestions/SUGGESTION_ID/status \\
188
190
  -H 'Content-Type: application/json' \\
189
- -d '{ "status": "dismissed" }'
191
+ -d '{ "status": "dismissed", "reason": "Confirmed intentional behavior; no change needed." }'
190
192
  \`\`\`
191
193
 
192
194
  Valid statuses: \`"dismissed"\`, \`"active"\` (restore).
193
195
 
196
+ Optional field: \`reason\` (string, ≤2000 chars) — a concise, one-sentence explanation of why the suggestion is being dismissed. Valid **only** with status \`"dismissed"\`; sending it with \`"active"\` returns 400. Restoring to \`"active"\` clears any stored reason. You SHOULD include a \`reason\` whenever you dismiss a suggestion — it is surfaced in the UI as a reply-styled note under the suggestion. The stored reason is returned as \`status_reason\` (string|null) on suggestion objects in GET responses.
197
+
194
198
  > **Note:** Setting status to \`"adopted"\` directly is not allowed. Adoption must create a linked user comment via \`parent_id\`, which is why raw status-setting cannot do it. Use \`POST /suggestions/:id/adopt\` for adopt-as-is or \`POST /suggestions/:id/edit\` for adopt-with-edits.
195
199
 
196
- **Response:** \`{ "success": true, "status": "dismissed" }\`
200
+ **Response:** \`{ "success": true, "status": "dismissed", "status_reason": "Confirmed intentional behavior; no change needed." }\` (\`status_reason\` is the stored trimmed reason, or \`null\`)
197
201
 
198
202
  ### Adopt an AI suggestion as-is
199
203
 
@@ -503,7 +507,7 @@ Base: \`http://localhost:{{PORT}}\` | Review: \`{{REVIEW_ID}}\`
503
507
  ## Suggestions — /api/reviews/{{REVIEW_ID}}/suggestions
504
508
  - \`GET\` — List (?levels=final,1,2,3 &runId=UUID)
505
509
  - \`GET /check\` — Exists? (?runId=UUID)
506
- - \`POST /:id/status\` — Dismiss/restore {status}
510
+ - \`POST /:id/status\` — Dismiss/restore {status, ?reason} (reason: dismissed-only, ≤2000 chars, include when dismissing)
507
511
  - \`POST /:id/adopt\` — Adopt as-is (no body)
508
512
  - \`POST /:id/edit\` — Adopt edited {action:"adopt_edited", editedText:"..."}
509
513
 
@@ -46,6 +46,7 @@ function buildChatPrompt({ review, prData, chatInstructions, commentFormatTempla
46
46
  '- **Suggestions** are AI-generated findings from analysis runs.',
47
47
  '- **Workflow**: AI generates suggestions → reviewer triages (adopt, edit, or dismiss) → adopted suggestions become comments.',
48
48
  '- **IMPORTANT**: Do NOT adopt, dismiss, or modify suggestions or comments unless the user explicitly asks you to. Your role is to discuss and explain — the reviewer decides what action to take.',
49
+ '- When you DO dismiss a suggestion (only after the user asks), include a `reason` field on the status request with a one-sentence summary of why, grounded in the discussion (e.g. reason: "User confirmed the behavior is intentional").',
49
50
  '- **Analysis runs** are the process that produces suggestions. Each run has a provider, model, tier, and status.',
50
51
  '- **Review ID** is a stable integer identifying this review session, used in all API calls.',
51
52
  '- **IMPORTANT**: Never mention internal IDs (comment IDs, suggestion IDs, run IDs) in your responses to the user. These are meaningless to the user and not shown in the UI. Refer to comments and suggestions by their content, title, file location, or line number instead.'
@@ -206,7 +207,7 @@ function parseReasoning(reasoning) {
206
207
  * @returns {Object} Formatted suggestion
207
208
  */
208
209
  function formatSuggestionForContext(s) {
209
- return {
210
+ const formatted = {
210
211
  id: s.id,
211
212
  file: s.file,
212
213
  line_start: s.line_start,
@@ -219,6 +220,12 @@ function formatSuggestionForContext(s) {
219
220
  ai_confidence: s.ai_confidence,
220
221
  is_file_level: s.is_file_level
221
222
  };
223
+ // Include the dismissal reason when present so the agent sees WHY a
224
+ // suggestion was already dismissed (e.g. by a prior pair-loop write-back).
225
+ if (s.status_reason) {
226
+ formatted.status_reason = s.status_reason;
227
+ }
228
+ return formatted;
222
229
  }
223
230
 
224
231
  /**
package/src/config.js CHANGED
@@ -333,17 +333,24 @@ async function loadConfig() {
333
333
 
334
334
  const localDir = path.join(process.cwd(), '.pair-review');
335
335
  const sources = [
336
- { path: MANAGED_CONFIG_FILE, label: 'managed config', required: false },
337
- { path: CONFIG_FILE, label: 'global config', required: true },
338
- { path: CONFIG_LOCAL_FILE, label: 'global local config', required: false },
339
- { path: path.join(localDir, 'config.json'), label: 'project config', required: false },
340
- { path: path.join(localDir, 'config.local.json'), label: 'project local config', required: false },
336
+ { path: MANAGED_CONFIG_FILE, label: 'managed config', layerName: 'managed', required: false },
337
+ { path: CONFIG_FILE, label: 'global config', layerName: 'config', required: true },
338
+ { path: CONFIG_LOCAL_FILE, label: 'global local config', layerName: 'config.local', required: false },
339
+ { path: path.join(localDir, 'config.json'), label: 'project config', layerName: 'project', required: false },
340
+ { path: path.join(localDir, 'config.local.json'), label: 'project local config', layerName: 'project.local', required: false },
341
341
  ];
342
342
 
343
343
  let mergedConfig = { ...DEFAULT_CONFIG };
344
344
  let isFirstRun = false;
345
345
  let hasManagedConfig = false;
346
346
 
347
+ // Per-layer raw data, ordered low->high precedence, for source attribution
348
+ // by the global-settings service. Each layer holds the raw parsed file (NOT
349
+ // the merged result) so a hasPath() walk can report the highest layer that
350
+ // actually defined a given dot-path. The built-in defaults are the lowest
351
+ // layer.
352
+ const layers = [{ name: 'default', data: { ...DEFAULT_CONFIG } }];
353
+
347
354
  for (const source of sources) {
348
355
  try {
349
356
  const data = await fs.readFile(source.path, 'utf8');
@@ -351,6 +358,7 @@ async function loadConfig() {
351
358
  if (source.label === 'managed config' && Object.keys(parsed).length > 0) {
352
359
  hasManagedConfig = true;
353
360
  }
361
+ layers.push({ name: source.layerName, data: parsed });
354
362
  mergedConfig = deepMerge(mergedConfig, parsed);
355
363
  } catch (error) {
356
364
  if (error.code === 'ENOENT') {
@@ -422,7 +430,7 @@ async function loadConfig() {
422
430
  }
423
431
  }
424
432
 
425
- return { config: mergedConfig, isFirstRun };
433
+ return { config: mergedConfig, isFirstRun, layers };
426
434
  }
427
435
 
428
436
  /**
@@ -1627,6 +1635,7 @@ function shouldSkipUpdateNotifier() {
1627
1635
  }
1628
1636
 
1629
1637
  module.exports = {
1638
+ DEFAULT_CONFIG,
1630
1639
  deepMerge,
1631
1640
  loadConfig,
1632
1641
  getConfigDir,