@letterstory/cli 0.177.121 → 0.177.123

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
@@ -70,6 +70,7 @@ import {
70
70
  cmdPlan,
71
71
  cmdMemory,
72
72
  cmdGoals,
73
+ cmdRail,
73
74
  cmdSite,
74
75
  cmdEvals,
75
76
  cmdOfferings,
@@ -92,7 +93,7 @@ import {
92
93
  import { fetchParkedSections, withoutParked } from "./parked.mjs";
93
94
 
94
95
  // Matches cli/package.json; publish-cli.yml rewrites both to the published version.
95
- export const VERSION = "0.177.121";
96
+ export const VERSION = "0.177.123";
96
97
 
97
98
  /** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
98
99
  export const EXIT_PAYMENT_REQUIRED = 3;
@@ -660,6 +661,7 @@ Collections (the content engine as a primitive — one door, 'collection run'):
660
661
  collection runs [--collection <id>] [--status <s>] [--limit <n>]
661
662
  collection approve <run-id> [--now] Answer the gate (--now publishes immediately)
662
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)
663
665
  collection move <run-id> --date YYYY-MM-DD Move a slot not yet written, or an approved written post, to another day
664
666
  collection cancel <run-id>
665
667
  collection inventory <id> Where every piece is; each finished draft's publish-on-its-own time
@@ -1904,6 +1906,7 @@ Insights:
1904
1906
  plan strategy add "<words…>" [--site host] Keep a goal in your words as a strategy
1905
1907
  plan strategy archive <strategy-id> [--restore] Put one away (its card leaves the Plan), or bring it back
1906
1908
  goals list|save|commit [goal] --host <host> Set up goals, save to Memory and commit intent JSON
1909
+ rail [list] | rail set <key>… | rail reset Your Letterpress sidebar's pins, in order
1907
1910
  memory ingest [--text|--text-file <path|->] [--link <url>]… [--include-website] [--mcp-url <url>] Push context to Memory: a reviewable proposal
1908
1911
  memory apply <ingestion-id> --changes <id>,<id> Save the proposed changes you accept
1909
1912
  memory add --section <id> --body <text> [--title] [--origin] File one entry in a custom memory section
@@ -2371,6 +2374,7 @@ const CLIENT_COMMANDS = {
2371
2374
  plan: cmdPlan,
2372
2375
  memory: cmdMemory,
2373
2376
  goals: cmdGoals,
2377
+ rail: cmdRail,
2374
2378
  site: cmdSite,
2375
2379
  evals: cmdEvals,
2376
2380
  visits: cmdVisits,
@@ -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) {
@@ -0,0 +1,38 @@
1
+ // `rail` — your own Letterpress rail (the sidebar), the same list pinning from More sets in the app. Thin wrappers
2
+ // over get_rail_pins / set_rail_pins (lib/rail/pins.ts).
3
+ //
4
+ // letterstory rail your pins, in order
5
+ // letterstory rail set build plan fix templates pin exactly these, in this order
6
+ // letterstory rail reset back to the defaults
7
+
8
+ import { CliError } from "../client.mjs";
9
+ import { argsFromFlags, printResult, refuseUnknownFlags } from "./shared.mjs";
10
+
11
+ export const ARGS = {
12
+ get_rail_pins: {},
13
+ set_rail_pins: {
14
+ // `rail set <key>…` pins exactly these, in order; `rail reset` is the tool's null (the defaults).
15
+ pins: { value: (_flags, positionals) => (positionals[0] === "reset" ? null : positionals.slice(1)) },
16
+ },
17
+ };
18
+
19
+ export async function cmdRail(ctx) {
20
+ const [sub, ...keys] = ctx.positionals;
21
+ refuseUnknownFlags(ctx, {}, []);
22
+ let result;
23
+ if (!sub || sub === "list") result = await ctx.client.callTool("get_rail_pins", {});
24
+ else if (sub === "set") {
25
+ if (!keys.length) throw new CliError("Usage: rail set <key> [<key>…] (rail reset puts the defaults back)");
26
+ result = await ctx.client.callTool(
27
+ "set_rail_pins",
28
+ argsFromFlags(ARGS.set_rail_pins, ctx.flags, ctx.positionals)
29
+ );
30
+ } else if (sub === "reset")
31
+ result = await ctx.client.callTool(
32
+ "set_rail_pins",
33
+ argsFromFlags(ARGS.set_rail_pins, ctx.flags, ctx.positionals)
34
+ );
35
+ else throw new CliError("Usage: rail [list] | rail set <key>… | rail reset");
36
+ printResult(ctx.io, ctx.flags, result, (r) => (r.pins ?? []).join("\n"));
37
+ return 0;
38
+ }
package/lib/commands.mjs CHANGED
@@ -65,3 +65,4 @@ export * from "./commands/refs.mjs";
65
65
  export * from "./commands/models.mjs";
66
66
 
67
67
  export * from "./commands/goals.mjs";
68
+ export * from "./commands/rail.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.177.121",
3
+ "version": "0.177.123",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",