@root-signals/scorable-cli 0.4.1 → 0.6.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.
@@ -1 +1 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/evaluator/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAkF9D"}
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/evaluator/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CA+E9D"}
@@ -9,7 +9,6 @@ export function registerCreateCommand(evaluator) {
9
9
  .requiredOption("--scoring-criteria <text>", "The scoring criteria prompt. Must contain {{ request }} and/or {{ response }} as placeholders.")
10
10
  .option("--intent <intent>", "The intent for the evaluator (mutually exclusive with --objective-id)")
11
11
  .option("--objective-id <id>", "Objective ID (mutually exclusive with --intent)")
12
- .option("--system-message <text>", "System message for the evaluator")
13
12
  .option("--models <json>", "JSON array of model names, in priority order. E.g., '[\"gpt-5-mini\"]'")
14
13
  .option("--overwrite", "Overwrite if evaluator with same name exists")
15
14
  .option("--objective-version-id <id>", "Objective version ID")
@@ -32,8 +31,6 @@ export function registerCreateCommand(evaluator) {
32
31
  payload.intent = opts.intent;
33
32
  if (opts.objectiveId)
34
33
  payload.objective_id = opts.objectiveId;
35
- if (opts.systemMessage)
36
- payload.system_message = opts.systemMessage;
37
34
  if (opts.overwrite !== undefined)
38
35
  payload.overwrite = opts.overwrite;
39
36
  if (opts.objectiveVersionId)
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare function registerExportYamlCommand(evaluator: Command): void;
3
+ //# sourceMappingURL=export-yaml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export-yaml.d.ts","sourceRoot":"","sources":["../../../src/commands/evaluator/export-yaml.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAwBlE"}
@@ -0,0 +1,31 @@
1
+ import { writeFileSync } from "node:fs";
2
+ import ora from "ora";
3
+ import { requireApiKey, getSdkClient } from "../../auth.js";
4
+ import { printSuccess, handleSdkError } from "../../output.js";
5
+ export function registerExportYamlCommand(evaluator) {
6
+ evaluator
7
+ .command("export-yaml")
8
+ .description("Export an evaluator as a YAML file")
9
+ .argument("<id>", "Evaluator ID")
10
+ .option("--output <file>", "Write YAML to this file instead of stdout")
11
+ .action(async (id, opts) => {
12
+ const spinner = ora("Exporting…").start();
13
+ try {
14
+ const apiKey = await requireApiKey();
15
+ const client = getSdkClient(apiKey);
16
+ const yaml = await client.evaluators.exportYaml(id);
17
+ spinner.stop();
18
+ if (opts.output) {
19
+ writeFileSync(opts.output, yaml, "utf8");
20
+ printSuccess(`Evaluator exported to ${opts.output}`);
21
+ }
22
+ else {
23
+ process.stdout.write(yaml);
24
+ }
25
+ }
26
+ catch (e) {
27
+ spinner.stop();
28
+ handleSdkError(e);
29
+ }
30
+ });
31
+ }
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare function registerImportYamlCommand(evaluator: Command): void;
3
+ //# sourceMappingURL=import-yaml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-yaml.d.ts","sourceRoot":"","sources":["../../../src/commands/evaluator/import-yaml.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CA2ClE"}
@@ -0,0 +1,49 @@
1
+ import { readFileSync } from "node:fs";
2
+ import ora from "ora";
3
+ import { requireApiKey, getBaseUrl } from "../../auth.js";
4
+ import { printSuccess, printError, printJson, handleSdkError } from "../../output.js";
5
+ export function registerImportYamlCommand(evaluator) {
6
+ evaluator
7
+ .command("import-yaml")
8
+ .description("Import an evaluator from a YAML file")
9
+ .requiredOption("--file <path>", "Path to the YAML file to import")
10
+ .option("--overwrite", "Overwrite if an evaluator with the same name already exists")
11
+ .action(async (opts) => {
12
+ let yamlContent;
13
+ try {
14
+ yamlContent = readFileSync(opts.file, "utf8");
15
+ }
16
+ catch {
17
+ printError(`Could not read file: ${opts.file}`);
18
+ return;
19
+ }
20
+ const spinner = ora("Importing…").start();
21
+ try {
22
+ const apiKey = await requireApiKey();
23
+ const baseUrl = getBaseUrl();
24
+ const response = await fetch(`${baseUrl}/v1/evaluators/import-yaml/`, {
25
+ method: "POST",
26
+ headers: {
27
+ Authorization: `Api-Key ${apiKey}`,
28
+ "Content-Type": "application/json",
29
+ },
30
+ body: JSON.stringify({ yaml: yamlContent, overwrite: opts.overwrite ?? false }),
31
+ });
32
+ if (!response.ok) {
33
+ spinner.stop();
34
+ const text = await response.text();
35
+ printError(`Import failed (${response.status}): ${text}`);
36
+ return;
37
+ }
38
+ const result = (await response.json());
39
+ spinner.stop();
40
+ const name = typeof result["name"] === "string" ? result["name"] : "evaluator";
41
+ printSuccess(`Evaluator "${name}" imported successfully!`);
42
+ printJson(result);
43
+ }
44
+ catch (e) {
45
+ spinner.stop();
46
+ handleSdkError(e);
47
+ }
48
+ });
49
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/evaluator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAahE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/evaluator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYpC,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAehE"}
@@ -7,6 +7,8 @@ import { registerDeleteCommand } from "./delete.js";
7
7
  import { registerExecuteCommand } from "./execute.js";
8
8
  import { registerExecuteByNameCommand } from "./execute-by-name.js";
9
9
  import { registerDuplicateCommand } from "./duplicate.js";
10
+ import { registerExportYamlCommand } from "./export-yaml.js";
11
+ import { registerImportYamlCommand } from "./import-yaml.js";
10
12
  export function registerEvaluatorCommands(program) {
11
13
  const evaluator = new Command("evaluator").description("Evaluator management commands");
12
14
  registerListCommand(evaluator);
@@ -17,5 +19,7 @@ export function registerEvaluatorCommands(program) {
17
19
  registerExecuteCommand(evaluator);
18
20
  registerExecuteByNameCommand(evaluator);
19
21
  registerDuplicateCommand(evaluator);
22
+ registerExportYamlCommand(evaluator);
23
+ registerImportYamlCommand(evaluator);
20
24
  program.addCommand(evaluator);
21
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/commands/evaluator/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CA2D9D"}
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/commands/evaluator/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAwD9D"}
@@ -7,7 +7,6 @@ export function registerUpdateCommand(evaluator) {
7
7
  .description("Update an existing evaluator (PATCH)")
8
8
  .option("--name <name>", "The new name for the evaluator")
9
9
  .option("--scoring-criteria <text>", "The new scoring criteria (prompt text)")
10
- .option("--system-message <text>", "The new system message")
11
10
  .option("--models <json>", "JSON array of model names. E.g., '[\"gpt-4\"]'")
12
11
  .option("--objective-id <id>", "The new objective ID")
13
12
  .option("--objective-version-id <id>", "The new objective version ID")
@@ -18,8 +17,6 @@ export function registerUpdateCommand(evaluator) {
18
17
  payload.name = opts.name;
19
18
  if (opts.scoringCriteria !== undefined)
20
19
  payload.prompt = opts.scoringCriteria;
21
- if (opts.systemMessage !== undefined)
22
- payload.system_message = opts.systemMessage;
23
20
  if (opts.objectiveId !== undefined)
24
21
  payload.objective_id = opts.objectiveId;
25
22
  if (opts.objectiveVersionId !== undefined)
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/commands/judge/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAcpC,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CA4H5D"}
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/commands/judge/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAcpC,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CA2H5D"}
@@ -30,7 +30,6 @@ offer to connect the guest with a human agent when uncertain."`)
30
30
  printError(`Invalid --visibility value: "${visibility}". Accepted values: private, public.`);
31
31
  throw new CliError(1, "invalid_visibility");
32
32
  }
33
- const apiVisibility = visibility === "private" ? "unlisted" : "public";
34
33
  const apiKey = await requireApiKey();
35
34
  let extra_contexts;
36
35
  if (opts.extraContexts) {
@@ -45,9 +44,9 @@ offer to connect the guest with a human agent when uncertain."`)
45
44
  const spinner = ora("Generating judge (this may take a moment)...").start();
46
45
  try {
47
46
  const client = getSdkClient(apiKey);
48
- const result = await client.judges.generate({
47
+ const result = (await client.judges.generate({
49
48
  intent: opts.intent,
50
- visibility: apiVisibility,
49
+ visibility: visibility,
51
50
  overwrite: opts.overwrite,
52
51
  name: opts.name,
53
52
  stage: opts.stage,
@@ -59,7 +58,7 @@ offer to connect the guest with a human agent when uncertain."`)
59
58
  reasoning_effort: opts.reasoningEffort,
60
59
  },
61
60
  }),
62
- });
61
+ }));
63
62
  spinner.stop();
64
63
  if (result.error_code === "multiple_stages") {
65
64
  printWarning("Multiple evaluation stages detected. Each judge covers one stage.");
@@ -12,7 +12,7 @@ export function registerListCommand(judge) {
12
12
  .option("--ordering <field>", "Which field to use for ordering the results")
13
13
  .action(async (opts) => {
14
14
  const apiKey = await requireApiKey();
15
- const params = { is_public: false };
15
+ const params = {};
16
16
  if (opts.pageSize !== undefined)
17
17
  params.page_size = opts.pageSize;
18
18
  if (opts.cursor !== undefined)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@root-signals/scorable-cli",
3
- "version": "0.4.1",
3
+ "version": "0.6.0",
4
4
  "description": "CLI for Scorable",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Scorable",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@inquirer/prompts": "^8.3.2",
34
- "@root-signals/scorable": "^0.3.1",
34
+ "@root-signals/scorable": "^0.5.0",
35
35
  "chalk": "^5.6.2",
36
36
  "cli-table3": "^0.6.5",
37
37
  "commander": "^14.0.3",