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.
@@ -45,47 +45,53 @@ export async function collectDiff(input) {
45
45
  }
46
46
  }
47
47
  await debugLog(`Collecting diff: ${base}...${branchName} in ${workspaceDir}`);
48
- // Run git diff for committed changes - use execFileSync to prevent command injection
49
- let diff = execFileSync('git', ['diff', `${base}...${branchName}`], {
50
- cwd: workspaceDir,
51
- encoding: 'utf8',
52
- maxBuffer: 10 * 1024 * 1024, // 10MB buffer for large diffs
53
- });
54
- // If no committed changes, check for uncommitted changes on the branch
55
- if (!diff.trim()) {
56
- await debugLog(`No committed changes found, checking for uncommitted changes`);
57
- // Check if we're currently on the target branch
58
- let currentBranch;
59
- try {
60
- currentBranch = execSync('git rev-parse --abbrev-ref HEAD', {
61
- cwd: workspaceDir,
62
- encoding: 'utf8',
63
- stdio: ['ignore', 'pipe', 'ignore']
64
- }).trim();
65
- }
66
- catch {
67
- currentBranch = '';
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
- if (currentBranch === branchName) {
70
- // We're on the target branch - collect uncommitted changes
71
- await debugLog(`On target branch ${branchName}, collecting uncommitted changes`);
72
- // Get uncommitted changes (staged + unstaged)
73
- diff = execFileSync('git', ['diff', base], {
74
- cwd: workspaceDir,
75
- encoding: 'utf8',
76
- maxBuffer: 10 * 1024 * 1024,
77
- });
78
- if (diff.trim()) {
79
- await debugLog(`Found uncommitted changes: ${diff.length} chars`);
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
- `Tried:\n` +
86
- ` 1. Committed changes: git diff ${base}...${branchName}\n` +
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-review-mcp",
3
- "version": "2.10.5",
3
+ "version": "2.10.6",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "build": "tsc",