@letterstory/cli 0.176.1 → 0.176.3

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
@@ -80,7 +80,7 @@ import {
80
80
  import { fetchParkedSections, withoutParked } from "./parked.mjs";
81
81
 
82
82
  // Matches cli/package.json; publish-cli.yml rewrites both to the published version.
83
- export const VERSION = "0.176.1";
83
+ export const VERSION = "0.176.3";
84
84
 
85
85
  /** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
86
86
  export const EXIT_PAYMENT_REQUIRED = 3;
@@ -1307,11 +1307,12 @@ Org (the account as one file, its integrations and billing):
1307
1307
  org export --split <dir> …as one file per record (for keeping config in git)
1308
1308
  org join <dir> [--file <path>] Rebuild the bundle from a --split directory
1309
1309
  org integrations Every integration and whether it's connected
1310
- org billing [cap <dollars|off> [--why "…"] | card | request [--note "…"] | cancel [--why "…"] --yes]
1310
+ org billing [cap <dollars|off> [--why "…"] | card | request [--note "…"] | cancel [--why "…"] --yes | keep]
1311
1311
  Usage billing: plan, this period against the
1312
1312
  allowance and spend cap, failed payments; set
1313
- the cap or change the card (admins), or ask
1314
- the admins for more
1313
+ the cap or change the card (admins), cancel or
1314
+ keep a plan set to end (admins), or ask the
1315
+ admins for more
1315
1316
  org billing usage This period by product and collection: quantities,
1316
1317
  and tokens and dollars when billed by usage
1317
1318
  org billing rewards [claim <action>] Free tokens for connecting Slack, signing in with the
@@ -38,6 +38,7 @@ export const ARGS = {
38
38
  },
39
39
  request_billing_tokens: { note: { flag: "note" } },
40
40
  cancel_billing_plan: { reason: { flag: "why" } },
41
+ undo_billing_plan_cancel: {},
41
42
  update_billing_card: {},
42
43
  list_integrations: {},
43
44
  get_linear_connection: {},
@@ -116,7 +117,8 @@ const usd = (n) => `$${Number(n).toFixed(2)}`;
116
117
  * `org billing`: the org's plan on Lago, this period against its allowance and spend cap, whether
117
118
  * it is past due, and its failed payments (get_billing_payments). `org billing cap <dollars|off>`
118
119
  * sets the cap (set_billing_spend_cap, admins); `org billing card` links to Stripe's page for a new
119
- * card (update_billing_card, admins); `org billing request` asks the admins for more
120
+ * card (update_billing_card, admins); `org billing keep` takes back a cancel set for the period's end
121
+ * (undo_billing_plan_cancel, admins); `org billing request` asks the admins for more
120
122
  * (request_billing_tokens); `org billing usage` is this period by product and collection (get_billing);
121
123
  * `org billing invoices` is what was charged and the next invoice (get_billing_invoices).
122
124
  */
@@ -141,12 +143,21 @@ async function orgBilling(ctx) {
141
143
  refuseUnknownFlags(ctx, ARGS.cancel_billing_plan, ["yes"]);
142
144
  if (!flagBool(flags.yes))
143
145
  throw new CliError(
144
- "In the plan's first month this ends it now and refunds the plan fee, once per workspace (usage so far is billed; overage already charged isn't refunded). If the workspace had that refund before, the plan ends at the end of this billing period instead, with no refund. Run again with --yes to do it."
146
+ "In the plan's first month (its first billing period) this ends it now and refunds the plan fee, once per workspace; an unpaid first invoice is cancelled instead and doesn't use the refund (usage so far is billed; overage already charged isn't refunded). If the workspace had that refund before, the plan ends at the end of this billing period instead, with no refund. Run again with --yes to do it."
145
147
  );
146
148
  const result = await client.callTool("cancel_billing_plan", argsFromFlags(ARGS.cancel_billing_plan, flags, []));
147
149
  printResult(io, flags, result, (r) => r.message);
148
150
  return 0;
149
151
  }
152
+ if (positionals[0] === "keep") {
153
+ refuseUnknownFlags(ctx, ARGS.undo_billing_plan_cancel, []);
154
+ const result = await client.callTool(
155
+ "undo_billing_plan_cancel",
156
+ argsFromFlags(ARGS.undo_billing_plan_cancel, flags, [])
157
+ );
158
+ printResult(io, flags, result, (r) => r.message);
159
+ return 0;
160
+ }
150
161
  if (positionals[0] === "card") {
151
162
  refuseUnknownFlags(ctx, ARGS.update_billing_card, []);
152
163
  const result = await client.callTool("update_billing_card", argsFromFlags(ARGS.update_billing_card, flags, []));
@@ -232,12 +243,27 @@ export function billingAccountText(r) {
232
243
  : "When they run out, new work needs a card (an admin adds one in Settings → Billing).",
233
244
  ]
234
245
  : []),
235
- // No plan and not on free tokens (unassigned, or the plan ended): adding a card starts one (addCard).
236
- ...(r.addCard && !f
246
+ // Paying by card starts a plan (addCard): every plan offered, as letter.dev/pricing shows them, Growth's
247
+ // "Most teams" and, with usage, "Cheapest for you" (Kaya, 2026-11-02), the same choice Settings →
248
+ // Billing shows; a person enters the card there.
249
+ ...(r.addCard
237
250
  ? [
238
- `Adding a card starts ${r.addCard.planName}, at ${usd(r.addCard.monthlyUsd)} a month: an admin adds one in Settings → Billing.`,
251
+ r.addCard.lockedBy
252
+ ? `Paying by card starts ${r.addCard.planName}, at ${usd(r.addCard.monthlyUsd)} a month (a signup from ${r.addCard.lockedBy} is in progress): an admin pays in Settings → Billing.`
253
+ : `Pay by card: an admin picks a plan in Settings → Billing.${r.addCard.tokensPerMonth ? ` At your usage (about ${r.addCard.tokensPerMonth} tokens a month):` : ""}`,
254
+ ...(r.addCard.lockedBy ? [] : (r.addCard.plans ?? [])).map(
255
+ (p) =>
256
+ ` ${p.planName}${[p.badge, p.cheapestForYou ? "Cheapest for you" : null]
257
+ .filter(Boolean)
258
+ .map((b) => ` [${b}]`)
259
+ .join(
260
+ ""
261
+ )}: ${usd(p.monthlyUsd)} a month, ${p.includedTokens} tokens, ${usd(p.usdPer1kTokens)} per 1,000, past the pool ${usd(p.overageUsdPer1kTokens)} per 1,000${p.expectedMonthlyUsd !== null ? `; about ${usd(p.expectedMonthlyUsd)} a month at your usage` : ""}${p.savesUsdPerMonth ? `, saves ${usd(p.savesUsdPerMonth)} a month` : ""}.${p.tagline ? ` ${p.tagline}` : ""}${p.extras?.length ? ` ${p.extras.join(", ")}.` : ""}`
262
+ ),
239
263
  ]
240
264
  : []),
265
+ // Free tokens carrying over, not landed yet: the account read's own sentence (Kaya, 2026-11-02).
266
+ ...(r.carryOverArriving ? [`${r.carryOverArriving.words}.`] : []),
241
267
  ...(u
242
268
  ? [
243
269
  `This period (${u.periodFrom.slice(0, 10)} to ${u.periodTo.slice(0, 10)}): ${u.usedTokens} of ${u.allowanceTokens} tokens included${u.overageUsd > 0 ? `, ${usd(u.overageUsd)} of overage so far${u.overageChargedUsd ? ` (${usd(u.overageChargedUsd)} of it already charged to the card)` : ""}` : ""}${u.runningTokens ? `; ${u.runningTokens} more held by running work${u.runningOverageUsd > 0 ? ` (${usd(u.runningOverageUsd)} against the cap)` : ""}` : ""}.`,
@@ -294,7 +320,7 @@ function billingInvoicesText(r) {
294
320
  const lines = [];
295
321
  if (r.upcoming)
296
322
  lines.push(
297
- `Next invoice ${r.upcoming.issuesOn}: ${usd(r.upcoming.totalUsd)} (plan ${usd(r.upcoming.planFeeUsd)} in advance + overage ${usd(r.upcoming.overageUsd)}${r.upcoming.overagePrepaidUsd ? `, ${usd(r.upcoming.overagePrepaidUsd)} of it already charged` : ""}).`,
323
+ `${r.upcoming.final ? "Last invoice (the plan ends)" : "Next invoice"} ${r.upcoming.issuesOn}: ${usd(r.upcoming.totalUsd)} (plan ${usd(r.upcoming.planFeeUsd)}${r.upcoming.final ? "" : " in advance"} + overage ${usd(r.upcoming.overageUsd)}${r.upcoming.overagePrepaidUsd ? `, ${usd(r.upcoming.overagePrepaidUsd)} of it already charged` : ""}).`,
298
324
  ""
299
325
  );
300
326
  if (r.invoices.length === 0) return [...lines, "No invoices yet."].join("\n");
@@ -333,6 +359,7 @@ function billingUsageText(r) {
333
359
  `Tokens: ${r.tokens.used} used of ${r.tokens.allowance} included${r.tokens.complimentary ? ` (+${r.tokens.complimentary} complimentary)` : ""}${r.tokens.arriving ? ` (${r.tokens.arriving} of them still being counted)` : ""}${r.tokens.running ? `, ${r.tokens.running} held by running work` : ""}.`
334
360
  );
335
361
  else lines.push("Not billed by usage: quantities only.");
362
+ if (r.carryOverArriving) lines.push(`${r.carryOverArriving.words}.`);
336
363
  if (r.usd)
337
364
  lines.push(
338
365
  `Plan fee ${usd(r.usd.planFee)}; overage so far ${usd(r.usd.overage)}. What was charged and the next invoice: letterstory org billing invoices.`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.176.1",
3
+ "version": "0.176.3",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",