coding-agent-benchmarks 0.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/LICENSE +21 -0
- package/README.md +474 -0
- package/dist/adapters/claudeCodeCLI.d.ts +19 -0
- package/dist/adapters/claudeCodeCLI.d.ts.map +1 -0
- package/dist/adapters/claudeCodeCLI.js +106 -0
- package/dist/adapters/claudeCodeCLI.js.map +1 -0
- package/dist/adapters/copilotCLI.d.ts +19 -0
- package/dist/adapters/copilotCLI.d.ts.map +1 -0
- package/dist/adapters/copilotCLI.js +104 -0
- package/dist/adapters/copilotCLI.js.map +1 -0
- package/dist/config/defaultScenarios.d.ts +6 -0
- package/dist/config/defaultScenarios.d.ts.map +1 -0
- package/dist/config/defaultScenarios.js +209 -0
- package/dist/config/defaultScenarios.js.map +1 -0
- package/dist/config/loader.d.ts +13 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +153 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/evaluator.d.ts +45 -0
- package/dist/evaluator.d.ts.map +1 -0
- package/dist/evaluator.js +226 -0
- package/dist/evaluator.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/runner.d.ts +6 -0
- package/dist/runner.d.ts.map +1 -0
- package/dist/runner.js +233 -0
- package/dist/runner.js.map +1 -0
- package/dist/types.d.ts +354 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/baselineManager.d.ts +53 -0
- package/dist/utils/baselineManager.d.ts.map +1 -0
- package/dist/utils/baselineManager.js +220 -0
- package/dist/utils/baselineManager.js.map +1 -0
- package/dist/utils/gitUtils.d.ts +39 -0
- package/dist/utils/gitUtils.d.ts.map +1 -0
- package/dist/utils/gitUtils.js +121 -0
- package/dist/utils/gitUtils.js.map +1 -0
- package/dist/utils/githubAuth.d.ts +22 -0
- package/dist/utils/githubAuth.d.ts.map +1 -0
- package/dist/utils/githubAuth.js +79 -0
- package/dist/utils/githubAuth.js.map +1 -0
- package/dist/utils/workspaceUtils.d.ts +32 -0
- package/dist/utils/workspaceUtils.d.ts.map +1 -0
- package/dist/utils/workspaceUtils.js +121 -0
- package/dist/utils/workspaceUtils.js.map +1 -0
- package/dist/validators/eslintValidator.d.ts +22 -0
- package/dist/validators/eslintValidator.d.ts.map +1 -0
- package/dist/validators/eslintValidator.js +217 -0
- package/dist/validators/eslintValidator.js.map +1 -0
- package/dist/validators/llmJudge.d.ts +28 -0
- package/dist/validators/llmJudge.d.ts.map +1 -0
- package/dist/validators/llmJudge.js +241 -0
- package/dist/validators/llmJudge.js.map +1 -0
- package/dist/validators/patternValidator.d.ts +27 -0
- package/dist/validators/patternValidator.d.ts.map +1 -0
- package/dist/validators/patternValidator.js +233 -0
- package/dist/validators/patternValidator.js.map +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* GitHub Copilot CLI Adapter
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CopilotCLIAdapter = void 0;
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
8
|
+
const gitUtils_1 = require("../utils/gitUtils");
|
|
9
|
+
const workspaceUtils_1 = require("../utils/workspaceUtils");
|
|
10
|
+
class CopilotCLIAdapter {
|
|
11
|
+
constructor(workspaceRoot) {
|
|
12
|
+
this.type = 'copilot';
|
|
13
|
+
this.workspaceRoot = (0, workspaceUtils_1.resolveWorkspaceRoot)(workspaceRoot);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Check if GitHub Copilot CLI is available
|
|
17
|
+
*/
|
|
18
|
+
async checkAvailability() {
|
|
19
|
+
return new Promise((resolve) => {
|
|
20
|
+
const proc = (0, child_process_1.spawn)('which', ['copilot'], {
|
|
21
|
+
stdio: 'pipe',
|
|
22
|
+
});
|
|
23
|
+
proc.on('close', (code) => {
|
|
24
|
+
resolve(code === 0);
|
|
25
|
+
});
|
|
26
|
+
proc.on('error', () => {
|
|
27
|
+
resolve(false);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Generate code using GitHub Copilot CLI
|
|
33
|
+
* @param timeout Timeout in milliseconds, or null for no timeout
|
|
34
|
+
*/
|
|
35
|
+
async generate(prompt, contextFiles, timeout) {
|
|
36
|
+
// Reset workspace to clean state before generation
|
|
37
|
+
try {
|
|
38
|
+
(0, gitUtils_1.resetGitWorkingDirectory)(this.workspaceRoot);
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
console.warn('Warning: Could not reset git working directory:', error);
|
|
42
|
+
}
|
|
43
|
+
// Build the full prompt with context
|
|
44
|
+
let fullPrompt = prompt;
|
|
45
|
+
if (contextFiles && contextFiles.length > 0) {
|
|
46
|
+
const contexts = (0, workspaceUtils_1.readContextFiles)(this.workspaceRoot, contextFiles);
|
|
47
|
+
if (contexts.length > 0) {
|
|
48
|
+
const contextSection = contexts
|
|
49
|
+
.map(ctx => `\n\n### Context from ${ctx.path}:\n\`\`\`\n${ctx.content}\n\`\`\``)
|
|
50
|
+
.join('\n');
|
|
51
|
+
fullPrompt = `${prompt}${contextSection}`;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// Spawn the copilot CLI process
|
|
55
|
+
return new Promise((resolve, reject) => {
|
|
56
|
+
const proc = (0, child_process_1.spawn)('copilot', [fullPrompt], {
|
|
57
|
+
cwd: this.workspaceRoot,
|
|
58
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
59
|
+
shell: true,
|
|
60
|
+
});
|
|
61
|
+
let stdout = '';
|
|
62
|
+
let stderr = '';
|
|
63
|
+
proc.stdout?.on('data', (data) => {
|
|
64
|
+
stdout += data.toString();
|
|
65
|
+
});
|
|
66
|
+
proc.stderr?.on('data', (data) => {
|
|
67
|
+
stderr += data.toString();
|
|
68
|
+
});
|
|
69
|
+
// Set timeout only if specified (null/undefined = no timeout)
|
|
70
|
+
let timeoutHandle = null;
|
|
71
|
+
if (timeout !== null && timeout !== undefined) {
|
|
72
|
+
timeoutHandle = setTimeout(() => {
|
|
73
|
+
proc.kill('SIGTERM');
|
|
74
|
+
reject(new Error(`Copilot CLI timed out after ${timeout}ms`));
|
|
75
|
+
}, timeout);
|
|
76
|
+
}
|
|
77
|
+
proc.on('close', (code) => {
|
|
78
|
+
if (timeoutHandle) {
|
|
79
|
+
clearTimeout(timeoutHandle);
|
|
80
|
+
}
|
|
81
|
+
if (code !== 0) {
|
|
82
|
+
reject(new Error(`Copilot CLI exited with code ${code}\nStderr: ${stderr}`));
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
// Get the list of changed files
|
|
86
|
+
try {
|
|
87
|
+
const changedFiles = (0, gitUtils_1.getChangedFiles)(this.workspaceRoot);
|
|
88
|
+
resolve(changedFiles);
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
reject(new Error(`Failed to get changed files: ${error}`));
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
proc.on('error', (error) => {
|
|
95
|
+
if (timeoutHandle) {
|
|
96
|
+
clearTimeout(timeoutHandle);
|
|
97
|
+
}
|
|
98
|
+
reject(new Error(`Failed to spawn Copilot CLI: ${error}`));
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
exports.CopilotCLIAdapter = CopilotCLIAdapter;
|
|
104
|
+
//# sourceMappingURL=copilotCLI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilotCLI.js","sourceRoot":"","sources":["../../src/adapters/copilotCLI.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,iDAAsC;AAEtC,gDAA8E;AAC9E,4DAAiF;AAEjF,MAAa,iB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C;YAED,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;gBACxB,IAAI,aAAa,EAAE,CAAC;oBAClB,YAAY,CAAC,aAAa,CAAC,CAAC;gBAC9B,CAAC;gBAED,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;oBACf,MAAM,CAAC,IAAI,KAAK,CAAC,gCAAgC,IAAI,aAAa,MAAM,EAAE,CAAC,CAAC,CAAC;oBAC7E,OAAO;gBACT,CAAC;gBAED,gCAAgC;gBAChC,IAAI,CAAC;oBACH,MAAM,YAAY,GAAG,IAAA,0BAAe,EAAC,IAAI,CAAC,aAAa,CAAC,CAAC;oBACzD,OAAO,CAAC,YAAY,CAAC,CAAC;gBACxB,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,MAAM,CAAC,IAAI,KAAK,CAAC,gCAAgC,KAAK,EAAE,CAAC,CAAC,CAAC;gBAC7D,CAAC;YACH,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;gBACzB,IAAI,aAAa,EAAE,CAAC;oBAClB,YAAY,CAAC,aAAa,CAAC,CAAC;gBAC9B,CAAC;gBACD,MAAM,CAAC,IAAI,KAAK,CAAC,gCAAgC,KAAK,EAAE,CAAC,CAAC,CAAC;YAC7D,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA/GD,8CA+GC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultScenarios.d.ts","sourceRoot":"","sources":["../../src/config/defaultScenarios.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,eAAO,MAAM,mBAAmB,QAAO,YAAY,EAyNhD,CAAC"}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Default test scenarios
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getDefaultScenarios = void 0;
|
|
7
|
+
const getDefaultScenarios = () => [
|
|
8
|
+
{
|
|
9
|
+
id: 'typescript-no-any',
|
|
10
|
+
category: 'typescript',
|
|
11
|
+
severity: 'critical',
|
|
12
|
+
tags: ['typescript', 'types', 'safety'],
|
|
13
|
+
description: 'Ensure TypeScript interfaces use explicit types instead of "any"',
|
|
14
|
+
prompt: 'Create a TypeScript interface called User with fields: id (number), name (string), email (string), and metadata (object with key-value pairs)',
|
|
15
|
+
validationStrategy: {
|
|
16
|
+
patterns: {
|
|
17
|
+
forbiddenPatterns: [/:\s*any\b/, /:\s*any\s*[,;]/],
|
|
18
|
+
requiredPatterns: [/interface\s+User/],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
timeout: 120000,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: 'typescript-readonly-props',
|
|
25
|
+
category: 'typescript',
|
|
26
|
+
severity: 'major',
|
|
27
|
+
tags: ['typescript', 'immutability', 'best-practices'],
|
|
28
|
+
description: 'Enforce readonly properties in TypeScript interfaces',
|
|
29
|
+
prompt: 'Create a TypeScript interface called AppConfig with readonly properties: apiUrl (string), timeout (number), and features (array of strings)',
|
|
30
|
+
validationStrategy: {
|
|
31
|
+
patterns: {
|
|
32
|
+
requiredPatterns: [
|
|
33
|
+
/interface\s+AppConfig/,
|
|
34
|
+
/readonly\s+apiUrl/,
|
|
35
|
+
/readonly\s+timeout/,
|
|
36
|
+
/readonly\s+features/,
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
timeout: 120000,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: 'react-no-inline-styles',
|
|
44
|
+
category: 'react',
|
|
45
|
+
severity: 'major',
|
|
46
|
+
tags: ['react', 'styling', 'best-practices'],
|
|
47
|
+
description: 'Forbid inline style objects in React components',
|
|
48
|
+
prompt: 'Create a React functional component called Button that accepts a "label" prop and renders a styled button. Use CSS classes instead of inline styles.',
|
|
49
|
+
validationStrategy: {
|
|
50
|
+
patterns: {
|
|
51
|
+
forbiddenPatterns: [
|
|
52
|
+
/style\s*=\s*\{\{/,
|
|
53
|
+
/style\s*=\s*\{[^}]*\}/,
|
|
54
|
+
],
|
|
55
|
+
requiredPatterns: [
|
|
56
|
+
/function\s+Button|const\s+Button.*=|export\s+(default\s+)?function\s+Button/,
|
|
57
|
+
/className/,
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
timeout: 120000,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: 'react-proper-hooks',
|
|
65
|
+
category: 'react',
|
|
66
|
+
severity: 'critical',
|
|
67
|
+
tags: ['react', 'hooks', 'correctness'],
|
|
68
|
+
description: 'Ensure React hooks are not called conditionally',
|
|
69
|
+
prompt: 'Create a React component called UserProfile that uses useState to manage a "loading" state and useEffect to fetch user data. Make sure hooks are used correctly.',
|
|
70
|
+
validationStrategy: {
|
|
71
|
+
patterns: {
|
|
72
|
+
// Forbid hooks inside if statements or loops
|
|
73
|
+
forbiddenPatterns: [
|
|
74
|
+
/if\s*\([^)]*\)\s*\{[^}]*use(State|Effect|Context|Reducer|Callback|Memo|Ref)/,
|
|
75
|
+
],
|
|
76
|
+
requiredPatterns: [
|
|
77
|
+
/useState/,
|
|
78
|
+
/useEffect/,
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
llmJudge: {
|
|
82
|
+
enabled: true,
|
|
83
|
+
judgmentPrompt: `Evaluate whether this React component follows the Rules of Hooks:
|
|
84
|
+
1. Hooks must be called at the top level (not inside conditions, loops, or nested functions)
|
|
85
|
+
2. Hooks must be called in the same order every render
|
|
86
|
+
3. useState and useEffect should be used correctly
|
|
87
|
+
|
|
88
|
+
Return JSON: {"passed": boolean, "score": 0-1, "reasoning": "explanation", "violations": []}`,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
timeout: 120000,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
id: 'async-error-handling',
|
|
95
|
+
category: 'general',
|
|
96
|
+
severity: 'critical',
|
|
97
|
+
tags: ['async', 'error-handling', 'robustness'],
|
|
98
|
+
description: 'Ensure async functions have proper error handling',
|
|
99
|
+
prompt: 'Create an async function called fetchUserData that takes a userId parameter, makes an HTTP request to fetch user data, and returns the user object. Handle errors appropriately.',
|
|
100
|
+
validationStrategy: {
|
|
101
|
+
patterns: {
|
|
102
|
+
requiredPatterns: [
|
|
103
|
+
/async\s+function\s+fetchUserData|const\s+fetchUserData.*async/,
|
|
104
|
+
/try|catch|\.catch\(/,
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
llmJudge: {
|
|
108
|
+
enabled: true,
|
|
109
|
+
judgmentPrompt: `Evaluate the error handling in this async function:
|
|
110
|
+
1. Does it use try/catch or .catch()?
|
|
111
|
+
2. Are errors logged or re-thrown appropriately?
|
|
112
|
+
3. Does it prevent unhandled promise rejections?
|
|
113
|
+
|
|
114
|
+
Return JSON: {"passed": boolean, "score": 0-1, "reasoning": "explanation", "violations": []}`,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
timeout: 120000,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: 'typescript-explicit-return-types',
|
|
121
|
+
category: 'typescript',
|
|
122
|
+
severity: 'major',
|
|
123
|
+
tags: ['typescript', 'types', 'documentation'],
|
|
124
|
+
description: 'Functions should have explicit return type annotations',
|
|
125
|
+
prompt: 'Create a TypeScript function called calculateTotal that takes an array of numbers and returns their sum. Include explicit type annotations for parameters and return type.',
|
|
126
|
+
validationStrategy: {
|
|
127
|
+
patterns: {
|
|
128
|
+
requiredPatterns: [
|
|
129
|
+
/function\s+calculateTotal.*:\s*number|const\s+calculateTotal.*:\s*\([^)]*\)\s*=>\s*number/,
|
|
130
|
+
],
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
timeout: 120000,
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: 'typescript-strict-null-safety',
|
|
137
|
+
category: 'typescript',
|
|
138
|
+
severity: 'critical',
|
|
139
|
+
tags: ['typescript', 'null-safety', 'types', 'best-practices'],
|
|
140
|
+
description: 'Proper null/undefined handling with optional chaining and type guards',
|
|
141
|
+
prompt: 'Create a TypeScript function called getUserEmail that takes a user object (which might be null or undefined) and returns their email address. The user object has an optional email field. Handle all null/undefined cases safely without using type assertions (as or !).',
|
|
142
|
+
validationStrategy: {
|
|
143
|
+
patterns: {
|
|
144
|
+
forbiddenPatterns: [
|
|
145
|
+
/as\s+\w+/, // No type assertions
|
|
146
|
+
/!\s*\./, // No non-null assertions
|
|
147
|
+
/!\s*\[/, // No non-null assertions on arrays
|
|
148
|
+
],
|
|
149
|
+
requiredPatterns: [
|
|
150
|
+
/function\s+getUserEmail|const\s+getUserEmail/,
|
|
151
|
+
/\?\.|if\s*\(.*\)/, // Optional chaining or null checks
|
|
152
|
+
],
|
|
153
|
+
},
|
|
154
|
+
llmJudge: {
|
|
155
|
+
enabled: true,
|
|
156
|
+
judgmentPrompt: `Evaluate the null safety of this function:
|
|
157
|
+
1. Does it handle null/undefined user objects safely?
|
|
158
|
+
2. Does it handle undefined email fields?
|
|
159
|
+
3. Does it avoid type assertions (as, !) and use proper type guards or optional chaining?
|
|
160
|
+
4. Does it have a clear return type that reflects possible null/undefined?
|
|
161
|
+
|
|
162
|
+
Return JSON: {"passed": boolean, "score": 0-1, "reasoning": "explanation", "violations": []}`,
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
timeout: 120000,
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
id: 'no-console-logs-production',
|
|
169
|
+
category: 'general',
|
|
170
|
+
severity: 'minor',
|
|
171
|
+
tags: ['logging', 'production', 'cleanup'],
|
|
172
|
+
description: 'Production code should not contain console.log statements',
|
|
173
|
+
prompt: 'Create a utility function called processData that processes an array of items and returns the results. Include proper error handling but avoid console.log statements.',
|
|
174
|
+
validationStrategy: {
|
|
175
|
+
patterns: {
|
|
176
|
+
forbiddenPatterns: [/console\.log/],
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
timeout: 120000,
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
id: 'react-key-prop',
|
|
183
|
+
category: 'react',
|
|
184
|
+
severity: 'critical',
|
|
185
|
+
tags: ['react', 'lists', 'performance'],
|
|
186
|
+
description: 'React lists must include unique key props',
|
|
187
|
+
prompt: 'Create a React component called TodoList that renders a list of todo items from an array. Each todo has an id and text. Render them as list items.',
|
|
188
|
+
validationStrategy: {
|
|
189
|
+
patterns: {
|
|
190
|
+
requiredPatterns: [
|
|
191
|
+
/key\s*=\s*\{/,
|
|
192
|
+
/\.map\(/,
|
|
193
|
+
],
|
|
194
|
+
},
|
|
195
|
+
llmJudge: {
|
|
196
|
+
enabled: true,
|
|
197
|
+
judgmentPrompt: `Evaluate if the React component properly uses key props:
|
|
198
|
+
1. Are key props used when rendering lists?
|
|
199
|
+
2. Are the keys unique and stable?
|
|
200
|
+
3. Are keys based on item IDs rather than indexes?
|
|
201
|
+
|
|
202
|
+
Return JSON: {"passed": boolean, "score": 0-1, "reasoning": "explanation", "violations": []}`,
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
timeout: 120000,
|
|
206
|
+
},
|
|
207
|
+
];
|
|
208
|
+
exports.getDefaultScenarios = getDefaultScenarios;
|
|
209
|
+
//# sourceMappingURL=defaultScenarios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultScenarios.js","sourceRoot":"","sources":["../../src/config/defaultScenarios.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAII,MAAM,mBAAmB,GAAG,GAAmB,EAAE,CAAC;IACrD;QACE,EAAE,EAAE,mBAAmB;QACvB,QAAQ,EAAE,YAAY;QACtB,QAAQ,EAAE,UAAU;QACpB,IAAI,EAAE,CAAC,Y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|
|
6
|
+
* Load benchmark configuration
|
|
7
|
+
*/
|
|
8
|
+
export declare const loadConfig: (cwd?: string) => Promise<{
|
|
9
|
+
config: BenchmarkConfig;
|
|
10
|
+
scenarios: TestScenario[];
|
|
11
|
+
configPath: string | null;
|
|
12
|
+
}>;
|
|
13
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AA+FzD;;GAEG;AACH,eAAO,MAAM,UAAU,GAAU,MAAK,MAAsB,KAAG,OAAO,CAAC;IACrE,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,EAAE,YAAY,EAAE,CAAC;IAC1B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAiCA,CAAC"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Configuration file loader
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.loadConfig = void 0;
|
|
40
|
+
const fs = __importStar(require("fs"));
|
|
41
|
+
const path = __importStar(require("path"));
|
|
42
|
+
/**
|
|
43
|
+
* Find configuration file in project directory
|
|
44
|
+
*/
|
|
45
|
+
const findConfigFile = (cwd) => {
|
|
46
|
+
const possiblePaths = [
|
|
47
|
+
path.join(cwd, 'benchmarks.config.js'),
|
|
48
|
+
path.join(cwd, 'benchmarks.config.ts'),
|
|
49
|
+
path.join(cwd, 'benchmarks.config.mjs'),
|
|
50
|
+
path.join(cwd, 'benchmarks.config.cjs'),
|
|
51
|
+
];
|
|
52
|
+
for (const configPath of possiblePaths) {
|
|
53
|
+
if (fs.existsSync(configPath)) {
|
|
54
|
+
return configPath;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const packageJsonPath = path.join(cwd, 'package.json');
|
|
58
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
59
|
+
try {
|
|
60
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
61
|
+
if (packageJson.benchmarks) {
|
|
62
|
+
return packageJsonPath;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
// Ignore parse errors
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Load configuration from a file
|
|
73
|
+
*/
|
|
74
|
+
const loadConfigFromFile = async (configPath) => {
|
|
75
|
+
const ext = path.extname(configPath);
|
|
76
|
+
// Load from package.json
|
|
77
|
+
if (configPath.endsWith('package.json')) {
|
|
78
|
+
const packageJson = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
79
|
+
return packageJson.benchmarks;
|
|
80
|
+
}
|
|
81
|
+
// Load CommonJS or ESM
|
|
82
|
+
try {
|
|
83
|
+
// For .ts files, we'd need tsx or ts-node
|
|
84
|
+
if (ext === '.ts') {
|
|
85
|
+
console.warn('TypeScript config files require tsx to be installed. Falling back to default config.');
|
|
86
|
+
return {};
|
|
87
|
+
}
|
|
88
|
+
// Use dynamic import for .js, .mjs, .cjs
|
|
89
|
+
const configModule = await Promise.resolve(`${configPath}`).then(s => __importStar(require(s)));
|
|
90
|
+
return configModule.default || configModule;
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
throw new Error(`Failed to load config from ${configPath}: ${error}`);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Validate configuration
|
|
98
|
+
*/
|
|
99
|
+
const validateConfig = (config) => {
|
|
100
|
+
if (config.scenarios) {
|
|
101
|
+
for (const scenario of config.scenarios) {
|
|
102
|
+
if (!scenario.id) {
|
|
103
|
+
throw new Error('Scenario missing required field: id');
|
|
104
|
+
}
|
|
105
|
+
if (!scenario.category) {
|
|
106
|
+
throw new Error(`Scenario ${scenario.id} missing required field: category`);
|
|
107
|
+
}
|
|
108
|
+
if (!scenario.severity) {
|
|
109
|
+
throw new Error(`Scenario ${scenario.id} missing required field: severity`);
|
|
110
|
+
}
|
|
111
|
+
if (!scenario.description) {
|
|
112
|
+
throw new Error(`Scenario ${scenario.id} missing required field: description`);
|
|
113
|
+
}
|
|
114
|
+
if (!scenario.prompt) {
|
|
115
|
+
throw new Error(`Scenario ${scenario.id} missing required field: prompt`);
|
|
116
|
+
}
|
|
117
|
+
if (!scenario.validationStrategy) {
|
|
118
|
+
throw new Error(`Scenario ${scenario.id} missing required field: validationStrategy`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Load benchmark configuration
|
|
125
|
+
*/
|
|
126
|
+
const loadConfig = async (cwd = process.cwd()) => {
|
|
127
|
+
// Find config file
|
|
128
|
+
const configPath = findConfigFile(cwd);
|
|
129
|
+
if (!configPath) {
|
|
130
|
+
throw new Error('No config file found. Please create a benchmarks.config.js file with scenarios defined.');
|
|
131
|
+
}
|
|
132
|
+
let config = {};
|
|
133
|
+
// Load user config
|
|
134
|
+
try {
|
|
135
|
+
config = await loadConfigFromFile(configPath);
|
|
136
|
+
validateConfig(config);
|
|
137
|
+
console.log(`Loaded config from: ${configPath}`);
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
throw new Error(`Failed to load config: ${error}`);
|
|
141
|
+
}
|
|
142
|
+
// Ensure scenarios are defined
|
|
143
|
+
if (!config.scenarios || config.scenarios.length === 0) {
|
|
144
|
+
throw new Error('No scenarios defined in config. Please add scenarios to your config file.');
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
config,
|
|
148
|
+
scenarios: config.scenarios,
|
|
149
|
+
configPath,
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
exports.loadConfig = loadConfig;
|
|
153
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;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|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main evaluation engine
|
|
3
|
+
*/
|
|
4
|
+
import { AdapterType, TestScenario, EvaluationResult, EvaluationReport } from './types';
|
|
5
|
+
export interface EvaluatorOptions {
|
|
6
|
+
adapter: AdapterType;
|
|
7
|
+
model?: string;
|
|
8
|
+
workspaceRoot?: string;
|
|
9
|
+
defaultTimeout?: number | null;
|
|
10
|
+
verbose?: boolean;
|
|
11
|
+
saveBaseline?: boolean;
|
|
12
|
+
compareBaseline?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare class Evaluator {
|
|
15
|
+
private adapter;
|
|
16
|
+
private workspaceRoot;
|
|
17
|
+
private baselineManager;
|
|
18
|
+
private options;
|
|
19
|
+
constructor(options: EvaluatorOptions);
|
|
20
|
+
/**
|
|
21
|
+
* Create adapter instance based on type
|
|
22
|
+
*/
|
|
23
|
+
private createAdapter;
|
|
24
|
+
/**
|
|
25
|
+
* Check if adapter is available
|
|
26
|
+
*/
|
|
27
|
+
checkAdapterAvailability(): Promise<boolean>;
|
|
28
|
+
/**
|
|
29
|
+
* Filter scenarios based on criteria
|
|
30
|
+
*/
|
|
31
|
+
filterScenarios(scenarios: TestScenario[], filters: {
|
|
32
|
+
scenarioPattern?: string;
|
|
33
|
+
category?: string;
|
|
34
|
+
tags?: string[];
|
|
35
|
+
}): TestScenario[];
|
|
36
|
+
/**
|
|
37
|
+
* Evaluate a single scenario
|
|
38
|
+
*/
|
|
39
|
+
evaluateScenario(scenario: TestScenario): Promise<EvaluationResult>;
|
|
40
|
+
/**
|
|
41
|
+
* Evaluate multiple scenarios
|
|
42
|
+
*/
|
|
43
|
+
evaluate(scenarios: TestScenario[]): Promise<EvaluationReport>;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=evaluator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../src/evaluator.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,WAAW,EAEX,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAEjB,MAAM,SAAS,CAAC;AASjB,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,WAAW,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,qBAAa,SAAS;IACpB,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,OAAO,CAAmB;gBAEtB,OAAO,EAAE,gBAAgB;IASrC;;OAEG;IACH,OAAO,CAAC,aAAa;IAWrB;;OAEG;IACG,wBAAwB,IAAI,OAAO,CAAC,OAAO,CAAC;IAIlD;;OAEG;IACH,eAAe,CACb,SAAS,EAAE,YAAY,EAAE,EACzB,OAAO,EAAE;QACP,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;KACjB,GACA,YAAY,EAAE;IA0BjB;;OAEG;IACG,gBAAgB,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA8IzE;;OAEG;IACG,QAAQ,CAAC,SAAS,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAuDrE"}
|