@letterstory/cli 0.177.105 → 0.177.107

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
@@ -91,7 +91,7 @@ import {
91
91
  import { fetchParkedSections, withoutParked } from "./parked.mjs";
92
92
 
93
93
  // Matches cli/package.json; publish-cli.yml rewrites both to the published version.
94
- export const VERSION = "0.177.105";
94
+ export const VERSION = "0.177.107";
95
95
 
96
96
  /** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
97
97
  export const EXIT_PAYMENT_REQUIRED = 3;
@@ -1833,8 +1833,12 @@ Mailers (the sending mailboxes):
1833
1833
  mailers message <mailer-id> <uid> --folder inbox|sent
1834
1834
  One message in full (plain-text body)
1835
1835
  mailers forward <mailer-id> (--to <email> | --clear) Forward replies to sequences to an address
1836
- mailers forwards <mailer-id> [--outcome forwarded|held|failed] [--limit <n>]
1836
+ mailers forwards <mailer-id> [--outcome forwarded|held|failed|kept] [--limit <n>]
1837
1837
  What forwarding forwarded or held, and why
1838
+ mailers replies [--state open|replied|all] [--mailer <id>] [--limit <n>]
1839
+ Replies to your sequences, across every mailer
1840
+ mailers reply <reply-id> --text <answer> Answer a reply from the mailer it came to
1841
+ mailers mark-replied <reply-id> [--reopen] Mark a reply replied without answering, or reopen it
1838
1842
  mailers test <mailer-id> --to <email> Send one test email (5 a mailer, 25 an org a day)
1839
1843
  mailers warmup start|pause <mailer-id> Start / pause warming (14+ days; ready at score 85)
1840
1844
  mailers limit <mailer-id> <per-day> Daily send limit, 0..500 (not while warming)
@@ -376,9 +376,22 @@ export const ARGS = {
376
376
  },
377
377
  list_mailer_forwards: {
378
378
  mailer_id: { positional: 0, label: "mailer-id", required: true },
379
- outcome: { flag: "outcome", enum: ["pending", "forwarded", "held", "failed"] },
379
+ outcome: { flag: "outcome", enum: ["pending", "forwarded", "held", "failed", "kept"] },
380
380
  limit: { flag: "limit", type: "num" },
381
381
  },
382
+ list_mailer_replies: {
383
+ state: { flag: "state", enum: ["open", "replied", "all"] },
384
+ mailer_id: { flag: "mailer" },
385
+ limit: { flag: "limit", type: "num" },
386
+ },
387
+ answer_mailer_reply: {
388
+ reply_id: { positional: 0, label: "reply-id", required: true },
389
+ text: { flag: "text", required: true },
390
+ },
391
+ resolve_mailer_reply: {
392
+ reply_id: { positional: 0, label: "reply-id", required: true },
393
+ replied: { value: (flags) => flags.reopen !== true },
394
+ },
382
395
  send_mailer_test: {
383
396
  mailer_id: { positional: 0, label: "mailer-id", required: true },
384
397
  to: { flag: "to", required: true },
@@ -729,7 +742,7 @@ async function prospectsColumns(ctx, sub) {
729
742
  }
730
743
  }
731
744
 
732
- const MAILERS_USAGE = `Usage: mailers <list|domains|domain|retry|quote|launch|move|messages|message|forward|forwards|test|warmup|limit|retire|suppressions>`;
745
+ const MAILERS_USAGE = `Usage: mailers <list|domains|domain|retry|quote|launch|move|messages|message|forward|forwards|replies|reply|mark-replied|test|warmup|limit|retire|suppressions>`;
733
746
 
734
747
  export async function cmdMailers(ctx) {
735
748
  const sub = ctx.positionals[0];
@@ -781,6 +794,14 @@ export async function cmdMailers(ctx) {
781
794
  return run(rest, "set_mailer_forwarding", "Forwarding updated.");
782
795
  case "forwards":
783
796
  return run(rest, "list_mailer_forwards");
797
+ case "replies":
798
+ return run(rest, "list_mailer_replies");
799
+ case "reply":
800
+ return run(rest, "answer_mailer_reply", (r) => `Answer sent to ${r?.to ?? "the sender"}.`);
801
+ case "mark-replied":
802
+ return run(rest, "resolve_mailer_reply", (r) =>
803
+ r?.state === "open" ? "Reply reopened." : "Reply marked replied."
804
+ );
784
805
  case "test":
785
806
  return run(
786
807
  rest,
@@ -9,6 +9,8 @@
9
9
  // [--internal-accounts accounts.json] confirmed account IDs for new Proofs suggestions
10
10
  // connect PostHog for good: 90 days now, then daily
11
11
  // letterstory usage posthog [status]|sync [--days 7]|disconnect the connection (never its key), sync now, remove it
12
+ // letterstory usage database connect (--project <ref> --key <sbp_…> | --url postgres://… | --existing)
13
+ // --host app.acme.com --schemas public --since … --until … Supabase or any Postgres
12
14
  // letterstory usage case-study [--days 7|30|90] the patterns and the latest case study
13
15
  // letterstory usage case-study generate [--days] [--patterns a,b] [--named [--companies x.com,y.com]]
14
16
  // letterstory usage case-study publish|unpublish <id>
@@ -34,6 +36,20 @@ const repoPart = (i) => ({
34
36
  });
35
37
 
36
38
  export const ARGS = {
39
+ connect_usage_payments: {
40
+ restricted_key: {
41
+ value: (flags) => {
42
+ const key = flags["key-file"]
43
+ ? readFileSync(String(flags["key-file"]), "utf8").trim()
44
+ : process.env.STRIPE_USAGE_RESTRICTED_KEY;
45
+ if (!key) throw new CliError("Use --key-file or STRIPE_USAGE_RESTRICTED_KEY");
46
+ return key;
47
+ },
48
+ },
49
+ },
50
+ get_usage_payments: {},
51
+ refresh_usage_payments: {},
52
+ disconnect_usage_payments: {},
37
53
  get_usage_sources: { host: { flag: "host" }, site_id: { flag: "site" } },
38
54
  choose_product_repo: {
39
55
  repo_owner: { flag: "owner" },
@@ -49,6 +65,8 @@ export const ARGS = {
49
65
  : undefined,
50
66
  },
51
67
  project_ref: { flag: "project" },
68
+ // Any other Postgres: postgres://user:password@host:5432/database[?sslmode=require].
69
+ connection_url: { flag: "url" },
52
70
  host: { flag: "host" },
53
71
  access_token: { flag: "key" },
54
72
  use_oauth: { flag: "oauth", type: "bool" },
@@ -302,6 +320,17 @@ export async function cmdUsage(ctx) {
302
320
  printResult(io, flags, await client.callTool(tool, argsFromFlags(ARGS[tool], flags, [])));
303
321
  return 0;
304
322
  }
323
+ if (ctx.positionals[0] === "payments") {
324
+ const tool = {
325
+ connect: "connect_usage_payments",
326
+ status: "get_usage_payments",
327
+ refresh: "refresh_usage_payments",
328
+ disconnect: "disconnect_usage_payments",
329
+ }[ctx.positionals[1] ?? "status"];
330
+ if (!tool) throw new CliError("Use payments connect, status, refresh or disconnect");
331
+ printResult(io, flags, await client.callTool(tool, argsFromFlags(ARGS[tool], flags, [])));
332
+ return 0;
333
+ }
305
334
  if (ctx.positionals[0] === "database") {
306
335
  const tool = {
307
336
  connect: "connect_proof_database",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.177.105",
3
+ "version": "0.177.107",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",