cc-reviewer 1.1.7 → 1.2.0

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.
@@ -5,9 +5,11 @@
5
5
  * Specializes in correctness, edge cases, and performance analysis.
6
6
  */
7
7
  import { spawn } from 'child_process';
8
- import { existsSync } from 'fs';
8
+ import { existsSync, writeFileSync, unlinkSync, mkdtempSync } from 'fs';
9
+ import { tmpdir } from 'os';
10
+ import { join } from 'path';
9
11
  import { registerAdapter, } from './base.js';
10
- import { parseReviewOutput, parseLegacyMarkdownOutput } from '../schema.js';
12
+ import { parseReviewOutput, parseLegacyMarkdownOutput, getReviewOutputJsonSchema } from '../schema.js';
11
13
  import { buildSimpleHandoff, buildHandoffPrompt, selectRole, } from '../handoff.js';
12
14
  // =============================================================================
13
15
  // CONFIGURATION
@@ -201,6 +203,18 @@ export class CodexAdapter {
201
203
  }
202
204
  runCli(prompt, workingDir, reasoningEffort) {
203
205
  return new Promise((resolve, reject) => {
206
+ // Create temp schema file for structured output
207
+ let schemaFile = null;
208
+ try {
209
+ const tempDir = mkdtempSync(join(tmpdir(), 'codex-schema-'));
210
+ schemaFile = join(tempDir, 'schema.json');
211
+ const schema = getReviewOutputJsonSchema();
212
+ writeFileSync(schemaFile, JSON.stringify(schema, null, 2), 'utf-8');
213
+ }
214
+ catch (err) {
215
+ console.error('[codex] Warning: Failed to create schema file, continuing without structured output:', err);
216
+ schemaFile = null;
217
+ }
204
218
  const args = [
205
219
  'exec',
206
220
  '-m', 'gpt-5.2-codex',
@@ -209,8 +223,12 @@ export class CodexAdapter {
209
223
  '--dangerously-bypass-approvals-and-sandbox',
210
224
  '--skip-git-repo-check',
211
225
  '-C', workingDir,
212
- prompt
213
226
  ];
227
+ // Add schema enforcement if available
228
+ if (schemaFile) {
229
+ args.push('--output-schema', schemaFile);
230
+ }
231
+ args.push(prompt);
214
232
  const proc = spawn('codex', args, {
215
233
  cwd: workingDir,
216
234
  stdio: ['ignore', 'pipe', 'pipe'],
@@ -273,12 +291,30 @@ export class CodexAdapter {
273
291
  clearTimeout(maxTimer);
274
292
  const elapsed = Math.round((Date.now() - cliStartTime) / 1000);
275
293
  console.error(` ✓ [${elapsed}s]`);
294
+ // Cleanup temp schema file
295
+ if (schemaFile) {
296
+ try {
297
+ unlinkSync(schemaFile);
298
+ }
299
+ catch {
300
+ // Ignore cleanup errors
301
+ }
302
+ }
276
303
  resolve({ stdout, stderr, exitCode: code ?? -1, truncated });
277
304
  });
278
305
  proc.on('error', (err) => {
279
306
  clearTimeout(inactivityTimer);
280
307
  clearTimeout(maxTimer);
281
308
  console.error(' ✗');
309
+ // Cleanup temp schema file
310
+ if (schemaFile) {
311
+ try {
312
+ unlinkSync(schemaFile);
313
+ }
314
+ catch {
315
+ // Ignore cleanup errors
316
+ }
317
+ }
282
318
  reject(err);
283
319
  });
284
320
  });
@@ -204,6 +204,7 @@ export class GeminiAdapter {
204
204
  // Gemini CLI uses positional prompt and --yolo for auto-approval
205
205
  const args = [
206
206
  '--yolo',
207
+ '--output-format', 'json', // Force JSON output
207
208
  '--include-directories', workingDir,
208
209
  prompt
209
210
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-reviewer",
3
- "version": "1.1.7",
3
+ "version": "1.2.0",
4
4
  "description": "MCP server for Claude Code - Get second-opinion feedback from Codex/Gemini CLIs",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",