codex-review-mcp 2.3.0 → 2.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.
@@ -1,10 +1,13 @@
|
|
1
|
-
export function formatOutput(agentMarkdown) {
|
1
|
+
export function formatOutput(agentMarkdown, version) {
|
2
2
|
// For MVP, trust agent output if non-empty; otherwise return a minimal stub.
|
3
|
-
|
4
|
-
|
3
|
+
const versionFooter = version ? `\n\n---\n*Generated by codex-review-mcp v${version}*` : '';
|
4
|
+
if (agentMarkdown && agentMarkdown.trim().length > 0) {
|
5
|
+
return agentMarkdown + versionFooter;
|
6
|
+
}
|
5
7
|
return [
|
6
8
|
'# Code Review',
|
7
9
|
'',
|
8
10
|
'No issues detected or empty output from agent.',
|
11
|
+
versionFooter,
|
9
12
|
].join('\n');
|
10
13
|
}
|
@@ -2,10 +2,18 @@ import { describe, it, expect } from 'vitest';
|
|
2
2
|
import { formatOutput } from './formatOutput.js';
|
3
3
|
describe('formatOutput', () => {
|
4
4
|
describe('Valid Agent Output', () => {
|
5
|
-
it('should return agent markdown
|
5
|
+
it('should return agent markdown without version when version not provided', () => {
|
6
6
|
const agentOutput = '# Code Review\n\n## Issues\n\n- Issue 1\n- Issue 2';
|
7
7
|
const result = formatOutput(agentOutput);
|
8
8
|
expect(result).toBe(agentOutput);
|
9
|
+
expect(result).not.toContain('Generated by codex-review-mcp');
|
10
|
+
});
|
11
|
+
it('should append version footer when version is provided', () => {
|
12
|
+
const agentOutput = '# Code Review\n\n## Issues\n\n- Issue 1';
|
13
|
+
const result = formatOutput(agentOutput, '2.3.0');
|
14
|
+
expect(result).toContain(agentOutput);
|
15
|
+
expect(result).toContain('---');
|
16
|
+
expect(result).toContain('*Generated by codex-review-mcp v2.3.0*');
|
9
17
|
});
|
10
18
|
it('should preserve formatting and special characters', () => {
|
11
19
|
const agentOutput = `# Review
|
@@ -58,6 +66,12 @@ function fix() {
|
|
58
66
|
expect(result).toContain('# Code Review');
|
59
67
|
expect(result).toContain('No issues detected or empty output from agent');
|
60
68
|
});
|
69
|
+
it('should include version in fallback message when provided', () => {
|
70
|
+
const result = formatOutput('', '2.3.0');
|
71
|
+
expect(result).toContain('# Code Review');
|
72
|
+
expect(result).toContain('No issues detected or empty output from agent');
|
73
|
+
expect(result).toContain('*Generated by codex-review-mcp v2.3.0*');
|
74
|
+
});
|
61
75
|
it('should return fallback message when output is only whitespace', () => {
|
62
76
|
const result = formatOutput(' \n\n \t ');
|
63
77
|
expect(result).toContain('# Code Review');
|
@@ -59,7 +59,7 @@ export async function performCodeReview(input, onProgress) {
|
|
59
59
|
await debugLog(`Review produced ${agentMd.length} chars`);
|
60
60
|
// Format output
|
61
61
|
await onProgress?.('Formatting output…', 90, 100);
|
62
|
-
const out = formatOutput(agentMd);
|
62
|
+
const out = formatOutput(agentMd, VERSION);
|
63
63
|
await onProgress?.('Done', 100, 100);
|
64
64
|
return out;
|
65
65
|
}
|