@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.
- package/README.md +81 -13
- package/package.json +6 -2
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin-code-critic/.claude-plugin/plugin.json +1 -1
- package/plugin-pair-loop/.claude-plugin/plugin.json +1 -1
- package/plugin-pair-loop/skills/loop/SKILL.md +17 -8
- package/public/css/ai-summary-modal.css +1 -1
- package/public/css/analysis-config.css +33 -49
- package/public/css/council-card.css +118 -0
- package/public/css/council-dropdown.css +164 -0
- package/public/css/pr.css +668 -393
- package/public/css/repo-settings.css +15 -305
- package/public/css/settings.css +1141 -0
- package/public/css/snippet-manager.css +233 -0
- package/public/index.html +40 -59
- package/public/js/components/AIPanel.js +82 -16
- package/public/js/components/ChatPanel.js +401 -5
- package/public/js/components/CouncilCard.js +202 -0
- package/public/js/components/CouncilDropdown.js +292 -0
- package/public/js/components/DiffOptionsDropdown.js +177 -4
- package/public/js/components/SnippetManager.js +463 -0
- package/public/js/index.js +7 -30
- package/public/js/local.js +20 -2
- package/public/js/modules/comment-manager.js +8 -1
- package/public/js/modules/comment-minimizer.js +249 -190
- package/public/js/modules/diff-renderer.js +16 -4
- package/public/js/modules/external-comment-manager.js +414 -48
- package/public/js/modules/file-comment-manager.js +28 -21
- package/public/js/modules/hunk-summary-renderer.js +155 -29
- package/public/js/modules/pierre-bridge.js +2513 -0
- package/public/js/modules/pierre-context.js +345 -0
- package/public/js/modules/suggestion-manager.js +176 -20
- package/public/js/modules/tour-renderer.js +400 -184
- package/public/js/pr.js +1614 -158
- package/public/js/repo-settings.js +60 -284
- package/public/js/settings.js +1086 -0
- package/public/js/theme-bootstrap.js +40 -0
- package/public/js/theme.js +247 -0
- package/public/js/utils/provider-model.js +3 -3
- package/public/js/utils/suggestion-ui.js +157 -8
- package/public/local.html +20 -31
- package/public/pr.html +14 -23
- package/public/repo-settings.html +24 -14
- package/public/settings.html +138 -0
- package/public/setup.html +8 -13
- package/src/chat/api-reference.js +9 -5
- package/src/chat/prompt-builder.js +8 -1
- package/src/config.js +15 -6
- package/src/database.js +307 -14
- package/src/external/github-adapter.js +39 -5
- package/src/headless/delegate.js +682 -0
- package/src/local-review.js +10 -10
- package/src/local-scope.js +9 -0
- package/src/main.js +276 -157
- package/src/mcp-stdio.js +24 -1
- package/src/review-config.js +93 -25
- package/src/routes/chat.js +2 -2
- package/src/routes/config.js +12 -10
- package/src/routes/external-comments.js +5 -1
- package/src/routes/local.js +2 -4
- package/src/routes/mcp.js +18 -13
- package/src/routes/reviews.js +223 -4
- package/src/routes/settings.js +252 -0
- package/src/routes/setup.js +80 -1
- package/src/routes/shared.js +31 -29
- package/src/routes/snippets.js +154 -0
- package/src/routes/stack-analysis.js +17 -14
- package/src/server.js +86 -18
- package/src/settings/global-settings-service.js +472 -0
- package/src/settings/registry.js +624 -0
- package/src/utils/db-identity.js +44 -0
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
*
|
|
15
15
|
* IMPORTANT: This dropdown is constructed in BOTH pr.js and local.js.
|
|
16
16
|
* LocalManager (local.js) destroys the pr.js instance and recreates it
|
|
17
|
-
* with scope-selector support. Any new callback added here
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* with scope-selector support. Any new callback added here (e.g.
|
|
18
|
+
* onToggleWhitespace, onToggleMinimize, onScopeChange, onDiffViewChange)
|
|
19
|
+
* MUST be threaded through both construction sites or it will silently
|
|
20
|
+
* no-op in local mode.
|
|
20
21
|
*
|
|
21
22
|
* Usage:
|
|
22
23
|
* const dropdown = new DiffOptionsDropdown(
|
|
@@ -25,6 +26,9 @@
|
|
|
25
26
|
* onToggleWhitespace: (hidden) => { … },
|
|
26
27
|
* onToggleMinimize: (minimized) => { … },
|
|
27
28
|
* onScopeChange: (start, end) => { … },
|
|
29
|
+
* onDiffViewChange: (mode) => { … }, // 'unified' | 'split'
|
|
30
|
+
* diffView: 'unified',
|
|
31
|
+
* diffViewAvailable: true, // false hides the Unified/Split control
|
|
28
32
|
* initialScope: { start: 'unstaged', end: 'untracked' },
|
|
29
33
|
* branchAvailable: false
|
|
30
34
|
* }
|
|
@@ -33,6 +37,29 @@
|
|
|
33
37
|
|
|
34
38
|
const STORAGE_KEY = 'pair-review-hide-whitespace';
|
|
35
39
|
const MINIMIZE_STORAGE_KEY = 'pair-review-minimize-comments';
|
|
40
|
+
const DIFF_VIEW_STORAGE_KEY = 'pair-review-diff-view';
|
|
41
|
+
const DIFF_VIEW_VALUES = ['unified', 'split'];
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Read the persisted diff-view preference, validated against the allowed
|
|
45
|
+
* values. Returns 'unified' when the key is unset, invalid, or unreadable.
|
|
46
|
+
*
|
|
47
|
+
* Single source of truth for the `pair-review-diff-view` storage key and its
|
|
48
|
+
* validation. pr.js (PierreBridge seed) and local.js (dropdown re-init) call
|
|
49
|
+
* this instead of re-implementing divergent inline parsing.
|
|
50
|
+
* @returns {('unified'|'split')}
|
|
51
|
+
*/
|
|
52
|
+
function readPersistedDiffView() {
|
|
53
|
+
let stored = null;
|
|
54
|
+
try {
|
|
55
|
+
stored = typeof localStorage !== 'undefined'
|
|
56
|
+
? localStorage.getItem(DIFF_VIEW_STORAGE_KEY)
|
|
57
|
+
: null;
|
|
58
|
+
} catch (_e) {
|
|
59
|
+
stored = null;
|
|
60
|
+
}
|
|
61
|
+
return DIFF_VIEW_VALUES.includes(stored) ? stored : 'unified';
|
|
62
|
+
}
|
|
36
63
|
|
|
37
64
|
class DiffOptionsDropdown {
|
|
38
65
|
/**
|
|
@@ -41,14 +68,21 @@ class DiffOptionsDropdown {
|
|
|
41
68
|
* @param {function(boolean):void} callbacks.onToggleWhitespace
|
|
42
69
|
* @param {function(boolean):void} [callbacks.onToggleMinimize]
|
|
43
70
|
* @param {function(string,string):void} [callbacks.onScopeChange]
|
|
71
|
+
* @param {function(string):void} [callbacks.onDiffViewChange] - Called with 'unified'|'split'
|
|
72
|
+
* @param {('unified'|'split')} [callbacks.diffView] - Initial diff view (fallback; localStorage wins)
|
|
73
|
+
* @param {boolean} [callbacks.diffViewAvailable] - Whether the current render
|
|
74
|
+
* path can apply a unified/split swap. When false, the Unified/Split
|
|
75
|
+
* control is not rendered so the user cannot select (and persist) a
|
|
76
|
+
* mode that would silently no-op. Defaults to true.
|
|
44
77
|
* @param {{start:string,end:string}} [callbacks.initialScope]
|
|
45
78
|
* @param {boolean} [callbacks.branchAvailable]
|
|
46
79
|
*/
|
|
47
|
-
constructor(buttonElement, { onToggleWhitespace, onToggleMinimize, onScopeChange, initialScope, branchAvailable, worktreePath }) {
|
|
80
|
+
constructor(buttonElement, { onToggleWhitespace, onToggleMinimize, onScopeChange, onDiffViewChange, diffView, diffViewAvailable, initialScope, branchAvailable, worktreePath }) {
|
|
48
81
|
this._btn = buttonElement;
|
|
49
82
|
this._onToggleWhitespace = onToggleWhitespace;
|
|
50
83
|
this._onToggleMinimize = onToggleMinimize || (() => {});
|
|
51
84
|
this._onScopeChange = onScopeChange || null;
|
|
85
|
+
this._onDiffViewChange = onDiffViewChange || (() => {});
|
|
52
86
|
this._worktreePath = worktreePath || null;
|
|
53
87
|
this._worktreeName = null;
|
|
54
88
|
|
|
@@ -91,6 +125,21 @@ class DiffOptionsDropdown {
|
|
|
91
125
|
this._hideWhitespace = localStorage.getItem(STORAGE_KEY) === 'true';
|
|
92
126
|
this._minimizeComments = localStorage.getItem(MINIMIZE_STORAGE_KEY) === 'true';
|
|
93
127
|
|
|
128
|
+
// Whether the active render path can apply a unified/split swap. When
|
|
129
|
+
// false we omit the segmented control entirely so the user can't select
|
|
130
|
+
// (and persist) a mode the renderer would silently ignore. Defaults to
|
|
131
|
+
// true so callers that don't opt in keep the control.
|
|
132
|
+
this._diffViewAvailable = diffViewAvailable === undefined ? true : Boolean(diffViewAvailable);
|
|
133
|
+
|
|
134
|
+
// Diff view (unified | split). localStorage is the source of truth so this
|
|
135
|
+
// stays in sync with the PierreBridge instance, which pr.js constructs from
|
|
136
|
+
// the same key. The `diffView` option is only a fallback default.
|
|
137
|
+
const storedDiffView = localStorage.getItem(DIFF_VIEW_STORAGE_KEY);
|
|
138
|
+
this._diffView = DIFF_VIEW_VALUES.includes(storedDiffView)
|
|
139
|
+
? storedDiffView
|
|
140
|
+
: (DIFF_VIEW_VALUES.includes(diffView) ? diffView : 'unified');
|
|
141
|
+
this._diffViewButtons = null;
|
|
142
|
+
|
|
94
143
|
this._renderPopover();
|
|
95
144
|
this._syncButtonActive();
|
|
96
145
|
|
|
@@ -150,6 +199,36 @@ class DiffOptionsDropdown {
|
|
|
150
199
|
this._onToggleMinimize(bool);
|
|
151
200
|
}
|
|
152
201
|
|
|
202
|
+
/** @returns {('unified'|'split')} The current diff view mode. */
|
|
203
|
+
get diffView() {
|
|
204
|
+
return this._diffView;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Programmatically set the diff view mode (updates UI + storage + callback).
|
|
209
|
+
* Ignores invalid values and no-ops when unchanged.
|
|
210
|
+
*
|
|
211
|
+
* The callback is invoked BEFORE persisting so a renderer that can't honor
|
|
212
|
+
* the mode can veto it by returning `false`. On veto we roll `_diffView`
|
|
213
|
+
* back to the previous value and skip persistence + UI restyle, so
|
|
214
|
+
* localStorage and the segmented control never claim a mode the diff isn't
|
|
215
|
+
* actually showing. Callbacks that return `undefined` (the common case)
|
|
216
|
+
* count as success.
|
|
217
|
+
*/
|
|
218
|
+
set diffView(value) {
|
|
219
|
+
if (!DIFF_VIEW_VALUES.includes(value)) return;
|
|
220
|
+
if (value === this._diffView) return;
|
|
221
|
+
const prev = this._diffView;
|
|
222
|
+
this._diffView = value;
|
|
223
|
+
// Apply BEFORE persisting; roll back if the renderer can't honor it.
|
|
224
|
+
if (this._onDiffViewChange(value) === false) {
|
|
225
|
+
this._diffView = prev;
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
this._persist();
|
|
229
|
+
this._updateDiffViewUI();
|
|
230
|
+
}
|
|
231
|
+
|
|
153
232
|
/** Update branch availability (e.g. after base branch is set). */
|
|
154
233
|
set branchAvailable(value) {
|
|
155
234
|
this._branchAvailable = Boolean(value);
|
|
@@ -245,6 +324,13 @@ class DiffOptionsDropdown {
|
|
|
245
324
|
const minCheckbox = minLabel.querySelector('input');
|
|
246
325
|
popover.appendChild(minLabel);
|
|
247
326
|
|
|
327
|
+
// --- Diff view segmented control (Unified / Split) ---
|
|
328
|
+
// Only when the render path can actually apply the swap; otherwise the
|
|
329
|
+
// control is omitted so a selection can't desync the UI from the diff.
|
|
330
|
+
if (this._diffViewAvailable) {
|
|
331
|
+
this._renderDiffViewControl(popover);
|
|
332
|
+
}
|
|
333
|
+
|
|
248
334
|
// Worktree path row (placeholder — populated by _updateWorktreeRow)
|
|
249
335
|
this._worktreeRowEl = null;
|
|
250
336
|
|
|
@@ -301,6 +387,86 @@ class DiffOptionsDropdown {
|
|
|
301
387
|
return label;
|
|
302
388
|
}
|
|
303
389
|
|
|
390
|
+
/**
|
|
391
|
+
* Render the "Diff view" segmented control (Unified / Split) with a divider
|
|
392
|
+
* above it. Clicking an option routes through the `diffView` setter, which
|
|
393
|
+
* persists, restyles, and fires `onDiffViewChange`.
|
|
394
|
+
* @param {HTMLElement} popover
|
|
395
|
+
*/
|
|
396
|
+
_renderDiffViewControl(popover) {
|
|
397
|
+
// Divider above the control
|
|
398
|
+
const divider = document.createElement('div');
|
|
399
|
+
divider.style.height = '1px';
|
|
400
|
+
divider.style.background = 'var(--color-border-primary, #d0d7de)';
|
|
401
|
+
divider.style.margin = '0 20px';
|
|
402
|
+
popover.appendChild(divider);
|
|
403
|
+
|
|
404
|
+
const row = document.createElement('div');
|
|
405
|
+
row.className = 'diff-view-row';
|
|
406
|
+
row.style.display = 'flex';
|
|
407
|
+
row.style.alignItems = 'center';
|
|
408
|
+
row.style.justifyContent = 'space-between';
|
|
409
|
+
row.style.gap = '12px';
|
|
410
|
+
row.style.padding = '8px 12px';
|
|
411
|
+
row.style.fontSize = '0.8125rem';
|
|
412
|
+
row.style.whiteSpace = 'nowrap';
|
|
413
|
+
row.style.userSelect = 'none';
|
|
414
|
+
|
|
415
|
+
const label = document.createElement('span');
|
|
416
|
+
label.textContent = 'Diff view';
|
|
417
|
+
row.appendChild(label);
|
|
418
|
+
|
|
419
|
+
const segmented = document.createElement('div');
|
|
420
|
+
segmented.className = 'diff-view-segmented';
|
|
421
|
+
segmented.style.display = 'flex';
|
|
422
|
+
segmented.style.borderRadius = '6px';
|
|
423
|
+
segmented.style.overflow = 'hidden';
|
|
424
|
+
segmented.style.border = '1px solid var(--color-border-primary, #d0d7de)';
|
|
425
|
+
|
|
426
|
+
this._diffViewButtons = {};
|
|
427
|
+
[['unified', 'Unified'], ['split', 'Split']].forEach(([mode, text]) => {
|
|
428
|
+
const btn = document.createElement('button');
|
|
429
|
+
btn.type = 'button';
|
|
430
|
+
btn.className = 'diff-view-option';
|
|
431
|
+
btn.dataset.diffView = mode;
|
|
432
|
+
btn.textContent = text;
|
|
433
|
+
btn.style.border = 'none';
|
|
434
|
+
btn.style.padding = '4px 10px';
|
|
435
|
+
btn.style.fontSize = '0.75rem';
|
|
436
|
+
btn.style.lineHeight = '1.4';
|
|
437
|
+
btn.style.cursor = 'pointer';
|
|
438
|
+
btn.style.background = 'transparent';
|
|
439
|
+
btn.style.color = 'inherit';
|
|
440
|
+
btn.style.transition = 'background 0.15s ease, color 0.15s ease';
|
|
441
|
+
btn.addEventListener('click', (e) => {
|
|
442
|
+
e.stopPropagation();
|
|
443
|
+
this.diffView = mode;
|
|
444
|
+
});
|
|
445
|
+
segmented.appendChild(btn);
|
|
446
|
+
this._diffViewButtons[mode] = btn;
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
row.appendChild(segmented);
|
|
450
|
+
popover.appendChild(row);
|
|
451
|
+
|
|
452
|
+
this._updateDiffViewUI();
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
/** Restyle the diff-view segmented buttons to reflect the current mode. */
|
|
456
|
+
_updateDiffViewUI() {
|
|
457
|
+
if (!this._diffViewButtons) return;
|
|
458
|
+
Object.keys(this._diffViewButtons).forEach((mode) => {
|
|
459
|
+
const btn = this._diffViewButtons[mode];
|
|
460
|
+
const active = mode === this._diffView;
|
|
461
|
+
btn.style.background = active ? 'var(--ai-primary, #8b5cf6)' : 'transparent';
|
|
462
|
+
btn.style.color = active
|
|
463
|
+
? 'var(--color-text-on-emphasis, #ffffff)'
|
|
464
|
+
: 'var(--color-text-secondary, #656d76)';
|
|
465
|
+
btn.style.fontWeight = active ? '600' : 'normal';
|
|
466
|
+
btn.setAttribute('aria-pressed', active ? 'true' : 'false');
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
|
|
304
470
|
/**
|
|
305
471
|
* Render or update the worktree path row at the bottom of the popover.
|
|
306
472
|
*/
|
|
@@ -739,6 +905,7 @@ class DiffOptionsDropdown {
|
|
|
739
905
|
_persist() {
|
|
740
906
|
localStorage.setItem(STORAGE_KEY, String(this._hideWhitespace));
|
|
741
907
|
localStorage.setItem(MINIMIZE_STORAGE_KEY, String(this._minimizeComments));
|
|
908
|
+
localStorage.setItem(DIFF_VIEW_STORAGE_KEY, this._diffView);
|
|
742
909
|
}
|
|
743
910
|
|
|
744
911
|
/** Add/remove `.active` on the gear button as a visual cue that filtering is on. */
|
|
@@ -749,3 +916,9 @@ class DiffOptionsDropdown {
|
|
|
749
916
|
}
|
|
750
917
|
|
|
751
918
|
window.DiffOptionsDropdown = DiffOptionsDropdown;
|
|
919
|
+
window.readPersistedDiffView = readPersistedDiffView;
|
|
920
|
+
|
|
921
|
+
// Node/test export (browser code uses the window globals above).
|
|
922
|
+
if (typeof module !== 'undefined' && module.exports) {
|
|
923
|
+
module.exports = { DiffOptionsDropdown, readPersistedDiffView };
|
|
924
|
+
}
|