@letterstory/cli 0.175.0 → 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 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.175.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;
@@ -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)
@@ -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);
@@ -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
- // --web: read the web for a recipe the facts can't decide (off by default: facts only).
17
- web: { flag: "web", type: "bool" },
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", "web"]);
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.175.0",
3
+ "version": "0.175.1",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",