@letterstory/cli 0.177.88 → 0.177.90

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
@@ -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.88";
93
+ export const VERSION = "0.177.90";
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;
@@ -102,6 +102,7 @@ export const BOOLEAN_FLAGS = new Set([
102
102
  // visits transact add folder|page: leave it out of the set.
103
103
  "uncheck",
104
104
  "clear-choice",
105
+ "disconnect",
105
106
  // models list: say whether each trained model's server is up now.
106
107
  "serving",
107
108
  // Models material: retain a request for attachments before preparing it.
@@ -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 | friction [--kind error|exception|rage|step|server|stall|background] [--surface s] [--org id] [--limit N] | tools [--days N] [--org id] [--all-orgs] | checks | frustration [--days N] | health | asks [--days N] [--surface cmd_l|build_chat|slack|terminal|app|signup|letter] [--people | --letter] [--door d] [--whose ours|agent|setup|member] [--pattern <code or key>] [--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>";
5329
+ "Usage: admin letterpress status | gaps | friction [--kind error|exception|rage|step|server|stall|background] [--surface s] [--org id] [--limit N] | issues [--days N] [--state came_back|open|fixing|resolved] [--source ask|friction] [--surface s] [--whose ours|agent|setup] [--limit N] | issues fix|unfix <key> [--pr url] [--note …] | tools [--days N] [--org id] [--customers] | checks | frustration [--days N] | health | asks [--days N] [--surface cmd_l|build_chat|slack|terminal|app|signup|letter] [--people | --letter] [--door d] [--whose ours|agent|setup|member] [--pattern <code or key>] [--org id] [--limit N] [--customers] | telemetry [--days N] [--harness h] [--customers] | 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] [--customers] | blocked [--days N] [--org id] [--customers] | 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] [--customers] | 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]] [--customers] | 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,39 @@ async function cmdAdminLetterpress(ctx) {
5478
5478
  );
5479
5479
  return 0;
5480
5480
  }
5481
+ case "issues": {
5482
+ // get_issue_trend / mark_issue_fixed: every way Letter keeps failing, over time (docs/architecture/failure-visibility.md).
5483
+ const [action, key] = positionals.slice(1);
5484
+ if (action === "fix" || action === "unfix") {
5485
+ if (!key) throw new CliError("Usage: admin letterpress issues fix|unfix <key> [--pr url] [--note …]");
5486
+ const r = await staffRequest(ctx, "POST", CODING_TELEMETRY, {
5487
+ key,
5488
+ fixed: action === "fix",
5489
+ ...(flags.pr ? { pr_url: String(flags.pr) } : {}),
5490
+ ...(flags.note ? { note: String(flags.note) } : {}),
5491
+ });
5492
+ printResult(
5493
+ io,
5494
+ flags,
5495
+ r,
5496
+ (x) => `${x.key}: ${x.state ?? "not seen"}${x.fixed_at ? `, fix shipped ${x.fixed_at}` : ""}`
5497
+ );
5498
+ return 0;
5499
+ }
5500
+ const q = new URLSearchParams({ view: "issues", days: String(flags.days ?? 30) });
5501
+ for (const f of ["state", "source", "surface", "whose", "limit"]) if (flags[f]) q.set(f, String(flags[f]));
5502
+ const r = await staffRequest(ctx, "GET", `${CODING_TELEMETRY}?${q}`);
5503
+ printResult(io, flags, r, (t) =>
5504
+ [
5505
+ `Issues, ${t.from} to ${t.to}: ${t.totals.open} open (${t.totals.open_before} when it began), ${t.totals.came_back} came back, ${t.totals.fixing} fix shipped, ${t.totals.resolved_in_period} resolved, ${t.totals.new_in_period} new, ${t.totals.one_offs} one-offs left out`,
5506
+ ...t.issues.map(
5507
+ (x) =>
5508
+ `${x.state.padEnd(9)} ${String(x.reach).padStart(4)} ${x.reach_unit.padEnd(6)} ${String(x.days_seen).padStart(2)}d ${x.code.padEnd(22)} ${x.words.slice(0, 80)}${x.fix_url ? ` fix: ${x.fix_url}` : ""}\n ${x.key}`
5509
+ ),
5510
+ ].join("\n")
5511
+ );
5512
+ return 0;
5513
+ }
5481
5514
  case "friction": {
5482
5515
  // get_member_friction: what members ran into on screen this week (docs/architecture/failure-visibility.md).
5483
5516
  const q = new URLSearchParams({ view: "friction" });
@@ -5503,7 +5536,7 @@ async function cmdAdminLetterpress(ctx) {
5503
5536
  case "tools": {
5504
5537
  // get_tool_failures: each Letterpress tool's failures inside turns.
5505
5538
  const q = new URLSearchParams({ view: "tools", days: String(flags.days ?? 7) });
5506
- if (flagBool(flags["all-orgs"])) q.set("customers", "0");
5539
+ if (flagBool(flags.customers)) q.set("customers", "1");
5507
5540
  if (flags.org) q.set("org_id", String(flags.org));
5508
5541
  const r = await staffRequest(ctx, "GET", `${CODING_TELEMETRY}?${q}`);
5509
5542
  printResult(io, flags, r, (t) =>
@@ -5573,6 +5606,7 @@ async function cmdAdminLetterpress(ctx) {
5573
5606
  if (flags.whose) q.set("whose", String(flags.whose));
5574
5607
  if (flags.pattern) q.set("pattern", String(flags.pattern));
5575
5608
  if (flags.org) q.set("org_id", String(flags.org));
5609
+ if (flagBool(flags.customers)) q.set("customers", "1");
5576
5610
  if (flags.limit) q.set("limit", String(flags.limit));
5577
5611
  const r = await staffRequest(ctx, "GET", `${CODING_TELEMETRY}?${q}`);
5578
5612
  const pct = (x) => (x.rate == null ? "—" : `${Math.round(100 * x.rate)}% (${x.hits}/${x.n})`);
@@ -5605,7 +5639,7 @@ async function cmdAdminLetterpress(ctx) {
5605
5639
  // get_coding_telemetry with fleet: the coding agent's numbers (docs/architecture/coding-telemetry.md).
5606
5640
  const q = new URLSearchParams({ view: "summary", days: String(flags.days ?? 7) });
5607
5641
  if (flags.harness) q.set("harness", String(flags.harness));
5608
- if (flagBool(flags["all-orgs"])) q.set("customers", "0");
5642
+ if (flagBool(flags.customers)) q.set("customers", "1");
5609
5643
  const r = await staffRequest(ctx, "GET", `${CODING_TELEMETRY}?${q}`);
5610
5644
  const pct = (x) => (x.rate == null ? "—" : `${Math.round(100 * x.rate)}% (${x.hits}/${x.n})`);
5611
5645
  const usd = (v) => (v == null ? "—" : `$${v.toFixed(2)}`);
@@ -5638,7 +5672,7 @@ async function cmdAdminLetterpress(ctx) {
5638
5672
  // list_blockers: what Letter withheld because it cannot do it here (docs/architecture/preflight.md).
5639
5673
  const q = new URLSearchParams({ view: "blocked", days: String(flags.days ?? 7) });
5640
5674
  if (flags.org) q.set("org_id", String(flags.org));
5641
- if (flagBool(flags["all-orgs"])) q.set("customers", "0");
5675
+ if (flagBool(flags.customers)) q.set("customers", "1");
5642
5676
  const r = await staffRequest(ctx, "GET", `${CODING_TELEMETRY}?${q}`);
5643
5677
  printResult(io, flags, r, (b) =>
5644
5678
  [
@@ -5831,7 +5865,7 @@ async function cmdAdminLetterpress(ctx) {
5831
5865
  for (const [flag, key] of [...filters, ["from", "from"], ["to", "to"], ["tz", "tz"], ["limit", "limit"]])
5832
5866
  if (flags[flag]) q.set(key, String(flags[flag]));
5833
5867
  if (slow) q.set("slow", "1");
5834
- if (flagBool(flags["all-orgs"])) q.set("customers", "0");
5868
+ if (flagBool(flags.customers)) q.set("customers", "1");
5835
5869
  if (flagBool(flags["all-time"])) q.set("all_time", "1");
5836
5870
  const r = await staffRequest(ctx, "GET", `${BUILD_FAILURES}?${q}`);
5837
5871
  const pct = (v) => (v == null ? "—" : `${Math.round(100 * v)}%`);
@@ -5885,6 +5919,7 @@ async function cmdAdminLetterpress(ctx) {
5885
5919
  days: String(flags.days ?? 30),
5886
5920
  limit: String(flags.limit ?? 50),
5887
5921
  });
5922
+ if (flagBool(flags.customers)) q.set("customers", "1");
5888
5923
  for (const [flag, key] of [
5889
5924
  ["status", "status"],
5890
5925
  ["error-code", "error_code"],
@@ -6036,7 +6071,7 @@ async function cmdAdminLetterpress(ctx) {
6036
6071
  if (flags.day) q.set("day", String(flags.day));
6037
6072
  if (flags.type) q.set("type_key", String(flags.type));
6038
6073
  if (flags.org) q.set("org_id", String(flags.org));
6039
- if (flagBool(flags["all-orgs"])) q.set("customers", "0");
6074
+ if (flagBool(flags.customers)) q.set("customers", "1");
6040
6075
  const r = await staffRequest(ctx, "GET", `${SUGGESTION_REVIEW}?${q}`);
6041
6076
  printResult(io, flags, r, (x) =>
6042
6077
  flags.type
@@ -39,6 +39,7 @@ export const ARGS = {
39
39
  repo_owner: { flag: "owner" },
40
40
  repo_name: { flag: "repo" },
41
41
  reset: { flag: "clear-choice", type: "bool" },
42
+ disconnect: { flag: "disconnect", type: "bool" },
42
43
  },
43
44
  connect_proof_database: {
44
45
  known_internal_accounts: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.177.88",
3
+ "version": "0.177.90",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",