@letterstory/cli 0.175.4 → 0.175.5

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
@@ -77,7 +77,7 @@ import {
77
77
  } from "./commands.mjs";
78
78
 
79
79
  // Matches cli/package.json; publish-cli.yml rewrites both to the published version.
80
- export const VERSION = "0.175.4";
80
+ export const VERSION = "0.175.5";
81
81
 
82
82
  /** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
83
83
  export const EXIT_PAYMENT_REQUIRED = 3;
@@ -554,22 +554,22 @@ Reviewers:
554
554
  automations set <automation-id> --collection <id> [--pace <n>] [--pause | --resume] [--goal <id>]
555
555
  [--brief <text>] [--remap]
556
556
  automations remove <automation-id> --collection <id>
557
- automate options What an automation can be made of here: triggers,
558
- actions and what each can be fixed to
559
- automate list Your automations: an event, what Letter reads it
560
- for, the action it becomes
557
+ automate options What an automation can be made of here: the triggers,
558
+ and whether each one's events can come yet
559
+ automate list Your automations: an event, which ones it acts on,
560
+ and what Letterpress then does
561
561
  automate show <automation-id>
562
- automate add --name <n> --trigger competitor_page|visitor_identified|custom
563
- --action write_post|enroll_in_sequence|build_page [--instruction <text>]
564
- [--collection <id>|--sequence <id>|--host <site>] [--event <name>] [--kind post|landing]
565
- [--competitor <host>] [--site <host>] [--hot-leads-only] [--review act|ask] [--off]
566
- Make one: it starts from now
567
- automate set <automation-id> [--name <n>] [--instruction <text>] [--review act|ask] [--on|--off] ...
568
- automate try [<automation-id>] [--trigger <t> --action <a> --instruction <text> ...] [--limit <n>]
562
+ automate add --name <n> --trigger competitor_page|visitor_identified|issue_found|custom
563
+ --prompt <what Letterpress does with each event> [--instruction <which events>]
564
+ [--event <name>] [--kind post|landing] [--competitor <host>] [--site <host>]
565
+ [--hot-leads-only] [--off]
566
+ Make one: it starts from now, and acts on its own
567
+ automate set <automation-id> [--name <n>] [--instruction <text>] [--prompt <text>] [--on|--off] ...
568
+ automate try [<automation-id>] [--trigger <t> --prompt <text> --instruction <text> ...] [--limit <n>]
569
569
  What it would do with the latest events (acts on none)
570
- automate runs [--automation <id>] [--status proposed|acted|skipped|failed|rejected] [--limit <n>]
570
+ automate runs [--automation <id>] [--status acting|acted|skipped|failed|proposed|rejected] [--limit <n>]
571
571
  Every event read, what came of it and why
572
- automate approve <run-id> Make the call a run that asked first proposes
572
+ automate approve <run-id> Make the call a run left from asking first proposes
573
573
  automate reject <run-id> --reason <why>
574
574
  automate send <event-name> --title <what happened> [--key <id>] [--url <u>] [--fact k=v ...]
575
575
  [--email <e>] [--person <name>] [--company <c>]
@@ -1566,8 +1566,10 @@ Build (a change to your site, or launching what isn't code; the Build box's own
1566
1566
  done by Build itself (a phantom site buys its own domain), and the
1567
1567
  build reads Done with no PR to merge. --again repeats an open build's ask
1568
1568
  build talk <words…> [--conversation <id>|--build <id>] [--site <host>] [--harness claude-code|letterpress-1]
1569
- [--repo owner/name]
1569
+ [--repo owner/name] [--action build|build_pr|build_merge]
1570
1570
  One turn of a conversation with Build (questions, follow-ups on a build)
1571
+ build cancel <build-id> Stop a build before it merges: what's being built stops, its
1572
+ preview goes, and its open pull request is closed unmerged
1571
1573
  build benchmark <words…> [--prompt <text>] [--site <host>] [--agent letterpress-1|claude-code|codex]...
1572
1574
  [--attach <path>]... [--attach-url <name>=<https url>]... [--attach-ref <path>]... [--attach-url-ref <name>=<https url>]...
1573
1575
  Staff only. The same prompt on Letterpress-1 (as Build runs it) and on
@@ -1610,13 +1612,14 @@ Repo changes (Claude Code edits your repo in a sandbox; the Letter GitHub App op
1610
1612
  repo suggestions Fixes found and not acted on yet, and how to start each
1611
1613
  repo settings [--action build|build_pr|build_merge|slack|linear] [--branch <name>|none] [--slack-agent <name|U…>|none]
1612
1614
  [--slack-channel <C…>|none] [--slack-reports off|as_found|daily] [--reports-channel <C…>|none] [--autopilot-channel <C…>|none] [--listen <C…,C…>|none] [--autopilot on|off] [--autopilot-weekly <1-20>]
1613
- [--autopilot-severity critical|warning] [--auto-merge 1h|12h|24h|3d|off]
1615
+ [--autopilot-severity critical|warning] [--auto-merge 1h|12h|24h|3d|off] [--editor-auto-merge on|off]
1614
1616
  [--reports-remedy report|fix_pr|fix_merge] [--recommendations on|off] [--recommendations-channel <C…>|none]
1615
1617
  [--competitor-pages on|off] [--competitor-pages-mode relevant|all] [--competitor-pages-channel <C…>|none]
1616
1618
  The org's defaults for every fix: build (preview first),
1617
1619
  build_pr, or slack (post it to --slack-channel for your
1618
1620
  own agent, tagging --slack-agent), and the branch changes go to;
1619
1621
  --auto-merge merges Letter's PRs once open that long;
1622
+ --editor-auto-merge merges Letter Edit's (⌘L) changes once ready;
1620
1623
  Slack's automations: new issues (--slack-reports, and
1621
1624
  --reports-remedy to fix them on their own), recommended
1622
1625
  actions, and competitors' new pages, each with a channel
@@ -1,16 +1,14 @@
1
1
  // `automate` — Letterpress → Automations (docs/architecture/event-automations.md): an event, read
2
- // against your instruction, made into an action. options / list / show / add / set / try / runs /
3
- // approve / reject / send / remove, through the same tools the app uses. (A letterbase's writing
4
- // automations are `automations`.)
2
+ // against your filter (--instruction), then done by Letterpress as your prompt (--prompt) says.
3
+ // options / list / show / add / set / try / runs / approve / reject / send / remove, through the
4
+ // same tools the app uses. (A letterbase's writing automations are `automations`.)
5
5
  // Same flag/positional/io conventions as posts.mjs — no commander, no color.
6
6
 
7
7
  import { CliError } from "../client.mjs";
8
8
  import { printResult, ok, argsFromFlags, flagList, refuseUnknownFlags } from "./shared.mjs";
9
9
 
10
- const TRIGGERS = ["competitor_page", "visitor_identified", "custom"];
11
- const ACTIONS = ["write_post", "enroll_in_sequence", "build_page"];
12
- const REVIEW = ["act", "ask"];
13
- const STATUSES = ["pending", "proposed", "acted", "skipped", "failed", "rejected"];
10
+ const TRIGGERS = ["competitor_page", "visitor_identified", "issue_found", "custom"];
11
+ const STATUSES = ["pending", "proposed", "acting", "acted", "skipped", "failed", "rejected"];
14
12
 
15
13
  const triggerParams = {
16
14
  object: {
@@ -21,13 +19,6 @@ const triggerParams = {
21
19
  event: { flag: "event" },
22
20
  },
23
21
  };
24
- const actionParams = {
25
- object: {
26
- collection_id: { flag: "collection" },
27
- sequence_id: { flag: "sequence" },
28
- host: { flag: "host" },
29
- },
30
- };
31
22
  const enabled = { value: (flags) => (flags.off === true ? false : flags.on === true ? true : undefined) };
32
23
 
33
24
  /** --fact plan=team --fact seats=40 → { plan: "team", seats: 40 } (numbers and true/false read as such). */
@@ -63,9 +54,7 @@ export const ARGS = {
63
54
  trigger: { flag: "trigger", required: true, enum: TRIGGERS },
64
55
  trigger_params: triggerParams,
65
56
  instruction: { flag: "instruction" },
66
- action: { flag: "action", required: true, enum: ACTIONS },
67
- action_params: actionParams,
68
- review: { flag: "review", enum: REVIEW },
57
+ prompt: { flag: "prompt", required: true },
69
58
  enabled,
70
59
  },
71
60
  update_event_automation: {
@@ -73,8 +62,7 @@ export const ARGS = {
73
62
  name: { flag: "name" },
74
63
  trigger_params: triggerParams,
75
64
  instruction: { flag: "instruction" },
76
- action_params: actionParams,
77
- review: { flag: "review", enum: REVIEW },
65
+ prompt: { flag: "prompt" },
78
66
  enabled,
79
67
  },
80
68
  delete_event_automation: {
@@ -85,8 +73,7 @@ export const ARGS = {
85
73
  trigger: { flag: "trigger", enum: TRIGGERS },
86
74
  trigger_params: triggerParams,
87
75
  instruction: { flag: "instruction" },
88
- action: { flag: "action", enum: ACTIONS },
89
- action_params: actionParams,
76
+ prompt: { flag: "prompt" },
90
77
  limit: { flag: "limit", type: "num" },
91
78
  },
92
79
  list_automation_runs: {
@@ -4,6 +4,7 @@
4
4
  // main blog, is carried out by Build itself with nothing to merge.
5
5
  // build <words…> → start_build (--prompt for a long ask; --again to repeat one)
6
6
  // build talk <words…> → send_build_message (--conversation <id> | --build <id> to continue)
7
+ // build cancel <id> → cancel_growth_build (stop it before it merges: its PR is closed)
7
8
  // build benchmark <words…> → start_build_benchmark (staff only: Letterpress-1, stock Claude Code
8
9
  // and stock Codex on the same prompt, each a preview)
9
10
  // build benchmarks → list_build_benchmarks (staff only; --id <uuid> for one)
@@ -43,7 +44,10 @@ const ARGS = {
43
44
  harness: { flag: "harness", enum: ["claude-code", "letterpress-1"] },
44
45
  // --repo owner/name: the repo you're working in, where a Proofs install goes.
45
46
  repo: "repo",
47
+ // --action build|build_pr|build_merge: how a build this message starts is delivered (Letter Edit's auto-merge sends build_merge).
48
+ delivery: { flag: "action", enum: ["build", "build_pr", "build_merge"] },
46
49
  },
50
+ cancel_growth_build: { id: { positional: 0, required: true, label: "build-id" } },
47
51
  start_build_benchmark: {
48
52
  prompt: { value: (flags, positionals) => flagStr(flags.prompt) ?? (positionals.join(" ").trim() || undefined) },
49
53
  domain: "site",
@@ -73,6 +77,7 @@ async function attachedFiles(ctx) {
73
77
 
74
78
  export async function cmdBuild(ctx) {
75
79
  if (ctx.positionals[0] === "talk") return buildTalk({ ...ctx, positionals: ctx.positionals.slice(1) });
80
+ if (ctx.positionals[0] === "cancel") return buildCancel({ ...ctx, positionals: ctx.positionals.slice(1) });
76
81
  if (ctx.positionals[0] === "benchmark") return buildBenchmark({ ...ctx, positionals: ctx.positionals.slice(1) });
77
82
  if (ctx.positionals[0] === "benchmarks") return buildBenchmarks({ ...ctx, positionals: ctx.positionals.slice(1) });
78
83
  return buildStart(ctx);
@@ -92,6 +97,21 @@ export function benchmarkLines(b) {
92
97
  return lines.join("\n");
93
98
  }
94
99
 
100
+ /** `build cancel <id>`: stop a build before anything of it merges (cancel_growth_build). */
101
+ async function buildCancel(ctx) {
102
+ const { client, flags, io } = ctx;
103
+ refuseUnknownFlags(ctx, {}, []);
104
+ const args = argsFromFlags(ARGS.cancel_growth_build, flags, ctx.positionals);
105
+ const result = await client.callTool("cancel_growth_build", args);
106
+ printResult(io, flags, result, (r) =>
107
+ [
108
+ r.message,
109
+ ...(r.changes ?? []).map((c) => ` ${c.outcome} ${c.title}${c.message ? `: ${c.message}` : ""}`),
110
+ ].join("\n")
111
+ );
112
+ return 0;
113
+ }
114
+
95
115
  async function buildBenchmark(ctx) {
96
116
  const { client, flags, io } = ctx;
97
117
  refuseUnknownFlags(ctx, {}, ["prompt", "site", "agent", ...FILE_FLAGS]);
@@ -149,6 +169,7 @@ async function buildTalk(ctx) {
149
169
  "subject",
150
170
  "harness",
151
171
  "repo",
172
+ "action",
152
173
  ...FILE_FLAGS,
153
174
  ]);
154
175
  const files = await attachedFiles(ctx);
@@ -234,6 +234,13 @@ const ARGS = {
234
234
  autopilot_min_severity: { flag: "autopilot-severity", enum: ["critical", "warning"] },
235
235
  // --auto-merge 1h|12h|24h|3d (or the hours: 1, 12, 24, 72), or --auto-merge off
236
236
  auto_merge_after_hours: { value: (flags) => autoMergeHours(flags["auto-merge"]) },
237
+ // --editor-auto-merge on|off: Letter Edit's (⌘L) changes merge once they're ready
238
+ editor_auto_merge: {
239
+ value: (flags) =>
240
+ flags["editor-auto-merge"] === undefined
241
+ ? undefined
242
+ : ["on", "true", "1"].includes(String(flags["editor-auto-merge"])),
243
+ },
237
244
  },
238
245
  get_repo_change: { run_id: { positional: 0, required: true, label: "run-id" } },
239
246
  get_repo_change_activity: {
@@ -853,6 +860,7 @@ async function repoSettings(ctx) {
853
860
  "autopilot-weekly",
854
861
  "autopilot-severity",
855
862
  "auto-merge",
863
+ "editor-auto-merge",
856
864
  ];
857
865
  refuseUnknownFlags(ctx, {}, settingFlags);
858
866
  const setting = settingFlags.some((f) => flags[f] !== undefined);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.175.4",
3
+ "version": "0.175.5",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",