@letterstory/cli 0.177.122 → 0.177.124

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/README.md CHANGED
@@ -204,6 +204,7 @@ letterstory collection run-status <run-id> # status, steps,
204
204
  letterstory collection runs --collection <id> --status ready
205
205
  letterstory collection approve <run-id> --now
206
206
  letterstory collection cancel <run-id>
207
+ letterstory collection rewrite <run-id> # a held post, rewritten to the finding
207
208
  letterstory collection inventory <id> # every piece; each finished draft's publish-on-its-own time
208
209
  letterstory collection links <id> # internal-link refresh: on/off, posts due
209
210
  letterstory collection links <id> --refresh # run the next batch now
package/lib/cli.mjs CHANGED
@@ -93,7 +93,7 @@ import {
93
93
  import { fetchParkedSections, withoutParked } from "./parked.mjs";
94
94
 
95
95
  // Matches cli/package.json; publish-cli.yml rewrites both to the published version.
96
- export const VERSION = "0.177.122";
96
+ export const VERSION = "0.177.124";
97
97
 
98
98
  /** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
99
99
  export const EXIT_PAYMENT_REQUIRED = 3;
@@ -661,6 +661,7 @@ Collections (the content engine as a primitive — one door, 'collection run'):
661
661
  collection runs [--collection <id>] [--status <s>] [--limit <n>]
662
662
  collection approve <run-id> [--now] Answer the gate (--now publishes immediately)
663
663
  collection start <run-id> Start a scheduled slot's writing now (it goes live at its slot)
664
+ collection rewrite <run-id> Rewrite a held post to its finding (skip_code held_guard in collection runs)
664
665
  collection move <run-id> --date YYYY-MM-DD Move a slot not yet written, or an approved written post, to another day
665
666
  collection cancel <run-id>
666
667
  collection inventory <id> Where every piece is; each finished draft's publish-on-its-own time
@@ -936,6 +937,7 @@ Offerings (context layered org → offering → collection; a layer sets only wh
936
937
  probes edit <probe_id> <new question text> Fix/sharpen a generated probe
937
938
  probes add <question> [--kind mention|citation] [--scope site|company|<blogId>] [--cluster <id>]
938
939
  onboarding status Show the onboarding checklist
940
+ onboarding for <website|seo|geo|visitors|cmd_l> … What Letter is for: the onboarding's first question
939
941
  onboarding step [--current <step>] [--complete <step>] [--skip <step>] [--status <status>]
940
942
  series list The org's content series + coverage state
941
943
  series create --name <n> [--description <d>] [--coverage a,b,c] [--collection <uuid>] [--template <key>]
@@ -5362,7 +5362,7 @@ const BUILD_FAILURES = "/api/superadmin/build-failures";
5362
5362
  const SUGGESTION_REVIEW = "/api/superadmin/suggestion-review";
5363
5363
  const TURN_ENDINGS = "/api/superadmin/turn-endings";
5364
5364
  const ENGINE_USAGE =
5365
- "Usage: admin letterpress status | gaps | friction [--kind error|exception|rage|step|rule|server|stall|background] [--surface s] [--org id] [--limit N] [--customers] | 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] [--family premise|landing|preview|outcome|run|infra|writing|waiting|other] [--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] [--people | --letter] [--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>";
5365
+ "Usage: admin letterpress status | gaps | friction [--kind error|exception|rage|step|rule|server|stall|background] [--surface s] [--org id] [--limit N] [--customers] | 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] [--family premise|landing|preview|outcome|run|infra|writing|waiting|other] [--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] [--people | --letter] [--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] [--no-change-code code] [--failure-kind network|provider|tool_denied|agent|unrecorded] [--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>";
5366
5366
 
5367
5367
  /** One number of the settings from a dotted path and a value: the PUT body save_engine_settings reads. */
5368
5368
  function engineSettingsPatch(path, value) {
@@ -5581,7 +5581,7 @@ async function cmdAdminLetterpress(ctx) {
5581
5581
  `Tools that failed, last ${t.days} days (${t.turns} turns)`,
5582
5582
  ...t.rows.map(
5583
5583
  (x) =>
5584
- `${String(x.failed).padStart(4)} of ${String(x.calls).padEnd(5)} ${x.tool.padEnd(32)} ${x.orgs} orgs ${x.top_reason ?? ""}`
5584
+ `${String(x.failed).padStart(4)} of ${String(x.calls).padEnd(5)} ${x.tool.padEnd(32)} ${x.orgs} orgs ${x.invalid ? `${x.invalid} bad arguments${x.top_field ? ` (${x.top_field.field}, ${x.top_field.code})` : ""}, ` : ""}${x.refused} refused ${x.top_reason ?? ""}`
5585
5585
  ),
5586
5586
  ].join("\n")
5587
5587
  );
@@ -5718,9 +5718,35 @@ async function cmdAdminLetterpress(ctx) {
5718
5718
  .map(
5719
5719
  (g) => ` missed (${g.cause}, ${g.category}): ${g.runs} runs. ${g.notes[0] ?? g.what_to_do}`
5720
5720
  ),
5721
+ `first review's blocking issues: ${t.first_pass.issues.caught_fixed} caught and fixed, ${t.first_pass.issues.open_at_end} still open at the end${t.first_pass.issues.unread ? `, ${t.first_pass.issues.unread} not read` : ""}`,
5721
5722
  t.failures.length
5722
5723
  ? `failures: ${t.failures.map((f) => `${f.error_code} ${f.count} (was ${f.previous}, ${f.fault})`).join(", ")}`
5723
5724
  : "no failures",
5725
+ t.no_change.length
5726
+ ? `changed nothing: ${t.no_change
5727
+ .slice(0, 8)
5728
+ .map((n) => `${n.source_kind} ${n.code} ${n.runs}`)
5729
+ .join(", ")}`
5730
+ : "no run changed nothing",
5731
+ `agent stops: ${
5732
+ Object.entries(t.ground.failure_kinds)
5733
+ .map(([k, n]) => `${k} ${n}`)
5734
+ .join(", ") || "none"
5735
+ }; checkouts: ${
5736
+ Object.entries(t.ground.checkout)
5737
+ .map(([k, n]) => `${k} ${n}`)
5738
+ .join(", ") || "none"
5739
+ }; failed previews: ${
5740
+ Object.entries(t.ground.preview_causes)
5741
+ .map(([k, n]) => `${k} ${n}`)
5742
+ .join(", ") || "none"
5743
+ }`,
5744
+ t.starts_refused.length
5745
+ ? `starts refused: ${t.starts_refused
5746
+ .slice(0, 8)
5747
+ .map((x) => `${x.door}/${x.reason} ${x.count}`)
5748
+ .join(", ")}`
5749
+ : "no start refused",
5724
5750
  `lost to timeouts/memory/crashes: ${pct(t.resilience)}${t.resilience.over_bar ? " OVER 3%" : ""}`,
5725
5751
  ].join("\n")
5726
5752
  );
@@ -5984,6 +6010,8 @@ async function cmdAdminLetterpress(ctx) {
5984
6010
  ["status", "status"],
5985
6011
  ["error-code", "error_code"],
5986
6012
  ["first-review-cause", "first_review_cause"],
6013
+ ["no-change-code", "no_change_code"],
6014
+ ["failure-kind", "failure_kind"],
5987
6015
  ["harness", "harness"],
5988
6016
  ["pr", "pr"],
5989
6017
  ])
@@ -138,6 +138,9 @@ export const ARGS = {
138
138
  start_collection_run: {
139
139
  run_id: { positional: 0, label: "run-id", required: true },
140
140
  },
141
+ release_held_post: {
142
+ run_id: { positional: 0, label: "run-id", required: true },
143
+ },
141
144
  reschedule_collection_run: {
142
145
  run_id: { positional: 0, label: "run-id", required: true },
143
146
  date: { flag: "date", required: true },
@@ -190,6 +193,8 @@ export async function cmdCollection(ctx) {
190
193
  return collectionCancel(rest);
191
194
  case "start":
192
195
  return collectionStart(rest);
196
+ case "rewrite":
197
+ return collectionRewrite(rest);
193
198
  case "move":
194
199
  case "reschedule":
195
200
  return collectionMove(rest);
@@ -413,6 +418,18 @@ async function collectionStart(ctx) {
413
418
  return 0;
414
419
  }
415
420
 
421
+ // `collection rewrite <run-id>` — a written post a publish guard holds (skip_code held_guard in `collection runs`) is
422
+ // rewritten to its finding (release_held_post).
423
+ async function collectionRewrite(ctx) {
424
+ const result = await ctx.client.callTool(
425
+ "release_held_post",
426
+ argsFromFlags(ARGS.release_held_post, ctx.flags, ctx.positionals)
427
+ );
428
+ ok(ctx, "Rewriting it to the finding: it publishes again once it fits.");
429
+ printResult(ctx.io, ctx.flags, result);
430
+ return 0;
431
+ }
432
+
416
433
  // `collection move <run-id> --date YYYY-MM-DD` — a slot not yet written, or a written post
417
434
  // already approved, onto another day (reschedule_collection_run).
418
435
  async function collectionMove(ctx) {
@@ -90,6 +90,13 @@ export const ARGS = {
90
90
  suggestion_id: "suggestion",
91
91
  },
92
92
  get_onboarding_status: {},
93
+ // The onboarding's first question: the answers are positionals (`onboarding for seo geo`).
94
+ set_signup_intents: {
95
+ intents: {
96
+ value: (_flags, positionals) =>
97
+ positionals.map((p) => p.toLowerCase().replace("⌘l", "cmd_l").replace("-", "_")),
98
+ },
99
+ },
93
100
  // Step ids are the server's to define (the registry is the authority); forwarded as given.
94
101
  set_onboarding_step: {
95
102
  current_step: "current",
@@ -293,15 +300,44 @@ export async function cmdOnboarding(ctx) {
293
300
  return onboardingStatus(rest);
294
301
  case "step":
295
302
  return onboardingStep(rest);
303
+ case "for":
304
+ return onboardingFor(rest);
296
305
  default:
297
- throw new CliError(`Unknown onboarding subcommand: ${sub ?? "(none)"}. Try: status, step`);
306
+ throw new CliError(`Unknown onboarding subcommand: ${sub ?? "(none)"}. Try: status, for, step`);
298
307
  }
299
308
  }
300
309
 
310
+ /** The onboarding's steps for its answer, the one it is on marked, and where it finishes. */
311
+ function signupPathLines(path) {
312
+ if (!path) return [];
313
+ const at = path.steps.findIndex((s) => s.id === path.step);
314
+ const lines = path.steps.map((s, i) => `${i === at ? ">" : i < at ? "✓" : " "} ${i + 1}. ${s.title}`);
315
+ return [...lines, ` Finishes in ${path.finish}`];
316
+ }
317
+
301
318
  async function onboardingStatus(ctx) {
302
319
  const { client, flags, io } = ctx;
303
320
  const result = await client.callTool("get_onboarding_status", {});
304
- printResult(io, flags, result);
321
+ printResult(io, flags, result, (r) =>
322
+ r.signup ? signupPathLines(r.signup).join("\n") : JSON.stringify(r, null, 2)
323
+ );
324
+ return 0;
325
+ }
326
+
327
+ const SIGNUP_INTENT_IDS = ["website", "seo", "geo", "visitors", "cmd_l"];
328
+
329
+ /**
330
+ * `onboarding for <answer…>`: the onboarding's first question (set_signup_intents), what the org wants Letter for:
331
+ * website, seo, geo, visitors, cmd_l. Prints the steps it now has and where it finishes.
332
+ */
333
+ async function onboardingFor(ctx) {
334
+ const { client, flags, io, positionals } = ctx;
335
+ const args = argsFromFlags(ARGS.set_signup_intents, flags, positionals);
336
+ if (args.intents.length === 0 || args.intents.some((i) => !SIGNUP_INTENT_IDS.includes(i)))
337
+ throw new CliError(`Say what Letter is for: any of ${SIGNUP_INTENT_IDS.join(", ")}.`);
338
+ const result = await client.callTool("set_signup_intents", args);
339
+ ok(ctx, "Saved.");
340
+ printResult(io, flags, result, (r) => signupPathLines(r).join("\n"));
305
341
  return 0;
306
342
  }
307
343
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.177.122",
3
+ "version": "0.177.124",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",