@root-signals/scorable-cli 0.2.0 → 0.3.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 (46) hide show
  1. package/README.md +14 -4
  2. package/dist/auth.d.ts +2 -1
  3. package/dist/auth.d.ts.map +1 -1
  4. package/dist/auth.js +10 -2
  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 +41 -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/get.d.ts.map +1 -1
  19. package/dist/commands/evaluator/get.js +5 -2
  20. package/dist/commands/evaluator/list.d.ts.map +1 -1
  21. package/dist/commands/evaluator/list.js +5 -2
  22. package/dist/commands/evaluator/update.d.ts.map +1 -1
  23. package/dist/commands/evaluator/update.js +4 -2
  24. package/dist/commands/execution-log/get.d.ts.map +1 -1
  25. package/dist/commands/execution-log/get.js +5 -2
  26. package/dist/commands/execution-log/list.d.ts.map +1 -1
  27. package/dist/commands/execution-log/list.js +5 -2
  28. package/dist/commands/judge/create.d.ts.map +1 -1
  29. package/dist/commands/judge/create.js +5 -3
  30. package/dist/commands/judge/delete.d.ts.map +1 -1
  31. package/dist/commands/judge/delete.js +5 -2
  32. package/dist/commands/judge/duplicate.d.ts.map +1 -1
  33. package/dist/commands/judge/duplicate.js +5 -2
  34. package/dist/commands/judge/execute-by-name.d.ts.map +1 -1
  35. package/dist/commands/judge/execute-by-name.js +14 -7
  36. package/dist/commands/judge/execute.d.ts.map +1 -1
  37. package/dist/commands/judge/execute.js +14 -7
  38. package/dist/commands/judge/get.d.ts.map +1 -1
  39. package/dist/commands/judge/get.js +5 -2
  40. package/dist/commands/judge/list.d.ts.map +1 -1
  41. package/dist/commands/judge/list.js +5 -2
  42. package/dist/commands/judge/update.d.ts.map +1 -1
  43. package/dist/commands/judge/update.js +4 -2
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +12 -0
  46. package/package.json +2 -2
package/README.md CHANGED
@@ -48,17 +48,27 @@ 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
+ Get a free API key at [scorable.ai/register](https://scorable.ai/register), then save it using one of:
52
52
 
53
53
  ```bash
54
- export SCORABLE_API_KEY="your-api-key"
54
+ # Interactively
55
+ scorable auth set-key
56
+
57
+ # From argument
58
+ scorable auth set-key sk-your-api-key
55
59
  ```
56
60
 
57
- Get a free API key at [scorable.ai/register](https://scorable.ai/register).
61
+ The key is written to `~/.scorable/settings.json`
62
+
63
+ Alternatively, set it as an environment variable — this takes precedence over the saved key:
64
+
65
+ ```bash
66
+ export SCORABLE_API_KEY="sk-your-api-key"
67
+ ```
58
68
 
59
69
  ### Temporary API keys
60
70
 
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.
71
+ 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`.
62
72
 
63
73
  ## Judge Management
64
74
 
package/dist/auth.d.ts CHANGED
@@ -1,5 +1,6 @@
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;
@@ -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,CA+DrD"}
package/dist/auth.js CHANGED
@@ -10,7 +10,7 @@ function configDir() {
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() {
@@ -56,6 +60,7 @@ export async function requireApiKey() {
56
60
  else {
57
61
  printInfo("Run: export SCORABLE_API_KEY='<your_key>'");
58
62
  }
63
+ printInfo("Or run: scorable auth set-key <your-key>");
59
64
  if (process.stdin.isTTY && process.stdout.isTTY) {
60
65
  const { confirm } = await import("@inquirer/prompts");
61
66
  const answer = await confirm({
@@ -79,7 +84,10 @@ export async function requireApiKey() {
79
84
  process.env["SCORABLE_API_KEY"] = tempKey;
80
85
  const settings = loadSettings();
81
86
  settings["temporary_api_key"] = tempKey;
82
- saveSettings(settings);
87
+ if (!saveSettings(settings)) {
88
+ printError("Failed to save temporary API key to ~/.scorable/settings.json");
89
+ throw new CliError(1, "Failed to save temporary API key");
90
+ }
83
91
  printSuccess("Temporary API key saved to ~/.scorable/settings.json");
84
92
  if (shell.includes("fish")) {
85
93
  printInfo("To persist in your shell: set -x SCORABLE_API_KEY <paste_key_here>");
@@ -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;AAKpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAuC3D"}
@@ -0,0 +1,41 @@
1
+ import { loadSettings, saveSettings } from "../../auth.js";
2
+ import { printSuccess, printError } from "../../output.js";
3
+ import { CliError } from "../../types.js";
4
+ export function registerAuthCommands(program) {
5
+ const auth = program.command("auth").description("Manage authentication");
6
+ auth
7
+ .command("set-key [apiKey]")
8
+ .description("Save an API key to ~/.scorable/settings.json")
9
+ .option("--stdin", "Read the API key from stdin")
10
+ .action(async (apiKey, opts) => {
11
+ let key;
12
+ if (opts.stdin) {
13
+ const chunks = [];
14
+ for await (const chunk of process.stdin)
15
+ chunks.push(chunk);
16
+ key = Buffer.concat(chunks).toString().trim();
17
+ }
18
+ else if (apiKey) {
19
+ key = apiKey.trim();
20
+ }
21
+ else if (process.stdin.isTTY && process.stdout.isTTY) {
22
+ const { password } = await import("@inquirer/prompts");
23
+ key = (await password({ message: "Enter your API key:" })).trim();
24
+ }
25
+ else {
26
+ printError("No API key provided. Pass it as an argument, use --stdin, or run interactively.");
27
+ throw new CliError(1, "No API key provided");
28
+ }
29
+ if (!key) {
30
+ printError("API key must not be empty.");
31
+ throw new CliError(1, "Empty API key");
32
+ }
33
+ const settings = loadSettings();
34
+ settings["api_key"] = key;
35
+ if (!saveSettings(settings)) {
36
+ printError("Failed to save API key to ~/.scorable/settings.json");
37
+ throw new CliError(1, "Failed to save API key");
38
+ }
39
+ printSuccess("API key saved to ~/.scorable/settings.json");
40
+ });
41
+ }
@@ -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
@@ -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
  });
@@ -1 +1 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/judge/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CA+C1D"}
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/judge/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CA+C1D"}
@@ -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(judge) {
4
5
  judge
5
6
  .command("create")
@@ -22,15 +23,16 @@ export function registerCreateCommand(judge) {
22
23
  return;
23
24
  }
24
25
  }
25
- printInfo("Attempting to create judge with payload:");
26
- printJson(payload);
26
+ const spinner = ora("Creating...").start();
27
27
  try {
28
28
  const client = getSdkClient(apiKey);
29
29
  const result = await client.judges.create(payload);
30
+ spinner.stop();
30
31
  printSuccess("Judge created successfully!");
31
32
  printJson(result);
32
33
  }
33
34
  catch (e) {
35
+ spinner.stop();
34
36
  handleSdkError(e);
35
37
  }
36
38
  });
@@ -1 +1 @@
1
- {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/commands/judge/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAmC1D"}
1
+ {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/commands/judge/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAoC1D"}
@@ -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(judge) {
5
6
  judge
@@ -21,13 +22,15 @@ export function registerDeleteCommand(judge) {
21
22
  throw new CliError(1, "Aborted");
22
23
  }
23
24
  }
24
- printInfo(`Deleting judge ${judgeId}...`);
25
+ const spinner = ora("Deleting...").start();
25
26
  try {
26
27
  const client = getSdkClient(apiKey);
27
28
  await client.judges.delete(judgeId);
29
+ spinner.stop();
28
30
  printSuccess(`Judge ${judgeId} 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/judge/duplicate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAiB7D"}
1
+ {"version":3,"file":"duplicate.d.ts","sourceRoot":"","sources":["../../../src/commands/judge/duplicate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAkB7D"}
@@ -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(judge) {
4
5
  judge
5
6
  .command("duplicate <judgeId>")
6
7
  .description("Duplicate an existing judge")
7
8
  .action(async (judgeId) => {
8
9
  const apiKey = await requireApiKey();
9
- printInfo(`Duplicating judge ID: ${judgeId}...`);
10
+ const spinner = ora("Duplicating...").start();
10
11
  try {
11
12
  const client = getSdkClient(apiKey);
12
13
  const result = await client.judges.duplicate(judgeId);
14
+ spinner.stop();
13
15
  printSuccess(`Judge ${judgeId} 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/judge/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,kBAAkB,CACtC,SAAS,EAAE,MAAM,EACjB,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;CACvB,EACD,SAAS,0BAAmB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAyDf;AAED,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAkEjE"}
1
+ {"version":3,"file":"execute-by-name.d.ts","sourceRoot":"","sources":["../../../src/commands/judge/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,kBAAkB,CACtC,SAAS,EAAE,MAAM,EACjB,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;CACvB,EACD,SAAS,0BAAmB,GAC3B,OAAO,CAAC,IAAI,CAAC,CA6Df;AAED,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAkEjE"}
@@ -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 } from "../../utils.js";
4
5
  async function readStdinDefault() {
5
6
  const chunks = [];
@@ -60,12 +61,18 @@ export async function executeJudgeByName(judgeName, opts, readStdin = readStdinD
60
61
  return;
61
62
  }
62
63
  }
63
- printInfo(`Attempting to execute judge '${judgeName}' with payload:`);
64
- printJson(payload);
65
- const client = getSdkClient(apiKey);
66
- const result = await client.judges.executeByName(judgeName, payload);
67
- printSuccess("Judge execution by name successful!");
68
- printJson(result);
64
+ const spinner = ora("Running judge...").start();
65
+ try {
66
+ const client = getSdkClient(apiKey);
67
+ const result = await client.judges.executeByName(judgeName, payload);
68
+ spinner.stop();
69
+ printSuccess("Judge execution by name successful!");
70
+ printJson(result);
71
+ }
72
+ catch (e) {
73
+ spinner.stop();
74
+ throw e;
75
+ }
69
76
  }
70
77
  export function registerExecuteByNameCommand(judge) {
71
78
  judge
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/judge/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,iBAAe,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAIjD;AAED,wBAAsB,YAAY,CAChC,OAAO,EAAE,MAAM,EACf,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;CACvB,EACD,SAAS,0BAAmB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAyDf;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAyE3D"}
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/judge/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,iBAAe,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAIjD;AAED,wBAAsB,YAAY,CAChC,OAAO,EAAE,MAAM,EACf,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;CACvB,EACD,SAAS,0BAAmB,GAC3B,OAAO,CAAC,IAAI,CAAC,CA6Df;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAyE3D"}
@@ -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 } from "../../utils.js";
4
5
  async function readStdinDefault() {
5
6
  const chunks = [];
@@ -60,12 +61,18 @@ export async function executeJudge(judgeId, opts, readStdin = readStdinDefault)
60
61
  return;
61
62
  }
62
63
  }
63
- printInfo(`Attempting to execute judge ${judgeId} with payload:`);
64
- printJson(payload);
65
- const client = getSdkClient(apiKey);
66
- const result = await client.judges.execute(judgeId, payload);
67
- printSuccess("Judge execution successful!");
68
- printJson(result);
64
+ const spinner = ora("Running judge...").start();
65
+ try {
66
+ const client = getSdkClient(apiKey);
67
+ const result = await client.judges.execute(judgeId, payload);
68
+ spinner.stop();
69
+ printSuccess("Judge execution successful!");
70
+ printJson(result);
71
+ }
72
+ catch (e) {
73
+ spinner.stop();
74
+ throw e;
75
+ }
69
76
  }
70
77
  export function registerExecuteCommand(judge) {
71
78
  judge
@@ -1 +1 @@
1
- {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/judge/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAiBvD"}
1
+ {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/judge/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAkBvD"}
@@ -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(judge) {
4
5
  judge
5
6
  .command("get <judgeId>")
6
7
  .description("Get a specific judge by its ID")
7
8
  .action(async (judgeId) => {
8
9
  const apiKey = await requireApiKey();
9
- printInfo(`Fetching judge with ID: ${judgeId}...`);
10
+ const spinner = ora("Fetching...").start();
10
11
  try {
11
12
  const client = getSdkClient(apiKey);
12
13
  const result = await client.judges.get(judgeId);
14
+ spinner.stop();
13
15
  printSuccess(`Judge '${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/judge/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CA2CxD"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/judge/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CA4CxD"}
@@ -1,5 +1,6 @@
1
+ import ora from "ora";
1
2
  import { requireApiKey, getSdkClient } from "../../auth.js";
2
- import { printInfo, printMessage, printJudgeTable, handleSdkError } from "../../output.js";
3
+ import { printMessage, printJudgeTable, handleSdkError } from "../../output.js";
3
4
  export function registerListCommand(judge) {
4
5
  judge
5
6
  .command("list")
@@ -22,10 +23,11 @@ export function registerListCommand(judge) {
22
23
  params.name = opts.name;
23
24
  if (opts.ordering !== undefined)
24
25
  params.ordering = opts.ordering;
25
- printInfo(`Fetching judges 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.judges.list(params);
30
+ spinner.stop();
29
31
  if (!response.results.length) {
30
32
  printMessage("No judges found.");
31
33
  return;
@@ -33,6 +35,7 @@ export function registerListCommand(judge) {
33
35
  printJudgeTable(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/judge/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAkD1D"}
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/commands/judge/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAkD1D"}
@@ -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(judge) {
@@ -27,15 +28,16 @@ export function registerUpdateCommand(judge) {
27
28
  printInfo("No update parameters provided. Aborting.");
28
29
  return;
29
30
  }
30
- printInfo(`Attempting to update judge ${judgeId} with PATCH payload:`);
31
- printJson(payload);
31
+ const spinner = ora("Updating...").start();
32
32
  try {
33
33
  const client = getSdkClient(apiKey);
34
34
  const result = await client.judges.update(judgeId, payload);
35
+ spinner.stop();
35
36
  printSuccess(`Judge ${judgeId} updated successfully!`);
36
37
  printJson(result);
37
38
  }
38
39
  catch (e) {
40
+ spinner.stop();
39
41
  handleSdkError(e);
40
42
  }
41
43
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,SAAS,IAAI,OAAO,CAYnC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASpC,wBAAgB,SAAS,IAAI,OAAO,CAwBnC"}
package/dist/index.js CHANGED
@@ -1,20 +1,32 @@
1
1
  #!/usr/bin/env node
2
2
  import { realpathSync } from "node:fs";
3
3
  import { fileURLToPath } from "node:url";
4
+ import { createRequire } from "node:module";
4
5
  import { Command } from "commander";
5
6
  import { registerJudgeCommands } from "./commands/judge/index.js";
6
7
  import { registerPromptTestCommands } from "./commands/prompt-test/index.js";
7
8
  import { registerEvaluatorCommands } from "./commands/evaluator/index.js";
8
9
  import { registerExecutionLogCommands } from "./commands/execution-log/index.js";
10
+ import { registerAuthCommands } from "./commands/auth/index.js";
11
+ const { version } = createRequire(import.meta.url)("../package.json");
9
12
  export function createCli() {
10
13
  const program = new Command()
11
14
  .name("scorable")
12
15
  .description("A CLI tool to interact with the Scorable API")
16
+ .version(version, "-V, --version", "Print version number")
17
+ .addHelpText("after", `
18
+ Getting started:
19
+ Set your API key first (required before any command):
20
+ $ scorable auth set-key <your-api-key>
21
+
22
+ Then use any command, e.g.:
23
+ $ scorable judge list`)
13
24
  .exitOverride();
14
25
  registerJudgeCommands(program);
15
26
  registerPromptTestCommands(program);
16
27
  registerEvaluatorCommands(program);
17
28
  registerExecutionLogCommands(program);
29
+ registerAuthCommands(program);
18
30
  return program;
19
31
  }
20
32
  if (realpathSync(fileURLToPath(import.meta.url)) === realpathSync(process.argv[1])) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@root-signals/scorable-cli",
3
- "version": "0.2.0",
3
+ "version": "0.3.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.2.1",
34
+ "@root-signals/scorable": "^0.3.0",
35
35
  "chalk": "^5.6.2",
36
36
  "cli-table3": "^0.6.5",
37
37
  "commander": "^14.0.3",