@letterstory/cli 0.175.18 → 0.175.20
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/lib/cli.mjs +10 -3
- package/lib/commands/bench.mjs +70 -8
- package/lib/documents.mjs +2 -0
- package/package.json +1 -1
package/lib/cli.mjs
CHANGED
|
@@ -78,7 +78,7 @@ import {
|
|
|
78
78
|
} from "./commands.mjs";
|
|
79
79
|
|
|
80
80
|
// Matches cli/package.json; publish-cli.yml rewrites both to the published version.
|
|
81
|
-
export const VERSION = "0.175.
|
|
81
|
+
export const VERSION = "0.175.20";
|
|
82
82
|
|
|
83
83
|
/** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
|
|
84
84
|
export const EXIT_PAYMENT_REQUIRED = 3;
|
|
@@ -87,6 +87,10 @@ export const EXIT_PAYMENT_REQUIRED = 3;
|
|
|
87
87
|
// can't accidentally swallow the id as --json's value. Every `type: "bool"` flag (and its
|
|
88
88
|
// `negate` spelling) in a command's ARGS map must be listed; boolean-flags.test.ts enforces it.
|
|
89
89
|
export const BOOLEAN_FLAGS = new Set([
|
|
90
|
+
// bench run: the spec was just changed.
|
|
91
|
+
"spec-changed",
|
|
92
|
+
// bench update: remove the README's disclosure.
|
|
93
|
+
"no-disclosure",
|
|
90
94
|
// sim create / resample / sample-key: keep the customer's sample key, or delete it now.
|
|
91
95
|
"keep-key",
|
|
92
96
|
"delete-key",
|
|
@@ -1726,10 +1730,13 @@ Bench (Benches: open-source benchmarks on their own domains, kept running; @lett
|
|
|
1726
1730
|
[--letterbase <collection-id>] [--every <days>] [--repo-owner <o>] [--repo-name <r>] [--spec-file <path>]
|
|
1727
1731
|
The repo lives on your organization's GitHub
|
|
1728
1732
|
bench show <id> Spec, domain, repo, site, results, recent events
|
|
1733
|
+
bench check <id> [--skip <contender-id>]… Readiness: GitHub, credentials, domain, model, sandboxes; the quote
|
|
1734
|
+
bench approve <id> [--skip <contender-id>]… Approve a bench in review; nothing is spent before
|
|
1729
1735
|
bench update <id> [--name <n>] [--slug <s>] [--repo-owner <o>] [--repo-name <r>] [--spec-file <path>] [--domain <d>] [--every <days>]
|
|
1736
|
+
[--disclosure "<text>"|--disclosure-file <path>|--no-disclosure] The README's optional ## Disclosure
|
|
1730
1737
|
bench pause <id> | bench resume <id> | bench archive <id>
|
|
1731
|
-
bench advance <id> [--retry]
|
|
1732
|
-
bench run <id> [--note "<what else to do>"]
|
|
1738
|
+
bench advance <id> [--retry] [--skip <id>]… Move it on now; --retry once blocked_on is done
|
|
1739
|
+
bench run <id> [--note "<what else to do>"] [--spec-changed] [--skip <id>]… Run the benchmark again
|
|
1733
1740
|
bench connect <id> <collection-id|none> A letterbase whose posts cite and link it
|
|
1734
1741
|
bench cite <id> The reference line a post cites
|
|
1735
1742
|
bench replicate <id> REPLICATE.md: how an agent reproduces the results
|
package/lib/commands/bench.mjs
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
// `bench` — Benches from a terminal (docs/architecture/benches.md): public, open-source benchmarks
|
|
2
2
|
// on their own domains, kept running by Letter. Staff only: the tools answer only a key an
|
|
3
3
|
// @letterstory.com person made. Thin wrappers over the bench tools (create_bench, list_benches,
|
|
4
|
-
// get_bench, update_bench, advance_bench, start_bench_run,
|
|
5
|
-
// get_bench_citation), the same lib functions the app calls.
|
|
4
|
+
// get_bench, get_bench_readiness, approve_bench, update_bench, advance_bench, start_bench_run,
|
|
5
|
+
// connect_bench_letterbase, get_bench_citation), the same lib functions the app calls.
|
|
6
6
|
//
|
|
7
7
|
// letterstory bench create --prompt "Benchmark Acme's vector search against Pinecone and Qdrant: …"
|
|
8
8
|
// letterstory bench create --prompt-file brief.md --name VectorBench --domain vectorbench.dev --letterbase <collection-id>
|
|
9
9
|
// [--repo-owner <their GitHub account>] [--repo-name <name>]
|
|
10
10
|
// letterstory bench list
|
|
11
11
|
// letterstory bench show <id>
|
|
12
|
+
// letterstory bench check <id> [--skip <contender-id>]… (the readiness checklist and the quote)
|
|
13
|
+
// letterstory bench approve <id> [--skip <contender-id>]… (a bench in review: nothing is spent before)
|
|
12
14
|
// letterstory bench update <id> [--name <n>] [--slug <s>] [--repo-owner <o>] [--repo-name <r>] [--spec-file spec.json] [--domain <d>] [--every <days>]
|
|
15
|
+
// [--disclosure "<README disclosure text>" | --no-disclosure]
|
|
13
16
|
// letterstory bench pause <id> | resume <id> | archive <id>
|
|
14
|
-
// letterstory bench advance <id> [--retry]
|
|
15
|
-
// letterstory bench run <id> [--note "add Qdrant as a contender"]
|
|
17
|
+
// letterstory bench advance <id> [--retry] [--skip <contender-id>]…
|
|
18
|
+
// letterstory bench run <id> [--note "add Qdrant as a contender"] [--spec-changed] [--skip <contender-id>]…
|
|
16
19
|
// letterstory bench connect <id> <collection-id|none>
|
|
17
20
|
// letterstory bench cite <id>
|
|
18
21
|
// letterstory bench replicate <id>
|
|
@@ -61,10 +64,29 @@ export const ARGS = {
|
|
|
61
64
|
spec: { value: specFromFile },
|
|
62
65
|
domain: "domain",
|
|
63
66
|
rerun_every_days: { flag: "every", type: "num" },
|
|
67
|
+
// The README's disclosure: text sets it, --no-disclosure removes it (the default is none).
|
|
68
|
+
disclosure: {
|
|
69
|
+
value: (flags) => {
|
|
70
|
+
if (flags["no-disclosure"] === true) return null;
|
|
71
|
+
const text = readTextInput(flags, "disclosure", "disclosure-file");
|
|
72
|
+
return text === undefined ? undefined : text;
|
|
73
|
+
},
|
|
74
|
+
},
|
|
64
75
|
status: { flag: "status", enum: ["live", "paused", "archived"] },
|
|
65
76
|
},
|
|
66
|
-
|
|
67
|
-
|
|
77
|
+
get_bench_readiness: { bench_id: benchId, skip_contenders: { flag: "skip", type: "list" } },
|
|
78
|
+
approve_bench: { bench_id: benchId, skip_contenders: { flag: "skip", type: "list" } },
|
|
79
|
+
advance_bench: {
|
|
80
|
+
bench_id: benchId,
|
|
81
|
+
retry: { flag: "retry", type: "bool" },
|
|
82
|
+
skip_contenders: { flag: "skip", type: "list" },
|
|
83
|
+
},
|
|
84
|
+
start_bench_run: {
|
|
85
|
+
bench_id: benchId,
|
|
86
|
+
note: "note",
|
|
87
|
+
spec_changed: { flag: "spec-changed", type: "bool" },
|
|
88
|
+
skip_contenders: { flag: "skip", type: "list" },
|
|
89
|
+
},
|
|
68
90
|
connect_bench_letterbase: {
|
|
69
91
|
bench_id: benchId,
|
|
70
92
|
collection_id: {
|
|
@@ -95,8 +117,19 @@ export async function cmdBench(ctx) {
|
|
|
95
117
|
return benchShow(rest, await call(rest, "create_bench"));
|
|
96
118
|
case "show":
|
|
97
119
|
return benchShow(rest, await call(rest, "get_bench"));
|
|
120
|
+
case "check":
|
|
121
|
+
refuseUnknownFlags(rest, ARGS.get_bench_readiness, []);
|
|
122
|
+
return benchCheck(rest);
|
|
123
|
+
case "approve":
|
|
124
|
+
refuseUnknownFlags(rest, ARGS.approve_bench, []);
|
|
125
|
+
return benchShow(rest, await call(rest, "approve_bench"));
|
|
98
126
|
case "update":
|
|
99
|
-
refuseUnknownFlags(rest, ARGS.update_bench, [
|
|
127
|
+
refuseUnknownFlags(rest, ARGS.update_bench, [
|
|
128
|
+
"spec-file",
|
|
129
|
+
"disclosure",
|
|
130
|
+
"disclosure-file",
|
|
131
|
+
"no-disclosure",
|
|
132
|
+
]);
|
|
100
133
|
return benchShow(rest, await call(rest, "update_bench"));
|
|
101
134
|
case "pause":
|
|
102
135
|
case "resume":
|
|
@@ -117,7 +150,7 @@ export async function cmdBench(ctx) {
|
|
|
117
150
|
return benchReplicate(rest);
|
|
118
151
|
default:
|
|
119
152
|
throw new CliError(
|
|
120
|
-
"Usage: bench [list|create|show|update|pause|resume|archive|advance|run|connect|cite|replicate]"
|
|
153
|
+
"Usage: bench [list|create|show|check|approve|update|pause|resume|archive|advance|run|connect|cite|replicate]"
|
|
121
154
|
);
|
|
122
155
|
}
|
|
123
156
|
}
|
|
@@ -146,6 +179,9 @@ function benchShow(ctx, result) {
|
|
|
146
179
|
`${title(b)} — ${b.status}, stage ${b.stage}`,
|
|
147
180
|
...(b.spec ? [` ${b.spec.tagline}`] : []),
|
|
148
181
|
...(b.blocked_on ? [` Blocked: ${b.blocked_on}`, ` Then: bench advance ${b.id} --retry`] : []),
|
|
182
|
+
...(b.stage === "review" && !b.blocked_on
|
|
183
|
+
? [` In review: check it (bench check ${b.id}), then bench approve ${b.id}`]
|
|
184
|
+
: []),
|
|
149
185
|
...(b.stage_note && !b.blocked_on ? [` ${b.stage_note}`] : []),
|
|
150
186
|
...(b.domain
|
|
151
187
|
? [` Domain ${b.domain}${b.domain_decision?.source === "ai" ? " (chosen and bought)" : ""}`]
|
|
@@ -179,6 +215,32 @@ function benchShow(ctx, result) {
|
|
|
179
215
|
return 0;
|
|
180
216
|
}
|
|
181
217
|
|
|
218
|
+
const MARK = { pass: "✓", warn: "!", block: "✗" };
|
|
219
|
+
|
|
220
|
+
async function benchCheck(ctx) {
|
|
221
|
+
const result = await call(ctx, "get_bench_readiness");
|
|
222
|
+
printResult(ctx.io, ctx.flags, result, (r) => {
|
|
223
|
+
const { readiness } = r;
|
|
224
|
+
const q = readiness.quote;
|
|
225
|
+
const lines = readiness.items.map(
|
|
226
|
+
(i) =>
|
|
227
|
+
`${MARK[i.state]} ${i.label.padEnd(12)} ${i.detail}${i.fix ? ` (${i.fix.label}: ${i.fix.href})` : ""}`
|
|
228
|
+
);
|
|
229
|
+
lines.push(
|
|
230
|
+
"",
|
|
231
|
+
`Domain ${q.domain.domain ?? "—"} (${q.domain.state}${q.domain.price_usd != null ? `, $${q.domain.price_usd}` : ""})`,
|
|
232
|
+
`Repo ${q.repo.owner ?? "?"}/${q.repo.name}${q.repo.public === false ? " (private)" : ""}`,
|
|
233
|
+
`A run at most $${q.run.budget_usd}${q.run.typical_usd != null ? `; typically $${q.run.typical_usd} (${q.run.runs_counted} runs)` : ""}`,
|
|
234
|
+
"",
|
|
235
|
+
readiness.ready
|
|
236
|
+
? "Ready."
|
|
237
|
+
: "Not ready: fix what's marked ✗ (or --skip a contender to run without its credentials)."
|
|
238
|
+
);
|
|
239
|
+
return lines.join("\n");
|
|
240
|
+
});
|
|
241
|
+
return 0;
|
|
242
|
+
}
|
|
243
|
+
|
|
182
244
|
async function benchCite(ctx) {
|
|
183
245
|
const result = await call(ctx, "get_bench_citation");
|
|
184
246
|
printResult(ctx.io, ctx.flags, result, (r) => r.citation.cite_as);
|
package/lib/documents.mjs
CHANGED
|
@@ -65,6 +65,8 @@ export const DOCUMENT_FLAG_PAIRS = [
|
|
|
65
65
|
["instructions", "instructions-file"],
|
|
66
66
|
// A bench's prompt (bench.mjs `bench create`): what the benchmark is and how it works, prose.
|
|
67
67
|
["prompt", "prompt-file"],
|
|
68
|
+
// A bench's README disclosure (bench.mjs `bench create|update --disclosure-file`): prose.
|
|
69
|
+
["disclosure", "disclosure-file"],
|
|
68
70
|
];
|
|
69
71
|
|
|
70
72
|
/**
|