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