codex-review-mcp 2.6.0 → 2.8.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.
|
@@ -7,8 +7,22 @@ export function buildPrompt({ diffText, context, focus, version, isStaticReview
|
|
|
7
7
|
'',
|
|
8
8
|
'You are an expert TypeScript, React 18, Material UI, and Emotion UI code reviewer. Be concise, specific, and actionable.',
|
|
9
9
|
'',
|
|
10
|
-
'⚠️ CRITICAL
|
|
11
|
-
'
|
|
10
|
+
'⚠️ CRITICAL CONSTRAINTS:',
|
|
11
|
+
'1. Review ONLY the files and changes shown in the diff below.',
|
|
12
|
+
'2. Do NOT reference, suggest, or mention files that are not in this diff.',
|
|
13
|
+
'3. EVERY finding MUST include:',
|
|
14
|
+
' - Exact file path and line number(s) that exist in the diff',
|
|
15
|
+
' - A short quoted code snippet from that exact location as evidence',
|
|
16
|
+
' - If you cannot quote the code, the finding is invalid',
|
|
17
|
+
'',
|
|
18
|
+
'💡 WHEN IN DOUBT, ASK - DON\'T GUESS:',
|
|
19
|
+
'If you need more information to give accurate feedback, ask clarifying questions instead of making assumptions.',
|
|
20
|
+
'Good questions help the coding agent provide better context. Examples:',
|
|
21
|
+
' • "I see a new `useUserData` hook but don\'t see its tests - are they in a separate PR?"',
|
|
22
|
+
' • "This component uses `CustomModal` - is this a new pattern or existing abstraction I should reference?"',
|
|
23
|
+
' • "The error handling here is minimal - is there a global error boundary handling this?"',
|
|
24
|
+
' • "I need to see the full `UserService` interface to verify this usage is type-safe"',
|
|
25
|
+
'Asking questions is ALWAYS better than asserting something you cannot verify from the diff.',
|
|
12
26
|
'',
|
|
13
27
|
'PRIORITY HIERARCHY:',
|
|
14
28
|
'1. Project documentation (.cursor/rules/*, CODE_REVIEW.md, CONTRIBUTING.md) - HIGHEST PRIORITY',
|
|
@@ -30,11 +44,30 @@ export function buildPrompt({ diffText, context, focus, version, isStaticReview
|
|
|
30
44
|
'- setTimeout/setInterval without clear cleanup or justification',
|
|
31
45
|
'- Direct DOM manipulation (document.querySelector, etc.) instead of React refs',
|
|
32
46
|
'- Inline styles with hardcoded colors/sizes instead of theme values',
|
|
47
|
+
'- ⚠️ Z-INDEX CHANGES (HIGH RISK): Treat all z-index modifications with extreme caution. MUST analyze the entire z-index hierarchy, verify no breaking changes in stacking context, and check for existing z-index patterns in codebase before recommending changes.',
|
|
33
48
|
'',
|
|
34
49
|
`\n---\n${reviewType}${isStaticReview ? ' - Code Files' : ' (unified=0)'}:\n`,
|
|
35
50
|
diffText,
|
|
36
51
|
context ? '\n---\nProject context and guidelines (FOLLOW THESE STRICTLY):\n' + context : '',
|
|
37
|
-
'
|
|
38
|
-
'
|
|
52
|
+
'',
|
|
53
|
+
'---',
|
|
54
|
+
'BEFORE YOU RESPOND - VALIDATE EACH FINDING:',
|
|
55
|
+
'- [ ] File path exists in the diff above',
|
|
56
|
+
'- [ ] Line number(s) exist in that file',
|
|
57
|
+
'- [ ] Code snippet is quoted verbatim from that location',
|
|
58
|
+
'- [ ] Issue ties to project rules/patterns (not just generic advice)',
|
|
59
|
+
'- [ ] If you cannot verify all above → ASK a specific question instead of asserting',
|
|
60
|
+
'',
|
|
61
|
+
'Remember: A good clarifying question is more valuable than a questionable assertion.',
|
|
62
|
+
'',
|
|
63
|
+
'---',
|
|
64
|
+
'Output strictly as Markdown with the following sections:',
|
|
65
|
+
'1) Title + scope summary',
|
|
66
|
+
'2) Quick Summary (3–6 bullets)',
|
|
67
|
+
'3) Issues table: severity | file:lines | category | explanation | suggested fix',
|
|
68
|
+
'4) Inline suggested edits for top issues',
|
|
69
|
+
'5) Clarifying Questions (if any) - list specific questions that would help provide better feedback',
|
|
70
|
+
'6) Positive notes (mention when code follows project guidelines well)',
|
|
71
|
+
'7) Next steps',
|
|
39
72
|
].join('\n');
|
|
40
73
|
}
|
|
@@ -62,10 +62,12 @@ describe('buildPrompt', () => {
|
|
|
62
62
|
});
|
|
63
63
|
// Verify key sections are present
|
|
64
64
|
expect(prompt).toContain('You are an expert TypeScript, React 18, Material UI, and Emotion UI code reviewer');
|
|
65
|
-
expect(prompt).toContain('CRITICAL
|
|
65
|
+
expect(prompt).toContain('CRITICAL CONSTRAINTS');
|
|
66
|
+
expect(prompt).toContain('Review ONLY the files');
|
|
67
|
+
expect(prompt).toContain('EVERY finding MUST include');
|
|
68
|
+
expect(prompt).toContain('BEFORE YOU RESPOND - VALIDATE EACH FINDING');
|
|
66
69
|
expect(prompt).toContain('PRIORITY HIERARCHY');
|
|
67
70
|
expect(prompt).toContain('CORE PRINCIPLES');
|
|
68
|
-
// Severity is determined by GPT-5 based on context, not pre-defined
|
|
69
71
|
expect(prompt).toContain('Output strictly as Markdown with the following sections');
|
|
70
72
|
});
|
|
71
73
|
it('should include the diff text', () => {
|
|
@@ -92,8 +94,11 @@ describe('buildPrompt', () => {
|
|
|
92
94
|
const prompt = buildPrompt({
|
|
93
95
|
diffText: mockDiff,
|
|
94
96
|
});
|
|
95
|
-
expect(prompt).toContain('CRITICAL
|
|
97
|
+
expect(prompt).toContain('CRITICAL CONSTRAINTS');
|
|
98
|
+
expect(prompt).toContain('Review ONLY the files');
|
|
96
99
|
expect(prompt).toContain('Do NOT reference, suggest, or mention files that are not in this diff');
|
|
100
|
+
expect(prompt).toContain('EVERY finding MUST include');
|
|
101
|
+
expect(prompt).toContain('quoted code snippet from that exact location as evidence');
|
|
97
102
|
});
|
|
98
103
|
it('should include guidance hierarchy with proper priorities', () => {
|
|
99
104
|
const prompt = buildPrompt({
|