@root-signals/scorable-cli 0.2.1 → 0.4.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.
Files changed (58) hide show
  1. package/README.md +19 -5
  2. package/dist/auth.d.ts +3 -1
  3. package/dist/auth.d.ts.map +1 -1
  4. package/dist/auth.js +26 -52
  5. package/dist/commands/auth/index.d.ts +3 -0
  6. package/dist/commands/auth/index.d.ts.map +1 -0
  7. package/dist/commands/auth/index.js +66 -0
  8. package/dist/commands/evaluator/create.d.ts.map +1 -1
  9. package/dist/commands/evaluator/create.js +5 -3
  10. package/dist/commands/evaluator/delete.d.ts.map +1 -1
  11. package/dist/commands/evaluator/delete.js +5 -2
  12. package/dist/commands/evaluator/duplicate.d.ts.map +1 -1
  13. package/dist/commands/evaluator/duplicate.js +5 -2
  14. package/dist/commands/evaluator/execute-by-name.d.ts.map +1 -1
  15. package/dist/commands/evaluator/execute-by-name.js +14 -7
  16. package/dist/commands/evaluator/execute.d.ts.map +1 -1
  17. package/dist/commands/evaluator/execute.js +14 -7
  18. package/dist/commands/evaluator/generate.d.ts +3 -0
  19. package/dist/commands/evaluator/generate.d.ts.map +1 -0
  20. package/dist/commands/evaluator/generate.js +49 -0
  21. package/dist/commands/evaluator/get.d.ts.map +1 -1
  22. package/dist/commands/evaluator/get.js +5 -2
  23. package/dist/commands/evaluator/list.d.ts.map +1 -1
  24. package/dist/commands/evaluator/list.js +5 -2
  25. package/dist/commands/evaluator/update.d.ts.map +1 -1
  26. package/dist/commands/evaluator/update.js +4 -2
  27. package/dist/commands/execution-log/get.d.ts.map +1 -1
  28. package/dist/commands/execution-log/get.js +5 -2
  29. package/dist/commands/execution-log/list.d.ts.map +1 -1
  30. package/dist/commands/execution-log/list.js +5 -2
  31. package/dist/commands/judge/create.d.ts.map +1 -1
  32. package/dist/commands/judge/create.js +5 -3
  33. package/dist/commands/judge/delete.d.ts.map +1 -1
  34. package/dist/commands/judge/delete.js +5 -2
  35. package/dist/commands/judge/duplicate.d.ts.map +1 -1
  36. package/dist/commands/judge/duplicate.js +5 -2
  37. package/dist/commands/judge/execute-by-name.d.ts.map +1 -1
  38. package/dist/commands/judge/execute-by-name.js +14 -7
  39. package/dist/commands/judge/execute.d.ts.map +1 -1
  40. package/dist/commands/judge/execute.js +14 -7
  41. package/dist/commands/judge/generate.d.ts +3 -0
  42. package/dist/commands/judge/generate.d.ts.map +1 -0
  43. package/dist/commands/judge/generate.js +98 -0
  44. package/dist/commands/judge/get.d.ts.map +1 -1
  45. package/dist/commands/judge/get.js +5 -2
  46. package/dist/commands/judge/index.d.ts.map +1 -1
  47. package/dist/commands/judge/index.js +2 -0
  48. package/dist/commands/judge/list.d.ts.map +1 -1
  49. package/dist/commands/judge/list.js +5 -2
  50. package/dist/commands/judge/update.d.ts.map +1 -1
  51. package/dist/commands/judge/update.js +4 -2
  52. package/dist/commands/prompt-test/run.d.ts.map +1 -1
  53. package/dist/commands/prompt-test/run.js +22 -4
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js +43 -1
  56. package/dist/output.d.ts.map +1 -1
  57. package/dist/output.js +27 -10
  58. package/package.json +2 -2
package/README.md CHANGED
@@ -48,17 +48,31 @@ npx @root-signals/scorable-cli judge list
48
48
 
49
49
  ## Authentication
50
50
 
51
- Set your Scorable API key as an environment variable:
51
+ **Option 1 Free demo key** (no registration required):
52
52
 
53
53
  ```bash
54
- export SCORABLE_API_KEY="your-api-key"
54
+ scorable auth demo-key
55
55
  ```
56
56
 
57
- Get a free API key at [scorable.ai/register](https://scorable.ai/register).
57
+ Creates a temporary key and saves it to `~/.scorable/settings.json`.
58
58
 
59
- ### Temporary API keys
59
+ **Option 2 Permanent key** from [scorable.ai/register](https://scorable.ai/register):
60
60
 
61
- If no API key is set, the CLI will offer to create a temporary key interactively (in TTY sessions) and save it to `~/.scorable/settings.json`. The `SCORABLE_API_KEY` environment variable always takes precedence.
61
+ ```bash
62
+ # Interactively
63
+ scorable auth set-key
64
+
65
+ # From argument
66
+ scorable auth set-key sk-your-api-key
67
+ ```
68
+
69
+ **Option 3 — Environment variable** (takes precedence over saved key):
70
+
71
+ ```bash
72
+ export SCORABLE_API_KEY="sk-your-api-key"
73
+ ```
74
+
75
+ The key lookup order is: `SCORABLE_API_KEY` env var → `api_key` in `~/.scorable/settings.json` → `temporary_api_key` in `~/.scorable/settings.json`.
62
76
 
63
77
  ## Judge Management
64
78
 
package/dist/auth.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import { Scorable } from "@root-signals/scorable";
2
- export declare function saveSettings(settings: Record<string, unknown>): void;
2
+ export declare function loadSettings(): Record<string, unknown>;
3
+ export declare function saveSettings(settings: Record<string, unknown>): boolean;
3
4
  export declare function getApiKey(): string | undefined;
4
5
  export declare function getBaseUrl(): string;
5
6
  export declare function getSdkClient(apiKey: string): Scorable;
6
7
  export declare function requireApiKey(): Promise<string>;
8
+ export declare function createDemoKey(): Promise<string>;
7
9
  //# sourceMappingURL=auth.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAuBlD,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAQpE;AAED,wBAAgB,SAAS,IAAI,MAAM,GAAG,SAAS,CAK9C;AAED,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAErD;AAED,wBAAsB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CA2DrD"}
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAYlD,wBAAgB,YAAY,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAStD;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CASvE;AAED,wBAAgB,SAAS,IAAI,MAAM,GAAG,SAAS,CAM9C;AAED,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAErD;AAED,wBAAsB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAQrD;AAED,wBAAsB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAarD"}
package/dist/auth.js CHANGED
@@ -3,14 +3,14 @@ import { join } from "node:path";
3
3
  import { homedir } from "node:os";
4
4
  import { Scorable } from "@root-signals/scorable";
5
5
  import { CliError } from "./types.js";
6
- import { printError, printInfo, printSuccess } from "./output.js";
6
+ import { printError, printInfo } from "./output.js";
7
7
  function configDir() {
8
8
  return join(homedir(), ".scorable");
9
9
  }
10
10
  function settingsPath() {
11
11
  return join(configDir(), "settings.json");
12
12
  }
13
- function loadSettings() {
13
+ export function loadSettings() {
14
14
  try {
15
15
  const path = settingsPath();
16
16
  if (!existsSync(path))
@@ -27,8 +27,10 @@ export function saveSettings(settings) {
27
27
  const dir = configDir();
28
28
  mkdirSync(dir, { recursive: true, mode: 0o700 });
29
29
  writeFileSync(settingsPath(), JSON.stringify(settings, null, 2), { mode: 0o600 });
30
+ return true;
30
31
  }
31
32
  catch {
33
+ return false;
32
34
  }
33
35
  }
34
36
  export function getApiKey() {
@@ -36,6 +38,8 @@ export function getApiKey() {
36
38
  if (fromEnv)
37
39
  return fromEnv;
38
40
  const settings = loadSettings();
41
+ if (settings["api_key"])
42
+ return settings["api_key"];
39
43
  return settings["temporary_api_key"];
40
44
  }
41
45
  export function getBaseUrl() {
@@ -48,56 +52,26 @@ export async function requireApiKey() {
48
52
  const key = getApiKey();
49
53
  if (key)
50
54
  return key;
51
- printError("SCORABLE_API_KEY environment variable not set.");
52
- const shell = process.env["SHELL"] ?? "";
53
- if (shell.includes("fish")) {
54
- printInfo("Run: set -x SCORABLE_API_KEY <your_key>");
55
- }
56
- else {
57
- printInfo("Run: export SCORABLE_API_KEY='<your_key>'");
58
- }
59
- if (process.stdin.isTTY && process.stdout.isTTY) {
60
- const { confirm } = await import("@inquirer/prompts");
61
- const answer = await confirm({
62
- message: "No API key found. Create a temporary key now?",
63
- default: true,
64
- });
65
- if (!answer) {
66
- printInfo("Aborted. Please set SCORABLE_API_KEY and try again.");
67
- throw new CliError(1, "Aborted");
68
- }
69
- try {
70
- const resp = await fetch(`${getBaseUrl()}/create-demo-user/`, { method: "POST" });
71
- if (!resp.ok)
72
- throw new Error(`HTTP ${resp.status}`);
73
- const data = (await resp.json());
74
- const tempKey = data["api_key"];
75
- if (!tempKey) {
76
- printError("Temporary key response did not include 'api_key'.");
77
- throw new CliError(1, "Missing api_key in demo response");
78
- }
79
- process.env["SCORABLE_API_KEY"] = tempKey;
80
- const settings = loadSettings();
81
- settings["temporary_api_key"] = tempKey;
82
- saveSettings(settings);
83
- printSuccess("Temporary API key saved to ~/.scorable/settings.json");
84
- if (shell.includes("fish")) {
85
- printInfo("To persist in your shell: set -x SCORABLE_API_KEY <paste_key_here>");
86
- }
87
- else {
88
- printInfo("To persist in your shell: export SCORABLE_API_KEY='<paste_key_here>'");
89
- }
90
- return tempKey;
91
- }
92
- catch (e) {
93
- if (e instanceof CliError)
94
- throw e;
95
- printError(`Failed to create temporary API key: ${e instanceof Error ? e.message : String(e)}`);
96
- throw new CliError(1, "Failed to create temporary API key");
97
- }
55
+ printError("No API key found.");
56
+ printInfo("Get a free demo key: scorable auth demo-key");
57
+ printInfo("Set a permanent key: scorable auth set-key <your-api-key>");
58
+ throw new CliError(1, "Missing API key");
59
+ }
60
+ export async function createDemoKey() {
61
+ try {
62
+ const resp = await fetch(`${getBaseUrl()}/create-demo-user/`, { method: "POST" });
63
+ if (!resp.ok)
64
+ throw new Error(`HTTP ${resp.status}`);
65
+ const data = (await resp.json());
66
+ const tempKey = data["api_key"];
67
+ if (!tempKey)
68
+ throw new Error("Response did not include 'api_key'");
69
+ return tempKey;
98
70
  }
99
- else {
100
- printInfo("Set SCORABLE_API_KEY and retry. Non-interactive session cannot prompt.");
101
- throw new CliError(1, "Missing API key");
71
+ catch (e) {
72
+ if (e instanceof CliError)
73
+ throw e;
74
+ printError(`Failed to create demo key: ${e instanceof Error ? e.message : String(e)}`);
75
+ throw new CliError(1, "Failed to create demo key");
102
76
  }
103
77
  }
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare function registerAuthCommands(program: Command): void;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAgE3D"}
@@ -0,0 +1,66 @@
1
+ import ora from "ora";
2
+ import { loadSettings, saveSettings, createDemoKey } from "../../auth.js";
3
+ import { printSuccess, printError } from "../../output.js";
4
+ import { CliError } from "../../types.js";
5
+ export function registerAuthCommands(program) {
6
+ const auth = program.command("auth").description("Manage authentication");
7
+ auth
8
+ .command("set-key [apiKey]")
9
+ .description("Save an API key to ~/.scorable/settings.json")
10
+ .option("--stdin", "Read the API key from stdin")
11
+ .action(async (apiKey, opts) => {
12
+ let key;
13
+ if (opts.stdin) {
14
+ const chunks = [];
15
+ for await (const chunk of process.stdin)
16
+ chunks.push(chunk);
17
+ key = Buffer.concat(chunks).toString().trim();
18
+ }
19
+ else if (apiKey) {
20
+ key = apiKey.trim();
21
+ }
22
+ else if (process.stdin.isTTY && process.stdout.isTTY) {
23
+ const { password } = await import("@inquirer/prompts");
24
+ key = (await password({ message: "Enter your API key:" })).trim();
25
+ }
26
+ else {
27
+ printError("No API key provided. Pass it as an argument, use --stdin, or run interactively.");
28
+ throw new CliError(1, "No API key provided");
29
+ }
30
+ if (!key) {
31
+ printError("API key must not be empty.");
32
+ throw new CliError(1, "Empty API key");
33
+ }
34
+ const settings = loadSettings();
35
+ settings["api_key"] = key;
36
+ if (!saveSettings(settings)) {
37
+ printError("Failed to save API key to ~/.scorable/settings.json");
38
+ throw new CliError(1, "Failed to save API key");
39
+ }
40
+ printSuccess("API key saved to ~/.scorable/settings.json");
41
+ });
42
+ auth
43
+ .command("demo-key")
44
+ .description("Create a free demo API key and save it to ~/.scorable/settings.json")
45
+ .action(async () => {
46
+ const spinner = ora("Creating demo key...").start();
47
+ try {
48
+ const key = await createDemoKey();
49
+ spinner.stop();
50
+ const settings = loadSettings();
51
+ settings["temporary_api_key"] = key;
52
+ if (!saveSettings(settings)) {
53
+ printError("Failed to save demo key to ~/.scorable/settings.json");
54
+ throw new CliError(1, "Failed to save demo key");
55
+ }
56
+ printSuccess(`Demo key saved to ~/.scorable/settings.json`);
57
+ }
58
+ catch (e) {
59
+ spinner.stop();
60
+ if (e instanceof CliError)
61
+ throw e;
62
+ printError(`Failed to create demo key: ${e instanceof Error ? e.message : String(e)}`);
63
+ throw new CliError(1, "Failed to create demo key");
64
+ }
65
+ });
66
+ }
@@ -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;AAKpC,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,CAkF9D"}
@@ -1,5 +1,6 @@
1
+ import ora from "ora";
1
2
  import { requireApiKey, getSdkClient } from "../../auth.js";
2
- import { printInfo, printSuccess, printError, printJson, handleSdkError } from "../../output.js";
3
+ import { printSuccess, printError, printJson, handleSdkError } from "../../output.js";
3
4
  export function registerCreateCommand(evaluator) {
4
5
  evaluator
5
6
  .command("create")
@@ -46,16 +47,17 @@ export function registerCreateCommand(evaluator) {
46
47
  return;
47
48
  }
48
49
  }
49
- printInfo("Attempting to create evaluator with payload:");
50
- printJson(payload);
50
+ const spinner = ora("Creating...").start();
51
51
  try {
52
52
  const apiKey = await requireApiKey();
53
53
  const client = getSdkClient(apiKey);
54
54
  const result = await client.evaluators.create(payload);
55
+ spinner.stop();
55
56
  printSuccess("Evaluator created successfully!");
56
57
  printJson(result);
57
58
  }
58
59
  catch (e) {
60
+ spinner.stop();
59
61
  handleSdkError(e);
60
62
  }
61
63
  });
@@ -1 +1 @@
1
- {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/commands/evaluator/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAmC9D"}
1
+ {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/commands/evaluator/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAoC9D"}
@@ -1,5 +1,6 @@
1
+ import ora from "ora";
1
2
  import { requireApiKey, getSdkClient } from "../../auth.js";
2
- import { printInfo, printSuccess, handleSdkError } from "../../output.js";
3
+ import { printSuccess, handleSdkError } from "../../output.js";
3
4
  import { CliError } from "../../types.js";
4
5
  export function registerDeleteCommand(evaluator) {
5
6
  evaluator
@@ -21,13 +22,15 @@ export function registerDeleteCommand(evaluator) {
21
22
  throw new CliError(1, "Aborted");
22
23
  }
23
24
  }
24
- printInfo(`Deleting evaluator ${evaluatorId}...`);
25
+ const spinner = ora("Deleting...").start();
25
26
  try {
26
27
  const client = getSdkClient(apiKey);
27
28
  await client.evaluators.delete(evaluatorId);
29
+ spinner.stop();
28
30
  printSuccess(`Evaluator ${evaluatorId} deleted successfully.`);
29
31
  }
30
32
  catch (e) {
33
+ spinner.stop();
31
34
  handleSdkError(e);
32
35
  }
33
36
  });
@@ -1 +1 @@
1
- {"version":3,"file":"duplicate.d.ts","sourceRoot":"","sources":["../../../src/commands/evaluator/duplicate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAiBjE"}
1
+ {"version":3,"file":"duplicate.d.ts","sourceRoot":"","sources":["../../../src/commands/evaluator/duplicate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAkBjE"}
@@ -1,19 +1,22 @@
1
+ import ora from "ora";
1
2
  import { requireApiKey, getSdkClient } from "../../auth.js";
2
- import { printInfo, printSuccess, printJson, handleSdkError } from "../../output.js";
3
+ import { printSuccess, printJson, handleSdkError } from "../../output.js";
3
4
  export function registerDuplicateCommand(evaluator) {
4
5
  evaluator
5
6
  .command("duplicate <evaluatorId>")
6
7
  .description("Duplicate an existing evaluator")
7
8
  .action(async (evaluatorId) => {
8
9
  const apiKey = await requireApiKey();
9
- printInfo(`Duplicating evaluator ID: ${evaluatorId}...`);
10
+ const spinner = ora("Duplicating...").start();
10
11
  try {
11
12
  const client = getSdkClient(apiKey);
12
13
  const result = await client.evaluators.duplicate(evaluatorId);
14
+ spinner.stop();
13
15
  printSuccess(`Evaluator ${evaluatorId} duplicated successfully!`);
14
16
  printJson(result);
15
17
  }
16
18
  catch (e) {
19
+ spinner.stop();
17
20
  handleSdkError(e);
18
21
  }
19
22
  });
@@ -1 +1 @@
1
- {"version":3,"file":"execute-by-name.d.ts","sourceRoot":"","sources":["../../../src/commands/evaluator/execute-by-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,iBAAe,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAIjD;AAED,wBAAsB,sBAAsB,CAC1C,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE;IACJ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,EACD,SAAS,0BAAmB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAuEf;AAED,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CA4ErE"}
1
+ {"version":3,"file":"execute-by-name.d.ts","sourceRoot":"","sources":["../../../src/commands/evaluator/execute-by-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,iBAAe,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAIjD;AAED,wBAAsB,sBAAsB,CAC1C,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE;IACJ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,EACD,SAAS,0BAAmB,GAC3B,OAAO,CAAC,IAAI,CAAC,CA2Ef;AAED,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CA4ErE"}
@@ -1,5 +1,6 @@
1
+ import ora from "ora";
1
2
  import { requireApiKey, getSdkClient } from "../../auth.js";
2
- import { printInfo, printSuccess, printError, printJson, handleSdkError } from "../../output.js";
3
+ import { printSuccess, printError, printJson, handleSdkError } from "../../output.js";
3
4
  import { isTurnArray, isStringArray, isStringRecord } from "../../utils.js";
4
5
  async function readStdinDefault() {
5
6
  const chunks = [];
@@ -74,12 +75,18 @@ export async function executeEvaluatorByName(evaluatorName, opts, readStdin = re
74
75
  return;
75
76
  }
76
77
  }
77
- printInfo(`Attempting to execute evaluator '${evaluatorName}' with payload:`);
78
- printJson(payload);
79
- const client = getSdkClient(apiKey);
80
- const result = await client.evaluators.executeByName(evaluatorName, payload);
81
- printSuccess("Evaluator execution by name successful!");
82
- printJson(result);
78
+ const spinner = ora("Running evaluator...").start();
79
+ try {
80
+ const client = getSdkClient(apiKey);
81
+ const result = await client.evaluators.executeByName(evaluatorName, payload);
82
+ spinner.stop();
83
+ printSuccess("Evaluator execution by name successful!");
84
+ printJson(result);
85
+ }
86
+ catch (e) {
87
+ spinner.stop();
88
+ throw e;
89
+ }
83
90
  }
84
91
  export function registerExecuteByNameCommand(evaluator) {
85
92
  evaluator
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/evaluator/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,iBAAe,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAIjD;AAED,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE;IACJ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,EACD,SAAS,0BAAmB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAuEf;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAgF/D"}
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/evaluator/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,iBAAe,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAIjD;AAED,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE;IACJ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,EACD,SAAS,0BAAmB,GAC3B,OAAO,CAAC,IAAI,CAAC,CA2Ef;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAgF/D"}
@@ -1,5 +1,6 @@
1
+ import ora from "ora";
1
2
  import { requireApiKey, getSdkClient } from "../../auth.js";
2
- import { printInfo, printSuccess, printError, printJson, handleSdkError } from "../../output.js";
3
+ import { printSuccess, printError, printJson, handleSdkError } from "../../output.js";
3
4
  import { isTurnArray, isStringArray, isStringRecord } from "../../utils.js";
4
5
  async function readStdinDefault() {
5
6
  const chunks = [];
@@ -74,12 +75,18 @@ export async function executeEvaluator(evaluatorId, opts, readStdin = readStdinD
74
75
  return;
75
76
  }
76
77
  }
77
- printInfo(`Attempting to execute evaluator ${evaluatorId} with payload:`);
78
- printJson(payload);
79
- const client = getSdkClient(apiKey);
80
- const result = await client.evaluators.execute(evaluatorId, payload);
81
- printSuccess("Evaluator execution successful!");
82
- printJson(result);
78
+ const spinner = ora("Running evaluator...").start();
79
+ try {
80
+ const client = getSdkClient(apiKey);
81
+ const result = await client.evaluators.execute(evaluatorId, payload);
82
+ spinner.stop();
83
+ printSuccess("Evaluator execution successful!");
84
+ printJson(result);
85
+ }
86
+ catch (e) {
87
+ spinner.stop();
88
+ throw e;
89
+ }
83
90
  }
84
91
  export function registerExecuteCommand(evaluator) {
85
92
  evaluator
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare function registerGenerateCommand(evaluator: Command): void;
3
+ //# sourceMappingURL=generate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/commands/evaluator/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAcpC,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAwDhE"}
@@ -0,0 +1,49 @@
1
+ import ora from "ora";
2
+ import { requireApiKey } from "../../auth.js";
3
+ import { apiRequest } from "../../client.js";
4
+ import { printSuccess, printError, printJson } from "../../output.js";
5
+ import { CliError } from "../../types.js";
6
+ export function registerGenerateCommand(evaluator) {
7
+ evaluator
8
+ .command("generate")
9
+ .description("Generate an evaluator from scored examples using AI")
10
+ .requiredOption("--examples <json>", 'JSON array of scored examples, e.g. \'[{"response":"Paris","score":1.0}]\'')
11
+ .option("--evaluation-approach <value>", "Evaluation approach (default: pointwise_score)", "pointwise_score")
12
+ .action(async (opts) => {
13
+ const apiKey = await requireApiKey();
14
+ let examples;
15
+ try {
16
+ examples = JSON.parse(opts.examples);
17
+ if (!Array.isArray(examples) || examples.length === 0) {
18
+ throw new Error("Must be a non-empty array");
19
+ }
20
+ }
21
+ catch (e) {
22
+ printError(`Invalid --examples JSON: ${e instanceof Error ? e.message : String(e)}`);
23
+ throw new CliError(1, "Invalid examples JSON");
24
+ }
25
+ const spinner = ora("Generating evaluator (this may take a moment)...").start();
26
+ try {
27
+ const result = (await apiRequest("POST", "v1/beta/evaluation-agents/generate", {
28
+ payload: {
29
+ examples,
30
+ evaluation_approach: opts.evaluationApproach,
31
+ },
32
+ apiKey,
33
+ }));
34
+ spinner.stop();
35
+ if (!result) {
36
+ throw new CliError(1, "Generate request failed");
37
+ }
38
+ printSuccess("Evaluator generated successfully!");
39
+ printJson(result);
40
+ }
41
+ catch (e) {
42
+ spinner.stop();
43
+ if (e instanceof CliError)
44
+ throw e;
45
+ printError(`Failed to generate evaluator: ${e instanceof Error ? e.message : String(e)}`);
46
+ throw new CliError(1, "Failed to generate evaluator");
47
+ }
48
+ });
49
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/evaluator/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAiB3D"}
1
+ {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/evaluator/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAkB3D"}
@@ -1,19 +1,22 @@
1
+ import ora from "ora";
1
2
  import { requireApiKey, getSdkClient } from "../../auth.js";
2
- import { printInfo, printSuccess, printJson, handleSdkError } from "../../output.js";
3
+ import { printSuccess, printJson, handleSdkError } from "../../output.js";
3
4
  export function registerGetCommand(evaluator) {
4
5
  evaluator
5
6
  .command("get <evaluatorId>")
6
7
  .description("Get a specific evaluator by its ID")
7
8
  .action(async (evaluatorId) => {
8
9
  const apiKey = await requireApiKey();
9
- printInfo(`Fetching evaluator with ID: ${evaluatorId}...`);
10
+ const spinner = ora("Fetching...").start();
10
11
  try {
11
12
  const client = getSdkClient(apiKey);
12
13
  const result = await client.evaluators.get(evaluatorId);
14
+ spinner.stop();
13
15
  printSuccess(`Evaluator '${result.name}' details:`);
14
16
  printJson(result);
15
17
  }
16
18
  catch (e) {
19
+ spinner.stop();
17
20
  handleSdkError(e);
18
21
  }
19
22
  });
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/evaluator/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CA2C5D"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/evaluator/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CA4C5D"}
@@ -1,5 +1,6 @@
1
+ import ora from "ora";
1
2
  import { requireApiKey, getSdkClient } from "../../auth.js";
2
- import { printInfo, printMessage, printEvaluatorTable, handleSdkError } from "../../output.js";
3
+ import { printMessage, printEvaluatorTable, handleSdkError } from "../../output.js";
3
4
  export function registerListCommand(evaluator) {
4
5
  evaluator
5
6
  .command("list")
@@ -22,10 +23,11 @@ export function registerListCommand(evaluator) {
22
23
  params.name = opts.name;
23
24
  if (opts.ordering !== undefined)
24
25
  params.ordering = opts.ordering;
25
- printInfo(`Fetching evaluators with params: ${JSON.stringify(params)}...`);
26
+ const spinner = ora("Fetching...").start();
26
27
  try {
27
28
  const client = getSdkClient(apiKey);
28
29
  const response = await client.evaluators.list(params);
30
+ spinner.stop();
29
31
  if (!response.results.length) {
30
32
  printMessage("No evaluators found.");
31
33
  return;
@@ -33,6 +35,7 @@ export function registerListCommand(evaluator) {
33
35
  printEvaluatorTable(response.results, response.next);
34
36
  }
35
37
  catch (e) {
38
+ spinner.stop();
36
39
  handleSdkError(e);
37
40
  }
38
41
  });
@@ -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;AAKpC,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,CA2D9D"}
@@ -1,3 +1,4 @@
1
+ import ora from "ora";
1
2
  import { requireApiKey, getSdkClient } from "../../auth.js";
2
3
  import { printInfo, printSuccess, printError, printJson, handleSdkError } from "../../output.js";
3
4
  export function registerUpdateCommand(evaluator) {
@@ -36,15 +37,16 @@ export function registerUpdateCommand(evaluator) {
36
37
  printInfo("No update parameters provided. Aborting.");
37
38
  return;
38
39
  }
39
- printInfo(`Attempting to update evaluator ${evaluatorId} with PATCH payload:`);
40
- printJson(payload);
40
+ const spinner = ora("Updating...").start();
41
41
  try {
42
42
  const client = getSdkClient(apiKey);
43
43
  const result = await client.evaluators.update(evaluatorId, payload);
44
+ spinner.stop();
44
45
  printSuccess(`Evaluator ${evaluatorId} updated successfully!`);
45
46
  printJson(result);
46
47
  }
47
48
  catch (e) {
49
+ spinner.stop();
48
50
  handleSdkError(e);
49
51
  }
50
52
  });
@@ -1 +1 @@
1
- {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/execution-log/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,OAAO,GAAG,IAAI,CAgB9D"}
1
+ {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/execution-log/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,OAAO,GAAG,IAAI,CAiB9D"}
@@ -1,18 +1,21 @@
1
+ import ora from "ora";
1
2
  import { requireApiKey, getSdkClient } from "../../auth.js";
2
- import { printInfo, printJson, handleSdkError } from "../../output.js";
3
+ import { printJson, handleSdkError } from "../../output.js";
3
4
  export function registerGetCommand(executionLog) {
4
5
  executionLog
5
6
  .command("get <logId>")
6
7
  .description("Get a specific execution log by its ID")
7
8
  .action(async (logId) => {
8
9
  const apiKey = await requireApiKey();
9
- printInfo(`Fetching execution log with ID: ${logId}...`);
10
+ const spinner = ora("Fetching...").start();
10
11
  try {
11
12
  const client = getSdkClient(apiKey);
12
13
  const result = await client.executionLogs.get(logId);
14
+ spinner.stop();
13
15
  printJson(result);
14
16
  }
15
17
  catch (e) {
18
+ spinner.stop();
16
19
  handleSdkError(e);
17
20
  }
18
21
  });
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/execution-log/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,OAAO,GAAG,IAAI,CAgE/D"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/execution-log/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,OAAO,GAAG,IAAI,CAiE/D"}
@@ -1,5 +1,6 @@
1
+ import ora from "ora";
1
2
  import { requireApiKey, getSdkClient } from "../../auth.js";
2
- import { printInfo, printMessage, printExecutionLogTable, handleSdkError } from "../../output.js";
3
+ import { printMessage, printExecutionLogTable, handleSdkError } from "../../output.js";
3
4
  export function registerListCommand(executionLog) {
4
5
  executionLog
5
6
  .command("list")
@@ -43,10 +44,11 @@ export function registerListCommand(executionLog) {
43
44
  params.created_at_before = opts.createdAtBefore;
44
45
  if (opts.ownerEmail !== undefined)
45
46
  params.owner__email = opts.ownerEmail;
46
- printInfo(`Fetching execution logs...`);
47
+ const spinner = ora("Fetching...").start();
47
48
  try {
48
49
  const client = getSdkClient(apiKey);
49
50
  const response = await client.executionLogs.list(params);
51
+ spinner.stop();
50
52
  if (!response.results.length) {
51
53
  printMessage("No execution logs found.");
52
54
  return;
@@ -54,6 +56,7 @@ export function registerListCommand(executionLog) {
54
56
  printExecutionLogTable(response.results, response.next);
55
57
  }
56
58
  catch (e) {
59
+ spinner.stop();
57
60
  handleSdkError(e);
58
61
  }
59
62
  });