@letterstory/cli 0.177.78 → 0.177.80
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 +5 -1
- package/lib/commands/admin.mjs +33 -1
- package/lib/commands/usage.mjs +35 -1
- package/package.json +1 -1
package/lib/cli.mjs
CHANGED
|
@@ -90,7 +90,7 @@ import {
|
|
|
90
90
|
import { fetchParkedSections, withoutParked } from "./parked.mjs";
|
|
91
91
|
|
|
92
92
|
// Matches cli/package.json; publish-cli.yml rewrites both to the published version.
|
|
93
|
-
export const VERSION = "0.177.
|
|
93
|
+
export const VERSION = "0.177.80";
|
|
94
94
|
|
|
95
95
|
/** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
|
|
96
96
|
export const EXIT_PAYMENT_REQUIRED = 3;
|
|
@@ -99,6 +99,7 @@ export const EXIT_PAYMENT_REQUIRED = 3;
|
|
|
99
99
|
// can't accidentally swallow the id as --json's value. Every `type: "bool"` flag (and its
|
|
100
100
|
// `negate` spelling) in a command's ARGS map must be listed; boolean-flags.test.ts enforces it.
|
|
101
101
|
export const BOOLEAN_FLAGS = new Set([
|
|
102
|
+
"clear-choice",
|
|
102
103
|
// models list: say whether each trained model's server is up now.
|
|
103
104
|
"serving",
|
|
104
105
|
// Models material: retain a request for attachments before preparing it.
|
|
@@ -335,6 +336,9 @@ export const BOOLEAN_FLAGS = new Set([
|
|
|
335
336
|
"no-key",
|
|
336
337
|
// `admin evals triage --overdue`
|
|
337
338
|
"overdue",
|
|
339
|
+
// `admin letterpress asks --people` / `--letter`: what people asked for, or Letter's own jobs
|
|
340
|
+
"people",
|
|
341
|
+
"letter",
|
|
338
342
|
// `autopen start --article <id> --from-scratch`
|
|
339
343
|
"from-scratch",
|
|
340
344
|
// `collections activate <id> --no-topic-map` / `--no-headlines`
|
package/lib/commands/admin.mjs
CHANGED
|
@@ -5326,7 +5326,7 @@ const BUILD_FAILURES = "/api/superadmin/build-failures";
|
|
|
5326
5326
|
const SUGGESTION_REVIEW = "/api/superadmin/suggestion-review";
|
|
5327
5327
|
const TURN_ENDINGS = "/api/superadmin/turn-endings";
|
|
5328
5328
|
const ENGINE_USAGE =
|
|
5329
|
-
"Usage: admin letterpress status | gaps | telemetry [--days N] [--harness h] [--all-orgs] | tokens [--days N] [--so-far] [--all-orgs] | prs [--days N | --from YYYY-MM-DD [--to YYYY-MM-DD] | --all-time] [--day YYYY-MM-DD] [--org id] [--state merged|open|closed] [--top N] [--tz zone] [--all-orgs] | failures [--days N | --from YYYY-MM-DD [--to YYYY-MM-DD] | --all-time] [--day YYYY-MM-DD] [--org id] [--failure ours|agent|setup|undelivered] [--cause c] [--stopped-at step] [--repo owner/name] [--slow] [--tz zone] [--all-orgs] | blocked [--days N] [--org id] [--all-orgs] | endings [--days N | --since ISO] [--org id,id] [--no-model] [--top N] [--write-cases [--dir evals/letterpress]] | unblock <org-id> <host> <subject> | decisions <org-id> [--site host] [--surface plan|fix|build|site] | undo <org-id> <host> <decision-id> | runs [--status s] [--error-code c] [--first-review-cause agent|context|setup|unknown] [--pr merged|closed|open|none] [--harness h] [--days N] | beyond [--limit N] [--before ISO] | companies | company <org-id> [--site host] | ideas <org-id> [--site host] [--repo connected|none] | suggestions fix|idea [--day YYYY-MM-DD] [--type key [--org id]] [--all-orgs] | suggestions flag fix|idea <type-key> [--org id --item item-id] [--note …] | suggestions clear <flag-id> | facts <org-id> [--site host] | fits [--recipe id] [--org id] [--site host] [--fits yes|no|unknown|waiting] [--limit N] | replay <run-id> | mark <run-id> <item-id> <right|weak|wrong|lead|gap|recipe|clear> [--note …] | settings | set <weights.<ask>.<reading>|lenses.<lens>.bar.<reading>|lenses.<lens>.bar|lenses.<lens>.research.turns|lenses.<lens>.research.ms|asks.<lens>.ask|asks.<lens>.guidance|dismissals.block_days|preflight.off|explore.ask|explore.research.turns|explore.research.ms|explore.every_days> <value>";
|
|
5329
|
+
"Usage: admin letterpress status | gaps | asks [--days N] [--people | --letter] [--door d] [--org id] [--limit N] | telemetry [--days N] [--harness h] [--all-orgs] | tokens [--days N] [--so-far] [--all-orgs] | prs [--days N | --from YYYY-MM-DD [--to YYYY-MM-DD] | --all-time] [--day YYYY-MM-DD] [--org id] [--state merged|open|closed] [--top N] [--tz zone] [--all-orgs] | failures [--days N | --from YYYY-MM-DD [--to YYYY-MM-DD] | --all-time] [--day YYYY-MM-DD] [--org id] [--failure ours|agent|setup|undelivered] [--cause c] [--stopped-at step] [--repo owner/name] [--slow] [--tz zone] [--all-orgs] | blocked [--days N] [--org id] [--all-orgs] | endings [--days N | --since ISO] [--org id,id] [--no-model] [--top N] [--write-cases [--dir evals/letterpress]] | unblock <org-id> <host> <subject> | decisions <org-id> [--site host] [--surface plan|fix|build|site] | undo <org-id> <host> <decision-id> | runs [--status s] [--error-code c] [--first-review-cause agent|context|setup|unknown] [--pr merged|closed|open|none] [--harness h] [--days N] | beyond [--limit N] [--before ISO] | companies | company <org-id> [--site host] | ideas <org-id> [--site host] [--repo connected|none] | suggestions fix|idea [--day YYYY-MM-DD] [--type key [--org id]] [--all-orgs] | suggestions flag fix|idea <type-key> [--org id --item item-id] [--note …] | suggestions clear <flag-id> | facts <org-id> [--site host] | fits [--recipe id] [--org id] [--site host] [--fits yes|no|unknown|waiting] [--limit N] | replay <run-id> | mark <run-id> <item-id> <right|weak|wrong|lead|gap|recipe|clear> [--note …] | settings | set <weights.<ask>.<reading>|lenses.<lens>.bar.<reading>|lenses.<lens>.bar|lenses.<lens>.research.turns|lenses.<lens>.research.ms|asks.<lens>.ask|asks.<lens>.guidance|dismissals.block_days|preflight.off|explore.ask|explore.research.turns|explore.research.ms|explore.every_days> <value>";
|
|
5330
5330
|
|
|
5331
5331
|
/** One number of the settings from a dotted path and a value: the PUT body save_engine_settings reads. */
|
|
5332
5332
|
function engineSettingsPatch(path, value) {
|
|
@@ -5478,6 +5478,38 @@ async function cmdAdminLetterpress(ctx) {
|
|
|
5478
5478
|
);
|
|
5479
5479
|
return 0;
|
|
5480
5480
|
}
|
|
5481
|
+
case "asks": {
|
|
5482
|
+
// get_ask_outcomes: did each ask end with what was asked (docs/architecture/failure-visibility.md).
|
|
5483
|
+
const q = new URLSearchParams({ view: "asks", days: String(flags.days ?? 7) });
|
|
5484
|
+
if (flagBool(flags.people)) q.set("asked_by", "person");
|
|
5485
|
+
if (flagBool(flags.letter)) q.set("asked_by", "letter");
|
|
5486
|
+
if (flags.door) q.set("door", String(flags.door));
|
|
5487
|
+
if (flags.org) q.set("org_id", String(flags.org));
|
|
5488
|
+
if (flags.limit) q.set("limit", String(flags.limit));
|
|
5489
|
+
const r = await staffRequest(ctx, "GET", `${CODING_TELEMETRY}?${q}`);
|
|
5490
|
+
const pct = (x) => (x.rate == null ? "—" : `${Math.round(100 * x.rate)}% (${x.hits}/${x.n})`);
|
|
5491
|
+
const line = (d) =>
|
|
5492
|
+
`${d.door.padEnd(28)} ${String(d.asks).padStart(5)} asks delivered ${pct(d.delivered_rate)} not ${d.outcomes.not_delivered} stuck ${d.outcomes.stuck} merged ${pct(d.merged_rate)} live ${d.live}`;
|
|
5493
|
+
printResult(io, flags, r, (a) =>
|
|
5494
|
+
[
|
|
5495
|
+
`Delivered, last ${a.days} days${a.computed_at ? ` (read ${a.computed_at}${a.stale ? ", stale" : ""}${a.partial ? ", partial" : ""})` : ""}`,
|
|
5496
|
+
line(a.summary.person),
|
|
5497
|
+
line(a.summary.letter),
|
|
5498
|
+
"",
|
|
5499
|
+
...a.summary.doors.map(line),
|
|
5500
|
+
"",
|
|
5501
|
+
...a.summary.reasons
|
|
5502
|
+
.slice(0, 12)
|
|
5503
|
+
.map((x) => `${String(x.count).padStart(5)} ${x.asked_by.padEnd(6)} ${x.reason}`),
|
|
5504
|
+
"",
|
|
5505
|
+
...a.failures.map(
|
|
5506
|
+
(f) =>
|
|
5507
|
+
`${f.at.slice(0, 16)} ${(f.org ?? f.org_id).slice(0, 20).padEnd(20)} ${f.door.padEnd(22)} ${f.outcome.padEnd(13)} ${f.reason ?? ""}: ${f.why ?? ""}${f.pr_url ? ` ${f.pr_url}` : ""}`
|
|
5508
|
+
),
|
|
5509
|
+
].join("\n")
|
|
5510
|
+
);
|
|
5511
|
+
return 0;
|
|
5512
|
+
}
|
|
5481
5513
|
case "telemetry": {
|
|
5482
5514
|
// get_coding_telemetry with fleet: the coding agent's numbers (docs/architecture/coding-telemetry.md).
|
|
5483
5515
|
const q = new URLSearchParams({ view: "summary", days: String(flags.days ?? 7) });
|
package/lib/commands/usage.mjs
CHANGED
|
@@ -33,9 +33,24 @@ const repoPart = (i) => ({
|
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
export const ARGS = {
|
|
36
|
+
get_usage_sources: { host: { flag: "host" }, site_id: { flag: "site" } },
|
|
37
|
+
choose_product_repo: {
|
|
38
|
+
repo_owner: { flag: "owner" },
|
|
39
|
+
repo_name: { flag: "repo" },
|
|
40
|
+
reset: { flag: "clear-choice", type: "bool" },
|
|
41
|
+
},
|
|
42
|
+
connect_proof_database: {
|
|
43
|
+
project_ref: { flag: "project" },
|
|
44
|
+
host: { flag: "host" },
|
|
45
|
+
access_token: { flag: "key" },
|
|
46
|
+
streams: { value: (flags) => JSON.parse(readFileSync(String(flags.streams), "utf8")) },
|
|
47
|
+
},
|
|
48
|
+
get_proof_database: {},
|
|
49
|
+
disconnect_proof_database: {},
|
|
36
50
|
generate_proof_actions: {
|
|
37
51
|
window: { value: (flags) => ({ since: flags.since, until: flags.until }) },
|
|
38
52
|
focus: { flag: "focus" },
|
|
53
|
+
source: { flag: "source" },
|
|
39
54
|
},
|
|
40
55
|
refresh_proof_actions: {},
|
|
41
56
|
get_proof_actions: { id: { flag: "id" } },
|
|
@@ -53,8 +68,12 @@ export const ARGS = {
|
|
|
53
68
|
base_branch: { flag: "base" },
|
|
54
69
|
mode: { flag: "mode" },
|
|
55
70
|
},
|
|
56
|
-
discover_action_events: {
|
|
71
|
+
discover_action_events: {
|
|
72
|
+
source: { flag: "source" },
|
|
73
|
+
window: { value: (flags) => ({ since: flags.since, until: flags.until }) },
|
|
74
|
+
},
|
|
57
75
|
evaluate_action: {
|
|
76
|
+
source: { flag: "source" },
|
|
58
77
|
window: { value: (flags) => ({ since: flags.since, until: flags.until }) },
|
|
59
78
|
definition: { value: (flags) => JSON.parse(readFileSync(String(flags.definition), "utf8")) },
|
|
60
79
|
},
|
|
@@ -234,6 +253,21 @@ const STEP = {
|
|
|
234
253
|
|
|
235
254
|
export async function cmdUsage(ctx) {
|
|
236
255
|
const { client, flags, io } = ctx;
|
|
256
|
+
if (["sources", "choose-repo"].includes(ctx.positionals[0])) {
|
|
257
|
+
const tool = ctx.positionals[0] === "sources" ? "get_usage_sources" : "choose_product_repo";
|
|
258
|
+
printResult(io, flags, await client.callTool(tool, argsFromFlags(ARGS[tool], flags, [])));
|
|
259
|
+
return 0;
|
|
260
|
+
}
|
|
261
|
+
if (ctx.positionals[0] === "database") {
|
|
262
|
+
const tool = {
|
|
263
|
+
connect: "connect_proof_database",
|
|
264
|
+
status: "get_proof_database",
|
|
265
|
+
disconnect: "disconnect_proof_database",
|
|
266
|
+
}[ctx.positionals[1] ?? "status"];
|
|
267
|
+
if (!tool) throw new CliError("Use database connect, status or disconnect");
|
|
268
|
+
printResult(io, flags, await client.callTool(tool, argsFromFlags(ARGS[tool], flags, [])));
|
|
269
|
+
return 0;
|
|
270
|
+
}
|
|
237
271
|
if (["proofs", "find-proofs", "review-proof", "refresh-proofs"].includes(ctx.positionals[0])) {
|
|
238
272
|
const tool = {
|
|
239
273
|
proofs: "get_proof_actions",
|