@letterstory/cli 0.175.12 → 0.175.13

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
@@ -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.12";
81
+ export const VERSION = "0.175.13";
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;
@@ -969,7 +969,7 @@ Admin (STAFF key — --staff-key / LETTERSTORY_STAFF_API_KEY; acts before an org
969
969
  judgement's weights per ask, each lens's bar and read
970
970
  budget, each surface's ask and guidance, the dismissal
971
971
  window. Needs recipes:read.
972
- admin letterpress 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.every_days> <value>
972
+ admin letterpress 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.every_days> <value>
973
973
  Change one weight, one bar, or a lens's ask and guidance (the
974
974
  opinions Letterpress chooses by, as staff's words); the version
975
975
  bumps and the previous body is kept. Needs recipes:write.
@@ -5127,7 +5127,7 @@ const ENGINE = "/api/superadmin/engine-settings";
5127
5127
  const LETTERPRESS = "/api/superadmin/letterpress";
5128
5128
  const CODING_TELEMETRY = "/api/superadmin/coding-telemetry";
5129
5129
  const ENGINE_USAGE =
5130
- "Usage: admin letterpress status | gaps | telemetry [--days N] [--harness h] [--all-orgs] | 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] | 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|explore.ask|explore.research.turns|explore.research.ms|explore.every_days> <value>";
5130
+ "Usage: admin letterpress status | gaps | telemetry [--days N] [--harness h] [--all-orgs] | blocked [--days N] [--org id] [--all-orgs] | unblock <org-id> <host> <subject> | 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] | 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>";
5131
5131
 
5132
5132
  /** One number of the settings from a dotted path and a value: the PUT body save_engine_settings reads. */
5133
5133
  function engineSettingsPatch(path, value) {
@@ -5150,6 +5150,11 @@ function engineSettingsPatch(path, value) {
5150
5150
  if (!Number.isInteger(n)) throw new CliError(`${path}: a whole number of days`);
5151
5151
  return { explore: { every_days: n } };
5152
5152
  }
5153
+ // preflight.off wrong_repo,not_in_repo: those codes are not enforced (blank or "none": every code back on).
5154
+ if (parts[0] === "preflight" && parts[1] === "off" && parts.length === 2) {
5155
+ const text = String(value ?? "").trim();
5156
+ return { preflight: { off: text === "" || text === "none" ? [] : text.split(",").map((c) => c.trim()) } };
5157
+ }
5153
5158
  if (parts[0] === "dismissals" && parts[1] === "block_days" && parts.length === 2) {
5154
5159
  const n = Number(value);
5155
5160
  if (!Number.isInteger(n)) throw new CliError(`${path}: a whole number of days`);
@@ -5238,6 +5243,9 @@ async function cmdAdminLetterpress(ctx) {
5238
5243
  ? `asks from: ${s.surfaces.map((x) => `${x.surface} ${x.runs}`).join(", ")}`
5239
5244
  : "no runs yet",
5240
5245
  `turns ${s.turns.runs}${s.turns.by_action.length ? ` (${s.turns.by_action.map((a) => `${a.action} ${a.runs}`).join(", ")})` : ""}; builds ${s.turns.merge.builds}, merged ${s.turns.merge.merged}, closed ${s.turns.merge.closed}${s.customer_only ? " [customers only]" : ""}`,
5246
+ s.withheld && s.withheld.active > 0
5247
+ ? `withheld: ${s.withheld.active} suggestion${s.withheld.active === 1 ? "" : "s"} in ${s.withheld.orgs} org${s.withheld.orgs === 1 ? "" : "s"} (Letter cannot do them there)${s.withheld.recipe_bugs ? `; ${s.withheld.recipe_bugs} recipe bug${s.withheld.recipe_bugs === 1 ? "" : "s"}` : ""} → admin letterpress blocked`
5248
+ : "withheld: none",
5241
5249
  ...(s.harness_evals ?? []).map(
5242
5250
  (p) =>
5243
5251
  `harness eval ${p.at.slice(0, 10)} (${p.version}, ${p.pairs} pairs): ${p.harnesses
@@ -5284,6 +5292,46 @@ async function cmdAdminLetterpress(ctx) {
5284
5292
  );
5285
5293
  return 0;
5286
5294
  }
5295
+ case "blocked": {
5296
+ // list_blockers: what Letter withheld because it cannot do it here (docs/architecture/preflight.md).
5297
+ const q = new URLSearchParams({ view: "blocked", days: String(flags.days ?? 7) });
5298
+ if (flags.org) q.set("org_id", String(flags.org));
5299
+ if (flagBool(flags["all-orgs"])) q.set("customers", "0");
5300
+ const r = await staffRequest(ctx, "GET", `${CODING_TELEMETRY}?${q}`);
5301
+ printResult(io, flags, r, (b) =>
5302
+ [
5303
+ `Withheld now: ${b.active} in ${b.orgs} organizations. In the last ${b.days} days: ${b.cleared.facts} came back (facts moved), ${b.cleared.time} timed out, ${b.cleared.staff} cleared by staff.${b.off.length ? ` OFF: ${b.off.join(", ")}` : ""}`,
5304
+ ...b.by_code.map(
5305
+ (c) =>
5306
+ `${c.code.padEnd(14)} ${String(c.active).padStart(3)} in ${c.orgs} orgs (${c.owner}) ${c.what_to_do}`
5307
+ ),
5308
+ ...(b.by_subject.length ? ["", "Most blocked:"] : []),
5309
+ ...b.by_subject.map(
5310
+ (s) =>
5311
+ ` ${s.recipe_bug ? "RECIPE BUG " : ""}${s.label} [${s.code}] ${s.active} in ${s.orgs} orgs`
5312
+ ),
5313
+ ...(b.recent.length ? ["", "Holding now:"] : []),
5314
+ ...b.recent
5315
+ .slice(0, 20)
5316
+ .map(
5317
+ (x) =>
5318
+ ` ${(x.org_name ?? x.org_id).slice(0, 24).padEnd(24)} ${x.host} ${x.subject} [${x.code}] ${x.say}`
5319
+ ),
5320
+ ].join("\n")
5321
+ );
5322
+ return 0;
5323
+ }
5324
+ case "unblock": {
5325
+ // clear_blocker: "Show anyway" on one withheld item.
5326
+ const [orgId, host, subject] = positionals.slice(1);
5327
+ if (!orgId || !host || !subject)
5328
+ throw new CliError("Usage: admin letterpress unblock <org-id> <host> <subject>");
5329
+ const r = await staffRequest(ctx, "POST", CODING_TELEMETRY, { org_id: orgId, host, subject });
5330
+ printResult(io, flags, r, (x) =>
5331
+ x.cleared ? "Cleared: it is offered and allowed to start again." : "Nothing was holding."
5332
+ );
5333
+ return 0;
5334
+ }
5287
5335
  case "runs": {
5288
5336
  // list_coding_runs with fleet.
5289
5337
  const q = new URLSearchParams({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.175.12",
3
+ "version": "0.175.13",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",