@root-signals/scorable-cli 0.1.2 → 0.2.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.
- package/README.md +94 -13
- package/dist/client.d.ts.map +1 -1
- package/dist/commands/evaluator/create.d.ts +3 -0
- package/dist/commands/evaluator/create.d.ts.map +1 -0
- package/dist/commands/evaluator/create.js +62 -0
- package/dist/commands/evaluator/delete.d.ts +3 -0
- package/dist/commands/evaluator/delete.d.ts.map +1 -0
- package/dist/commands/evaluator/delete.js +34 -0
- package/dist/commands/evaluator/duplicate.d.ts +3 -0
- package/dist/commands/evaluator/duplicate.d.ts.map +1 -0
- package/dist/commands/evaluator/duplicate.js +20 -0
- package/dist/commands/evaluator/execute-by-name.d.ts +17 -0
- package/dist/commands/evaluator/execute-by-name.d.ts.map +1 -0
- package/dist/commands/evaluator/execute-by-name.js +131 -0
- package/dist/commands/evaluator/execute.d.ts +17 -0
- package/dist/commands/evaluator/execute.d.ts.map +1 -0
- package/dist/commands/evaluator/execute.js +135 -0
- package/dist/commands/evaluator/get.d.ts +3 -0
- package/dist/commands/evaluator/get.d.ts.map +1 -0
- package/dist/commands/evaluator/get.js +20 -0
- package/dist/commands/evaluator/index.d.ts +3 -0
- package/dist/commands/evaluator/index.d.ts.map +1 -0
- package/dist/commands/evaluator/index.js +21 -0
- package/dist/commands/evaluator/list.d.ts +3 -0
- package/dist/commands/evaluator/list.d.ts.map +1 -0
- package/dist/commands/evaluator/list.js +39 -0
- package/dist/commands/evaluator/update.d.ts +3 -0
- package/dist/commands/evaluator/update.d.ts.map +1 -0
- package/dist/commands/evaluator/update.js +51 -0
- package/dist/commands/execution-log/get.d.ts +3 -0
- package/dist/commands/execution-log/get.d.ts.map +1 -0
- package/dist/commands/execution-log/get.js +19 -0
- package/dist/commands/execution-log/index.d.ts +3 -0
- package/dist/commands/execution-log/index.d.ts.map +1 -0
- package/dist/commands/execution-log/index.js +9 -0
- package/dist/commands/execution-log/list.d.ts +3 -0
- package/dist/commands/execution-log/list.d.ts.map +1 -0
- package/dist/commands/execution-log/list.js +60 -0
- package/dist/commands/judge/create.d.ts.map +1 -1
- package/dist/commands/judge/create.js +2 -5
- package/dist/commands/judge/delete.d.ts.map +1 -1
- package/dist/commands/judge/delete.js +5 -4
- package/dist/commands/judge/duplicate.d.ts.map +1 -1
- package/dist/commands/judge/duplicate.js +2 -5
- package/dist/commands/judge/exec-openai-generic.d.ts.map +1 -1
- package/dist/commands/judge/exec-openai-generic.js +2 -5
- package/dist/commands/judge/exec-openai.d.ts.map +1 -1
- package/dist/commands/judge/exec-openai.js +2 -5
- package/dist/commands/judge/execute-by-name.d.ts +1 -0
- package/dist/commands/judge/execute-by-name.d.ts.map +1 -1
- package/dist/commands/judge/execute-by-name.js +54 -16
- package/dist/commands/judge/execute.d.ts +1 -0
- package/dist/commands/judge/execute.d.ts.map +1 -1
- package/dist/commands/judge/execute.js +61 -16
- package/dist/commands/judge/get.d.ts.map +1 -1
- package/dist/commands/judge/get.js +2 -5
- package/dist/commands/judge/list.d.ts.map +1 -1
- package/dist/commands/judge/list.js +15 -34
- package/dist/commands/judge/update.d.ts.map +1 -1
- package/dist/commands/judge/update.js +2 -5
- package/dist/commands/prompt-test/run.d.ts.map +1 -1
- package/dist/commands/prompt-test/run.js +5 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/output.d.ts +4 -1
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +47 -4
- package/dist/types.d.ts +0 -15
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +5 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +18 -0
- package/package.json +1 -3
|
@@ -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;
|
|
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,6 +1,5 @@
|
|
|
1
1
|
import { requireApiKey, getSdkClient } from "../../auth.js";
|
|
2
|
-
import { printInfo, printSuccess,
|
|
3
|
-
import { CliError } from "../../types.js";
|
|
2
|
+
import { printInfo, printSuccess, printJson, handleSdkError } from "../../output.js";
|
|
4
3
|
export function registerGetCommand(judge) {
|
|
5
4
|
judge
|
|
6
5
|
.command("get <judgeId>")
|
|
@@ -15,9 +14,7 @@ export function registerGetCommand(judge) {
|
|
|
15
14
|
printJson(result);
|
|
16
15
|
}
|
|
17
16
|
catch (e) {
|
|
18
|
-
|
|
19
|
-
throw e;
|
|
20
|
-
printError(e instanceof Error ? e.message : String(e));
|
|
17
|
+
handleSdkError(e);
|
|
21
18
|
}
|
|
22
19
|
});
|
|
23
20
|
}
|
|
@@ -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;
|
|
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,6 +1,5 @@
|
|
|
1
1
|
import { requireApiKey, getSdkClient } from "../../auth.js";
|
|
2
|
-
import { printInfo, printMessage,
|
|
3
|
-
import { CliError } from "../../types.js";
|
|
2
|
+
import { printInfo, printMessage, printJudgeTable, handleSdkError } from "../../output.js";
|
|
4
3
|
export function registerListCommand(judge) {
|
|
5
4
|
judge
|
|
6
5
|
.command("list")
|
|
@@ -10,39 +9,23 @@ export function registerListCommand(judge) {
|
|
|
10
9
|
.option("--search <term>", "A search term to filter by")
|
|
11
10
|
.option("--name <name>", "Filter by exact judge name")
|
|
12
11
|
.option("--ordering <field>", "Which field to use for ordering the results")
|
|
13
|
-
.option("--is-preset", "Filter preset judges (true)")
|
|
14
|
-
.option("--not-is-preset", "Exclude preset judges (false)")
|
|
15
|
-
.option("--is-public", "Filter public judges (true)")
|
|
16
|
-
.option("--not-is-public", "Exclude public judges (false)")
|
|
17
|
-
.option("--show-global", "Include global judges (true)")
|
|
18
|
-
.option("--not-show-global", "Exclude global judges (false)")
|
|
19
12
|
.action(async (opts) => {
|
|
20
13
|
const apiKey = await requireApiKey();
|
|
21
|
-
const params = {};
|
|
22
|
-
if (opts
|
|
23
|
-
params
|
|
24
|
-
if (opts
|
|
25
|
-
params
|
|
26
|
-
if (opts
|
|
27
|
-
params
|
|
28
|
-
if (opts
|
|
29
|
-
params
|
|
30
|
-
if (opts
|
|
31
|
-
params
|
|
32
|
-
|
|
33
|
-
if (isPreset !== undefined)
|
|
34
|
-
params["is_preset"] = isPreset;
|
|
35
|
-
const isPublic = opts["isPublic"] ? true : opts["notIsPublic"] ? false : undefined;
|
|
36
|
-
if (isPublic !== undefined)
|
|
37
|
-
params["is_public"] = isPublic;
|
|
38
|
-
const showGlobal = opts["showGlobal"] ? true : opts["notShowGlobal"] ? false : undefined;
|
|
39
|
-
if (showGlobal !== undefined)
|
|
40
|
-
params["show_global"] = showGlobal;
|
|
41
|
-
const actual = Object.fromEntries(Object.entries(params).filter(([, v]) => v !== undefined));
|
|
42
|
-
printInfo(`Fetching judges with params: ${JSON.stringify(actual)}...`);
|
|
14
|
+
const params = { is_public: false };
|
|
15
|
+
if (opts.pageSize !== undefined)
|
|
16
|
+
params.page_size = opts.pageSize;
|
|
17
|
+
if (opts.cursor !== undefined)
|
|
18
|
+
params.cursor = opts.cursor;
|
|
19
|
+
if (opts.search !== undefined)
|
|
20
|
+
params.search = opts.search;
|
|
21
|
+
if (opts.name !== undefined)
|
|
22
|
+
params.name = opts.name;
|
|
23
|
+
if (opts.ordering !== undefined)
|
|
24
|
+
params.ordering = opts.ordering;
|
|
25
|
+
printInfo(`Fetching judges with params: ${JSON.stringify(params)}...`);
|
|
43
26
|
try {
|
|
44
27
|
const client = getSdkClient(apiKey);
|
|
45
|
-
const response = await client.judges.list(
|
|
28
|
+
const response = await client.judges.list(params);
|
|
46
29
|
if (!response.results.length) {
|
|
47
30
|
printMessage("No judges found.");
|
|
48
31
|
return;
|
|
@@ -50,9 +33,7 @@ export function registerListCommand(judge) {
|
|
|
50
33
|
printJudgeTable(response.results, response.next);
|
|
51
34
|
}
|
|
52
35
|
catch (e) {
|
|
53
|
-
|
|
54
|
-
throw e;
|
|
55
|
-
printError(e instanceof Error ? e.message : String(e));
|
|
36
|
+
handleSdkError(e);
|
|
56
37
|
}
|
|
57
38
|
});
|
|
58
39
|
}
|
|
@@ -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;
|
|
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,6 +1,5 @@
|
|
|
1
1
|
import { requireApiKey, getSdkClient } from "../../auth.js";
|
|
2
|
-
import { printInfo, printSuccess, printError, printJson } from "../../output.js";
|
|
3
|
-
import { CliError } from "../../types.js";
|
|
2
|
+
import { printInfo, printSuccess, printError, printJson, handleSdkError } from "../../output.js";
|
|
4
3
|
export function registerUpdateCommand(judge) {
|
|
5
4
|
judge
|
|
6
5
|
.command("update <judgeId>")
|
|
@@ -37,9 +36,7 @@ export function registerUpdateCommand(judge) {
|
|
|
37
36
|
printJson(result);
|
|
38
37
|
}
|
|
39
38
|
catch (e) {
|
|
40
|
-
|
|
41
|
-
throw e;
|
|
42
|
-
printError(e instanceof Error ? e.message : String(e));
|
|
39
|
+
handleSdkError(e);
|
|
43
40
|
}
|
|
44
41
|
});
|
|
45
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/commands/prompt-test/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0FpC,wBAAsB,cAAc,CAClC,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,UAAU,EAAE,MAAM,EAClB,KAAK,GAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAiD,GACnF,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/commands/prompt-test/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0FpC,wBAAsB,cAAc,CAClC,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,UAAU,EAAE,MAAM,EAClB,KAAK,GAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAiD,GACnF,OAAO,CAAC,IAAI,CAAC,CAiHf;AAED,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAYpD"}
|
|
@@ -3,7 +3,7 @@ import yaml from "js-yaml";
|
|
|
3
3
|
import Table from "cli-table3";
|
|
4
4
|
import { requireApiKey } from "../../auth.js";
|
|
5
5
|
import { apiRequest } from "../../client.js";
|
|
6
|
-
import { printInfo, printSuccess, printWarning, printError } from "../../output.js";
|
|
6
|
+
import { printInfo, printSuccess, printWarning, printError, handleSdkError } from "../../output.js";
|
|
7
7
|
import { CliError } from "../../types.js";
|
|
8
8
|
function isPromptTestComplete(exp) {
|
|
9
9
|
if (!exp.tasks.length)
|
|
@@ -90,6 +90,9 @@ export async function runPromptTests(outputFile, configPath, sleep = (ms) => new
|
|
|
90
90
|
if (!config.prompts || !config.models || !config.evaluators) {
|
|
91
91
|
throw new Error("Missing required fields: prompts, models, evaluators");
|
|
92
92
|
}
|
|
93
|
+
if (!("inputs" in config) || !Array.isArray(config.inputs)) {
|
|
94
|
+
throw new Error("Missing required field: inputs");
|
|
95
|
+
}
|
|
93
96
|
}
|
|
94
97
|
catch (e) {
|
|
95
98
|
printError(`Error reading or validating '${configPath}': ${e instanceof Error ? e.message : String(e)}`);
|
|
@@ -173,8 +176,6 @@ export async function runPromptTests(outputFile, configPath, sleep = (ms) => new
|
|
|
173
176
|
printError(`Failed to write results to ${outputFile}: ${e instanceof Error ? e.message : String(e)}`);
|
|
174
177
|
}
|
|
175
178
|
}
|
|
176
|
-
const ids = finalTests.map((t) => t.id).join(",");
|
|
177
|
-
printInfo(`\nView full results in the browser:\nhttps://scorable.ai/prompt-testing/compare?ids=${ids}`);
|
|
178
179
|
}
|
|
179
180
|
export function registerRunCommand(pt) {
|
|
180
181
|
pt.command("run")
|
|
@@ -186,9 +187,7 @@ export function registerRunCommand(pt) {
|
|
|
186
187
|
await runPromptTests(opts.output, opts.config);
|
|
187
188
|
}
|
|
188
189
|
catch (e) {
|
|
189
|
-
|
|
190
|
-
throw e;
|
|
191
|
-
throw new CliError(1, e instanceof Error ? e.message : String(e));
|
|
190
|
+
handleSdkError(e);
|
|
192
191
|
}
|
|
193
192
|
});
|
|
194
193
|
}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";
|
|
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"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { realpathSync } from "node:fs";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
2
4
|
import { Command } from "commander";
|
|
3
5
|
import { registerJudgeCommands } from "./commands/judge/index.js";
|
|
4
6
|
import { registerPromptTestCommands } from "./commands/prompt-test/index.js";
|
|
7
|
+
import { registerEvaluatorCommands } from "./commands/evaluator/index.js";
|
|
8
|
+
import { registerExecutionLogCommands } from "./commands/execution-log/index.js";
|
|
5
9
|
export function createCli() {
|
|
6
10
|
const program = new Command()
|
|
7
11
|
.name("scorable")
|
|
@@ -9,9 +13,11 @@ export function createCli() {
|
|
|
9
13
|
.exitOverride();
|
|
10
14
|
registerJudgeCommands(program);
|
|
11
15
|
registerPromptTestCommands(program);
|
|
16
|
+
registerEvaluatorCommands(program);
|
|
17
|
+
registerExecutionLogCommands(program);
|
|
12
18
|
return program;
|
|
13
19
|
}
|
|
14
|
-
if (import.meta.url ===
|
|
20
|
+
if (realpathSync(fileURLToPath(import.meta.url)) === realpathSync(process.argv[1])) {
|
|
15
21
|
createCli()
|
|
16
22
|
.parseAsync(process.argv)
|
|
17
23
|
.catch((e) => {
|
package/dist/output.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import type { Judge } from "
|
|
1
|
+
import type { Judge, EvaluatorListItem, ExecutionLogList } from "@root-signals/scorable";
|
|
2
2
|
export declare function printJson(data: unknown): void;
|
|
3
3
|
export declare function printError(msg: string): void;
|
|
4
|
+
export declare function handleSdkError(e: unknown): never;
|
|
4
5
|
export declare function printSuccess(msg: string): void;
|
|
5
6
|
export declare function printInfo(msg: string): void;
|
|
6
7
|
export declare function printWarning(msg: string): void;
|
|
7
8
|
export declare function printMessage(msg: string): void;
|
|
8
9
|
export declare function printJudgeTable(judges: Judge[], nextCursor?: string): void;
|
|
10
|
+
export declare function printEvaluatorTable(evaluators: EvaluatorListItem[], nextCursor?: string): void;
|
|
11
|
+
export declare function printExecutionLogTable(logs: ExecutionLogList[], nextCursor?: string): void;
|
|
9
12
|
//# sourceMappingURL=output.d.ts.map
|
package/dist/output.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAEzF,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAE7C;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE5C;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,GAAG,KAAK,CAKhD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE9C;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE3C;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE9C;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE9C;AAMD,wBAAgB,eAAe,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAmB1E;AAED,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,iBAAiB,EAAE,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAmB9F;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,gBAAgB,EAAE,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAoB1F"}
|
package/dist/output.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import Table from "cli-table3";
|
|
3
|
+
import { CliError } from "./types.js";
|
|
3
4
|
export function printJson(data) {
|
|
4
5
|
console.log(JSON.stringify(data, null, 2));
|
|
5
6
|
}
|
|
6
7
|
export function printError(msg) {
|
|
7
|
-
console.
|
|
8
|
+
console.error(chalk.bold.red("Error:") + " " + msg);
|
|
9
|
+
}
|
|
10
|
+
export function handleSdkError(e) {
|
|
11
|
+
if (e instanceof CliError)
|
|
12
|
+
throw e;
|
|
13
|
+
const message = e instanceof Error ? e.message || String(e) : String(e);
|
|
14
|
+
printError(message);
|
|
15
|
+
throw new CliError(1, message);
|
|
8
16
|
}
|
|
9
17
|
export function printSuccess(msg) {
|
|
10
18
|
console.log(chalk.bold.green("Success:") + " " + msg);
|
|
@@ -23,14 +31,49 @@ function truncate(s, max) {
|
|
|
23
31
|
}
|
|
24
32
|
export function printJudgeTable(judges, nextCursor) {
|
|
25
33
|
const table = new Table({
|
|
26
|
-
head: ["ID", "Name", "Intent", "Created At"
|
|
34
|
+
head: ["ID", "Name", "Intent", "Created At"],
|
|
27
35
|
style: { head: ["cyan"] },
|
|
28
|
-
colWidths: [38, 30, 52, 12
|
|
36
|
+
colWidths: [38, 30, 52, 12],
|
|
29
37
|
wordWrap: true,
|
|
30
38
|
});
|
|
31
39
|
for (const j of judges) {
|
|
32
40
|
const date = (j.created_at ?? "").slice(0, 10);
|
|
33
|
-
table.push([j.id, j.name, truncate(j.intent ?? "", 50), date
|
|
41
|
+
table.push([j.id, j.name, truncate(j.intent ?? "", 50), date]);
|
|
42
|
+
}
|
|
43
|
+
console.log(table.toString());
|
|
44
|
+
if (nextCursor) {
|
|
45
|
+
const cursor = nextCursor.split("cursor=")[1] ?? nextCursor;
|
|
46
|
+
printInfo(`Next page available. Use --cursor "${cursor}"`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export function printEvaluatorTable(evaluators, nextCursor) {
|
|
50
|
+
const table = new Table({
|
|
51
|
+
head: ["ID", "Name", "Created At"],
|
|
52
|
+
style: { head: ["cyan"] },
|
|
53
|
+
colWidths: [38, 30, 12],
|
|
54
|
+
wordWrap: true,
|
|
55
|
+
});
|
|
56
|
+
for (const e of evaluators) {
|
|
57
|
+
const date = (e.created_at ?? "").slice(0, 10);
|
|
58
|
+
table.push([e.id, e.name, date]);
|
|
59
|
+
}
|
|
60
|
+
console.log(table.toString());
|
|
61
|
+
if (nextCursor) {
|
|
62
|
+
const cursor = nextCursor.split("cursor=")[1] ?? nextCursor;
|
|
63
|
+
printInfo(`Next page available. Use --cursor "${cursor}"`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export function printExecutionLogTable(logs, nextCursor) {
|
|
67
|
+
const table = new Table({
|
|
68
|
+
head: ["ID", "Item Name", "Type", "Score", "Created At"],
|
|
69
|
+
style: { head: ["cyan"] },
|
|
70
|
+
colWidths: [38, 30, 15, 8, 12],
|
|
71
|
+
wordWrap: true,
|
|
72
|
+
});
|
|
73
|
+
for (const l of logs) {
|
|
74
|
+
const date = (l.created_at ?? "").slice(0, 10);
|
|
75
|
+
const score = l.score != null ? String(l.score) : "";
|
|
76
|
+
table.push([l.id, truncate(l.executed_item_name, 28), l.execution_type, score, date]);
|
|
34
77
|
}
|
|
35
78
|
console.log(table.toString());
|
|
36
79
|
if (nextCursor) {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
export interface Judge {
|
|
2
|
-
id: string;
|
|
3
|
-
name: string;
|
|
4
|
-
intent: string;
|
|
5
|
-
created_at: string;
|
|
6
|
-
status?: string;
|
|
7
|
-
stage?: string;
|
|
8
|
-
evaluator_references?: Array<{
|
|
9
|
-
id: string;
|
|
10
|
-
}>;
|
|
11
|
-
}
|
|
12
|
-
export interface JudgeListResponse {
|
|
13
|
-
results: Judge[];
|
|
14
|
-
next?: string;
|
|
15
|
-
}
|
|
16
1
|
export interface PromptTestTask {
|
|
17
2
|
id: string;
|
|
18
3
|
status: string;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kBAAkB,EAAE,KAAK,CAAC;QACxB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;KAC9B,CAAC,CAAC;IACH,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,UAAU,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACjD;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,QAAS,SAAQ,KAAK;aAEf,QAAQ,EAAE,MAAM;gBAAhB,QAAQ,EAAE,MAAM,EAChC,OAAO,EAAE,MAAM;CAKlB"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Turn } from "@root-signals/scorable";
|
|
2
|
+
export declare function isTurnArray(v: unknown): v is Turn[];
|
|
3
|
+
export declare function isStringArray(v: unknown): v is string[];
|
|
4
|
+
export declare function isStringRecord(v: unknown): v is Record<string, string>;
|
|
5
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAEnD,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,IAAI,EAAE,CAanD;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,EAAE,CAEvD;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOtE"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function isTurnArray(v) {
|
|
2
|
+
return (Array.isArray(v) &&
|
|
3
|
+
v.every((t) => typeof t === "object" &&
|
|
4
|
+
t !== null &&
|
|
5
|
+
"role" in t &&
|
|
6
|
+
typeof t.role === "string" &&
|
|
7
|
+
"content" in t &&
|
|
8
|
+
typeof t.content === "string"));
|
|
9
|
+
}
|
|
10
|
+
export function isStringArray(v) {
|
|
11
|
+
return Array.isArray(v) && v.every((s) => typeof s === "string");
|
|
12
|
+
}
|
|
13
|
+
export function isStringRecord(v) {
|
|
14
|
+
return (typeof v === "object" &&
|
|
15
|
+
v !== null &&
|
|
16
|
+
!Array.isArray(v) &&
|
|
17
|
+
Object.values(v).every((val) => typeof val === "string"));
|
|
18
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@root-signals/scorable-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "CLI for Scorable",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Scorable",
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
"main": "./dist/index.js",
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "tsc --project tsconfig.build.json",
|
|
23
|
-
"bundle": "esbuild src/cli.ts --bundle --platform=node --target=node18 --format=cjs --minify --banner:js='#!/usr/bin/env node' --log-override:empty-import-meta=silent --outfile=dist/scorable.cjs && chmod +x dist/scorable.cjs",
|
|
24
23
|
"check-all": "npm run typecheck && npm run lint && npm run fmt:check && npm run test",
|
|
25
24
|
"prepublishOnly": "npm run check-all && npm run build",
|
|
26
25
|
"typecheck": "tsc --noEmit",
|
|
@@ -42,7 +41,6 @@
|
|
|
42
41
|
"devDependencies": {
|
|
43
42
|
"@types/js-yaml": "^4.0.9",
|
|
44
43
|
"@types/node": "^25.5.0",
|
|
45
|
-
"esbuild": "^0.25.0",
|
|
46
44
|
"oxfmt": "^0.41.0",
|
|
47
45
|
"oxlint": "^1.56.0",
|
|
48
46
|
"typescript": "^5.9.3",
|