codex-review-mcp 2.10.5 → 2.10.6
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/dist/review/collectDiff.js +42 -36
- package/package.json +1 -1
|
@@ -45,47 +45,53 @@ export async function collectDiff(input) {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
await debugLog(`Collecting diff: ${base}...${branchName} in ${workspaceDir}`);
|
|
48
|
-
//
|
|
49
|
-
let
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
48
|
+
// Check if we're currently on the target branch
|
|
49
|
+
let currentBranch;
|
|
50
|
+
try {
|
|
51
|
+
currentBranch = execSync('git rev-parse --abbrev-ref HEAD', {
|
|
52
|
+
cwd: workspaceDir,
|
|
53
|
+
encoding: 'utf8',
|
|
54
|
+
stdio: ['ignore', 'pipe', 'ignore']
|
|
55
|
+
}).trim();
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
currentBranch = '';
|
|
59
|
+
}
|
|
60
|
+
const onTargetBranch = currentBranch === branchName;
|
|
61
|
+
// If on target branch, get ALL changes (committed + uncommitted)
|
|
62
|
+
// This reviews work-in-progress, not just committed code
|
|
63
|
+
let diff;
|
|
64
|
+
if (onTargetBranch) {
|
|
65
|
+
await debugLog(`On target branch ${branchName}, reviewing ALL changes (committed + uncommitted)`);
|
|
66
|
+
// Get all changes from base branch (includes both committed and uncommitted)
|
|
67
|
+
diff = execFileSync('git', ['diff', base], {
|
|
68
|
+
cwd: workspaceDir,
|
|
69
|
+
encoding: 'utf8',
|
|
70
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
71
|
+
});
|
|
72
|
+
if (diff.trim()) {
|
|
73
|
+
await debugLog(`Found changes: ${diff.length} chars (committed + uncommitted)`);
|
|
68
74
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
// Not on target branch, only get committed changes
|
|
78
|
+
await debugLog(`Not on target branch, reviewing only committed changes`);
|
|
79
|
+
diff = execFileSync('git', ['diff', `${base}...${branchName}`], {
|
|
80
|
+
cwd: workspaceDir,
|
|
81
|
+
encoding: 'utf8',
|
|
82
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
83
|
+
});
|
|
84
|
+
if (diff.trim()) {
|
|
85
|
+
await debugLog(`Found committed changes: ${diff.length} chars`);
|
|
81
86
|
}
|
|
82
87
|
}
|
|
83
88
|
if (!diff.trim()) {
|
|
89
|
+
const checkType = onTargetBranch
|
|
90
|
+
? `All changes (committed + uncommitted): git diff ${base}`
|
|
91
|
+
: `Committed changes: git diff ${base}...${branchName}`;
|
|
84
92
|
throw new Error(`No changes found on branch ${branchName}.\n` +
|
|
85
|
-
`
|
|
86
|
-
`
|
|
87
|
-
` 2. Uncommitted changes (if on branch): git diff ${base}\n` +
|
|
88
|
-
`Make sure the branch exists and has changes (committed or uncommitted).`);
|
|
93
|
+
`Checked: ${checkType}\n` +
|
|
94
|
+
`Make sure the branch has changes compared to ${base}.`);
|
|
89
95
|
}
|
|
90
96
|
await debugLog(`Collected diff: ${diff.length} chars, ${diff.split('\n').length} lines`);
|
|
91
97
|
return diff;
|