cc-reviewer 2.0.0 → 2.1.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.
@@ -23,78 +23,18 @@ function toPeerRequest(input) {
23
23
  serviceTier: input.serviceTier,
24
24
  };
25
25
  }
26
- export function formatPeerResponse(result, modelName) {
26
+ function formatPeerResult(result, modelName) {
27
27
  if (!result.success) {
28
- return formatPeerErrorResponse(result.error, result.suggestion);
29
- }
30
- const output = result.output;
31
- const lines = [];
32
- lines.push(`## ${modelName} Response\n`);
33
- lines.push(`**Execution Time:** ${(result.executionTimeMs / 1000).toFixed(1)}s`);
34
- lines.push(`**Confidence:** ${Math.round(output.confidence * 100)}%\n`);
35
- // Main answer
36
- lines.push(`### Answer\n`);
37
- lines.push(output.answer);
38
- lines.push('');
39
- // Key points
40
- if (output.key_points.length > 0) {
41
- lines.push(`### Key Points\n`);
42
- for (const point of output.key_points) {
43
- lines.push(`- ${point}`);
44
- }
45
- lines.push('');
46
- }
47
- // Suggested actions
48
- if (output.suggested_actions.length > 0) {
49
- lines.push(`### Suggested Actions\n`);
50
- const priorityEmoji = {
51
- high: 'šŸ”“', medium: '🟔', low: '🟢',
28
+ const emoji = {
29
+ cli_not_found: 'āŒ', timeout: 'ā±ļø', rate_limit: '🚫',
30
+ auth_error: 'šŸ”', cli_error: 'āŒ',
52
31
  };
53
- for (const action of output.suggested_actions) {
54
- lines.push(`${priorityEmoji[action.priority] || '•'} **${action.action}**`);
55
- if (action.file) {
56
- lines.push(` šŸ“ ${action.file}`);
57
- }
58
- lines.push(` ${action.rationale}`);
59
- lines.push('');
60
- }
61
- }
62
- // File references
63
- if (output.file_references.length > 0) {
64
- lines.push(`### Files Examined\n`);
65
- for (const ref of output.file_references) {
66
- const loc = ref.lines ? `${ref.path}:${ref.lines}` : ref.path;
67
- lines.push(`- \`${loc}\` — ${ref.relevance}`);
68
- }
69
- lines.push('');
70
- }
71
- // Alternatives
72
- if (output.alternatives && output.alternatives.length > 0) {
73
- lines.push(`### Alternatives\n`);
74
- for (const alt of output.alternatives) {
75
- lines.push(`**${alt.topic}**`);
76
- lines.push(` Current: ${alt.current_approach}`);
77
- lines.push(` Alternative: ${alt.alternative}`);
78
- lines.push(` Recommendation: ${alt.recommendation}`);
79
- lines.push('');
80
- }
81
- }
82
- return lines.join('\n');
83
- }
84
- function formatPeerErrorResponse(error, suggestion) {
85
- const emoji = {
86
- cli_not_found: 'āŒ',
87
- timeout: 'ā±ļø',
88
- rate_limit: '🚫',
89
- auth_error: 'šŸ”',
90
- parse_error: 'āš ļø',
91
- cli_error: 'āŒ',
92
- };
93
- let response = `${emoji[error.type] || 'āŒ'} **${error.type}**: ${error.message}`;
94
- if (suggestion) {
95
- response += `\n\nšŸ’” ${suggestion}`;
32
+ let msg = `${emoji[result.error.type] || 'āŒ'} **${result.error.type}**: ${result.error.message}`;
33
+ if (result.suggestion)
34
+ msg += `\n\nšŸ’” ${result.suggestion}`;
35
+ return msg;
96
36
  }
97
- return response;
37
+ return `## ${modelName} Response\n\n**Execution Time:** ${(result.executionTimeMs / 1000).toFixed(1)}s\n\n${result.output}`;
98
38
  }
99
39
  // =============================================================================
100
40
  // SINGLE MODEL HANDLERS
@@ -115,7 +55,7 @@ export async function handleAskCodex(input) {
115
55
  }
116
56
  const request = toPeerRequest(input);
117
57
  const result = await adapter.runPeerRequest(request);
118
- return { content: [{ type: 'text', text: formatPeerResponse(result, 'Codex') }] };
58
+ return { content: [{ type: 'text', text: formatPeerResult(result, 'Codex') }] };
119
59
  }
120
60
  export async function handleAskGemini(input) {
121
61
  const adapter = getAdapter('gemini');
@@ -133,7 +73,7 @@ export async function handleAskGemini(input) {
133
73
  }
134
74
  const request = toPeerRequest(input);
135
75
  const result = await adapter.runPeerRequest(request);
136
- return { content: [{ type: 'text', text: formatPeerResponse(result, 'Gemini') }] };
76
+ return { content: [{ type: 'text', text: formatPeerResult(result, 'Gemini') }] };
137
77
  }
138
78
  // =============================================================================
139
79
  // MULTI-MODEL HANDLER
@@ -154,43 +94,20 @@ export async function handleAskMulti(input) {
154
94
  return { adapter, result };
155
95
  });
156
96
  const results = await Promise.all(promises);
157
- const successful = [];
158
- const failed = [];
159
- for (const { adapter, result } of results) {
160
- if (result.success) {
161
- successful.push({ model: adapter.id, output: result.output });
162
- }
163
- else {
164
- failed.push({ model: adapter.id, error: result.error.message });
165
- }
166
- }
167
97
  const lines = [];
168
- if (failed.length === results.length) {
98
+ const allFailed = results.every(r => !r.result.success);
99
+ const someFailed = results.some(r => !r.result.success);
100
+ if (allFailed)
169
101
  lines.push('## Multi-Model Response āŒ All Failed\n');
170
- }
171
- else if (failed.length > 0) {
102
+ else if (someFailed)
172
103
  lines.push('## Multi-Model Response āš ļø Partial Success\n');
173
- }
174
- else {
104
+ else
175
105
  lines.push('## Multi-Model Response āœ“\n');
176
- }
177
- lines.push(`**Models:** ${availableAdapters.map(a => a.id).join(', ')}`);
178
- lines.push('');
179
- for (const { model, output } of successful) {
180
- lines.push(`### ${model.charAt(0).toUpperCase() + model.slice(1)} Response\n`);
181
- lines.push(formatPeerResponse({ success: true, output, executionTimeMs: 0 }, model));
182
- lines.push('');
183
- }
184
- if (failed.length > 0) {
185
- lines.push('### Failures\n');
186
- for (const { model, error } of failed) {
187
- lines.push(`**${model}:** ${error}`);
188
- }
106
+ lines.push(`**Models:** ${availableAdapters.map(a => a.id).join(', ')}\n`);
107
+ for (const { adapter, result } of results) {
108
+ lines.push(formatPeerResult(result, adapter.getCapabilities().name));
189
109
  lines.push('');
190
110
  }
191
- if (successful.length > 1) {
192
- lines.push(`---\n\n**Synthesis Instructions:**\n- Compare perspectives from each model\n- Note agreements and disagreements\n- Use your judgment to form a final answer`);
193
- }
194
111
  return { content: [{ type: 'text', text: lines.join('\n') }] };
195
112
  }
196
113
  // =============================================================================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-reviewer",
3
- "version": "2.0.0",
3
+ "version": "2.1.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",