@in-the-loop-labs/pair-review 5.0.0 → 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/package.json +1 -1
- 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/public/css/pr.css +4 -1
- package/public/js/modules/diff-renderer.js +16 -4
- package/public/js/pr.js +180 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pair-review",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "pair-review app integration — Open PRs and local changes in the pair-review web UI, run server-side AI analysis, and address review feedback. Requires the pair-review MCP server.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "in-the-loop-labs",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pair-loop",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "Agent-orchestrated review loop — implement, review with pair-review multi-model councils via the headless CLI, triage, fix, and repeat until a final review returns no blockers. MCP-independent.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "in-the-loop-labs",
|
package/public/css/pr.css
CHANGED
|
@@ -13528,7 +13528,10 @@ body.tour-active .d2h-file-header {
|
|
|
13528
13528
|
}
|
|
13529
13529
|
|
|
13530
13530
|
[data-theme="dark"] .tour-bar {
|
|
13531
|
-
|
|
13531
|
+
/* The bar is sticky, so diff content scrolls beneath it — the amber wash
|
|
13532
|
+
must be layered over an opaque base or that content bleeds through. */
|
|
13533
|
+
background: linear-gradient(rgba(187, 128, 9, 0.22), rgba(187, 128, 9, 0.22)),
|
|
13534
|
+
var(--color-bg-primary, #0d1117);
|
|
13532
13535
|
border-bottom-color: #bb8009;
|
|
13533
13536
|
color: #e3b341;
|
|
13534
13537
|
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.40);
|
|
@@ -273,7 +273,14 @@ class DiffRenderer {
|
|
|
273
273
|
: filePath;
|
|
274
274
|
|
|
275
275
|
try {
|
|
276
|
-
|
|
276
|
+
// Scope to `.d2h-file-wrapper` so a nested `.file-comments-zone` (which
|
|
277
|
+
// also carries data-file-name) can never be returned, and skip context
|
|
278
|
+
// entries — those are targeted explicitly via `.context-file` selectors
|
|
279
|
+
// (see PRManager.findContextFileWrapper). No unguarded fallback here:
|
|
280
|
+
// findFileElement's pathsMatch loop handles rename syntax and
|
|
281
|
+
// context-only files, and prefers the diff wrapper itself.
|
|
282
|
+
const selector = `.d2h-file-wrapper[${attribute}="${escapedValue}"]:not(.context-file)`;
|
|
283
|
+
return document.querySelector(selector);
|
|
277
284
|
} catch {
|
|
278
285
|
return null;
|
|
279
286
|
}
|
|
@@ -798,17 +805,22 @@ class DiffRenderer {
|
|
|
798
805
|
}
|
|
799
806
|
|
|
800
807
|
// Fall back to normalized iteration so special characters, rename syntax,
|
|
801
|
-
// and formatted variants still resolve to the rendered wrapper.
|
|
808
|
+
// and formatted variants still resolve to the rendered wrapper. Prefer a
|
|
809
|
+
// diff wrapper over a context entry that shares the file path.
|
|
802
810
|
const allFileWrappers = document.querySelectorAll('.d2h-file-wrapper');
|
|
811
|
+
let contextMatch = null;
|
|
803
812
|
for (const wrapper of allFileWrappers) {
|
|
804
813
|
const fileName = wrapper.dataset.fileName;
|
|
805
814
|
const filePathAttr = wrapper.dataset.filePath;
|
|
806
815
|
if (DiffRenderer.pathsMatch(fileName, filePath) || DiffRenderer.pathsMatch(filePathAttr, filePath)) {
|
|
807
|
-
|
|
816
|
+
if (!wrapper.classList?.contains('context-file')) {
|
|
817
|
+
return wrapper;
|
|
818
|
+
}
|
|
819
|
+
if (!contextMatch) contextMatch = wrapper;
|
|
808
820
|
}
|
|
809
821
|
}
|
|
810
822
|
|
|
811
|
-
return
|
|
823
|
+
return contextMatch;
|
|
812
824
|
}
|
|
813
825
|
}
|
|
814
826
|
|
package/public/js/pr.js
CHANGED
|
@@ -5170,6 +5170,98 @@ class PRManager {
|
|
|
5170
5170
|
this.saveViewedState();
|
|
5171
5171
|
}
|
|
5172
5172
|
|
|
5173
|
+
/**
|
|
5174
|
+
* Collapse/viewed state key for a context entry. Context entries share a
|
|
5175
|
+
* file path with a possible diff entry for the same file, so their state
|
|
5176
|
+
* is tracked under a namespaced key to keep the two independent.
|
|
5177
|
+
* @param {string} filePath - Path of the file
|
|
5178
|
+
* @returns {string}
|
|
5179
|
+
*/
|
|
5180
|
+
_contextStateKey(filePath) {
|
|
5181
|
+
return `context:${filePath}`;
|
|
5182
|
+
}
|
|
5183
|
+
|
|
5184
|
+
/**
|
|
5185
|
+
* Find the context-entry wrapper for a file path. Unlike findFileElement,
|
|
5186
|
+
* this never resolves to the diff wrapper for the same file.
|
|
5187
|
+
* @param {string} filePath - Path of the file
|
|
5188
|
+
* @returns {Element|null}
|
|
5189
|
+
*/
|
|
5190
|
+
findContextFileWrapper(filePath) {
|
|
5191
|
+
return document.querySelector(
|
|
5192
|
+
`.d2h-file-wrapper.context-file[data-file-name="${CSS.escape(filePath)}"]`
|
|
5193
|
+
);
|
|
5194
|
+
}
|
|
5195
|
+
|
|
5196
|
+
/**
|
|
5197
|
+
* Toggle collapse state of a context entry.
|
|
5198
|
+
*
|
|
5199
|
+
* Context entries must not route through toggleFileCollapse: that resolves
|
|
5200
|
+
* by file path, which finds the diff wrapper when the same file also has a
|
|
5201
|
+
* diff entry — collapsing the context entry would expand the viewed diff
|
|
5202
|
+
* instead (#540). Context bodies are built eagerly and are not managed by
|
|
5203
|
+
* the pierre bridge, so no lazy render or bridge sync is needed here.
|
|
5204
|
+
* @param {string} filePath - Path of the file
|
|
5205
|
+
*/
|
|
5206
|
+
toggleContextFileCollapse(filePath) {
|
|
5207
|
+
const wrapper = this.findContextFileWrapper(filePath);
|
|
5208
|
+
if (!wrapper) return;
|
|
5209
|
+
|
|
5210
|
+
const key = this._contextStateKey(filePath);
|
|
5211
|
+
const collapsed = wrapper.classList.toggle('collapsed');
|
|
5212
|
+
if (collapsed) {
|
|
5213
|
+
this.collapsedFiles.add(key);
|
|
5214
|
+
} else {
|
|
5215
|
+
this.collapsedFiles.delete(key);
|
|
5216
|
+
}
|
|
5217
|
+
|
|
5218
|
+
const header = wrapper.querySelector('.d2h-file-header');
|
|
5219
|
+
if (header) {
|
|
5220
|
+
window.DiffRenderer.updateFileHeaderState(header, !collapsed);
|
|
5221
|
+
}
|
|
5222
|
+
}
|
|
5223
|
+
|
|
5224
|
+
/**
|
|
5225
|
+
* Toggle viewed state of a context entry, independent of the diff entry
|
|
5226
|
+
* for the same file. Persists through the same viewedFiles storage as
|
|
5227
|
+
* diff entries, under the context-scoped key.
|
|
5228
|
+
* @param {string} filePath - Path of the file
|
|
5229
|
+
* @param {boolean} isViewed - Whether the context entry is now viewed
|
|
5230
|
+
*/
|
|
5231
|
+
toggleContextFileViewed(filePath, isViewed) {
|
|
5232
|
+
const wrapper = this.findContextFileWrapper(filePath);
|
|
5233
|
+
const key = this._contextStateKey(filePath);
|
|
5234
|
+
const header = wrapper ? wrapper.querySelector('.d2h-file-header') : null;
|
|
5235
|
+
|
|
5236
|
+
if (isViewed) {
|
|
5237
|
+
this.viewedFiles.add(key);
|
|
5238
|
+
// Auto-collapse when marking as viewed
|
|
5239
|
+
if (wrapper && !wrapper.classList.contains('collapsed')) {
|
|
5240
|
+
wrapper.classList.add('collapsed');
|
|
5241
|
+
this.collapsedFiles.add(key);
|
|
5242
|
+
if (header) {
|
|
5243
|
+
window.DiffRenderer.updateFileHeaderState(header, false);
|
|
5244
|
+
}
|
|
5245
|
+
}
|
|
5246
|
+
} else {
|
|
5247
|
+
this.viewedFiles.delete(key);
|
|
5248
|
+
// Auto-expand when unchecking viewed (match GitHub behavior)
|
|
5249
|
+
if (wrapper && wrapper.classList.contains('collapsed')) {
|
|
5250
|
+
wrapper.classList.remove('collapsed');
|
|
5251
|
+
this.collapsedFiles.delete(key);
|
|
5252
|
+
if (header) {
|
|
5253
|
+
window.DiffRenderer.updateFileHeaderState(header, true);
|
|
5254
|
+
}
|
|
5255
|
+
}
|
|
5256
|
+
}
|
|
5257
|
+
|
|
5258
|
+
// Context entries only get their own sidebar row when the file is not in
|
|
5259
|
+
// the diff; scope to context items so a same-path diff row is untouched.
|
|
5260
|
+
this.updateFileItemViewedState(filePath, isViewed, { contextItem: true });
|
|
5261
|
+
|
|
5262
|
+
this.saveViewedState();
|
|
5263
|
+
}
|
|
5264
|
+
|
|
5173
5265
|
/**
|
|
5174
5266
|
* Build the eye-slash icon wrapper element used to mark a sidebar
|
|
5175
5267
|
* file row as viewed. Shared by the initial render and in-place updates
|
|
@@ -5191,12 +5283,16 @@ class PRManager {
|
|
|
5191
5283
|
* without re-rendering the whole file list.
|
|
5192
5284
|
* @param {string} filePath - Path of the file
|
|
5193
5285
|
* @param {boolean} isViewed - Whether the file is now viewed
|
|
5286
|
+
* @param {Object} [options]
|
|
5287
|
+
* @param {boolean} [options.contextItem=false] - Match the context-entry
|
|
5288
|
+
* sidebar row instead of the diff row (they can share a file path)
|
|
5194
5289
|
*/
|
|
5195
|
-
updateFileItemViewedState(filePath, isViewed) {
|
|
5290
|
+
updateFileItemViewedState(filePath, isViewed, { contextItem = false } = {}) {
|
|
5196
5291
|
const items = document.querySelectorAll('.file-item');
|
|
5197
5292
|
let item = null;
|
|
5198
5293
|
for (const candidate of items) {
|
|
5199
|
-
if (candidate.dataset.path === filePath
|
|
5294
|
+
if (candidate.dataset.path === filePath &&
|
|
5295
|
+
candidate.classList.contains('context-file-item') === contextItem) {
|
|
5200
5296
|
item = candidate;
|
|
5201
5297
|
break;
|
|
5202
5298
|
}
|
|
@@ -7664,7 +7760,10 @@ class PRManager {
|
|
|
7664
7760
|
|
|
7665
7761
|
if (file.generated) item.classList.add('generated');
|
|
7666
7762
|
if (file.contextFile) item.classList.add('context-file-item');
|
|
7667
|
-
|
|
7763
|
+
// Context entries track viewed state under a context-scoped key so they
|
|
7764
|
+
// stay independent of a diff entry for the same file.
|
|
7765
|
+
const viewedKey = file.contextFile ? this._contextStateKey(file.fullPath) : file.fullPath;
|
|
7766
|
+
if (this.viewedFiles && this.viewedFiles.has(viewedKey)) {
|
|
7668
7767
|
item.classList.add('viewed');
|
|
7669
7768
|
const viewedIcon = this._createViewedIcon();
|
|
7670
7769
|
item.insertBefore(viewedIcon, item.firstChild);
|
|
@@ -8652,6 +8751,10 @@ class PRManager {
|
|
|
8652
8751
|
const reviewId = this.currentPR?.id;
|
|
8653
8752
|
if (!reviewId) return;
|
|
8654
8753
|
|
|
8754
|
+
// Capture before anything reassigns this.contextFiles — needed to scrub
|
|
8755
|
+
// context-scoped state for rows deleted remotely (peer tab / WebSocket).
|
|
8756
|
+
const previousFiles = this.contextFiles || [];
|
|
8757
|
+
|
|
8655
8758
|
try {
|
|
8656
8759
|
const response = await fetch(`/api/reviews/${reviewId}/context-files`);
|
|
8657
8760
|
if (!response.ok) return;
|
|
@@ -8690,9 +8793,18 @@ class PRManager {
|
|
|
8690
8793
|
}
|
|
8691
8794
|
}
|
|
8692
8795
|
|
|
8693
|
-
// Add only new context files
|
|
8796
|
+
// Add only new context files. "Diff wins": a stored context row whose
|
|
8797
|
+
// file has since entered the diff (Local-mode scope change, new commits,
|
|
8798
|
+
// PR refresh) is suppressed at the view layer — never rendered as a
|
|
8799
|
+
// duplicate wrapper, never deleted from the DB. renderDiff is a full
|
|
8800
|
+
// clear-and-rebuild that resets contextFiles and re-runs this method,
|
|
8801
|
+
// so a file leaving the diff self-heals back to a context wrapper.
|
|
8802
|
+
// Mirrors the add-time guards (ensureContextFile, the POST route) and
|
|
8803
|
+
// the sidebar merge (mergeFileListWithContext).
|
|
8804
|
+
const diffPaths = new Set((this.diffFiles || []).map(f => f.file));
|
|
8694
8805
|
let newFilesRendered = false;
|
|
8695
8806
|
for (const cf of newFiles) {
|
|
8807
|
+
if (diffPaths.has(cf.file)) continue;
|
|
8696
8808
|
if (!oldIds.has(cf.id)) {
|
|
8697
8809
|
await this.renderContextFile(cf);
|
|
8698
8810
|
newFilesRendered = true;
|
|
@@ -8701,6 +8813,13 @@ class PRManager {
|
|
|
8701
8813
|
|
|
8702
8814
|
this.contextFiles = newFiles;
|
|
8703
8815
|
|
|
8816
|
+
// Scrub context-scoped viewed/collapsed keys for paths whose entries all
|
|
8817
|
+
// disappeared in this refresh. Without this, a delete arriving via the
|
|
8818
|
+
// WebSocket path leaves orphaned `context:` keys on peer tabs: re-adding
|
|
8819
|
+
// the file renders it pre-viewed/pre-collapsed, and a later
|
|
8820
|
+
// saveViewedState() writes the orphan back into shared storage.
|
|
8821
|
+
this._scrubRemovedContextState(previousFiles);
|
|
8822
|
+
|
|
8704
8823
|
// Rebuild sidebar with context files interleaved in natural path order
|
|
8705
8824
|
this.rebuildFileListWithContext();
|
|
8706
8825
|
|
|
@@ -8902,7 +9021,7 @@ class PRManager {
|
|
|
8902
9021
|
chevronBtn.innerHTML = window.DiffRenderer.CHEVRON_DOWN_ICON;
|
|
8903
9022
|
chevronBtn.addEventListener('click', (e) => {
|
|
8904
9023
|
e.stopPropagation();
|
|
8905
|
-
this.
|
|
9024
|
+
this.toggleContextFileCollapse(contextFile.file);
|
|
8906
9025
|
});
|
|
8907
9026
|
header.appendChild(chevronBtn);
|
|
8908
9027
|
|
|
@@ -8924,10 +9043,10 @@ class PRManager {
|
|
|
8924
9043
|
const viewedCheckbox = document.createElement('input');
|
|
8925
9044
|
viewedCheckbox.type = 'checkbox';
|
|
8926
9045
|
viewedCheckbox.className = 'file-viewed-checkbox';
|
|
8927
|
-
viewedCheckbox.checked = this.viewedFiles.has(contextFile.file);
|
|
9046
|
+
viewedCheckbox.checked = this.viewedFiles.has(this._contextStateKey(contextFile.file));
|
|
8928
9047
|
viewedCheckbox.addEventListener('change', (e) => {
|
|
8929
9048
|
e.stopPropagation();
|
|
8930
|
-
this.
|
|
9049
|
+
this.toggleContextFileViewed(contextFile.file, viewedCheckbox.checked);
|
|
8931
9050
|
});
|
|
8932
9051
|
viewedLabel.appendChild(viewedCheckbox);
|
|
8933
9052
|
viewedLabel.appendChild(document.createTextNode('Viewed'));
|
|
@@ -9006,7 +9125,7 @@ class PRManager {
|
|
|
9006
9125
|
e.target.closest('.context-file-dismiss')) {
|
|
9007
9126
|
return;
|
|
9008
9127
|
}
|
|
9009
|
-
this.
|
|
9128
|
+
this.toggleContextFileCollapse(contextFile.file);
|
|
9010
9129
|
});
|
|
9011
9130
|
|
|
9012
9131
|
wrapper.appendChild(header);
|
|
@@ -9027,6 +9146,14 @@ class PRManager {
|
|
|
9027
9146
|
fileBody.appendChild(table);
|
|
9028
9147
|
wrapper.appendChild(fileBody);
|
|
9029
9148
|
|
|
9149
|
+
// Apply context-scoped collapse/viewed state (independent of any diff
|
|
9150
|
+
// entry for the same file) — mirrors renderFileDiff's initial state.
|
|
9151
|
+
const contextKey = this._contextStateKey(contextFile.file);
|
|
9152
|
+
if (this.viewedFiles.has(contextKey) || this.collapsedFiles.has(contextKey)) {
|
|
9153
|
+
wrapper.classList.add('collapsed');
|
|
9154
|
+
window.DiffRenderer.updateFileHeaderState(header, false);
|
|
9155
|
+
}
|
|
9156
|
+
|
|
9030
9157
|
// Insert in sorted path order among existing file wrappers
|
|
9031
9158
|
const allWrappers = [...diffContainer.querySelectorAll('.d2h-file-wrapper')];
|
|
9032
9159
|
const insertBefore = allWrappers.find(w => w.dataset.fileName > contextFile.file);
|
|
@@ -9037,6 +9164,38 @@ class PRManager {
|
|
|
9037
9164
|
}
|
|
9038
9165
|
}
|
|
9039
9166
|
|
|
9167
|
+
/**
|
|
9168
|
+
* Scrub context-scoped viewed/collapsed keys for context entries that no
|
|
9169
|
+
* longer have any row for their path in the current this.contextFiles.
|
|
9170
|
+
* Persists via saveViewedState() only when a viewed key was actually
|
|
9171
|
+
* removed, so WebSocket-driven refreshes don't POST on every event.
|
|
9172
|
+
* Idempotent: re-running with the same input is a no-op.
|
|
9173
|
+
*
|
|
9174
|
+
* Note: the "diff wins" guard in loadContextFiles only suppresses rendering;
|
|
9175
|
+
* suppressed rows remain in this.contextFiles, so they are correctly treated
|
|
9176
|
+
* as still present here and never scrubbed.
|
|
9177
|
+
*
|
|
9178
|
+
* @param {Array<{file: string}>} previousContextFiles - Context rows that
|
|
9179
|
+
* existed before the refresh/delete (candidates for scrubbing)
|
|
9180
|
+
*/
|
|
9181
|
+
_scrubRemovedContextState(previousContextFiles) {
|
|
9182
|
+
if (!previousContextFiles || previousContextFiles.length === 0) return;
|
|
9183
|
+
|
|
9184
|
+
const remainingPaths = new Set((this.contextFiles || []).map(cf => cf.file));
|
|
9185
|
+
let viewedRemoved = false;
|
|
9186
|
+
for (const prev of previousContextFiles) {
|
|
9187
|
+
if (!prev || remainingPaths.has(prev.file)) continue;
|
|
9188
|
+
const key = this._contextStateKey(prev.file);
|
|
9189
|
+
this.collapsedFiles?.delete(key);
|
|
9190
|
+
if (this.viewedFiles?.delete(key)) {
|
|
9191
|
+
viewedRemoved = true;
|
|
9192
|
+
}
|
|
9193
|
+
}
|
|
9194
|
+
if (viewedRemoved) {
|
|
9195
|
+
this.saveViewedState();
|
|
9196
|
+
}
|
|
9197
|
+
}
|
|
9198
|
+
|
|
9040
9199
|
/**
|
|
9041
9200
|
* Remove a context file by ID.
|
|
9042
9201
|
* @param {number} contextFileId
|
|
@@ -9045,6 +9204,12 @@ class PRManager {
|
|
|
9045
9204
|
const reviewId = this.currentPR?.id;
|
|
9046
9205
|
if (!reviewId) return;
|
|
9047
9206
|
|
|
9207
|
+
// Capture the row before loadContextFiles refreshes this.contextFiles —
|
|
9208
|
+
// afterwards the deleted ID is gone and the file path with it.
|
|
9209
|
+
const removed = (this.contextFiles || []).find(
|
|
9210
|
+
cf => String(cf.id) === String(contextFileId)
|
|
9211
|
+
);
|
|
9212
|
+
|
|
9048
9213
|
try {
|
|
9049
9214
|
const resp = await fetch(`/api/reviews/${reviewId}/context-files/${contextFileId}`, {
|
|
9050
9215
|
method: 'DELETE',
|
|
@@ -9056,6 +9221,13 @@ class PRManager {
|
|
|
9056
9221
|
}
|
|
9057
9222
|
// Refresh immediately — WebSocket self-echo is suppressed by the client ID filter
|
|
9058
9223
|
await this.loadContextFiles();
|
|
9224
|
+
|
|
9225
|
+
// Defense-in-depth: loadContextFiles already scrubs based on its own
|
|
9226
|
+
// previous-files snapshot, but scrub the captured row explicitly too —
|
|
9227
|
+
// the helper's remaining-paths check makes double-scrubbing harmless.
|
|
9228
|
+
if (removed) {
|
|
9229
|
+
this._scrubRemovedContextState([removed]);
|
|
9230
|
+
}
|
|
9059
9231
|
} catch (error) {
|
|
9060
9232
|
console.error('Error removing context file:', error);
|
|
9061
9233
|
}
|