(targetPath, options = {})
| 451 | } |
| 452 | |
| 453 | export async function initializeBenchmark(targetPath, options = {}) { |
| 454 | const target = await resolveTarget(targetPath); |
| 455 | const config = await createStarterBenchmarkConfig(target, options); |
| 456 | const outputPath = path.resolve(options.outputPath || defaultBenchmarkConfigPath(target)); |
| 457 | await writeJson(outputPath, config); |
| 458 | |
| 459 | const payload = { |
| 460 | kind: "benchmark-template-init", |
| 461 | createdAt: new Date().toISOString(), |
| 462 | target: { |
| 463 | ...target, |
| 464 | relativePath: relativePath(process.cwd(), target.path), |
| 465 | }, |
| 466 | configPath: outputPath, |
| 467 | scenarioCount: config.scenarios.length, |
| 468 | notes: config.notes, |
| 469 | setupQuestions: config.setupQuestions || [], |
| 470 | nextSteps: [ |
| 471 | `Edit ${formatCommandPath(outputPath)} so workspace.sourcePath, scenarios, and verifiers match your real workflow.`, |
| 472 | `Run the benchmark with: plugin-eval benchmark ${formatCommandPath(target.path)} --config ${formatCommandPath(outputPath)}`, |
| 473 | "The benchmark result will be written under .plugin-eval/runs/<timestamp>/benchmark-run.json.", |
| 474 | ], |
| 475 | workflowGuide: await buildWorkflowGuide(target.path, { |
| 476 | goal: "benchmark", |
| 477 | }), |
| 478 | artifact: createArtifact({ |
| 479 | id: "benchmark-template", |
| 480 | type: "benchmark-template", |
| 481 | label: "Benchmark template", |
| 482 | description: "Starter benchmark config for Codex CLI execution.", |
| 483 | path: outputPath, |
| 484 | }), |
| 485 | }; |
| 486 | payload.nextAction = createBenchmarkTemplateNextAction(payload); |
| 487 | return payload; |
| 488 | } |
| 489 | |
| 490 | export async function runBenchmark(targetPath, options = {}) { |
| 491 | const target = await resolveTarget(targetPath); |
no test coverage detected