@grekt/cli 6.43.0-beta.3 → 6.43.0-beta.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.
Files changed (2) hide show
  1. package/dist/index.js +17 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -104498,18 +104498,30 @@ async function runViaCli(mode, config) {
104498
104498
  const promptfooConfig = assemblePromptfooConfig(config, promptPath);
104499
104499
  writeFileSync2(configPath, JSON.stringify(promptfooConfig, null, 2));
104500
104500
  const cmd = getCommand(mode);
104501
- const result = Bun.spawnSync([...cmd, "eval", "--config", configPath, "--output", outputPath, "--no-cache"], { stdout: "pipe", stderr: "pipe" });
104502
- if (result.exitCode !== 0) {
104503
- const stderr = result.stderr.toString();
104501
+ const proc2 = Bun.spawn([...cmd, "eval", "--config", configPath, "--output", outputPath, "--no-cache"], { stdout: "pipe", stderr: "pipe" });
104502
+ const exitCode = await proc2.exited;
104503
+ if (exitCode !== 0) {
104504
+ const stderr = await new Response(proc2.stderr).text();
104504
104505
  throw new Error(`promptfoo eval failed: ${stderr}`);
104505
104506
  }
104506
104507
  const output = JSON.parse(readFileSync2(outputPath, "utf-8"));
104507
- const results = output.results ?? [];
104508
+ const results = extractResultsArray(output);
104508
104509
  return extractFailures(results);
104509
104510
  } finally {
104510
104511
  rmSync2(tempDir, { recursive: true, force: true });
104511
104512
  }
104512
104513
  }
104514
+ function extractResultsArray(output) {
104515
+ if (Array.isArray(output.results))
104516
+ return output.results;
104517
+ const nested = output.results;
104518
+ if (nested && Array.isArray(nested.results))
104519
+ return nested.results;
104520
+ const table = nested?.table;
104521
+ if (table && Array.isArray(table.body))
104522
+ return table.body;
104523
+ return [];
104524
+ }
104513
104525
 
104514
104526
  // src/eval/engine-resolver.ts
104515
104527
  var AVAILABLE_ENGINES = [
@@ -104974,7 +104986,7 @@ var whoamiCommand = new Command("whoami").description("Show current user").actio
104974
104986
  // package.json
104975
104987
  var package_default = {
104976
104988
  name: "@grekt/cli",
104977
- version: "6.43.0-beta.3",
104989
+ version: "6.43.0-beta.4",
104978
104990
  description: "AI tools versioned, synced, and shared across tools and teams",
104979
104991
  type: "module",
104980
104992
  bin: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grekt/cli",
3
- "version": "6.43.0-beta.3",
3
+ "version": "6.43.0-beta.4",
4
4
  "description": "AI tools versioned, synced, and shared across tools and teams",
5
5
  "type": "module",
6
6
  "bin": {