@root-signals/scorable-cli 0.1.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 (81) hide show
  1. package/README.md +206 -0
  2. package/dist/auth.d.ts +7 -0
  3. package/dist/auth.d.ts.map +1 -0
  4. package/dist/auth.js +103 -0
  5. package/dist/auth.js.map +1 -0
  6. package/dist/cli.d.ts +2 -0
  7. package/dist/cli.d.ts.map +1 -0
  8. package/dist/cli.js +16 -0
  9. package/dist/client.d.ts +7 -0
  10. package/dist/client.d.ts.map +1 -0
  11. package/dist/client.js +52 -0
  12. package/dist/client.js.map +1 -0
  13. package/dist/commands/judge/create.d.ts +3 -0
  14. package/dist/commands/judge/create.d.ts.map +1 -0
  15. package/dist/commands/judge/create.js +40 -0
  16. package/dist/commands/judge/create.js.map +1 -0
  17. package/dist/commands/judge/delete.d.ts +3 -0
  18. package/dist/commands/judge/delete.d.ts.map +1 -0
  19. package/dist/commands/judge/delete.js +33 -0
  20. package/dist/commands/judge/delete.js.map +1 -0
  21. package/dist/commands/judge/duplicate.d.ts +3 -0
  22. package/dist/commands/judge/duplicate.d.ts.map +1 -0
  23. package/dist/commands/judge/duplicate.js +23 -0
  24. package/dist/commands/judge/duplicate.js.map +1 -0
  25. package/dist/commands/judge/exec-openai-generic.d.ts +3 -0
  26. package/dist/commands/judge/exec-openai-generic.d.ts.map +1 -0
  27. package/dist/commands/judge/exec-openai-generic.js +50 -0
  28. package/dist/commands/judge/exec-openai-generic.js.map +1 -0
  29. package/dist/commands/judge/exec-openai.d.ts +3 -0
  30. package/dist/commands/judge/exec-openai.d.ts.map +1 -0
  31. package/dist/commands/judge/exec-openai.js +50 -0
  32. package/dist/commands/judge/exec-openai.js.map +1 -0
  33. package/dist/commands/judge/execute-by-name.d.ts +15 -0
  34. package/dist/commands/judge/execute-by-name.d.ts.map +1 -0
  35. package/dist/commands/judge/execute-by-name.js +73 -0
  36. package/dist/commands/judge/execute-by-name.js.map +1 -0
  37. package/dist/commands/judge/execute.d.ts +15 -0
  38. package/dist/commands/judge/execute.d.ts.map +1 -0
  39. package/dist/commands/judge/execute.js +73 -0
  40. package/dist/commands/judge/execute.js.map +1 -0
  41. package/dist/commands/judge/get.d.ts +3 -0
  42. package/dist/commands/judge/get.d.ts.map +1 -0
  43. package/dist/commands/judge/get.js +23 -0
  44. package/dist/commands/judge/get.js.map +1 -0
  45. package/dist/commands/judge/index.d.ts +3 -0
  46. package/dist/commands/judge/index.d.ts.map +1 -0
  47. package/dist/commands/judge/index.js +25 -0
  48. package/dist/commands/judge/index.js.map +1 -0
  49. package/dist/commands/judge/list.d.ts +3 -0
  50. package/dist/commands/judge/list.d.ts.map +1 -0
  51. package/dist/commands/judge/list.js +58 -0
  52. package/dist/commands/judge/list.js.map +1 -0
  53. package/dist/commands/judge/update.d.ts +3 -0
  54. package/dist/commands/judge/update.d.ts.map +1 -0
  55. package/dist/commands/judge/update.js +45 -0
  56. package/dist/commands/judge/update.js.map +1 -0
  57. package/dist/commands/prompt-test/index.d.ts +3 -0
  58. package/dist/commands/prompt-test/index.d.ts.map +1 -0
  59. package/dist/commands/prompt-test/index.js +13 -0
  60. package/dist/commands/prompt-test/index.js.map +1 -0
  61. package/dist/commands/prompt-test/init.d.ts +3 -0
  62. package/dist/commands/prompt-test/init.d.ts.map +1 -0
  63. package/dist/commands/prompt-test/init.js +77 -0
  64. package/dist/commands/prompt-test/init.js.map +1 -0
  65. package/dist/commands/prompt-test/run.d.ts +4 -0
  66. package/dist/commands/prompt-test/run.d.ts.map +1 -0
  67. package/dist/commands/prompt-test/run.js +194 -0
  68. package/dist/commands/prompt-test/run.js.map +1 -0
  69. package/dist/index.d.ts +3 -0
  70. package/dist/index.d.ts.map +1 -0
  71. package/dist/index.js +29 -0
  72. package/dist/index.js.map +1 -0
  73. package/dist/output.d.ts +9 -0
  74. package/dist/output.d.ts.map +1 -0
  75. package/dist/output.js +40 -0
  76. package/dist/output.js.map +1 -0
  77. package/dist/types.d.ts +62 -0
  78. package/dist/types.d.ts.map +1 -0
  79. package/dist/types.js +8 -0
  80. package/dist/types.js.map +1 -0
  81. package/package.json +53 -0
package/README.md ADDED
@@ -0,0 +1,206 @@
1
+ <h1 align="center">
2
+ <img width="600" alt="Scorable logo" src="https://scorable.ai/images/scorable-color.svg" loading="lazy">
3
+ </h1>
4
+
5
+ <p align="center" class="large-text">
6
+ <i><strong>Measurement & Control for LLM Automations</strong></i>
7
+ </p>
8
+
9
+ <p align="center">
10
+ <a href="https://scorable.ai/register">
11
+ <img src="https://img.shields.io/badge/Get_Started-2E6AFB?style=for-the-badge&logo=rocket&logoColor=white&scale=2" />
12
+ </a>
13
+
14
+ <a href="https://huggingface.co/root-signals">
15
+ <img src="https://img.shields.io/badge/HuggingFace-FF9D00?style=for-the-badge&logo=huggingface&logoColor=white&scale=2" />
16
+ </a>
17
+
18
+ <a href="https://sdk.rootsignals.ai/en/latest/">
19
+ <img src="https://img.shields.io/badge/Documentation-E53935?style=for-the-badge&logo=readthedocs&logoColor=white&scale=2" />
20
+ </a>
21
+
22
+ <a href="https://scorable.ai/demo-user">
23
+ <img src="https://img.shields.io/badge/Temporary_API_Key-15a20b?style=for-the-badge&logo=keycdn&logoColor=white&scale=2" />
24
+ </a>
25
+ </p>
26
+
27
+ The `scorable` CLI is a command-line tool for interacting with the Scorable API. It lets you manage and execute Judges and run prompt testing experiments directly from the terminal.
28
+
29
+ Requires **Node.js 20 or higher**.
30
+
31
+ ## Installation
32
+
33
+ ```bash
34
+ curl -sSL https://scorable.ai/cli/install.sh | sh
35
+ ```
36
+
37
+ Or install directly with npm:
38
+
39
+ ```bash
40
+ npm install -g @root-signals/scorable-cli
41
+ ```
42
+
43
+ Or run without installing via npx:
44
+
45
+ ```bash
46
+ npx @root-signals/scorable-cli judge list
47
+ ```
48
+
49
+ ## Authentication
50
+
51
+ Set your Scorable API key as an environment variable:
52
+
53
+ ```bash
54
+ export SCORABLE_API_KEY="your-api-key"
55
+ ```
56
+
57
+ Get a free API key at [scorable.ai/register](https://scorable.ai/register).
58
+
59
+ ### Temporary API keys
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.
62
+
63
+ ## Judge Management
64
+
65
+ ### List judges
66
+
67
+ ```bash
68
+ scorable judge list
69
+ ```
70
+
71
+ Options: `--page-size`, `--cursor`, `--search`, `--name`, `--ordering`, `--is-preset / --not-is-preset`, `--is-public / --not-is-public`, `--show-global / --not-show-global`
72
+
73
+ ### Get a judge
74
+
75
+ ```bash
76
+ scorable judge get <judge_id>
77
+ ```
78
+
79
+ ### Create a judge
80
+
81
+ ```bash
82
+ scorable judge create --name "My Judge" --intent "Evaluate response quality."
83
+ ```
84
+
85
+ Options: `--name` (required), `--intent` (required), `--stage`, `--evaluator-references` (JSON string, e.g. `'[{"id": "eval-id"}]'`)
86
+
87
+ ### Update a judge
88
+
89
+ ```bash
90
+ scorable judge update <judge_id> --name "Updated Name"
91
+ ```
92
+
93
+ Options: `--name`, `--stage`, `--evaluator-references` (use `"[]"` to clear)
94
+
95
+ ### Delete a judge
96
+
97
+ ```bash
98
+ scorable judge delete <judge_id>
99
+ ```
100
+
101
+ Prompts for confirmation. Use `--yes` to skip.
102
+
103
+ ### Duplicate a judge
104
+
105
+ ```bash
106
+ scorable judge duplicate <judge_id>
107
+ ```
108
+
109
+ ## Judge Execution
110
+
111
+ ### Execute by ID
112
+
113
+ ```bash
114
+ scorable judge execute <judge_id> --request "What is the capital of France?" --response "Paris"
115
+ ```
116
+
117
+ Options: `--request`, `--response`, `--contexts` (JSON list), `--expected-output`, `--tag` (repeatable), `--user-id`, `--session-id`, `--system-prompt`
118
+
119
+ Pipe input via stdin:
120
+
121
+ ```bash
122
+ echo "Paris" | scorable judge execute <judge_id> --request "What is the capital of France?"
123
+ cat response.txt | scorable judge execute <judge_id>
124
+ ```
125
+
126
+ ### Execute by name
127
+
128
+ ```bash
129
+ scorable judge execute-by-name "My Judge" --request "What is the capital of France?" --response "Paris"
130
+ ```
131
+
132
+ Accepts the same options as `execute`. Stdin piping works the same way.
133
+
134
+ ### Execute via OpenAI-compatible API
135
+
136
+ ```bash
137
+ scorable judge exec-openai <judge_id> \
138
+ --model gpt-4o \
139
+ --messages '[{"role": "user", "content": "Hello"}, {"role": "assistant", "content": "Hi there"}]'
140
+ ```
141
+
142
+ Generic variant (judge ID in the `model` field):
143
+
144
+ ```bash
145
+ scorable judge exec-openai-generic \
146
+ --model <judge_id_or_name> \
147
+ --messages '[{"role": "user", "content": "Hello"}, {"role": "assistant", "content": "Hi there"}]'
148
+ ```
149
+
150
+ ## Prompt Testing
151
+
152
+ Initialize a config file and run experiments:
153
+
154
+ ```bash
155
+ scorable pt init
156
+ scorable pt run
157
+ ```
158
+
159
+ Use a custom config path:
160
+
161
+ ```bash
162
+ scorable pt run --config path/to/prompt-tests.yaml
163
+ ```
164
+
165
+ The `prompt-test` command is an alias for `pt`.
166
+
167
+ ### Config file format
168
+
169
+ ```yaml
170
+ prompts:
171
+ - "Extract info from: {{text}}"
172
+
173
+ inputs:
174
+ - vars:
175
+ text: "John Doe, john@example.com"
176
+
177
+ # Or use a dataset instead of inline inputs:
178
+ # dataset_id: "<uuid>"
179
+
180
+ models:
181
+ - gpt-4o-mini
182
+ - gemini-2.5-flash-lite
183
+
184
+ evaluators:
185
+ - name: Precision
186
+ - name: Confidentiality
187
+
188
+ # Optional: enforce structured output
189
+ # response_schema:
190
+ # type: object
191
+ # properties:
192
+ # name: { type: string }
193
+ ```
194
+
195
+ Results are displayed in a table and a browser link is printed for the full comparison view.
196
+
197
+ ## Development
198
+
199
+ ```bash
200
+ npm install
201
+ npm run build # compile TypeScript
202
+ npm test # run tests
203
+ npm run typecheck # type-check without emitting
204
+ npm run lint # lint with oxlint
205
+ npm run fmt # format with oxfmt
206
+ ```
package/dist/auth.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { Scorable } from "@root-signals/scorable";
2
+ export declare function saveSettings(settings: Record<string, unknown>): void;
3
+ export declare function getApiKey(): string | undefined;
4
+ export declare function getBaseUrl(): string;
5
+ export declare function getSdkClient(apiKey: string): Scorable;
6
+ export declare function requireApiKey(): Promise<string>;
7
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +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"}
package/dist/auth.js ADDED
@@ -0,0 +1,103 @@
1
+ import { readFileSync, writeFileSync, mkdirSync, existsSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { homedir } from "node:os";
4
+ import { Scorable } from "@root-signals/scorable";
5
+ import { CliError } from "./types.js";
6
+ import { printError, printInfo, printSuccess } from "./output.js";
7
+ function configDir() {
8
+ return join(homedir(), ".scorable");
9
+ }
10
+ function settingsPath() {
11
+ return join(configDir(), "settings.json");
12
+ }
13
+ function loadSettings() {
14
+ try {
15
+ const path = settingsPath();
16
+ if (!existsSync(path))
17
+ return {};
18
+ const data = JSON.parse(readFileSync(path, "utf8"));
19
+ return typeof data === "object" && data !== null ? data : {};
20
+ }
21
+ catch {
22
+ return {};
23
+ }
24
+ }
25
+ export function saveSettings(settings) {
26
+ try {
27
+ const dir = configDir();
28
+ mkdirSync(dir, { recursive: true, mode: 0o700 });
29
+ writeFileSync(settingsPath(), JSON.stringify(settings, null, 2), { mode: 0o600 });
30
+ }
31
+ catch {
32
+ }
33
+ }
34
+ export function getApiKey() {
35
+ const fromEnv = process.env["SCORABLE_API_KEY"];
36
+ if (fromEnv)
37
+ return fromEnv;
38
+ const settings = loadSettings();
39
+ return settings["temporary_api_key"];
40
+ }
41
+ export function getBaseUrl() {
42
+ return process.env["SCORABLE_API_URL"] ?? "https://api.scorable.ai";
43
+ }
44
+ export function getSdkClient(apiKey) {
45
+ return new Scorable({ apiKey, baseUrl: getBaseUrl() });
46
+ }
47
+ export async function requireApiKey() {
48
+ const key = getApiKey();
49
+ if (key)
50
+ 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
+ }
98
+ }
99
+ else {
100
+ printInfo("Set SCORABLE_API_KEY and retry. Non-interactive session cannot prompt.");
101
+ throw new CliError(1, "Missing API key");
102
+ }
103
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAElE,SAAS,SAAS;IAChB,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC,CAAC;AACtC,CAAC;AAED,SAAS,YAAY;IACnB,OAAO,IAAI,CAAC,SAAS,EAAE,EAAE,eAAe,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,YAAY;IACnB,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,YAAY,EAAE,CAAC;QAC5B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,OAAO,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAY,CAAC;QAC/D,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,CAA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,YAAY,EAAE,CAAC;YAChC,QAAQ,CAAC,mBAAmB,CAAC,GAAG,OAAO,CAAC;YACxC,YAAY,CAAC,QAAQ,CAAC,CAAC;YACvB,YAAY,CAAC,sDAAsD,CAAC,CAAC;YAErE,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC3B,SAAS,CAAC,oEAAoE,CAAC,CAAC;YAClF,CAAC;iBAAM,CAAC;gBACN,SAAS,CAAC,sEAAsE,CAAC,CAAC;YACpF,CAAC;YAED,OAAO,OAAO,CAAC;QACjB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,YAAY,QAAQ;gBAAE,MAAM,CAAC,CAAC;YACnC,UAAU,CAAC,uCAAuC,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAChG,MAAM,IAAI,QAAQ,CAAC,CAAC,EAAE,oCAAoC,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;SAAM,CAAC;QACN,SAAS,CAAC,wEAAwE,CAAC,CAAC;QACpF,MAAM,IAAI,QAAQ,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC;IAC3C,CAAC;AACH,CAAC"}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,16 @@
1
+ import { createCli } from "./index.js";
2
+ createCli()
3
+ .parseAsync(process.argv)
4
+ .catch((e) => {
5
+ if (e && typeof e === "object" && "exitCode" in e) {
6
+ process.exit(e.exitCode);
7
+ }
8
+ if (e &&
9
+ typeof e === "object" &&
10
+ "code" in e &&
11
+ String(e.code).startsWith("commander.")) {
12
+ process.exit(e.exitCode ?? 1);
13
+ }
14
+ process.stderr.write(String(e) + "\n");
15
+ process.exit(1);
16
+ });
@@ -0,0 +1,7 @@
1
+ export declare function apiRequest(method: string, endpoint: string, options?: {
2
+ payload?: Record<string, unknown>;
3
+ params?: Record<string, unknown>;
4
+ apiKey?: string;
5
+ baseUrl?: string;
6
+ }): Promise<unknown>;
7
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAGA,wBAAsB,UAAU,CAC9B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE;IACR,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GACA,OAAO,CAAC,OAAO,CAAC,CAoDlB"}
package/dist/client.js ADDED
@@ -0,0 +1,52 @@
1
+ import { getApiKey, getBaseUrl } from "./auth.js";
2
+ import { printError, printJson } from "./output.js";
3
+ export async function apiRequest(method, endpoint, options) {
4
+ const apiKey = options?.apiKey ?? getApiKey();
5
+ const baseUrl = options?.baseUrl ?? getBaseUrl();
6
+ const seg = endpoint.endsWith("/") ? endpoint : `${endpoint}/`;
7
+ const url = new URL(`${baseUrl}/${seg}`);
8
+ if (options?.params) {
9
+ for (const [k, v] of Object.entries(options.params)) {
10
+ if (v !== undefined && v !== null) {
11
+ url.searchParams.set(k, String(v));
12
+ }
13
+ }
14
+ }
15
+ const headers = {
16
+ Authorization: `Api-Key ${apiKey}`,
17
+ "Content-Type": "application/json",
18
+ Accept: "application/json",
19
+ "User-Agent": "scorable-cli/1.0",
20
+ };
21
+ let response;
22
+ try {
23
+ response = await fetch(url.toString(), {
24
+ method,
25
+ headers,
26
+ body: options?.payload ? JSON.stringify(options.payload) : undefined,
27
+ });
28
+ }
29
+ catch (e) {
30
+ printError(`Request failed: ${e instanceof Error ? e.message : String(e)}`);
31
+ return null;
32
+ }
33
+ if (response.status === 204)
34
+ return null;
35
+ if (!response.ok) {
36
+ printError(`API Error: ${response.status} for ${method} ${url}`);
37
+ try {
38
+ printJson(await response.json());
39
+ }
40
+ catch {
41
+ printError(`Response content: ${await response.text().catch(() => "")}`);
42
+ }
43
+ return null;
44
+ }
45
+ try {
46
+ return await response.json();
47
+ }
48
+ catch {
49
+ printError(`Failed to decode JSON response from API for ${url}.`);
50
+ return null;
51
+ }
52
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,MAAc,EACd,QAAgB,EAChB,OAKC;IAED,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,CAAC;IAC9C,MAAM,OAAO,GAAG,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,CAAC;IAEjD,MAAM,GAAG,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,GAAG,CAAC;IAC/D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,OAAO,IAAI,GAAG,EAAE,CAAC,CAAC;IAEzC,IAAI,OAAO,EAAE,MAAM,EAAE,CAAC;QACpB,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YACpD,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,K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3E,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC;QACH,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,UAAU,CAAC,+CAA+C,GAAG,GAAG,CAAC,CAAC;QAClE,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare function registerCreateCommand(judge: Command): void;
3
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +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;AAMpC,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAgD1D"}
@@ -0,0 +1,40 @@
1
+ import { requireApiKey, getSdkClient } from "../../auth.js";
2
+ import { printInfo, printSuccess, printError, printJson } from "../../output.js";
3
+ import { CliError } from "../../types.js";
4
+ export function registerCreateCommand(judge) {
5
+ judge
6
+ .command("create")
7
+ .description("Create a new judge")
8
+ .requiredOption("--name <name>", "The name for the new judge")
9
+ .requiredOption("--intent <intent>", "The intent for the new judge")
10
+ .option("--stage <stage>", "The stage for the new judge")
11
+ .option("--evaluator-references <json>", 'JSON string for evaluator references. E.g., \'[{"id": "eval-id"}]\'')
12
+ .action(async (opts) => {
13
+ const apiKey = await requireApiKey();
14
+ const payload = { name: opts.name, intent: opts.intent };
15
+ if (opts.stage)
16
+ payload.stage = opts.stage;
17
+ if (opts.evaluatorReferences) {
18
+ try {
19
+ payload.evaluator_references = JSON.parse(opts.evaluatorReferences);
20
+ }
21
+ catch {
22
+ printError("Invalid JSON format for --evaluator-references.");
23
+ return;
24
+ }
25
+ }
26
+ printInfo("Attempting to create judge with payload:");
27
+ printJson(payload);
28
+ try {
29
+ const client = getSdkClient(apiKey);
30
+ const result = await client.judges.create(payload);
31
+ printSuccess("Judge created successfully!");
32
+ printJson(result);
33
+ }
34
+ catch (e) {
35
+ if (e instanceof CliError)
36
+ throw e;
37
+ printError(e instanceof Error ? e.message : String(e));
38
+ }
39
+ });
40
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/judge/create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C,MAAM,UAAU,qBAAqB,CAAC,KAAc;IAClD,KAAK;SACF,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,oBAAoB,CAAC;SACjC,cAAc,CAAC,eAAe,EAAE,4BAA4B,CAAC;SAC7D,cAAc,CAAC,mBAAmB,EAAE,8BAA8B,CAAC;SACnE,MAAM,CAAC,iBAAiB,EAAE,6BAA6B,CAAC;SACxD,MAAM,CAAC,+BAA+B,EAAE,uEAAuE,CAAC;SAChH,MAAM,CAAC,KAAK,EAAE,IAAoF,EAAE,EAAE;QACrG,MAAM,MAAM,GAAG,MAAM,aAAa,EAAE,CAAC;QAErC,MAAM,OAAO,GAAoB,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;QAC1E,IAAI,IAAI,CAAC,KAAK;YAAE,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAE3C,IAAI,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC7B,IAAI,CAAC;gBACH,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAA0B,CAAC;YAC/F,CAAC;YAAC,MAAM,CAAC;gBACP,UAAU,CAAC,iDAAiD,CAAC,CAAC;gBAC9D,OAAO;YACT,CAAC;QACH,CAAC;QAED,SAAS,CAAC,0CAA0C,CAAC,CAAC;QACtD,SAAS,CAAC,OAAO,CAAC,CAAC;QAEnB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;YACpC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACnD,YAAY,CAAC,6BAA6B,CAAC,CAAC;YAC5C,SAAS,CAAC,MAAM,CAAC,CAAC;QACpB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,YAAY,QAAQ;gBAAE,MAAM,CAAC,CAAC;YACnC,UAAU,CAAC,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACzD,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare function registerDeleteCommand(judge: Command): void;
3
+ //# sourceMappingURL=delete.d.ts.map
@@ -0,0 +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,CA8B1D"}
@@ -0,0 +1,33 @@
1
+ import { requireApiKey, getSdkClient } from "../../auth.js";
2
+ import { printInfo, printSuccess } from "../../output.js";
3
+ import { CliError } from "../../types.js";
4
+ export function registerDeleteCommand(judge) {
5
+ judge
6
+ .command("delete <judgeId>")
7
+ .description("Delete a judge by its ID")
8
+ .option("--yes", "Skip confirmation prompt")
9
+ .action(async (judgeId, opts) => {
10
+ const apiKey = await requireApiKey();
11
+ if (!opts.yes) {
12
+ const { confirm } = await import("@inquirer/prompts");
13
+ const ok = await confirm({
14
+ message: "Are you sure you want to delete this judge?",
15
+ default: false,
16
+ });
17
+ if (!ok) {
18
+ throw new CliError(1, "Aborted");
19
+ }
20
+ }
21
+ printInfo(`Deleting judge ${judgeId}...`);
22
+ try {
23
+ const client = getSdkClient(apiKey);
24
+ await client.judges.delete(judgeId);
25
+ printSuccess(`Judge ${judgeId} deleted successfully.`);
26
+ }
27
+ catch (e) {
28
+ if (e instanceof CliError)
29
+ throw e;
30
+ throw new CliError(1, e instanceof Error ? e.message : String(e));
31
+ }
32
+ });
33
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/commands/judge/delete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,UAAU,qBAAqB,CAAC,KAAc;IAClD,KAAK;SACF,OAAO,CAAC,kBAAkB,CAAC;SAC3B,WAAW,CAAC,0BAA0B,CAAC;SACvC,MAAM,CAAC,OAAO,EAAE,0BAA0B,CAAC;SAC3C,MAAM,CAAC,KAAK,EAAE,OAAe,EAAE,IAAuB,EAAE,EAAE;QACzD,MAAM,MAAM,GAAG,MAAM,aAAa,EAAE,CAAC;QAErC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;YACd,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;YACtD,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC;gBACvB,OAAO,EAAE,6CAA6C;gBACtD,OAAO,EAAE,KAAK;aACf,CAAC,CAAC;YACH,IAAI,CAAC,EAAE,EAAE,CAAC;gBACR,MAAM,IAAI,QAAQ,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;YACnC,CAAC;QACH,CAAC;QAED,SAAS,CAAC,kBAAkB,OAAO,KAAK,CAAC,CAAC;QAE1C,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;YACpC,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACpC,YAAY,CAAC,SAAS,OAAO,wBAAwB,CAAC,CAAC;QACzD,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,YAAY,QAAQ;gBAAE,MAAM,CAAC,CAAC;YACnC,MAAM,IAAI,QAAQ,CAAC,CAAC,EAAE,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACpE,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare function registerDuplicateCommand(judge: Command): void;
3
+ //# sourceMappingURL=duplicate.d.ts.map
@@ -0,0 +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;AAKpC,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAkB7D"}
@@ -0,0 +1,23 @@
1
+ import { requireApiKey, getSdkClient } from "../../auth.js";
2
+ import { printInfo, printSuccess, printError, printJson } from "../../output.js";
3
+ import { CliError } from "../../types.js";
4
+ export function registerDuplicateCommand(judge) {
5
+ judge
6
+ .command("duplicate <judgeId>")
7
+ .description("Duplicate an existing judge")
8
+ .action(async (judgeId) => {
9
+ const apiKey = await requireApiKey();
10
+ printInfo(`Duplicating judge ID: ${judgeId}...`);
11
+ try {
12
+ const client = getSdkClient(apiKey);
13
+ const result = await client.judges.duplicate(judgeId);
14
+ printSuccess(`Judge ${judgeId} duplicated successfully!`);
15
+ printJson(result);
16
+ }
17
+ catch (e) {
18
+ if (e instanceof CliError)
19
+ throw e;
20
+ printError(e instanceof Error ? e.message : String(e));
21
+ }
22
+ });
23
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duplicate.js","sourceRoot":"","sources":["../../../src/commands/judge/duplicate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,UAAU,wBAAwB,CAAC,KAAc;IACrD,KAAK;SACF,OAAO,CAAC,qBAAqB,CAAC;SAC9B,WAAW,CAAC,6BAA6B,CAAC;SAC1C,MAAM,CAAC,KAAK,EAAE,OAAe,EAAE,EAAE;QAChC,MAAM,MAAM,GAAG,MAAM,aAAa,EAAE,CAAC;QACrC,SAAS,CAAC,yBAAyB,OAAO,KAAK,CAAC,CAAC;QAEjD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;YACpC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;YACtD,YAAY,CAAC,SAAS,OAAO,2BAA2B,CAAC,CAAC;YAC1D,SAAS,CAAC,MAAM,CAAC,CAAC;QACpB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,YAAY,QAAQ;gBAAE,MAAM,CAAC,CAAC;YACnC,UAAU,CAAC,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACzD,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare function registerExecOpenaiGenericCommand(judge: Command): void;
3
+ //# sourceMappingURL=exec-openai-generic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exec-openai-generic.d.ts","sourceRoot":"","sources":["../../../src/commands/judge/exec-openai-generic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CA8CrE"}
@@ -0,0 +1,50 @@
1
+ import { requireApiKey } from "../../auth.js";
2
+ import { printInfo, printSuccess, printError, printWarning, printJson } from "../../output.js";
3
+ import { CliError } from "../../types.js";
4
+ import { apiRequest } from "../../client.js";
5
+ export function registerExecOpenaiGenericCommand(judge) {
6
+ judge
7
+ .command("exec-openai-generic")
8
+ .description("Execute a judge via the generic OpenAI API (judge is in the 'model' field)")
9
+ .requiredOption("--model <model>", "Judge ID (or name) to use as the 'model' field")
10
+ .requiredOption("--messages <json>", "JSON string of the messages payload")
11
+ .option("--extra-body <json>", "Optional JSON string for extra_body parameters")
12
+ .action(async (opts) => {
13
+ const apiKey = await requireApiKey();
14
+ let messages;
15
+ try {
16
+ messages = JSON.parse(opts.messages);
17
+ }
18
+ catch {
19
+ printError("Invalid JSON for --messages. Aborting.");
20
+ return;
21
+ }
22
+ const payload = { model: opts.model, messages };
23
+ if (opts.extraBody) {
24
+ try {
25
+ payload["extra_body"] = JSON.parse(opts.extraBody);
26
+ }
27
+ catch {
28
+ printWarning("Invalid JSON for --extra-body. Skipping.");
29
+ }
30
+ }
31
+ printInfo(`Executing a Judge using generic OpenAI endpoint. Judge ID/Name: ${opts.model}`);
32
+ printInfo("Attempting to execute with OpenAI compatible payload:");
33
+ printJson(payload);
34
+ try {
35
+ const result = await apiRequest("POST", "judges/openai/chat/completions", {
36
+ payload,
37
+ apiKey,
38
+ });
39
+ if (result) {
40
+ printSuccess("OpenAI compatible execution successful!");
41
+ printJson(result);
42
+ }
43
+ }
44
+ catch (e) {
45
+ if (e instanceof CliError)
46
+ throw e;
47
+ printError(e instanceof Error ? e.message : String(e));
48
+ }
49
+ });
50
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exec-openai-generic.js","sourceRoot":"","sources":["../../../src/commands/judge/exec-openai-generic.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC/F,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,UAAU,gCAAgC,CAAC,KAAc;IAC7D,KAAK;SACF,OAAO,CAAC,qBAAqB,CAAC;SAC9B,WAAW,CAAC,4EAA4E,CAAC;SACzF,cAAc,CAAC,iBAAiB,EAAE,gDAAgD,CAAC;SACnF,cAAc,CAAC,mBAAmB,EAAE,qCAAqC,CAAC;SAC1E,MAAM,CAAC,qBAAqB,EAAE,gDAAgD,CAAC;SAC/E,MAAM,CAAC,KAAK,EAAE,IAA6D,EAAE,EAAE;QAC9E,MAAM,MAAM,GAAG,MAAM,aAAa,EAAE,CAAC;QAErC,IAAI,QAAiB,CAAC;QACtB,IAAI,CAAC;YACH,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC;QAAC,MAAM,CAAC;YACP,UAAU,CAAC,wCAAwC,CAAC,CAAC;YACrD,OAAO;QACT,CAAC;QAED,MAAM,OAAO,GAA4B,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC;QAEzE,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,IAAI,CAAC;gBACH,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACrD,CAAC;YAAC,MAAM,CAAC;gBACP,YAAY,CAAC,0CAA0C,CAAC,CAAC;YAC3D,CAAC;QACH,CAAC;QAED,SAAS,CAAC,mEAAmE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAC3F,SAAS,CAAC,uDAAuD,CAAC,CAAC;QACnE,SAAS,CAAC,OAAO,CAAC,CAAC;QAEnB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,MAAM,EAAE,gCAAgC,EAAE;gBACxE,OAAO;gBACP,MAAM;aACP,CAAC,CAAC;YACH,IAAI,MAAM,EAAE,CAAC;gBACX,YAAY,CAAC,yCAAyC,CAAC,CAAC;gBACxD,SAAS,CAAC,MAAM,CAAC,CAAC;YACpB,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,YAAY,QAAQ;gBAAE,MAAM,CAAC,CAAC;YACnC,UAAU,CAAC,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACzD,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare function registerExecOpenaiCommand(judge: Command): void;
3
+ //# sourceMappingURL=exec-openai.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exec-openai.d.ts","sourceRoot":"","sources":["../../../src/commands/judge/exec-openai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAyD9D"}