anpord 0.1.10 → 0.1.11
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 +2 -2
- package/dist/bin.cjs +2 -2
- package/dist/bin.mjs +2 -2
- package/dist/cli-runtime.cjs +10 -12
- package/dist/cli-runtime.d.cts +1 -1
- package/dist/cli-runtime.d.mts +1 -1
- package/dist/cli-runtime.mjs +10 -12
- package/dist/cli.cjs +1 -1
- package/dist/cli.d.cts +1 -1
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/{compiler-aFvZixb7.cjs → compiler-Ap8DM-JU.cjs} +6 -6
- package/dist/{compiler-CKnNV-Ct.mjs → compiler-DXlpU_In.mjs} +6 -6
- package/dist/{define-Dxk8YZ4T.d.cts → define-BEiYXrC5.d.cts} +2 -2
- package/dist/{define-Dxk8YZ4T.d.mts → define-BEiYXrC5.d.mts} +2 -2
- package/dist/{define-Bh3A5AZv.cjs → define-CHx2lRp5.cjs} +5 -5
- package/dist/{define-Chq7EOpT.mjs → define-CLhfETBd.mjs} +5 -5
- package/dist/eval.cjs +1 -1
- package/dist/eval.d.cts +2 -2
- package/dist/eval.d.mts +2 -2
- package/dist/eval.mjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/{types-BFF8MwhF.d.cts → types-H9L450Iu.d.cts} +1 -1
- package/dist/{types-DPDjM69Q.d.mts → types-oaMF6-E1.d.mts} +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -113,11 +113,11 @@ import { defineEval } from "anpord";
|
|
|
113
113
|
import { cli, command } from "anpord/cli";
|
|
114
114
|
|
|
115
115
|
const client = cli({
|
|
116
|
-
|
|
116
|
+
path: "example",
|
|
117
117
|
version: "1.0.0",
|
|
118
118
|
commands: [
|
|
119
119
|
command({
|
|
120
|
-
|
|
120
|
+
path: ["users", "get"],
|
|
121
121
|
inputSchema: z.object({ id: z.string() }),
|
|
122
122
|
outputSchema: z.object({ id: z.string(), name: z.string() }),
|
|
123
123
|
options: { id: { type: "string" } },
|
package/dist/bin.cjs
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
const require_client = require("./client-Ci0woWLW.cjs");
|
|
3
3
|
const require_errors = require("./errors-Boum34f5.cjs");
|
|
4
4
|
const require_config = require("./config.cjs");
|
|
5
|
-
const require_compiler = require("./compiler-
|
|
5
|
+
const require_compiler = require("./compiler-Ap8DM-JU.cjs");
|
|
6
6
|
let _effect_cli = require("@effect/cli");
|
|
7
7
|
let _effect_platform = require("@effect/platform");
|
|
8
8
|
let _effect_platform_node = require("@effect/platform-node");
|
|
9
9
|
let effect = require("effect");
|
|
10
10
|
let yaml = require("yaml");
|
|
11
11
|
//#region package.json
|
|
12
|
-
var version$1 = "0.1.
|
|
12
|
+
var version$1 = "0.1.11";
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region ../template/src/extract.ts
|
|
15
15
|
/**
|
package/dist/bin.mjs
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import { a as ChannelName, o as PromptId, s as VersionNumber, t as AnpordApi } from "./client-5K3dMI5Q.mjs";
|
|
3
3
|
import { i as tokenMatcher, r as asAnpordError } from "./errors-C9bQUcA3.mjs";
|
|
4
4
|
import { ClientLayer, webUrlConfig } from "./config.mjs";
|
|
5
|
-
import { n as compileEvalEffect } from "./compiler-
|
|
5
|
+
import { n as compileEvalEffect } from "./compiler-DXlpU_In.mjs";
|
|
6
6
|
import { Args, Command, Options } from "@effect/cli";
|
|
7
7
|
import { FetchHttpClient, FileSystem, HttpClient, HttpClientError, HttpClientRequest } from "@effect/platform";
|
|
8
8
|
import { NodeContext, NodeRuntime } from "@effect/platform-node";
|
|
9
9
|
import { Cause, Clock, Config, Console, Data, Duration, Effect, Layer, Option, ParseResult, Redacted, Ref, Schema } from "effect";
|
|
10
10
|
import { parseDocument } from "yaml";
|
|
11
11
|
//#region package.json
|
|
12
|
-
var version$1 = "0.1.
|
|
12
|
+
var version$1 = "0.1.11";
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region ../template/src/extract.ts
|
|
15
15
|
/**
|
package/dist/cli-runtime.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_define = require("./define-
|
|
2
|
+
const require_define = require("./define-CHx2lRp5.cjs");
|
|
3
3
|
let effect = require("effect");
|
|
4
4
|
let node_path = require("node:path");
|
|
5
5
|
let node_fs_promises = require("node:fs/promises");
|
|
@@ -24,20 +24,18 @@ const append = (path, call) => effect.Effect.tryPromise({
|
|
|
24
24
|
const commandHelp = (definition, item) => {
|
|
25
25
|
const options = Object.entries(item.options).map(([key, option]) => ` ${require_define.optionName(key, option)}${option.type === "string" ? " <value>" : ""}${option.description ? ` ${option.description}` : ""}`);
|
|
26
26
|
return [
|
|
27
|
-
`Usage: ${definition.
|
|
27
|
+
`Usage: ${definition.path} ${item.path.join(" ")} [options]`,
|
|
28
28
|
item.description,
|
|
29
29
|
options.length ? `Options:\n${options.join("\n")}\n -h, --help` : void 0
|
|
30
30
|
].filter(Boolean).join("\n\n");
|
|
31
31
|
};
|
|
32
32
|
const rootHelp = (definition) => [
|
|
33
|
-
`Usage: ${definition.
|
|
33
|
+
`Usage: ${definition.path} <command> [options]`,
|
|
34
34
|
definition.description,
|
|
35
|
-
`Commands:\n${definition.commands.map(({ description,
|
|
35
|
+
`Commands:\n${definition.commands.map(({ description, path }) => ` ${path.join(" ")}${description ? ` ${description}` : ""}`).join("\n")}`,
|
|
36
36
|
"Options:\n -h, --help\n -v, --version"
|
|
37
37
|
].filter(Boolean).join("\n\n");
|
|
38
|
-
const selectedCommand = (definition, args) => [...definition.commands].sort((left, right) => right.
|
|
39
|
-
return name.split(" ").every((part, index) => args[index] === part);
|
|
40
|
-
});
|
|
38
|
+
const selectedCommand = (definition, args) => [...definition.commands].sort((left, right) => right.path.length - left.path.length).find(({ path }) => path.every((part, index) => args[index] === part));
|
|
41
39
|
const parseOptions = (item, args) => {
|
|
42
40
|
const options = new Map(Object.entries(item.options).map(([key, option]) => [require_define.optionName(key, option), {
|
|
43
41
|
key,
|
|
@@ -81,7 +79,7 @@ const executeCli = (definition, args, journal = JOURNAL) => effect.Effect.gen(fu
|
|
|
81
79
|
stderr: `Unknown command: ${args.join(" ")}\n`,
|
|
82
80
|
stdout: ""
|
|
83
81
|
};
|
|
84
|
-
const rest = args.slice(item.
|
|
82
|
+
const rest = args.slice(item.path.length);
|
|
85
83
|
if (rest[0] === "--help" || rest[0] === "-h") return {
|
|
86
84
|
exitCode: 0,
|
|
87
85
|
stderr: "",
|
|
@@ -99,8 +97,8 @@ const executeCli = (definition, args, journal = JOURNAL) => effect.Effect.gen(fu
|
|
|
99
97
|
try: () => Promise.resolve(item.handler(decoded, { signal: new AbortController().signal }))
|
|
100
98
|
}).pipe(effect.Effect.flatMap((value) => decode(item.outputSchema, value)));
|
|
101
99
|
yield* append(journal, {
|
|
102
|
-
cli: definition.
|
|
103
|
-
command: item.
|
|
100
|
+
cli: definition.path,
|
|
101
|
+
command: item.path.join(" "),
|
|
104
102
|
input: decoded,
|
|
105
103
|
output
|
|
106
104
|
});
|
|
@@ -110,8 +108,8 @@ const executeCli = (definition, args, journal = JOURNAL) => effect.Effect.gen(fu
|
|
|
110
108
|
stdout: `${JSON.stringify(output, null, 2) ?? String(output)}\n`
|
|
111
109
|
};
|
|
112
110
|
}).pipe(effect.Effect.catchAll((cause) => append(journal, {
|
|
113
|
-
cli: definition.
|
|
114
|
-
command: item.
|
|
111
|
+
cli: definition.path,
|
|
112
|
+
command: item.path.join(" "),
|
|
115
113
|
error: errorOf(cause).message,
|
|
116
114
|
input
|
|
117
115
|
}).pipe(effect.Effect.as({
|
package/dist/cli-runtime.d.cts
CHANGED
package/dist/cli-runtime.d.mts
CHANGED
package/dist/cli-runtime.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as optionName } from "./define-
|
|
1
|
+
import { r as optionName } from "./define-CLhfETBd.mjs";
|
|
2
2
|
import { Effect } from "effect";
|
|
3
3
|
import { dirname } from "node:path";
|
|
4
4
|
import { appendFile, mkdir } from "node:fs/promises";
|
|
@@ -23,20 +23,18 @@ const append = (path, call) => Effect.tryPromise({
|
|
|
23
23
|
const commandHelp = (definition, item) => {
|
|
24
24
|
const options = Object.entries(item.options).map(([key, option]) => ` ${optionName(key, option)}${option.type === "string" ? " <value>" : ""}${option.description ? ` ${option.description}` : ""}`);
|
|
25
25
|
return [
|
|
26
|
-
`Usage: ${definition.
|
|
26
|
+
`Usage: ${definition.path} ${item.path.join(" ")} [options]`,
|
|
27
27
|
item.description,
|
|
28
28
|
options.length ? `Options:\n${options.join("\n")}\n -h, --help` : void 0
|
|
29
29
|
].filter(Boolean).join("\n\n");
|
|
30
30
|
};
|
|
31
31
|
const rootHelp = (definition) => [
|
|
32
|
-
`Usage: ${definition.
|
|
32
|
+
`Usage: ${definition.path} <command> [options]`,
|
|
33
33
|
definition.description,
|
|
34
|
-
`Commands:\n${definition.commands.map(({ description,
|
|
34
|
+
`Commands:\n${definition.commands.map(({ description, path }) => ` ${path.join(" ")}${description ? ` ${description}` : ""}`).join("\n")}`,
|
|
35
35
|
"Options:\n -h, --help\n -v, --version"
|
|
36
36
|
].filter(Boolean).join("\n\n");
|
|
37
|
-
const selectedCommand = (definition, args) => [...definition.commands].sort((left, right) => right.
|
|
38
|
-
return name.split(" ").every((part, index) => args[index] === part);
|
|
39
|
-
});
|
|
37
|
+
const selectedCommand = (definition, args) => [...definition.commands].sort((left, right) => right.path.length - left.path.length).find(({ path }) => path.every((part, index) => args[index] === part));
|
|
40
38
|
const parseOptions = (item, args) => {
|
|
41
39
|
const options = new Map(Object.entries(item.options).map(([key, option]) => [optionName(key, option), {
|
|
42
40
|
key,
|
|
@@ -80,7 +78,7 @@ const executeCli = (definition, args, journal = JOURNAL) => Effect.gen(function*
|
|
|
80
78
|
stderr: `Unknown command: ${args.join(" ")}\n`,
|
|
81
79
|
stdout: ""
|
|
82
80
|
};
|
|
83
|
-
const rest = args.slice(item.
|
|
81
|
+
const rest = args.slice(item.path.length);
|
|
84
82
|
if (rest[0] === "--help" || rest[0] === "-h") return {
|
|
85
83
|
exitCode: 0,
|
|
86
84
|
stderr: "",
|
|
@@ -98,8 +96,8 @@ const executeCli = (definition, args, journal = JOURNAL) => Effect.gen(function*
|
|
|
98
96
|
try: () => Promise.resolve(item.handler(decoded, { signal: new AbortController().signal }))
|
|
99
97
|
}).pipe(Effect.flatMap((value) => decode(item.outputSchema, value)));
|
|
100
98
|
yield* append(journal, {
|
|
101
|
-
cli: definition.
|
|
102
|
-
command: item.
|
|
99
|
+
cli: definition.path,
|
|
100
|
+
command: item.path.join(" "),
|
|
103
101
|
input: decoded,
|
|
104
102
|
output
|
|
105
103
|
});
|
|
@@ -109,8 +107,8 @@ const executeCli = (definition, args, journal = JOURNAL) => Effect.gen(function*
|
|
|
109
107
|
stdout: `${JSON.stringify(output, null, 2) ?? String(output)}\n`
|
|
110
108
|
};
|
|
111
109
|
}).pipe(Effect.catchAll((cause) => append(journal, {
|
|
112
|
-
cli: definition.
|
|
113
|
-
command: item.
|
|
110
|
+
cli: definition.path,
|
|
111
|
+
command: item.path.join(" "),
|
|
114
112
|
error: errorOf(cause).message,
|
|
115
113
|
input
|
|
116
114
|
}).pipe(Effect.as({
|
package/dist/cli.cjs
CHANGED
package/dist/cli.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { t as CliCall } from "./calls-Drj_dZpu.cjs";
|
|
2
|
-
import { a as cli, i as CliOption, n as CliDefinition, o as command, r as CliHandlerContext, t as CliCommandDefinition } from "./define-
|
|
2
|
+
import { a as cli, i as CliOption, n as CliDefinition, o as command, r as CliHandlerContext, t as CliCommandDefinition } from "./define-BEiYXrC5.cjs";
|
|
3
3
|
export { type CliCall, type CliCommandDefinition, type CliDefinition, type CliHandlerContext, type CliOption, cli, command };
|
package/dist/cli.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { t as CliCall } from "./calls-Drj_dZpu.mjs";
|
|
2
|
-
import { a as cli, i as CliOption, n as CliDefinition, o as command, r as CliHandlerContext, t as CliCommandDefinition } from "./define-
|
|
2
|
+
import { a as cli, i as CliOption, n as CliDefinition, o as command, r as CliHandlerContext, t as CliCommandDefinition } from "./define-BEiYXrC5.mjs";
|
|
3
3
|
export { type CliCall, type CliCommandDefinition, type CliDefinition, type CliHandlerContext, type CliOption, cli, command };
|
package/dist/cli.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as command, t as cli } from "./define-
|
|
1
|
+
import { n as command, t as cli } from "./define-CLhfETBd.mjs";
|
|
2
2
|
export { cli, command };
|
|
@@ -255,12 +255,12 @@ await runCli(cli);`;
|
|
|
255
255
|
//#endregion
|
|
256
256
|
//#region src/evals/cli-profile.ts
|
|
257
257
|
const compileClis = (entry, definitions) => effect.Effect.gen(function* () {
|
|
258
|
-
const
|
|
259
|
-
const duplicate =
|
|
258
|
+
const paths = definitions.map(({ path }) => path);
|
|
259
|
+
const duplicate = paths.find((path, index) => paths.indexOf(path) !== index);
|
|
260
260
|
if (duplicate !== void 0) return yield* effect.Effect.fail(/* @__PURE__ */ new Error(`Duplicate CLI: ${duplicate}`));
|
|
261
261
|
return yield* effect.Effect.forEach(definitions, (definition, index) => bundle(cliEntry(entry, index), entry, { minify: true }).pipe(effect.Effect.map(({ source }) => ({
|
|
262
262
|
...packageProgram(`workspace/.anpord/cli/${index}`, "cli.mjs", source),
|
|
263
|
-
|
|
263
|
+
path: definition.path
|
|
264
264
|
}))), { concurrency: 4 });
|
|
265
265
|
});
|
|
266
266
|
const withClis = (task, clis) => {
|
|
@@ -274,9 +274,9 @@ const withClis = (task, clis) => {
|
|
|
274
274
|
if (files[path] !== void 0) throw new Error(`Profile file ${path} is reserved for CLI mocks`);
|
|
275
275
|
files[path] = source;
|
|
276
276
|
}
|
|
277
|
-
const install = ["mkdir -p ~/.local/bin", ...clis.flatMap(({ entry,
|
|
278
|
-
const
|
|
279
|
-
return [`chmod +x ${
|
|
277
|
+
const install = ["mkdir -p ~/.local/bin", ...clis.flatMap(({ entry, path }) => {
|
|
278
|
+
const executable = entry.slice(10);
|
|
279
|
+
return [`chmod +x ${executable}`, `ln -sf "$PWD/${executable}" ~/.local/bin/${path}`];
|
|
280
280
|
})].join(" && ");
|
|
281
281
|
return {
|
|
282
282
|
...task,
|
|
@@ -255,12 +255,12 @@ await runCli(cli);`;
|
|
|
255
255
|
//#endregion
|
|
256
256
|
//#region src/evals/cli-profile.ts
|
|
257
257
|
const compileClis = (entry, definitions) => Effect.gen(function* () {
|
|
258
|
-
const
|
|
259
|
-
const duplicate =
|
|
258
|
+
const paths = definitions.map(({ path }) => path);
|
|
259
|
+
const duplicate = paths.find((path, index) => paths.indexOf(path) !== index);
|
|
260
260
|
if (duplicate !== void 0) return yield* Effect.fail(/* @__PURE__ */ new Error(`Duplicate CLI: ${duplicate}`));
|
|
261
261
|
return yield* Effect.forEach(definitions, (definition, index) => bundle(cliEntry(entry, index), entry, { minify: true }).pipe(Effect.map(({ source }) => ({
|
|
262
262
|
...packageProgram(`workspace/.anpord/cli/${index}`, "cli.mjs", source),
|
|
263
|
-
|
|
263
|
+
path: definition.path
|
|
264
264
|
}))), { concurrency: 4 });
|
|
265
265
|
});
|
|
266
266
|
const withClis = (task, clis) => {
|
|
@@ -274,9 +274,9 @@ const withClis = (task, clis) => {
|
|
|
274
274
|
if (files[path] !== void 0) throw new Error(`Profile file ${path} is reserved for CLI mocks`);
|
|
275
275
|
files[path] = source;
|
|
276
276
|
}
|
|
277
|
-
const install = ["mkdir -p ~/.local/bin", ...clis.flatMap(({ entry,
|
|
278
|
-
const
|
|
279
|
-
return [`chmod +x ${
|
|
277
|
+
const install = ["mkdir -p ~/.local/bin", ...clis.flatMap(({ entry, path }) => {
|
|
278
|
+
const executable = entry.slice(10);
|
|
279
|
+
return [`chmod +x ${executable}`, `ln -sf "$PWD/${executable}" ~/.local/bin/${path}`];
|
|
280
280
|
})].join(" && ");
|
|
281
281
|
return {
|
|
282
282
|
...task,
|
|
@@ -16,9 +16,9 @@ interface CliCommandDefinition<Input extends InputSchema = InputSchema, Output e
|
|
|
16
16
|
readonly description?: string;
|
|
17
17
|
handler(input: InputOf<Input>, context: CliHandlerContext): Awaitable<StandardSchemaV1.InferInput<Output>>;
|
|
18
18
|
readonly inputSchema: Input;
|
|
19
|
-
readonly name: string;
|
|
20
19
|
readonly options: { readonly [Key in Extract<keyof InputOf<Input>, string>]: CliOption; };
|
|
21
20
|
readonly outputSchema: Output;
|
|
21
|
+
readonly path: readonly [string, ...string[]];
|
|
22
22
|
}
|
|
23
23
|
type CliCommandOptions<Input extends InputSchema, Output extends StandardSchemaV1> = Omit<CliCommandDefinition<Input, Output>, "_tag" | "options"> & {
|
|
24
24
|
readonly options: { readonly [Key in Extract<keyof InputOf<Input>, string>]: Omit<CliOption, "type"> & {
|
|
@@ -30,7 +30,7 @@ interface CliDefinition {
|
|
|
30
30
|
readonly _tag: "Cli";
|
|
31
31
|
readonly commands: readonly CliCommandDefinition[];
|
|
32
32
|
readonly description?: string;
|
|
33
|
-
readonly
|
|
33
|
+
readonly path: string;
|
|
34
34
|
readonly version: string;
|
|
35
35
|
}
|
|
36
36
|
type CliOptions = Omit<CliDefinition, "_tag">;
|
|
@@ -16,9 +16,9 @@ interface CliCommandDefinition<Input extends InputSchema = InputSchema, Output e
|
|
|
16
16
|
readonly description?: string;
|
|
17
17
|
handler(input: InputOf<Input>, context: CliHandlerContext): Awaitable<StandardSchemaV1.InferInput<Output>>;
|
|
18
18
|
readonly inputSchema: Input;
|
|
19
|
-
readonly name: string;
|
|
20
19
|
readonly options: { readonly [Key in Extract<keyof InputOf<Input>, string>]: CliOption; };
|
|
21
20
|
readonly outputSchema: Output;
|
|
21
|
+
readonly path: readonly [string, ...string[]];
|
|
22
22
|
}
|
|
23
23
|
type CliCommandOptions<Input extends InputSchema, Output extends StandardSchemaV1> = Omit<CliCommandDefinition<Input, Output>, "_tag" | "options"> & {
|
|
24
24
|
readonly options: { readonly [Key in Extract<keyof InputOf<Input>, string>]: Omit<CliOption, "type"> & {
|
|
@@ -30,7 +30,7 @@ interface CliDefinition {
|
|
|
30
30
|
readonly _tag: "Cli";
|
|
31
31
|
readonly commands: readonly CliCommandDefinition[];
|
|
32
32
|
readonly description?: string;
|
|
33
|
-
readonly
|
|
33
|
+
readonly path: string;
|
|
34
34
|
readonly version: string;
|
|
35
35
|
}
|
|
36
36
|
type CliOptions = Omit<CliDefinition, "_tag">;
|
|
@@ -3,23 +3,23 @@ const command = (definition) => ({
|
|
|
3
3
|
...definition,
|
|
4
4
|
_tag: "CliCommand"
|
|
5
5
|
});
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
const CLI_PATH = /^[a-z0-9][a-z0-9_-]{0,63}$/;
|
|
7
|
+
const COMMAND_PATH = /^[a-z0-9][a-z0-9-]*$/;
|
|
8
8
|
const OPTION = /^--[a-z0-9][a-z0-9-]*$/;
|
|
9
9
|
const optionName = (key, option) => option.name ?? `--${key.replaceAll(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase()}`;
|
|
10
10
|
const duplicateOf = (values) => values.find((value, index) => values.indexOf(value) !== index);
|
|
11
11
|
const cli = (definition) => {
|
|
12
|
-
if (!
|
|
12
|
+
if (!CLI_PATH.test(definition.path)) throw new Error("CLI paths need 1-64 lowercase letters, digits, underscores, or hyphens");
|
|
13
13
|
if (!definition.version.trim()) throw new Error("CLIs need a version");
|
|
14
14
|
for (const item of definition.commands) {
|
|
15
|
-
if (!
|
|
15
|
+
if (item.path.length === 0 || !item.path.every((part) => COMMAND_PATH.test(part))) throw new Error(`Invalid CLI command: ${item.path.join(" ")}`);
|
|
16
16
|
const options = Object.entries(item.options).map(([key, value]) => optionName(key, value));
|
|
17
17
|
const invalid = options.find((name) => !OPTION.test(name));
|
|
18
18
|
if (invalid !== void 0) throw new Error(`Invalid CLI option: ${invalid}`);
|
|
19
19
|
const duplicate = duplicateOf(options);
|
|
20
20
|
if (duplicate !== void 0) throw new Error(`Duplicate CLI option: ${duplicate}`);
|
|
21
21
|
}
|
|
22
|
-
const duplicate = duplicateOf(definition.commands.map(({
|
|
22
|
+
const duplicate = duplicateOf(definition.commands.map(({ path }) => path.join(" ")));
|
|
23
23
|
if (duplicate !== void 0) throw new Error(`Duplicate CLI command: ${duplicate}`);
|
|
24
24
|
return {
|
|
25
25
|
...definition,
|
|
@@ -3,23 +3,23 @@ const command = (definition) => ({
|
|
|
3
3
|
...definition,
|
|
4
4
|
_tag: "CliCommand"
|
|
5
5
|
});
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
const CLI_PATH = /^[a-z0-9][a-z0-9_-]{0,63}$/;
|
|
7
|
+
const COMMAND_PATH = /^[a-z0-9][a-z0-9-]*$/;
|
|
8
8
|
const OPTION = /^--[a-z0-9][a-z0-9-]*$/;
|
|
9
9
|
const optionName = (key, option) => option.name ?? `--${key.replaceAll(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase()}`;
|
|
10
10
|
const duplicateOf = (values) => values.find((value, index) => values.indexOf(value) !== index);
|
|
11
11
|
const cli = (definition) => {
|
|
12
|
-
if (!
|
|
12
|
+
if (!CLI_PATH.test(definition.path)) throw new Error("CLI paths need 1-64 lowercase letters, digits, underscores, or hyphens");
|
|
13
13
|
if (!definition.version.trim()) throw new Error("CLIs need a version");
|
|
14
14
|
for (const item of definition.commands) {
|
|
15
|
-
if (!
|
|
15
|
+
if (item.path.length === 0 || !item.path.every((part) => COMMAND_PATH.test(part))) throw new Error(`Invalid CLI command: ${item.path.join(" ")}`);
|
|
16
16
|
const options = Object.entries(item.options).map(([key, value]) => optionName(key, value));
|
|
17
17
|
const invalid = options.find((name) => !OPTION.test(name));
|
|
18
18
|
if (invalid !== void 0) throw new Error(`Invalid CLI option: ${invalid}`);
|
|
19
19
|
const duplicate = duplicateOf(options);
|
|
20
20
|
if (duplicate !== void 0) throw new Error(`Duplicate CLI option: ${duplicate}`);
|
|
21
21
|
}
|
|
22
|
-
const duplicate = duplicateOf(definition.commands.map(({
|
|
22
|
+
const duplicate = duplicateOf(definition.commands.map(({ path }) => path.join(" ")));
|
|
23
23
|
if (duplicate !== void 0) throw new Error(`Duplicate CLI command: ${duplicate}`);
|
|
24
24
|
return {
|
|
25
25
|
...definition,
|
package/dist/eval.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_compiler = require("./compiler-
|
|
2
|
+
const require_compiler = require("./compiler-Ap8DM-JU.cjs");
|
|
3
3
|
exports.compileEval = require_compiler.compileEval;
|
|
4
4
|
exports.compileEvalEffect = require_compiler.compileEvalEffect;
|
package/dist/eval.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as PublicStartEvalRequest, t as CaseCache } from "./types-
|
|
1
|
+
import { h as PublicStartEvalRequest, t as CaseCache } from "./types-H9L450Iu.cjs";
|
|
2
2
|
import { Effect } from "effect";
|
|
3
3
|
//#region src/evals/profile-errors.d.ts
|
|
4
4
|
declare const ProfileDirectoryUnreadable_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
@@ -101,10 +101,10 @@ declare const compileEvalEffect: (path: string) => Effect.Effect<{
|
|
|
101
101
|
readonly harness: "cursor" | "codex" | "opencode" | "pi" | "fx" | "claude" | "gemini" | "qwen" | "command";
|
|
102
102
|
readonly model: string;
|
|
103
103
|
readonly profile?: {
|
|
104
|
+
readonly name: string;
|
|
104
105
|
readonly files: {
|
|
105
106
|
readonly [x: string]: string;
|
|
106
107
|
};
|
|
107
|
-
readonly name: string;
|
|
108
108
|
readonly env?: {
|
|
109
109
|
readonly [x: string]: string;
|
|
110
110
|
} | undefined;
|
package/dist/eval.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as PublicStartEvalRequest, t as CaseCache } from "./types-
|
|
1
|
+
import { h as PublicStartEvalRequest, t as CaseCache } from "./types-oaMF6-E1.mjs";
|
|
2
2
|
import { Effect } from "effect";
|
|
3
3
|
//#region src/evals/profile-errors.d.ts
|
|
4
4
|
declare const ProfileDirectoryUnreadable_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
@@ -101,10 +101,10 @@ declare const compileEvalEffect: (path: string) => Effect.Effect<{
|
|
|
101
101
|
readonly harness: "cursor" | "codex" | "opencode" | "pi" | "fx" | "claude" | "gemini" | "qwen" | "command";
|
|
102
102
|
readonly model: string;
|
|
103
103
|
readonly profile?: {
|
|
104
|
+
readonly name: string;
|
|
104
105
|
readonly files: {
|
|
105
106
|
readonly [x: string]: string;
|
|
106
107
|
};
|
|
107
|
-
readonly name: string;
|
|
108
108
|
readonly env?: {
|
|
109
109
|
readonly [x: string]: string;
|
|
110
110
|
} | undefined;
|
package/dist/eval.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as compileEvalEffect, t as compileEval } from "./compiler-
|
|
1
|
+
import { n as compileEvalEffect, t as compileEval } from "./compiler-DXlpU_In.mjs";
|
|
2
2
|
export { compileEval, compileEvalEffect };
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as layer, i as DEFAULT_BASE_URL, n as AnpordClient, o as make, r as ClientOptions, t as AnpordApi } from "./client-C9m0uLCz.cjs";
|
|
2
2
|
import { _ as EvalVerdict, a as EvalDistribution, b as StartedEval, c as EvalProvider, d as EvalRunSummary, f as EvalSource, g as EvalUsage, h as EvalTrialStatus, i as EvalComparison, l as EvalRun, m as EvalTrial, n as EvalCell, o as EvalHarness, p as EvalTask, r as EvalCellHistoryEntry, s as EvalJournalEntry, t as CatalogueModel, u as EvalRunStatus, v as ModelCatalogue, y as RerunCellRequest } from "./evals-BEgEmfiO.cjs";
|
|
3
|
-
import { a as EvalTaskDefinition, c as Prepare, d as ProfileRef, f as Validator, i as EvalDefinition, l as PrepareContext, m as ValidatorResult, n as CommandResult, o as ExecOptions, p as ValidatorContext, r as EvalCaseDefinition, s as HarnessRef, t as CaseCache, u as PrepareValue } from "./types-
|
|
3
|
+
import { a as EvalTaskDefinition, c as Prepare, d as ProfileRef, f as Validator, i as EvalDefinition, l as PrepareContext, m as ValidatorResult, n as CommandResult, o as ExecOptions, p as ValidatorContext, r as EvalCaseDefinition, s as HarnessRef, t as CaseCache, u as PrepareValue } from "./types-H9L450Iu.cjs";
|
|
4
4
|
import { t as McpCall } from "./calls-DYqBi5FA.cjs";
|
|
5
5
|
import { t as CliCall } from "./calls-Drj_dZpu.cjs";
|
|
6
6
|
import { empty, files, repo } from "./source.cjs";
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as layer, i as DEFAULT_BASE_URL, n as AnpordClient, o as make, r as ClientOptions, t as AnpordApi } from "./client-TFCLuMv8.mjs";
|
|
2
2
|
import { _ as EvalVerdict, a as EvalDistribution, b as StartedEval, c as EvalProvider, d as EvalRunSummary, f as EvalSource, g as EvalUsage, h as EvalTrialStatus, i as EvalComparison, l as EvalRun, m as EvalTrial, n as EvalCell, o as EvalHarness, p as EvalTask, r as EvalCellHistoryEntry, s as EvalJournalEntry, t as CatalogueModel, u as EvalRunStatus, v as ModelCatalogue, y as RerunCellRequest } from "./evals-BEgEmfiO.mjs";
|
|
3
|
-
import { a as EvalTaskDefinition, c as Prepare, d as ProfileRef, f as Validator, i as EvalDefinition, l as PrepareContext, m as ValidatorResult, n as CommandResult, o as ExecOptions, p as ValidatorContext, r as EvalCaseDefinition, s as HarnessRef, t as CaseCache, u as PrepareValue } from "./types-
|
|
3
|
+
import { a as EvalTaskDefinition, c as Prepare, d as ProfileRef, f as Validator, i as EvalDefinition, l as PrepareContext, m as ValidatorResult, n as CommandResult, o as ExecOptions, p as ValidatorContext, r as EvalCaseDefinition, s as HarnessRef, t as CaseCache, u as PrepareValue } from "./types-oaMF6-E1.mjs";
|
|
4
4
|
import { t as McpCall } from "./calls-DYqBi5FA.mjs";
|
|
5
5
|
import { t as CliCall } from "./calls-Drj_dZpu.mjs";
|
|
6
6
|
import { empty, files, repo } from "./source.mjs";
|
|
@@ -3,7 +3,7 @@ import { f as EvalSource, o as EvalHarness } from "./evals-BEgEmfiO.cjs";
|
|
|
3
3
|
import { t as McpCall } from "./calls-DYqBi5FA.cjs";
|
|
4
4
|
import { n as McpServerDefinition } from "./define-HK0eeSNn.cjs";
|
|
5
5
|
import { t as CliCall } from "./calls-Drj_dZpu.cjs";
|
|
6
|
-
import { n as CliDefinition } from "./define-
|
|
6
|
+
import { n as CliDefinition } from "./define-BEiYXrC5.cjs";
|
|
7
7
|
import { Schema } from "effect";
|
|
8
8
|
import "@effect/platform";
|
|
9
9
|
//#region ../schema/src/public/evals-api.d.ts
|
|
@@ -3,7 +3,7 @@ import { f as EvalSource, o as EvalHarness } from "./evals-BEgEmfiO.mjs";
|
|
|
3
3
|
import { t as McpCall } from "./calls-DYqBi5FA.mjs";
|
|
4
4
|
import { n as McpServerDefinition } from "./define-HK0eeSNn.mjs";
|
|
5
5
|
import { t as CliCall } from "./calls-Drj_dZpu.mjs";
|
|
6
|
-
import { n as CliDefinition } from "./define-
|
|
6
|
+
import { n as CliDefinition } from "./define-BEiYXrC5.mjs";
|
|
7
7
|
import { HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSecurity } from "@effect/platform";
|
|
8
8
|
import { Context, Schema } from "effect";
|
|
9
9
|
//#region ../schema/src/public/evals-api.d.ts
|