@letterstory/cli 0.177.107 → 0.177.109

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.107";
94
+ export const VERSION = "0.177.109";
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;
@@ -35,8 +35,20 @@ const repoPart = (i) => ({
35
35
  },
36
36
  });
37
37
 
38
+ const paymentScopeArgs = {
39
+ host: { flag: "host" },
40
+ connection_version: { flag: "connection-version" },
41
+ scope: {
42
+ value: (flags) => {
43
+ if (!flags["scope-file"]) throw new CliError("Use --scope-file with a billing scope JSON file");
44
+ return JSON.parse(readFileSync(String(flags["scope-file"]), "utf8"));
45
+ },
46
+ },
47
+ };
48
+
38
49
  export const ARGS = {
39
50
  connect_usage_payments: {
51
+ host: { flag: "host" },
40
52
  restricted_key: {
41
53
  value: (flags) => {
42
54
  const key = flags["key-file"]
@@ -47,8 +59,18 @@ export const ARGS = {
47
59
  },
48
60
  },
49
61
  },
50
- get_usage_payments: {},
51
- refresh_usage_payments: {},
62
+ get_usage_payments: { host: { flag: "host" } },
63
+ refresh_usage_payments: { host: { flag: "host" } },
64
+ discover_usage_payment_scope: { host: { flag: "host" }, connection_version: { flag: "connection-version" } },
65
+ list_usage_payment_catalog: { after: { flag: "after" } },
66
+ get_usage_payment_evidence: {
67
+ host: { flag: "host" },
68
+ run_id: { flag: "run" },
69
+ after: { flag: "after" },
70
+ limit: { flag: "limit", type: "num" },
71
+ },
72
+ set_usage_payment_scope: paymentScopeArgs,
73
+ preview_usage_payment_scope: paymentScopeArgs,
52
74
  disconnect_usage_payments: {},
53
75
  get_usage_sources: { host: { flag: "host" }, site_id: { flag: "site" } },
54
76
  choose_product_repo: {
@@ -326,8 +348,16 @@ export async function cmdUsage(ctx) {
326
348
  status: "get_usage_payments",
327
349
  refresh: "refresh_usage_payments",
328
350
  disconnect: "disconnect_usage_payments",
351
+ discover: "discover_usage_payment_scope",
352
+ catalog: "list_usage_payment_catalog",
353
+ preview: "preview_usage_payment_scope",
354
+ scope: "set_usage_payment_scope",
355
+ evidence: "get_usage_payment_evidence",
329
356
  }[ctx.positionals[1] ?? "status"];
330
- if (!tool) throw new CliError("Use payments connect, status, refresh or disconnect");
357
+ if (!tool)
358
+ throw new CliError(
359
+ "Use payments connect, status, discover, catalog, preview, scope, evidence, refresh or disconnect"
360
+ );
331
361
  printResult(io, flags, await client.callTool(tool, argsFromFlags(ARGS[tool], flags, [])));
332
362
  return 0;
333
363
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.177.107",
3
+ "version": "0.177.109",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",