coding-agent-benchmarks 0.1.2 → 0.1.4
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/README.md +38 -1
- package/dist/User.d.ts +10 -0
- package/dist/User.d.ts.map +1 -0
- package/dist/User.js +3 -0
- package/dist/User.js.map +1 -0
- package/dist/adapters/claudeCodeCLI.d.ts +10 -1
- package/dist/adapters/claudeCodeCLI.d.ts.map +1 -1
- package/dist/adapters/claudeCodeCLI.js +86 -25
- package/dist/adapters/claudeCodeCLI.js.map +1 -1
- package/dist/adapters/copilotCLI.d.ts +11 -2
- package/dist/adapters/copilotCLI.d.ts.map +1 -1
- package/dist/adapters/copilotCLI.js +99 -36
- package/dist/adapters/copilotCLI.js.map +1 -1
- package/dist/evaluator.d.ts +20 -2
- package/dist/evaluator.d.ts.map +1 -1
- package/dist/evaluator.js +58 -44
- package/dist/evaluator.js.map +1 -1
- package/dist/reporter.d.ts +35 -0
- package/dist/reporter.d.ts.map +1 -0
- package/dist/reporter.js +232 -0
- package/dist/reporter.js.map +1 -0
- package/dist/runner.js +75 -63
- package/dist/runner.js.map +1 -1
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/gitUtils.d.ts +7 -6
- package/dist/utils/gitUtils.d.ts.map +1 -1
- package/dist/utils/gitUtils.js +27 -24
- package/dist/utils/gitUtils.js.map +1 -1
- package/package.json +21 -4
package/README.md
CHANGED
|
@@ -93,7 +93,7 @@ module.exports = {
|
|
|
93
93
|
validationStrategy: {
|
|
94
94
|
patterns: {
|
|
95
95
|
forbiddenPatterns: [/:\s*any\b/],
|
|
96
|
-
requiredPatterns: [/interface\s+User/],
|
|
96
|
+
requiredPatterns: [/interface\s+User\b/],
|
|
97
97
|
},
|
|
98
98
|
},
|
|
99
99
|
timeout: 120000,
|
|
@@ -298,6 +298,43 @@ Test LLM judge with a custom prompt (for debugging).
|
|
|
298
298
|
**Options:**
|
|
299
299
|
- `--model <model>`: LLM model to use
|
|
300
300
|
|
|
301
|
+
## Understanding Output
|
|
302
|
+
|
|
303
|
+
When running evaluations, each scenario displays a live status that updates as it progresses:
|
|
304
|
+
|
|
305
|
+
```
|
|
306
|
+
Evaluating 3 scenario(s)...
|
|
307
|
+
|
|
308
|
+
✓ [1/3] typescript-no-any PASS (score: 1.00) 14.8s
|
|
309
|
+
✗ [2/3] react-inline-styles FAIL (score: 0.60) 22.1s
|
|
310
|
+
○ [3/3] async-error-handling SKIP (error) 2m 5s
|
|
311
|
+
|
|
312
|
+
============================================================
|
|
313
|
+
EVALUATION SUMMARY
|
|
314
|
+
============================================================
|
|
315
|
+
Total scenarios: 3
|
|
316
|
+
Passed: 1
|
|
317
|
+
Failed: 1
|
|
318
|
+
Skipped: 1
|
|
319
|
+
...
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### Status Indicators
|
|
323
|
+
|
|
324
|
+
| Status | Symbol | Meaning |
|
|
325
|
+
|--------|--------|---------|
|
|
326
|
+
| **PASS** | ✓ | Scenario passed validation (score ≥ 0.8, no violations) |
|
|
327
|
+
| **FAIL** | ✗ | Scenario was evaluated but didn't pass (low score or violations) |
|
|
328
|
+
| **SKIP** | ○ | Scenario couldn't be evaluated due to an error |
|
|
329
|
+
|
|
330
|
+
### Common Causes for SKIP
|
|
331
|
+
|
|
332
|
+
- **Timeout**: Code generation exceeded the configured timeout
|
|
333
|
+
- **Adapter failure**: The CLI (Copilot or Claude Code) crashed or returned an error
|
|
334
|
+
- **File system errors**: Couldn't read context files or write generated code
|
|
335
|
+
|
|
336
|
+
> **Note**: In interactive terminals, you'll see a spinner animation (⠋) while scenarios are running. In CI/non-TTY environments, output falls back to simple line-by-line logging.
|
|
337
|
+
|
|
301
338
|
## Programmatic Usage
|
|
302
339
|
|
|
303
340
|
You can also use the framework programmatically:
|
package/dist/User.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"User.d.ts","sourceRoot":"","sources":["../src/User.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC"}
|
package/dist/User.js
ADDED
package/dist/User.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"User.js","sourceRoot":"","sources":["../src/User.ts"],"names":[],"mappings":""}
|
|
@@ -2,14 +2,23 @@
|
|
|
2
2
|
* Claude Code CLI Adapter
|
|
3
3
|
*/
|
|
4
4
|
import { CodeGenerationAdapter } from '../types';
|
|
5
|
+
export interface ClaudeCodeCLIAdapterOptions {
|
|
6
|
+
workspaceRoot?: string;
|
|
7
|
+
model?: string;
|
|
8
|
+
}
|
|
5
9
|
export declare class ClaudeCodeCLIAdapter implements CodeGenerationAdapter {
|
|
6
10
|
readonly type: "claude-code";
|
|
7
11
|
private workspaceRoot;
|
|
8
|
-
|
|
12
|
+
private model;
|
|
13
|
+
constructor(options?: ClaudeCodeCLIAdapterOptions);
|
|
9
14
|
/**
|
|
10
15
|
* Check if Claude Code CLI is available
|
|
11
16
|
*/
|
|
12
17
|
checkAvailability(): Promise<boolean>;
|
|
18
|
+
/**
|
|
19
|
+
* Build the full prompt with context files
|
|
20
|
+
*/
|
|
21
|
+
private buildPrompt;
|
|
13
22
|
/**
|
|
14
23
|
* Generate code using Claude Code CLI
|
|
15
24
|
* @param timeout Timeout in milliseconds, or null for no timeout
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claudeCodeCLI.d.ts","sourceRoot":"","sources":["../../src/adapters/claudeCodeCLI.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"claudeCodeCLI.d.ts","sourceRoot":"","sources":["../../src/adapters/claudeCodeCLI.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAIjD,MAAM,WAAW,2BAA2B;IAC1C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAID,qBAAa,oBAAqB,YAAW,qBAAqB;IAChE,SAAgB,IAAI,EAAG,aAAa,CAAU;IAC9C,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,KAAK,CAAS;gBAEV,OAAO,CAAC,EAAE,2BAA2B;IAKjD;;OAEG;IACG,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC;IAgB3C;;OAEG;IACH,OAAO,CAAC,WAAW;IA8BnB;;;OAGG;IACG,QAAQ,CACZ,MAAM,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,EAChC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GACtB,OAAO,CAAC,MAAM,EAAE,CAAC;CA8ErB"}
|
|
@@ -2,15 +2,52 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Claude Code CLI Adapter
|
|
4
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
|
+
})();
|
|
5
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
39
|
exports.ClaudeCodeCLIAdapter = void 0;
|
|
7
40
|
const child_process_1 = require("child_process");
|
|
41
|
+
const fs = __importStar(require("fs"));
|
|
42
|
+
const path = __importStar(require("path"));
|
|
8
43
|
const gitUtils_1 = require("../utils/gitUtils");
|
|
9
44
|
const workspaceUtils_1 = require("../utils/workspaceUtils");
|
|
45
|
+
const DEFAULT_MODEL = 'sonnet';
|
|
10
46
|
class ClaudeCodeCLIAdapter {
|
|
11
|
-
constructor(
|
|
47
|
+
constructor(options) {
|
|
12
48
|
this.type = 'claude-code';
|
|
13
|
-
this.workspaceRoot = (0, workspaceUtils_1.resolveWorkspaceRoot)(workspaceRoot);
|
|
49
|
+
this.workspaceRoot = (0, workspaceUtils_1.resolveWorkspaceRoot)(options?.workspaceRoot);
|
|
50
|
+
this.model = options?.model || DEFAULT_MODEL;
|
|
14
51
|
}
|
|
15
52
|
/**
|
|
16
53
|
* Check if Claude Code CLI is available
|
|
@@ -29,36 +66,45 @@ class ClaudeCodeCLIAdapter {
|
|
|
29
66
|
});
|
|
30
67
|
}
|
|
31
68
|
/**
|
|
32
|
-
*
|
|
33
|
-
* @param timeout Timeout in milliseconds, or null for no timeout
|
|
69
|
+
* Build the full prompt with context files
|
|
34
70
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
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;
|
|
71
|
+
buildPrompt(prompt, contextFiles) {
|
|
72
|
+
const parts = [];
|
|
45
73
|
if (contextFiles && contextFiles.length > 0) {
|
|
46
74
|
const contexts = (0, workspaceUtils_1.readContextFiles)(this.workspaceRoot, contextFiles);
|
|
47
75
|
if (contexts.length > 0) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
.
|
|
51
|
-
|
|
76
|
+
parts.push("# Reference Files\n");
|
|
77
|
+
const contextContent = contexts
|
|
78
|
+
.map((ctx) => {
|
|
79
|
+
const ext = path.extname(ctx.path).slice(1) || "typescript";
|
|
80
|
+
return `### ${ctx.path}\n\`\`\`${ext}\n${ctx.content}\n\`\`\``;
|
|
81
|
+
})
|
|
82
|
+
.join("\n\n");
|
|
83
|
+
parts.push(contextContent);
|
|
84
|
+
parts.push("\n---\n");
|
|
52
85
|
}
|
|
53
86
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
87
|
+
parts.push("# Task\n");
|
|
88
|
+
parts.push(prompt);
|
|
89
|
+
parts.push("\n\nCreate/update the necessary file(s). Do not output code to the terminal - write it to files instead.");
|
|
90
|
+
return parts.join("\n");
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Generate code using Claude Code CLI
|
|
94
|
+
* @param timeout Timeout in milliseconds, or null for no timeout
|
|
95
|
+
*/
|
|
96
|
+
async generate(prompt, contextFiles, timeout) {
|
|
97
|
+
const fullPrompt = this.buildPrompt(prompt, contextFiles);
|
|
98
|
+
// Capture git status before generation
|
|
99
|
+
const statusBefore = (0, gitUtils_1.getGitStatusPorcelain)(this.workspaceRoot);
|
|
100
|
+
// Write prompt to temp file and pipe via stdin (matches @copilot-evals pattern)
|
|
57
101
|
return new Promise((resolve, reject) => {
|
|
58
|
-
const
|
|
102
|
+
const tempFile = path.join(this.workspaceRoot, '.claude-eval-prompt.txt');
|
|
103
|
+
fs.writeFileSync(tempFile, fullPrompt, 'utf8');
|
|
104
|
+
const command = `cat "${tempFile}" | claude --model ${this.model} --dangerously-skip-permissions --disallowed-tools 'Bash(rm)' --disallowed-tools 'Bash(git push)' --disallowed-tools 'Bash(git commit)'`;
|
|
105
|
+
const proc = (0, child_process_1.spawn)('sh', ['-c', command], {
|
|
59
106
|
cwd: this.workspaceRoot,
|
|
60
107
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
61
|
-
shell: true,
|
|
62
108
|
});
|
|
63
109
|
let stdout = '';
|
|
64
110
|
let stderr = '';
|
|
@@ -80,13 +126,21 @@ class ClaudeCodeCLIAdapter {
|
|
|
80
126
|
if (timeoutHandle) {
|
|
81
127
|
clearTimeout(timeoutHandle);
|
|
82
128
|
}
|
|
129
|
+
// Clean up temp file
|
|
130
|
+
try {
|
|
131
|
+
fs.unlinkSync(tempFile);
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
// Ignore cleanup errors
|
|
135
|
+
}
|
|
83
136
|
if (code !== 0) {
|
|
84
137
|
reject(new Error(`Claude Code CLI exited with code ${code}\nStderr: ${stderr}`));
|
|
85
138
|
return;
|
|
86
139
|
}
|
|
87
|
-
// Get
|
|
140
|
+
// Get files changed during generation (diff before/after)
|
|
88
141
|
try {
|
|
89
|
-
const
|
|
142
|
+
const statusAfter = (0, gitUtils_1.getGitStatusPorcelain)(this.workspaceRoot);
|
|
143
|
+
const changedFiles = (0, gitUtils_1.getChangedFilesDiff)(statusBefore, statusAfter);
|
|
90
144
|
resolve(changedFiles);
|
|
91
145
|
}
|
|
92
146
|
catch (error) {
|
|
@@ -97,6 +151,13 @@ class ClaudeCodeCLIAdapter {
|
|
|
97
151
|
if (timeoutHandle) {
|
|
98
152
|
clearTimeout(timeoutHandle);
|
|
99
153
|
}
|
|
154
|
+
// Clean up temp file
|
|
155
|
+
try {
|
|
156
|
+
fs.unlinkSync(tempFile);
|
|
157
|
+
}
|
|
158
|
+
catch {
|
|
159
|
+
// Ignore cleanup errors
|
|
160
|
+
}
|
|
100
161
|
reject(new Error(`Failed to spawn Claude Code CLI: ${error}`));
|
|
101
162
|
});
|
|
102
163
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claudeCodeCLI.js","sourceRoot":"","sources":["../../src/adapters/claudeCodeCLI.ts"],"names":[],"mappings":";AAAA;;GAEG
|
|
1
|
+
{"version":3,"file":"claudeCodeCLI.js","sourceRoot":"","sources":["../../src/adapters/claudeCodeCLI.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iDAAsC;AACtC,uCAAyB;AACzB,2CAA6B;AAE7B,gDAA+E;AAC/E,4DAAiF;AAOjF,MAAM,aAAa,GAAG,QAAQ,CAAC;AAE/B,MAAa,oBAAoB;IAK/B,YAAY,OAAqC;QAJjC,SAAI,GAAG,aAAsB,CAAC;QAK5C,IAAI,CAAC,aAAa,GAAG,IAAA,qCAAoB,EAAC,OAAO,EAAE,aAAa,CAAC,CAAC;QAClE,IAAI,CAAC,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,aAAa,CAAC;IAC/C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,iBAAiB;QACrB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,MAAM,IAAI,GAAG,IAAA,qBAAK,EAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,EAAE;gBACtC,KAAK,EAAE,MAAM;aACd,CAAC,CA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,KAAK,EAAE,EAAE;gBACzB,IAAI,aAAa,EAAE,CAAC;oBAClB,YAAY,CAAC,aAAa,CAAC,CAAC;gBAC9B,CAAC;gBACD,qBAAqB;gBACrB,IAAI,CAAC;oBACH,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;gBAC1B,CAAC;gBAAC,MAAM,CAAC;oBACP,wBAAwB;gBAC1B,CAAC;gBACD,MAAM,CAAC,IAAI,KAAK,CAAC,oCAAoC,KAAK,EAAE,CAAC,CAAC,CAAC;YACjE,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AApJD,oDAoJC"}
|
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GitHub Copilot CLI Adapter
|
|
3
3
|
*/
|
|
4
|
-
import { CodeGenerationAdapter } from
|
|
4
|
+
import { CodeGenerationAdapter } from "../types";
|
|
5
|
+
export interface CopilotCLIAdapterOptions {
|
|
6
|
+
workspaceRoot?: string;
|
|
7
|
+
model?: string;
|
|
8
|
+
}
|
|
5
9
|
export declare class CopilotCLIAdapter implements CodeGenerationAdapter {
|
|
6
10
|
readonly type: "copilot";
|
|
7
11
|
private workspaceRoot;
|
|
8
|
-
|
|
12
|
+
private model;
|
|
13
|
+
constructor(options?: CopilotCLIAdapterOptions);
|
|
9
14
|
/**
|
|
10
15
|
* Check if GitHub Copilot CLI is available
|
|
11
16
|
*/
|
|
12
17
|
checkAvailability(): Promise<boolean>;
|
|
18
|
+
/**
|
|
19
|
+
* Build the full prompt with context files
|
|
20
|
+
*/
|
|
21
|
+
private buildPrompt;
|
|
13
22
|
/**
|
|
14
23
|
* Generate code using GitHub Copilot CLI
|
|
15
24
|
* @param timeout Timeout in milliseconds, or null for no timeout
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copilotCLI.d.ts","sourceRoot":"","sources":["../../src/adapters/copilotCLI.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"copilotCLI.d.ts","sourceRoot":"","sources":["../../src/adapters/copilotCLI.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAOjD,MAAM,WAAW,wBAAwB;IACvC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAID,qBAAa,iBAAkB,YAAW,qBAAqB;IAC7D,SAAgB,IAAI,EAAG,SAAS,CAAU;IAC1C,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,KAAK,CAAS;gBAEV,OAAO,CAAC,EAAE,wBAAwB;IAK9C;;OAEG;IACG,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC;IAgB3C;;OAEG;IACH,OAAO,CAAC,WAAW;IA8BnB;;;OAGG;IACG,QAAQ,CACZ,MAAM,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,EAChC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GACtB,OAAO,CAAC,MAAM,EAAE,CAAC;CAkFrB"}
|
|
@@ -2,99 +2,162 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* GitHub Copilot CLI Adapter
|
|
4
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
|
+
})();
|
|
5
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
39
|
exports.CopilotCLIAdapter = void 0;
|
|
7
40
|
const child_process_1 = require("child_process");
|
|
41
|
+
const fs = __importStar(require("fs"));
|
|
42
|
+
const path = __importStar(require("path"));
|
|
8
43
|
const gitUtils_1 = require("../utils/gitUtils");
|
|
9
44
|
const workspaceUtils_1 = require("../utils/workspaceUtils");
|
|
45
|
+
const DEFAULT_MODEL = "claude-sonnet-4.5";
|
|
10
46
|
class CopilotCLIAdapter {
|
|
11
|
-
constructor(
|
|
12
|
-
this.type =
|
|
13
|
-
this.workspaceRoot = (0, workspaceUtils_1.resolveWorkspaceRoot)(workspaceRoot);
|
|
47
|
+
constructor(options) {
|
|
48
|
+
this.type = "copilot";
|
|
49
|
+
this.workspaceRoot = (0, workspaceUtils_1.resolveWorkspaceRoot)(options?.workspaceRoot);
|
|
50
|
+
this.model = options?.model || DEFAULT_MODEL;
|
|
14
51
|
}
|
|
15
52
|
/**
|
|
16
53
|
* Check if GitHub Copilot CLI is available
|
|
17
54
|
*/
|
|
18
55
|
async checkAvailability() {
|
|
19
56
|
return new Promise((resolve) => {
|
|
20
|
-
const proc = (0, child_process_1.spawn)(
|
|
21
|
-
stdio:
|
|
57
|
+
const proc = (0, child_process_1.spawn)("which", ["copilot"], {
|
|
58
|
+
stdio: "pipe",
|
|
22
59
|
});
|
|
23
|
-
proc.on(
|
|
60
|
+
proc.on("close", (code) => {
|
|
24
61
|
resolve(code === 0);
|
|
25
62
|
});
|
|
26
|
-
proc.on(
|
|
63
|
+
proc.on("error", () => {
|
|
27
64
|
resolve(false);
|
|
28
65
|
});
|
|
29
66
|
});
|
|
30
67
|
}
|
|
31
68
|
/**
|
|
32
|
-
*
|
|
33
|
-
* @param timeout Timeout in milliseconds, or null for no timeout
|
|
69
|
+
* Build the full prompt with context files
|
|
34
70
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
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;
|
|
71
|
+
buildPrompt(prompt, contextFiles) {
|
|
72
|
+
const parts = [];
|
|
45
73
|
if (contextFiles && contextFiles.length > 0) {
|
|
46
74
|
const contexts = (0, workspaceUtils_1.readContextFiles)(this.workspaceRoot, contextFiles);
|
|
47
75
|
if (contexts.length > 0) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
.
|
|
51
|
-
|
|
76
|
+
parts.push("# Reference Files\n");
|
|
77
|
+
const contextContent = contexts
|
|
78
|
+
.map((ctx) => {
|
|
79
|
+
const ext = path.extname(ctx.path).slice(1) || "typescript";
|
|
80
|
+
return `### ${ctx.path}\n\`\`\`${ext}\n${ctx.content}\n\`\`\``;
|
|
81
|
+
})
|
|
82
|
+
.join("\n\n");
|
|
83
|
+
parts.push(contextContent);
|
|
84
|
+
parts.push("\n---\n");
|
|
52
85
|
}
|
|
53
86
|
}
|
|
54
|
-
|
|
87
|
+
parts.push("# Task\n");
|
|
88
|
+
parts.push(prompt);
|
|
89
|
+
parts.push("\n\nCreate/update the necessary file(s). Do not output code to the terminal - write it to files instead.");
|
|
90
|
+
return parts.join("\n");
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Generate code using GitHub Copilot CLI
|
|
94
|
+
* @param timeout Timeout in milliseconds, or null for no timeout
|
|
95
|
+
*/
|
|
96
|
+
async generate(prompt, contextFiles, timeout) {
|
|
97
|
+
const fullPrompt = this.buildPrompt(prompt, contextFiles);
|
|
98
|
+
// Capture git status before generation
|
|
99
|
+
const statusBefore = (0, gitUtils_1.getGitStatusPorcelain)(this.workspaceRoot);
|
|
100
|
+
// Write prompt to temp file and pipe via stdin (matches @copilot-evals pattern)
|
|
55
101
|
return new Promise((resolve, reject) => {
|
|
56
|
-
const
|
|
102
|
+
const tempFile = path.join(this.workspaceRoot, '.copilot-eval-prompt.txt');
|
|
103
|
+
fs.writeFileSync(tempFile, fullPrompt, "utf8");
|
|
104
|
+
const command = `cat "${tempFile}" | copilot --model ${this.model} --allow-all-tools --deny-tool 'shell(rm)' --deny-tool 'shell(git push)' --deny-tool 'shell(git commit)'`;
|
|
105
|
+
const proc = (0, child_process_1.spawn)("sh", ["-c", command], {
|
|
57
106
|
cwd: this.workspaceRoot,
|
|
58
|
-
stdio: [
|
|
59
|
-
shell: true,
|
|
107
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
60
108
|
});
|
|
61
|
-
let stdout =
|
|
62
|
-
let stderr =
|
|
63
|
-
proc.stdout?.on(
|
|
109
|
+
let stdout = "";
|
|
110
|
+
let stderr = "";
|
|
111
|
+
proc.stdout?.on("data", (data) => {
|
|
64
112
|
stdout += data.toString();
|
|
65
113
|
});
|
|
66
|
-
proc.stderr?.on(
|
|
114
|
+
proc.stderr?.on("data", (data) => {
|
|
67
115
|
stderr += data.toString();
|
|
68
116
|
});
|
|
69
117
|
// Set timeout only if specified (null/undefined = no timeout)
|
|
70
118
|
let timeoutHandle = null;
|
|
71
119
|
if (timeout !== null && timeout !== undefined) {
|
|
72
120
|
timeoutHandle = setTimeout(() => {
|
|
73
|
-
proc.kill(
|
|
121
|
+
proc.kill("SIGTERM");
|
|
74
122
|
reject(new Error(`Copilot CLI timed out after ${timeout}ms`));
|
|
75
123
|
}, timeout);
|
|
76
124
|
}
|
|
77
|
-
proc.on(
|
|
125
|
+
proc.on("close", (code) => {
|
|
78
126
|
if (timeoutHandle) {
|
|
79
127
|
clearTimeout(timeoutHandle);
|
|
80
128
|
}
|
|
129
|
+
// Clean up temp file
|
|
130
|
+
try {
|
|
131
|
+
fs.unlinkSync(tempFile);
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
// Ignore cleanup errors
|
|
135
|
+
}
|
|
81
136
|
if (code !== 0) {
|
|
82
137
|
reject(new Error(`Copilot CLI exited with code ${code}\nStderr: ${stderr}`));
|
|
83
138
|
return;
|
|
84
139
|
}
|
|
85
|
-
// Get
|
|
140
|
+
// Get files changed during generation (diff before/after)
|
|
86
141
|
try {
|
|
87
|
-
const
|
|
142
|
+
const statusAfter = (0, gitUtils_1.getGitStatusPorcelain)(this.workspaceRoot);
|
|
143
|
+
const changedFiles = (0, gitUtils_1.getChangedFilesDiff)(statusBefore, statusAfter);
|
|
88
144
|
resolve(changedFiles);
|
|
89
145
|
}
|
|
90
146
|
catch (error) {
|
|
91
147
|
reject(new Error(`Failed to get changed files: ${error}`));
|
|
92
148
|
}
|
|
93
149
|
});
|
|
94
|
-
proc.on(
|
|
150
|
+
proc.on("error", (error) => {
|
|
95
151
|
if (timeoutHandle) {
|
|
96
152
|
clearTimeout(timeoutHandle);
|
|
97
153
|
}
|
|
154
|
+
// Clean up temp file
|
|
155
|
+
try {
|
|
156
|
+
fs.unlinkSync(tempFile);
|
|
157
|
+
}
|
|
158
|
+
catch {
|
|
159
|
+
// Ignore cleanup errors
|
|
160
|
+
}
|
|
98
161
|
reject(new Error(`Failed to spawn Copilot CLI: ${error}`));
|
|
99
162
|
});
|
|
100
163
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copilotCLI.js","sourceRoot":"","sources":["../../src/adapters/copilotCLI.ts"],"names":[],"mappings":";AAAA;;GAEG
|
|
1
|
+
{"version":3,"file":"copilotCLI.js","sourceRoot":"","sources":["../../src/adapters/copilotCLI.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iDAAsC;AACtC,uCAAyB;AACzB,2CAA6B;AAE7B,gDAA+E;AAC/E,4DAGiC;AAOjC,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAE1C,MAAa,iBAAiB;IAK5B,YAAY,OAAkC;QAJ9B,SAAI,GAAG,SAAkB,CAAC;QAKxC,IAAI,CAAC,aAAa,GAAG,IAAA,qCAAoB,EAAC,OAAO,EAAE,aAAa,CAAC,CAAC;QAClE,IAAI,CAAC,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,aAAa,CAAC;IAC/C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,iBAAiB;QACrB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,MAAM,IAAI,GAAG,IAAA,qBAAK,EAAC,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE;gBACvC,KAAK,EAAE,MAAM;aACd,CAAC,CAAC;YAEH,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;gBACxB,OAAO,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC;YACtB,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;gBACpB,OAAO,CAAC,KAAK,CAAC,CAAC;YACjB,CAAC,CAAC,CAAC;QACL,CAAC,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KAAK,CAAC,gCAAgC,KAAK,EAAE,CAAC,CAAC,CAAC;YAC7D,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAxJD,8CAwJC"}
|
package/dist/evaluator.d.ts
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Main evaluation engine
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { EventEmitter } from "events";
|
|
5
|
+
import { AdapterType, TestScenario, EvaluationResult, EvaluationReport } from "./types";
|
|
6
|
+
/**
|
|
7
|
+
* Events emitted by the Evaluator during execution
|
|
8
|
+
*/
|
|
9
|
+
export interface EvaluatorEvents {
|
|
10
|
+
"evaluation:start": (scenarios: TestScenario[]) => void;
|
|
11
|
+
"scenario:start": (scenarioId: string, scenario: TestScenario) => void;
|
|
12
|
+
"scenario:generating": (scenarioId: string) => void;
|
|
13
|
+
"scenario:validating": (scenarioId: string) => void;
|
|
14
|
+
"scenario:complete": (scenarioId: string, result: EvaluationResult) => void;
|
|
15
|
+
"evaluation:complete": (report: EvaluationReport) => void;
|
|
16
|
+
log: (message: string) => void;
|
|
17
|
+
}
|
|
5
18
|
export interface EvaluatorOptions {
|
|
6
19
|
adapter: AdapterType;
|
|
7
20
|
model?: string;
|
|
@@ -11,12 +24,17 @@ export interface EvaluatorOptions {
|
|
|
11
24
|
saveBaseline?: boolean;
|
|
12
25
|
compareBaseline?: boolean;
|
|
13
26
|
}
|
|
14
|
-
export declare class Evaluator {
|
|
27
|
+
export declare class Evaluator extends EventEmitter {
|
|
15
28
|
private adapter;
|
|
16
29
|
private workspaceRoot;
|
|
17
30
|
private baselineManager;
|
|
18
31
|
private options;
|
|
19
32
|
constructor(options: EvaluatorOptions);
|
|
33
|
+
/**
|
|
34
|
+
* Type-safe event emitter methods
|
|
35
|
+
*/
|
|
36
|
+
on<K extends keyof EvaluatorEvents>(event: K, listener: EvaluatorEvents[K]): this;
|
|
37
|
+
emit<K extends keyof EvaluatorEvents>(event: K, ...args: Parameters<EvaluatorEvents[K]>): boolean;
|
|
20
38
|
/**
|
|
21
39
|
* Create adapter instance based on type
|
|
22
40
|
*/
|
package/dist/evaluator.d.ts.map
CHANGED
|
@@ -1 +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,
|
|
1
|
+
{"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../src/evaluator.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EACL,WAAW,EAEX,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAEjB,MAAM,SAAS,CAAC;AASjB;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,kBAAkB,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;IACxD,gBAAgB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,KAAK,IAAI,CAAC;IACvE,qBAAqB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACpD,qBAAqB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACpD,mBAAmB,EAAE,CAAC,UAAU,E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