@letterstory/cli 0.174.5 → 0.175.1
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 +1 -1
- package/lib/commands/admin.mjs +42 -2
- package/lib/commands/ask.mjs +3 -3
- package/lib/commands/build.mjs +2 -0
- package/lib/commands/org.mjs +1 -1
- package/package.json +1 -1
package/lib/cli.mjs
CHANGED
|
@@ -76,7 +76,7 @@ import {
|
|
|
76
76
|
} from "./commands.mjs";
|
|
77
77
|
|
|
78
78
|
// Matches cli/package.json; publish-cli.yml rewrites both to the published version.
|
|
79
|
-
export const VERSION = "0.
|
|
79
|
+
export const VERSION = "0.175.1";
|
|
80
80
|
|
|
81
81
|
/** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
|
|
82
82
|
export const EXIT_PAYMENT_REQUIRED = 3;
|
package/lib/commands/admin.mjs
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
// admin brand-detection <org-id> (fleet:read)
|
|
20
20
|
// admin brand-detection <org-id> [--term t]... [--exact t]... [--exclude p]... [--note "…"] | --clear [--note "…"] (fleet:instrument)
|
|
21
21
|
// admin recipes list|show|runs|vocab|export|import|save|delete … (recipes:read / recipes:write)
|
|
22
|
+
// admin letterpress beyond [--limit N] [--before ISO] (what members asked that went past the library)
|
|
22
23
|
// admin letterpress settings|flip|set … (recipes:read / recipes:write)
|
|
23
24
|
// admin demo guide|list|show|set|reset|check … (demo:read / demo:write)
|
|
24
25
|
// admin models runs|run|star|unstar|scoreboard|requests|request|sampling … (models:read / models:write)
|
|
@@ -4549,7 +4550,7 @@ async function cmdAdminSpend(ctx) {
|
|
|
4549
4550
|
const result = await staffRequest(ctx, "GET", `${SPEND}/usage-margin${params.size ? `?${params}` : ""}`);
|
|
4550
4551
|
printResult(io, flags, result, (m) =>
|
|
4551
4552
|
[
|
|
4552
|
-
`${m.range.from} → ${m.range.to}: ${m.totals.billableEvents} billable of ${m.totals.events} events · ${m.totals.tokens ?? "?"} tokens (${m.rateCard?.version ?? "no card"}) · cost ${usd(m.totals.cost?.totalUsd)} · margin ${m.totals.marginUsd === null ? "?" : usd(m.totals.marginUsd)}`,
|
|
4553
|
+
`${m.range.from} → ${m.range.to}: ${m.totals.billableEvents} billable of ${m.totals.events} events · ${m.totals.tokens ?? "?"} tokens (${m.rateCards?.length > 1 ? `${m.rateCards.map((c) => c.version).join(" + ")}, each day on its own card` : (m.rateCard?.version ?? "no card")}) · cost ${usd(m.totals.cost?.totalUsd)} · margin ${m.totals.marginUsd === null ? "?" : usd(m.totals.marginUsd)}`,
|
|
4553
4554
|
"",
|
|
4554
4555
|
...m.rows.map(
|
|
4555
4556
|
(r) =>
|
|
@@ -5118,7 +5119,7 @@ const ENGINE = "/api/superadmin/engine-settings";
|
|
|
5118
5119
|
const LETTERPRESS = "/api/superadmin/letterpress";
|
|
5119
5120
|
const CODING_TELEMETRY = "/api/superadmin/coding-telemetry";
|
|
5120
5121
|
const ENGINE_USAGE =
|
|
5121
|
-
"Usage: admin letterpress status | gaps | telemetry [--days N] [--harness h] [--all-orgs] | runs [--status s] [--error-code c] [--pr merged|closed|open|none] [--harness h] [--days N] | replay <run-id> | mark <run-id> <item-id> <right|weak|wrong|lead|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|explore.ask|explore.research.turns|explore.research.ms|explore.every_days> <value>";
|
|
5122
|
+
"Usage: admin letterpress status | gaps | telemetry [--days N] [--harness h] [--all-orgs] | runs [--status s] [--error-code c] [--pr merged|closed|open|none] [--harness h] [--days N] | beyond [--limit N] [--before ISO] | fits [--recipe id] [--org id] [--site host] [--fits yes|no|unknown] [--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|explore.ask|explore.research.turns|explore.research.ms|explore.every_days> <value>";
|
|
5122
5123
|
|
|
5123
5124
|
/** One number of the settings from a dotted path and a value: the PUT body save_engine_settings reads. */
|
|
5124
5125
|
function engineSettingsPatch(path, value) {
|
|
@@ -5314,6 +5315,45 @@ async function cmdAdminLetterpress(ctx) {
|
|
|
5314
5315
|
);
|
|
5315
5316
|
return 0;
|
|
5316
5317
|
}
|
|
5318
|
+
case "fits": {
|
|
5319
|
+
// list_recipe_fits: the standing fit's verdicts, one per account, site and recipe.
|
|
5320
|
+
const q = new URLSearchParams({ limit: String(flags.limit ?? 100) });
|
|
5321
|
+
if (flags.recipe) q.set("recipe_id", String(flags.recipe));
|
|
5322
|
+
if (flags.org) q.set("org_id", String(flags.org));
|
|
5323
|
+
if (flags.site) q.set("domain", String(flags.site));
|
|
5324
|
+
if (flags.fits) q.set("fits", String(flags.fits));
|
|
5325
|
+
const r = await staffRequest(ctx, "GET", `/api/superadmin/recipe-fits?${q}`);
|
|
5326
|
+
printResult(io, flags, r, (x) =>
|
|
5327
|
+
x.fits.length
|
|
5328
|
+
? x.fits
|
|
5329
|
+
.map(
|
|
5330
|
+
(f) =>
|
|
5331
|
+
`${f.decided_at.slice(0, 16)} ${f.host} ${f.fits.padEnd(7)} ${f.recipe}: ${f.fits === "unknown" ? `needs ${f.needs}` : f.why}`
|
|
5332
|
+
)
|
|
5333
|
+
.join("\n")
|
|
5334
|
+
: "No verdicts match."
|
|
5335
|
+
);
|
|
5336
|
+
return 0;
|
|
5337
|
+
}
|
|
5338
|
+
case "beyond": {
|
|
5339
|
+
// list_letterpress_runs with beyond_library: the asks whose answer went past what the library holds.
|
|
5340
|
+
const q = new URLSearchParams({ beyond_library: "true", limit: String(flags.limit ?? 50) });
|
|
5341
|
+
if (flags.before) q.set("before", String(flags.before));
|
|
5342
|
+
const r = await staffRequest(ctx, "GET", `${LETTERPRESS}-runs?${q}`);
|
|
5343
|
+
printResult(io, flags, r, (x) =>
|
|
5344
|
+
x.runs.length
|
|
5345
|
+
? x.runs
|
|
5346
|
+
.map((run) => {
|
|
5347
|
+
const turn = run.sequence?.turn ?? {};
|
|
5348
|
+
const web = (turn.web_reads ?? []).length ? ` web ${turn.web_reads.length}` : "";
|
|
5349
|
+
const mark = (run.marks ?? []).map((m) => m.verdict).join(",");
|
|
5350
|
+
return `${run.created_at.slice(0, 16)} ${run.domain || run.org_id} ${run.surface ?? ""} ${run.ask?.words ?? ""}${web}${mark ? ` [${mark}]` : ""} ${run.id}`;
|
|
5351
|
+
})
|
|
5352
|
+
.join("\n")
|
|
5353
|
+
: "Nothing asked has gone past the library."
|
|
5354
|
+
);
|
|
5355
|
+
return 0;
|
|
5356
|
+
}
|
|
5317
5357
|
case "replay": {
|
|
5318
5358
|
const id = positionals[1];
|
|
5319
5359
|
if (!id) throw new CliError(ENGINE_USAGE);
|
package/lib/commands/ask.mjs
CHANGED
|
@@ -13,15 +13,15 @@ export const ARGS = {
|
|
|
13
13
|
outcome: "outcome",
|
|
14
14
|
lens: "lens",
|
|
15
15
|
words: { value: (flags, positionals) => flagStr(flags.words) ?? (positionals.join(" ").trim() || undefined) },
|
|
16
|
-
// --
|
|
17
|
-
|
|
16
|
+
// --refresh: decide every strategy again from the facts as they are now (the standing fit is read otherwise).
|
|
17
|
+
refresh: { flag: "refresh", type: "bool" },
|
|
18
18
|
domain: "site",
|
|
19
19
|
},
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
export async function cmdAsk(ctx) {
|
|
23
23
|
const { client, flags, io } = ctx;
|
|
24
|
-
refuseUnknownFlags(ctx, {}, ["outcome", "lens", "words", "site", "
|
|
24
|
+
refuseUnknownFlags(ctx, {}, ["outcome", "lens", "words", "site", "refresh"]);
|
|
25
25
|
const args = argsFromFlags(ARGS.ask_letterpress, flags, ctx.positionals, {});
|
|
26
26
|
if ([args.outcome, args.lens, args.words].filter(Boolean).length > 1)
|
|
27
27
|
throw new CliError("One ask at a time: --outcome, --lens fix|build, or your words.");
|
package/lib/commands/build.mjs
CHANGED
|
@@ -37,6 +37,8 @@ const ARGS = {
|
|
|
37
37
|
build_id: "build",
|
|
38
38
|
domain: "site",
|
|
39
39
|
subjects: { flag: "subject", type: "list" },
|
|
40
|
+
// --recipe <id>: the recipe the words carry out (a Plan row's), recorded on the build it starts.
|
|
41
|
+
recipe: "recipe",
|
|
40
42
|
files: { value: (_flags, _positionals, extra) => (extra.files?.length ? extra.files : undefined) },
|
|
41
43
|
harness: { flag: "harness", enum: ["claude-code", "letterpress-1"] },
|
|
42
44
|
// --repo owner/name: the repo you're working in, where a Proofs install goes.
|
package/lib/commands/org.mjs
CHANGED
|
@@ -274,7 +274,7 @@ function tokenRewardsText(r) {
|
|
|
274
274
|
return [
|
|
275
275
|
`Free tokens for actions: ${r.claimedTokens} earned, ${r.availableTokens} still to earn.`,
|
|
276
276
|
...lines,
|
|
277
|
-
"GitHub, GitLab
|
|
277
|
+
"Slack, the CLI, GitHub, GitLab and Search Console are granted on their own once done.",
|
|
278
278
|
"Claim the rest: letterstory org billing rewards claim <action>",
|
|
279
279
|
].join("\n");
|
|
280
280
|
}
|