niceeval 0.5.1 → 0.5.2
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/docs-site/zh/reference/cli.mdx +1 -0
- package/package.json +1 -1
- package/src/cli.ts +15 -1
- package/src/i18n/en.ts +1 -1
- package/src/i18n/zh-CN.ts +1 -1
|
@@ -87,6 +87,7 @@ npx niceeval exp compare-models weather
|
|
|
87
87
|
| `--early-exit` / `--no-early-exit` | boolean | 某个 eval 的一次 attempt 通过后,停止该 eval 剩余的 attempts。 |
|
|
88
88
|
| `--open` / `--no-open` | boolean | `view` 命令专用:启动后自动打开浏览器(默认行为)。 |
|
|
89
89
|
| `--help` | boolean | 打印用法说明并退出。 |
|
|
90
|
+
| `--version` | boolean | 打印 niceeval 的版本号并退出。 |
|
|
90
91
|
|
|
91
92
|
{/* GENERATED:END cli-flags */}
|
|
92
93
|
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -64,6 +64,7 @@ interface Flags {
|
|
|
64
64
|
out?: string;
|
|
65
65
|
port?: number;
|
|
66
66
|
help: boolean;
|
|
67
|
+
version: boolean;
|
|
67
68
|
// ── show 专属(位置参数仍是 eval id 前缀;这些 flag 选「怎么看」)──
|
|
68
69
|
transcript: boolean;
|
|
69
70
|
trace: boolean;
|
|
@@ -116,6 +117,7 @@ const FLAG_OPTIONS = {
|
|
|
116
117
|
open: { type: "boolean" },
|
|
117
118
|
"no-open": { type: "boolean" },
|
|
118
119
|
help: { type: "boolean", short: "h" },
|
|
120
|
+
version: { type: "boolean", short: "v" },
|
|
119
121
|
} as const;
|
|
120
122
|
|
|
121
123
|
function numberFlag(name: string, raw: string | undefined): number | undefined {
|
|
@@ -185,6 +187,7 @@ function parseArgs(argv: string[]): { command: string; positionals: string[]; fl
|
|
|
185
187
|
earlyExit: values["no-early-exit"] === true ? false : values["early-exit"] === true ? true : undefined,
|
|
186
188
|
open: values["no-open"] === true ? false : values.open === true ? true : undefined,
|
|
187
189
|
help: values.help === true,
|
|
190
|
+
version: values.version === true,
|
|
188
191
|
transcript: values.transcript === true,
|
|
189
192
|
trace: values.trace === true,
|
|
190
193
|
diff: values.diff === true && diffPath === undefined,
|
|
@@ -324,17 +327,28 @@ function evalsFilterFromExperiment(
|
|
|
324
327
|
return (id) => expFilter(id) && patternFilter(id);
|
|
325
328
|
}
|
|
326
329
|
|
|
330
|
+
/** package.json 的 version 字段;-v/--version 直接回显这个号。 */
|
|
331
|
+
async function packageVersion(): Promise<string> {
|
|
332
|
+
const raw = await readFile(new URL("../package.json", import.meta.url), "utf-8");
|
|
333
|
+
return (JSON.parse(raw) as { version: string }).version;
|
|
334
|
+
}
|
|
335
|
+
|
|
327
336
|
async function main(): Promise<void> {
|
|
328
337
|
const cwd = process.cwd();
|
|
329
338
|
await loadDotenv(cwd);
|
|
330
339
|
const { command, positionals, flags } = parseArgs(process.argv.slice(2));
|
|
331
340
|
|
|
332
|
-
// --help 不需要 config,先于一切命令处理。
|
|
341
|
+
// --help / --version 不需要 config,先于一切命令处理。
|
|
333
342
|
if (flags.help) {
|
|
334
343
|
process.stdout.write(t("cli.help"));
|
|
335
344
|
process.exit(0);
|
|
336
345
|
}
|
|
337
346
|
|
|
347
|
+
if (flags.version) {
|
|
348
|
+
process.stdout.write(`${await packageVersion()}\n`);
|
|
349
|
+
process.exit(0);
|
|
350
|
+
}
|
|
351
|
+
|
|
338
352
|
if (command === "view") {
|
|
339
353
|
// 位置参数 = eval id 前缀(收窄报告槽选集);存在的文件路径 = 单文件模式;
|
|
340
354
|
// 结果目录经 --run 递入;--report 整槽替换报告槽(与 show --report 吃同一个文件)。
|
package/src/i18n/en.ts
CHANGED
|
@@ -59,7 +59,7 @@ export const en = {
|
|
|
59
59
|
"Flags:\n" +
|
|
60
60
|
" --runs n --max-concurrency n --timeout ms --budget usd --tag t\n" +
|
|
61
61
|
" --early-exit / --no-early-exit --strict --force --dry --quiet\n" +
|
|
62
|
-
" --junit path --out dir --port n --open / --no-open -h, --help\n\n" +
|
|
62
|
+
" --junit path --out dir --port n --open / --no-open -h, --help -v, --version\n\n" +
|
|
63
63
|
"Positional args only select which evals to run (id prefixes); which agent and\n" +
|
|
64
64
|
"how to run come from experiments/ + flags. Env overrides (flag > env > config):\n" +
|
|
65
65
|
" NICEEVAL_RUNS NICEEVAL_MAX_CONCURRENCY NICEEVAL_TIMEOUT NICEEVAL_BUDGET\n",
|
package/src/i18n/zh-CN.ts
CHANGED
|
@@ -55,7 +55,7 @@ export const zhCN = {
|
|
|
55
55
|
"标志:\n" +
|
|
56
56
|
" --runs n --max-concurrency n --timeout ms --budget usd --tag t\n" +
|
|
57
57
|
" --early-exit / --no-early-exit --strict --force --dry --quiet\n" +
|
|
58
|
-
" --junit path --out dir --port n --open / --no-open -h, --help\n\n" +
|
|
58
|
+
" --junit path --out dir --port n --open / --no-open -h, --help -v, --version\n\n" +
|
|
59
59
|
"位置参数只选「跑哪些 eval」(id 前缀);对着哪个 agent、怎么跑来自 experiments/ 与\n" +
|
|
60
60
|
"标志。环境变量覆盖(标志 > 环境变量 > config):\n" +
|
|
61
61
|
" NICEEVAL_RUNS NICEEVAL_MAX_CONCURRENCY NICEEVAL_TIMEOUT NICEEVAL_BUDGET\n",
|