@letterstory/cli 0.150.1 → 0.152.0

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
@@ -66,7 +66,7 @@ import {
66
66
 
67
67
  // Matches cli/package.json; publish-cli.yml rewrites both to the published version.
68
68
  // Matches cli/package.json; publish-cli.yml rewrites both to the published version.
69
- export const VERSION = "0.150.1";
69
+ export const VERSION = "0.152.0";
70
70
 
71
71
  // Flags that never take a value. Listing them explicitly means `deploy get --json <id>`
72
72
  // can't accidentally swallow the id as --json's value. Every `type: "bool"` flag (and its
@@ -1009,7 +1009,7 @@ Admin (STAFF key — --staff-key / LETTERSTORY_STAFF_API_KEY; acts before an org
1009
1009
  [--slack a@acme.com,b@acme.com] [--invite a@acme.com[:admin]]… [--no-checklist]
1010
1010
  | onboarding <account-id> | retry-onboarding <onboarding-id>
1011
1011
  | onboard-plan <account-id> [--refresh]
1012
- | payment-link <account-id> [--amount-cents N] [--description "…"] [--plan starter] [--ratio N] [--why "…"]
1012
+ | payment-link <account-id> [--amount-cents N] [--description "…"] [--plan starter] [--ratio N] [--why "…"] [--first-invoice-credit-cents N]
1013
1013
  The staff CRM's pipeline: bulk-importing a
1014
1014
  CSV of leads, the inbound signal
1015
1015
  feed, recording a signal with no webhook
@@ -1500,6 +1500,7 @@ Repo changes (Claude Code edits your repo in a sandbox; the Letter GitHub App op
1500
1500
  repo say <run-id> <message…> Tell a running build something; it carries on with it
1501
1501
  repo list [--status running|succeeded|no_changes|failed|cancelled] [--limit n] [--audit <id>]
1502
1502
  [--source site_audit_issue|site_quick_check|letterprove_install|visitors_install]
1503
+ [--detail full] one row per run by default; full: every field
1503
1504
  repo publish <run-id> Make PR on a preview in review
1504
1505
  repo merge <run-id> Merge its open PR (a squash; the repo's branch rules decide)
1505
1506
  repo revise <run-id> --instructions <text>|--instructions-file <path|->
@@ -3726,7 +3726,7 @@ async function cmdAdminCrm(ctx) {
3726
3726
  // The key needs crm:write + billing:write.
3727
3727
  if (!id)
3728
3728
  throw new CliError(
3729
- 'Usage: admin crm payment-link <account-id> [--amount-cents N] [--description "…"] [--plan starter] [--ratio 1|2|4|8] [--why "…"]'
3729
+ 'Usage: admin crm payment-link <account-id> [--amount-cents N] [--description "…"] [--plan starter] [--ratio 1|2|4|8] [--why "…"] [--first-invoice-credit-cents N (Lago only)]'
3730
3730
  );
3731
3731
  const r = await staffPost(
3732
3732
  ctx,
@@ -3737,6 +3737,7 @@ async function cmdAdminCrm(ctx) {
3737
3737
  planCode: flagStr(flags.plan),
3738
3738
  ratio: flagNum(flags.ratio),
3739
3739
  exceptionReason: flagStr(flags.why),
3740
+ firstInvoiceCreditCents: flagNum(flags["first-invoice-credit-cents"]),
3740
3741
  })
3741
3742
  );
3742
3743
  return out(
@@ -25,6 +25,7 @@ export const ARGS = {
25
25
  get_campaign_build: { build_id: { positional: 0, label: "build-id", required: true } },
26
26
  list_campaign_builds: { limit: { flag: "limit", type: "num" } },
27
27
  cancel_campaign_build: { build_id: { positional: 0, label: "build-id", required: true } },
28
+ remove_campaign_build: { build_id: { positional: 0, label: "build-id", required: true } },
28
29
  suggest_campaigns: {},
29
30
  };
30
31
 
@@ -33,6 +34,7 @@ const USAGE = `Usage:
33
34
  campaigns show <build-id> [--watch] Its stage, what it built, and what it is doing
34
35
  campaigns list [--limit <n>] This org's builds, newest first
35
36
  campaigns cancel <build-id> Stop it; what it built is kept
37
+ campaigns remove <build-id> Remove it and what it made (sent copies stay sent)
36
38
  campaigns suggest Three campaigns to build in one step`;
37
39
 
38
40
  const STAGES = { who: "Who", picture: "The picture", test: "Tested on 3", email: "The email", desk: "On the desk" };
@@ -51,6 +53,8 @@ export async function cmdCampaigns(ctx) {
51
53
  return campaignsList(rest);
52
54
  case "cancel":
53
55
  return campaignsCancel(rest);
56
+ case "remove":
57
+ return campaignsRemove(rest);
54
58
  case "suggest":
55
59
  return campaignsSuggest(rest);
56
60
  default:
@@ -149,6 +153,30 @@ async function campaignsCancel(ctx) {
149
153
  return 0;
150
154
  }
151
155
 
156
+ async function campaignsRemove(ctx) {
157
+ const { client, flags, positionals, io } = ctx;
158
+ const result = await client.callTool(
159
+ "remove_campaign_build",
160
+ argsFromFlags(ARGS.remove_campaign_build, flags, positionals)
161
+ );
162
+ const r = result.removal ?? {};
163
+ ok(
164
+ ctx,
165
+ `Removed. ${r.copies_removed ?? 0} unsent ${r.copies_removed === 1 ? "copy" : "copies"} left the desk; sent copies stay sent.`
166
+ );
167
+ printResult(io, flags, result, () =>
168
+ [
169
+ r.sequence && `sequence: ${r.sequence}`,
170
+ r.desk && `desk: ${r.desk}`,
171
+ r.list && `list: ${r.list}${r.list === "deleted" ? " (its people stay in Prospects)" : ""}`,
172
+ r.enclosure && `enclosure: ${r.enclosure}`,
173
+ ]
174
+ .filter(Boolean)
175
+ .join("\n")
176
+ );
177
+ return 0;
178
+ }
179
+
152
180
  async function campaignsSuggest(ctx) {
153
181
  const { client, flags, io } = ctx;
154
182
  const result = await client.callTool("suggest_campaigns", {});
@@ -248,6 +248,7 @@ const ARGS = {
248
248
  ],
249
249
  },
250
250
  site_host: "site",
251
+ detail: { flag: "detail", enum: ["brief", "full"] },
251
252
  },
252
253
  list_github_app_repos: {},
253
254
  connect_github: {},
@@ -293,6 +294,16 @@ function describe(run) {
293
294
  return lines.join("\n");
294
295
  }
295
296
 
297
+ /** A list row (list_repo_changes' brief default): what was asked, where it is, its PR and preview. */
298
+ function describeBrief(run) {
299
+ if (!("title" in run)) return describe(run);
300
+ const lines = [`${run.id} ${run.repo} ${run.status} (${run.phase}) $${run.costUsd.toFixed(2)} ${run.title}`];
301
+ if (run.previewUrl) lines.push(` Preview: ${run.previewUrl}`);
302
+ if (run.prUrl) lines.push(` PR: ${run.prUrl} (${run.prState ?? "state unknown"})`);
303
+ if (run.errorCode) lines.push(` Error: ${run.errorCode}`);
304
+ return lines.join("\n");
305
+ }
306
+
296
307
  export async function cmdRepo(ctx) {
297
308
  const sub = ctx.positionals[0];
298
309
  const rest = { ...ctx, positionals: ctx.positionals.slice(1) };
@@ -647,7 +658,7 @@ async function repoList(ctx) {
647
658
  argsFromFlags(ARGS.list_repo_changes, flags, ctx.positionals)
648
659
  );
649
660
  printResult(io, flags, result.runs, (runs) =>
650
- runs.length ? runs.map(describe).join("\n") : "No repo changes yet."
661
+ runs.length ? runs.map(describeBrief).join("\n") : "No repo changes yet."
651
662
  );
652
663
  return 0;
653
664
  }
@@ -522,15 +522,24 @@ async function siteObservations(ctx) {
522
522
  "list_site_observations",
523
523
  argsFromFlags(ARGS.list_site_observations, flags, ctx.positionals)
524
524
  );
525
- printResult(
526
- io,
527
- flags,
528
- result,
529
- (r) =>
525
+ printResult(io, flags, result, (r) => {
526
+ // --keys, or a whole site with more than 50: one line per kind, then one key at a time.
527
+ if (r.keys)
528
+ return r.keys.length
529
+ ? [
530
+ ...r.keys.map(
531
+ (k) =>
532
+ `${GLYPH[k.tone].padEnd(2)} ${k.key} ${k.summary} (${k.count} on ${k.paths.length} pages)`
533
+ ),
534
+ `${r.total} in all. Read one kind with --key <key>.`,
535
+ ].join("\n")
536
+ : "Nothing noticed.";
537
+ return (
530
538
  r.observations
531
539
  .map((o) => `${GLYPH[o.tone].padEnd(2)} ${o.path} ${o.summary} [${o.status}] ${o.id}`)
532
540
  .join("\n") || "Nothing noticed."
533
- );
541
+ );
542
+ });
534
543
  return 0;
535
544
  }
536
545
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.150.1",
3
+ "version": "0.152.0",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",