codex-review-mcp 1.3.0 → 1.3.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.
@@ -153,8 +153,31 @@ export async function collectDiff(input, workspaceDir) {
153
153
  maxBuffer: 10 * 1024 * 1024,
154
154
  cwd: repoRoot,
155
155
  });
156
+ let diffText = stdout;
157
+ // In auto mode with uncommitted changes, also include untracked files
158
+ if (input.target === 'auto' && await hasUncommittedChanges(repoRoot)) {
159
+ try {
160
+ const { stdout: untrackedFiles } = await exec('git', ['ls-files', '--others', '--exclude-standard'], { encoding: 'utf8', cwd: repoRoot });
161
+ const files = untrackedFiles.trim().split('\n').filter(f => f);
162
+ for (const file of files) {
163
+ try {
164
+ const { stdout: fileDiff } = await exec('git', ['diff', '--no-index', '--unified=0', '/dev/null', file], { encoding: 'utf8', cwd: repoRoot });
165
+ diffText += '\n' + fileDiff;
166
+ }
167
+ catch (diffErr) {
168
+ // git diff --no-index returns exit code 1 when there are differences
169
+ if (diffErr.stdout) {
170
+ diffText += '\n' + diffErr.stdout;
171
+ }
172
+ }
173
+ }
174
+ }
175
+ catch {
176
+ // If we can't get untracked files, continue with just tracked changes
177
+ }
178
+ }
156
179
  // Drop obvious binary diffs
157
- const text = stdout
180
+ const text = diffText
158
181
  .split('\n')
159
182
  .filter((line) => !line.startsWith('Binary files '))
160
183
  .join('\n');
@@ -85,4 +85,19 @@ describe('performCodeReview', () => {
85
85
  expect(collectDiffModule.collectDiff).toHaveBeenCalled();
86
86
  }
87
87
  });
88
+ it('should handle diffs with untracked files', async () => {
89
+ const diffWithUntracked = `diff --git a/tracked.ts b/tracked.ts
90
+ +++ b/tracked.ts
91
+ +modified tracked file
92
+ diff --git a/newfile.ts b/newfile.ts
93
+ new file mode 100644
94
+ +++ b/newfile.ts
95
+ +new untracked file`;
96
+ vi.spyOn(collectDiffModule, 'collectDiff').mockResolvedValue(diffWithUntracked);
97
+ vi.spyOn(gatherContextModule, 'gatherContext').mockResolvedValue('');
98
+ vi.spyOn(invokeAgentModule, 'invokeAgent').mockResolvedValue('# Review');
99
+ const result = await performCodeReview({ target: 'auto' });
100
+ expect(result).toBeTruthy();
101
+ expect(collectDiffModule.collectDiff).toHaveBeenCalledWith(expect.objectContaining({ target: 'auto' }), undefined);
102
+ });
88
103
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-review-mcp",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "build": "tsc",