cc-reviewer 1.9.1 → 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.
- package/dist/adapters/base.d.ts +15 -20
- package/dist/adapters/base.js +22 -155
- package/dist/adapters/codex.d.ts +3 -4
- package/dist/adapters/codex.js +113 -386
- package/dist/adapters/gemini.d.ts +3 -4
- package/dist/adapters/gemini.js +87 -332
- package/dist/decoders/codex.d.ts +71 -0
- package/dist/decoders/codex.js +145 -0
- package/dist/decoders/gemini.d.ts +33 -0
- package/dist/decoders/gemini.js +58 -0
- package/dist/decoders/index.d.ts +4 -0
- package/dist/decoders/index.js +2 -0
- package/dist/executor.d.ts +103 -0
- package/dist/executor.js +244 -0
- package/dist/handoff.d.ts +3 -5
- package/dist/handoff.js +48 -422
- package/dist/schema.d.ts +11 -6
- package/dist/schema.js +21 -0
- package/dist/tools/feedback.d.ts +5 -6
- package/dist/tools/feedback.js +61 -339
- package/dist/tools/peer.d.ts +0 -2
- package/dist/tools/peer.js +19 -102
- package/package.json +1 -1
package/dist/adapters/base.d.ts
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Makes it easy to add new models (Ollama, Azure, etc.) without
|
|
6
6
|
* changing the core orchestration logic.
|
|
7
7
|
*/
|
|
8
|
-
import { ReviewOutput, PeerOutput } from '../schema.js';
|
|
9
8
|
import { FocusArea, OutputType, ReasoningEffort, ServiceTier, TaskType } from '../types.js';
|
|
10
9
|
export interface ReviewerCapabilities {
|
|
11
10
|
/** Display name for this reviewer */
|
|
@@ -42,9 +41,19 @@ export interface ReviewRequest {
|
|
|
42
41
|
reasoningEffort?: ReasoningEffort;
|
|
43
42
|
/** Service tier (for models that support it: priority = fast, flex = cheap) */
|
|
44
43
|
serviceTier?: ServiceTier;
|
|
45
|
-
/** Expert role configuration (optional override) */
|
|
46
|
-
expertRole?: ExpertRole;
|
|
47
44
|
}
|
|
45
|
+
/** @deprecated Use handoff.ts roles instead */
|
|
46
|
+
export interface ExpertRole {
|
|
47
|
+
name: string;
|
|
48
|
+
description: string;
|
|
49
|
+
systemPrompt: string;
|
|
50
|
+
focusAreas: FocusArea[];
|
|
51
|
+
evaluationCriteria: string[];
|
|
52
|
+
}
|
|
53
|
+
/** @deprecated Use handoff.ts selectRole() instead */
|
|
54
|
+
export declare const EXPERT_ROLES: Record<string, ExpertRole>;
|
|
55
|
+
/** @deprecated Use handoff.ts selectRole() instead */
|
|
56
|
+
export declare function selectExpertRole(focusAreas?: FocusArea[]): ExpertRole;
|
|
48
57
|
export interface PeerRequest {
|
|
49
58
|
/** Working directory containing the code */
|
|
50
59
|
workingDir: string;
|
|
@@ -65,22 +74,9 @@ export interface PeerRequest {
|
|
|
65
74
|
/** Service tier (for models that support it: priority = fast, flex = cheap) */
|
|
66
75
|
serviceTier?: ServiceTier;
|
|
67
76
|
}
|
|
68
|
-
export interface ExpertRole {
|
|
69
|
-
name: string;
|
|
70
|
-
description: string;
|
|
71
|
-
systemPrompt: string;
|
|
72
|
-
focusAreas: FocusArea[];
|
|
73
|
-
evaluationCriteria: string[];
|
|
74
|
-
}
|
|
75
|
-
export declare const EXPERT_ROLES: Record<string, ExpertRole>;
|
|
76
|
-
/**
|
|
77
|
-
* Select the best expert role based on requested focus areas
|
|
78
|
-
*/
|
|
79
|
-
export declare function selectExpertRole(focusAreas?: FocusArea[]): ExpertRole;
|
|
80
77
|
export interface ReviewSuccess {
|
|
81
78
|
success: true;
|
|
82
|
-
output:
|
|
83
|
-
rawOutput?: string;
|
|
79
|
+
output: string;
|
|
84
80
|
executionTimeMs: number;
|
|
85
81
|
}
|
|
86
82
|
export interface ReviewFailure {
|
|
@@ -98,8 +94,7 @@ export interface ReviewError {
|
|
|
98
94
|
}
|
|
99
95
|
export interface PeerSuccess {
|
|
100
96
|
success: true;
|
|
101
|
-
output:
|
|
102
|
-
rawOutput?: string;
|
|
97
|
+
output: string;
|
|
103
98
|
executionTimeMs: number;
|
|
104
99
|
}
|
|
105
100
|
export interface PeerFailure {
|
|
@@ -129,7 +124,7 @@ export interface ReviewerAdapter {
|
|
|
129
124
|
* Optional: Run peer review of another model's output
|
|
130
125
|
* Future capability - not currently implemented by any adapter
|
|
131
126
|
*/
|
|
132
|
-
runPeerReview?(originalRequest: ReviewRequest, reviewToScore:
|
|
127
|
+
runPeerReview?(originalRequest: ReviewRequest, reviewToScore: string): Promise<ReviewResult>;
|
|
133
128
|
}
|
|
134
129
|
export declare function registerAdapter(adapter: ReviewerAdapter): void;
|
|
135
130
|
export declare function getAdapter(id: string): ReviewerAdapter | undefined;
|
package/dist/adapters/base.js
CHANGED
|
@@ -5,180 +5,47 @@
|
|
|
5
5
|
* Makes it easy to add new models (Ollama, Azure, etc.) without
|
|
6
6
|
* changing the core orchestration logic.
|
|
7
7
|
*/
|
|
8
|
+
/** @deprecated Use handoff.ts selectRole() instead */
|
|
8
9
|
export const EXPERT_ROLES = {
|
|
9
10
|
security_auditor: {
|
|
10
|
-
name: 'Security Auditor',
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
- OWASP Top 10 vulnerabilities (injection, broken auth, XSS, CSRF, etc.)
|
|
14
|
-
- Authentication and authorization flaws
|
|
15
|
-
- Input validation and sanitization
|
|
16
|
-
- Cryptographic weaknesses and misuse
|
|
17
|
-
- Sensitive data exposure
|
|
18
|
-
- Security misconfigurations
|
|
19
|
-
- Dependency vulnerabilities
|
|
20
|
-
|
|
21
|
-
When reviewing code:
|
|
22
|
-
1. Identify specific vulnerability patterns with CWE IDs when applicable
|
|
23
|
-
2. Rate severity using CVSS-like scoring (critical/high/medium/low/info)
|
|
24
|
-
3. Provide concrete proof-of-concept or attack scenarios
|
|
25
|
-
4. Suggest specific remediations with code examples
|
|
26
|
-
5. Note any security best practices being followed (to validate CC's work)`,
|
|
27
|
-
focusAreas: ['security'],
|
|
28
|
-
evaluationCriteria: [
|
|
29
|
-
'SQL/NoSQL injection vectors',
|
|
30
|
-
'XSS (stored, reflected, DOM)',
|
|
31
|
-
'Authentication bypass',
|
|
32
|
-
'Authorization flaws (IDOR, privilege escalation)',
|
|
33
|
-
'Insecure deserialization',
|
|
34
|
-
'SSRF vulnerabilities',
|
|
35
|
-
'Path traversal',
|
|
36
|
-
'Command injection',
|
|
37
|
-
'Secrets in code',
|
|
38
|
-
'Insecure dependencies',
|
|
39
|
-
],
|
|
11
|
+
name: 'Security Auditor', description: 'Security vulnerabilities',
|
|
12
|
+
systemPrompt: 'Security auditor. Focus on injection, auth bypass, data exposure, input validation.',
|
|
13
|
+
focusAreas: ['security'], evaluationCriteria: ['Injection', 'Auth', 'Data exposure'],
|
|
40
14
|
},
|
|
41
15
|
performance_engineer: {
|
|
42
|
-
name: 'Performance Engineer',
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
- Algorithm complexity analysis (Big-O notation)
|
|
46
|
-
- Memory management and leak detection
|
|
47
|
-
- Database query optimization
|
|
48
|
-
- Caching strategies
|
|
49
|
-
- Concurrency and parallelism
|
|
50
|
-
- I/O optimization
|
|
51
|
-
- Bundle size and load time optimization
|
|
52
|
-
|
|
53
|
-
When reviewing code:
|
|
54
|
-
1. Analyze algorithmic complexity with Big-O notation
|
|
55
|
-
2. Identify memory leaks, unnecessary allocations, or retention issues
|
|
56
|
-
3. Spot N+1 query problems and suggest batching/caching
|
|
57
|
-
4. Recommend specific optimizations with expected improvements
|
|
58
|
-
5. Validate any performance claims from CC with analysis`,
|
|
59
|
-
focusAreas: ['performance', 'scalability'],
|
|
60
|
-
evaluationCriteria: [
|
|
61
|
-
'Time complexity',
|
|
62
|
-
'Space complexity',
|
|
63
|
-
'Memory leaks',
|
|
64
|
-
'Unnecessary re-renders',
|
|
65
|
-
'N+1 queries',
|
|
66
|
-
'Missing indexes',
|
|
67
|
-
'Inefficient loops',
|
|
68
|
-
'Blocking operations',
|
|
69
|
-
'Cache invalidation',
|
|
70
|
-
'Resource pooling',
|
|
71
|
-
],
|
|
16
|
+
name: 'Performance Engineer', description: 'Performance optimization',
|
|
17
|
+
systemPrompt: 'Performance engineer. Focus on complexity, N+1 queries, memory leaks.',
|
|
18
|
+
focusAreas: ['performance', 'scalability'], evaluationCriteria: ['Complexity', 'Memory', 'I/O'],
|
|
72
19
|
},
|
|
73
20
|
architect: {
|
|
74
|
-
name: 'Software Architect',
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
- Design patterns (GoF, enterprise patterns)
|
|
78
|
-
- SOLID principles
|
|
79
|
-
- Clean architecture and DDD
|
|
80
|
-
- API design and contracts
|
|
81
|
-
- Dependency management
|
|
82
|
-
- Code organization and modularity
|
|
83
|
-
- Technical debt assessment
|
|
84
|
-
|
|
85
|
-
When reviewing code:
|
|
86
|
-
1. Evaluate adherence to design patterns and principles
|
|
87
|
-
2. Identify coupling issues and suggest decoupling strategies
|
|
88
|
-
3. Assess abstraction levels and cohesion
|
|
89
|
-
4. Recommend refactoring opportunities with specific patterns
|
|
90
|
-
5. Evaluate API design for consistency and usability`,
|
|
91
|
-
focusAreas: ['architecture', 'maintainability'],
|
|
92
|
-
evaluationCriteria: [
|
|
93
|
-
'Single responsibility',
|
|
94
|
-
'Open/closed principle',
|
|
95
|
-
'Liskov substitution',
|
|
96
|
-
'Interface segregation',
|
|
97
|
-
'Dependency inversion',
|
|
98
|
-
'Coupling and cohesion',
|
|
99
|
-
'Abstraction levels',
|
|
100
|
-
'Error handling patterns',
|
|
101
|
-
'API consistency',
|
|
102
|
-
'Technical debt indicators',
|
|
103
|
-
],
|
|
21
|
+
name: 'Software Architect', description: 'Architecture and design',
|
|
22
|
+
systemPrompt: 'Software architect. Focus on SOLID, coupling, abstractions.',
|
|
23
|
+
focusAreas: ['architecture', 'maintainability'], evaluationCriteria: ['SOLID', 'Coupling', 'Patterns'],
|
|
104
24
|
},
|
|
105
25
|
correctness_analyst: {
|
|
106
|
-
name: 'Correctness Analyst',
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
- Logic errors and off-by-one mistakes
|
|
110
|
-
- Edge cases and boundary conditions
|
|
111
|
-
- Null/undefined handling
|
|
112
|
-
- Type safety issues
|
|
113
|
-
- Race conditions and concurrency bugs
|
|
114
|
-
- Error handling completeness
|
|
115
|
-
- State management issues
|
|
116
|
-
|
|
117
|
-
When reviewing code:
|
|
118
|
-
1. Trace execution paths looking for logic errors
|
|
119
|
-
2. Identify missing edge case handling
|
|
120
|
-
3. Spot potential null pointer/undefined errors
|
|
121
|
-
4. Check for race conditions in async code
|
|
122
|
-
5. Verify error handling covers failure modes`,
|
|
123
|
-
focusAreas: ['correctness', 'testing'],
|
|
124
|
-
evaluationCriteria: [
|
|
125
|
-
'Off-by-one errors',
|
|
126
|
-
'Null/undefined safety',
|
|
127
|
-
'Boundary conditions',
|
|
128
|
-
'Integer overflow',
|
|
129
|
-
'Floating point precision',
|
|
130
|
-
'Race conditions',
|
|
131
|
-
'Deadlocks',
|
|
132
|
-
'Exception handling',
|
|
133
|
-
'State consistency',
|
|
134
|
-
'Test coverage gaps',
|
|
135
|
-
],
|
|
26
|
+
name: 'Correctness Analyst', description: 'Logic errors and bugs',
|
|
27
|
+
systemPrompt: 'Correctness analyst. Focus on logic errors, edge cases, race conditions.',
|
|
28
|
+
focusAreas: ['correctness', 'testing'], evaluationCriteria: ['Logic', 'Edge cases', 'Concurrency'],
|
|
136
29
|
},
|
|
137
30
|
general_reviewer: {
|
|
138
|
-
name: 'General Reviewer',
|
|
139
|
-
|
|
140
|
-
systemPrompt: `You are a senior software engineer conducting a thorough code review.
|
|
141
|
-
Review the code across multiple dimensions:
|
|
142
|
-
- Correctness: Logic errors, edge cases, bugs
|
|
143
|
-
- Security: Vulnerabilities, input validation
|
|
144
|
-
- Performance: Efficiency, complexity
|
|
145
|
-
- Maintainability: Readability, patterns, documentation
|
|
146
|
-
|
|
147
|
-
Prioritize findings by impact and likelihood. Be specific with file paths
|
|
148
|
-
and line numbers. Provide actionable suggestions.`,
|
|
31
|
+
name: 'General Reviewer', description: 'Balanced review',
|
|
32
|
+
systemPrompt: 'Senior engineer. Review correctness, security, performance, maintainability.',
|
|
149
33
|
focusAreas: ['security', 'performance', 'architecture', 'correctness', 'maintainability'],
|
|
150
|
-
evaluationCriteria: [
|
|
151
|
-
'Logic correctness',
|
|
152
|
-
'Security vulnerabilities',
|
|
153
|
-
'Performance issues',
|
|
154
|
-
'Code quality',
|
|
155
|
-
'Documentation',
|
|
156
|
-
],
|
|
34
|
+
evaluationCriteria: ['Correctness', 'Security', 'Performance', 'Quality'],
|
|
157
35
|
},
|
|
158
36
|
};
|
|
159
|
-
/**
|
|
160
|
-
* Select the best expert role based on requested focus areas
|
|
161
|
-
*/
|
|
37
|
+
/** @deprecated Use handoff.ts selectRole() instead */
|
|
162
38
|
export function selectExpertRole(focusAreas) {
|
|
163
|
-
if (!focusAreas || focusAreas.length === 0)
|
|
39
|
+
if (!focusAreas || focusAreas.length === 0)
|
|
164
40
|
return EXPERT_ROLES.general_reviewer;
|
|
165
|
-
|
|
166
|
-
// Prioritize security if it's in the list
|
|
167
|
-
if (focusAreas.includes('security')) {
|
|
41
|
+
if (focusAreas.includes('security'))
|
|
168
42
|
return EXPERT_ROLES.security_auditor;
|
|
169
|
-
|
|
170
|
-
// Check for performance/scalability
|
|
171
|
-
if (focusAreas.includes('performance') || focusAreas.includes('scalability')) {
|
|
43
|
+
if (focusAreas.includes('performance') || focusAreas.includes('scalability'))
|
|
172
44
|
return EXPERT_ROLES.performance_engineer;
|
|
173
|
-
|
|
174
|
-
// Check for architecture/maintainability
|
|
175
|
-
if (focusAreas.includes('architecture') || focusAreas.includes('maintainability')) {
|
|
45
|
+
if (focusAreas.includes('architecture') || focusAreas.includes('maintainability'))
|
|
176
46
|
return EXPERT_ROLES.architect;
|
|
177
|
-
|
|
178
|
-
// Check for correctness/testing
|
|
179
|
-
if (focusAreas.includes('correctness') || focusAreas.includes('testing')) {
|
|
47
|
+
if (focusAreas.includes('correctness') || focusAreas.includes('testing'))
|
|
180
48
|
return EXPERT_ROLES.correctness_analyst;
|
|
181
|
-
}
|
|
182
49
|
return EXPERT_ROLES.general_reviewer;
|
|
183
50
|
}
|
|
184
51
|
// =============================================================================
|
package/dist/adapters/codex.d.ts
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Codex CLI Adapter
|
|
3
3
|
*
|
|
4
4
|
* Implements the ReviewerAdapter interface for OpenAI's Codex CLI.
|
|
5
|
-
*
|
|
5
|
+
* Returns raw text — no JSON parsing or schema enforcement.
|
|
6
|
+
* CC handles interpretation of the reviewer's response.
|
|
6
7
|
*/
|
|
7
8
|
import { ReviewerAdapter, ReviewerCapabilities, ReviewRequest, ReviewResult, PeerRequest, PeerResult } from './base.js';
|
|
8
9
|
export declare class CodexAdapter implements ReviewerAdapter {
|
|
@@ -10,12 +11,10 @@ export declare class CodexAdapter implements ReviewerAdapter {
|
|
|
10
11
|
getCapabilities(): ReviewerCapabilities;
|
|
11
12
|
isAvailable(): Promise<boolean>;
|
|
12
13
|
runReview(request: ReviewRequest): Promise<ReviewResult>;
|
|
13
|
-
private runWithRetry;
|
|
14
14
|
runPeerRequest(request: PeerRequest): Promise<PeerResult>;
|
|
15
|
-
private runPeerWithRetry;
|
|
16
15
|
private runCli;
|
|
16
|
+
private handleException;
|
|
17
17
|
private categorizeError;
|
|
18
18
|
private getSuggestion;
|
|
19
|
-
private parseRetryAfter;
|
|
20
19
|
}
|
|
21
20
|
export declare const codexAdapter: CodexAdapter;
|