@letterstory/cli 0.177.105 → 0.177.106

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.106";
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;
@@ -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.106",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",