@letterstory/cli 0.177.44 → 0.177.46

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
@@ -88,7 +88,7 @@ import {
88
88
  import { fetchParkedSections, withoutParked } from "./parked.mjs";
89
89
 
90
90
  // Matches cli/package.json; publish-cli.yml rewrites both to the published version.
91
- export const VERSION = "0.177.44";
91
+ export const VERSION = "0.177.46";
92
92
 
93
93
  /** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
94
94
  export const EXIT_PAYMENT_REQUIRED = 3;
@@ -399,6 +399,10 @@ export const BOOLEAN_FLAGS = new Set([
399
399
  "no-first-touch-only",
400
400
  "no-unsubscribe-links",
401
401
  "now",
402
+ // `billing lago move --fee-on-stripe`, `billing lago fee --stripe | --lago`.
403
+ "fee-on-stripe",
404
+ "stripe",
405
+ "lago",
402
406
  "opt-out-footer",
403
407
  "postal-address-footer",
404
408
  "redesign",
@@ -1969,9 +1973,10 @@ Repo changes (Claude Code edits your repo in a sandbox; the Letter GitHub App op
1969
1973
  repo fix-audit --issue <issue-type>... [--audit <id>] [--branch <base>] [--action build|build_pr|build_merge|slack|linear] [--wait]
1970
1974
  One PR fixing site-audit issues (repeat --issue to bundle) on every affected page,
1971
1975
  in the repo verified to build the site
1972
- repo install-letterprove --repo <owner/name> [--gitlab] [--branch <base>] [--action build|build_pr|build_merge|slack|linear] [--wait]
1973
- One PR adding Letterprove's script and identify calls
1974
- (pick the repo where users sign in)
1976
+ repo install-letterprove --repo <owner/name> [--gitlab] [--host <domain>] [--branch <base>] [--action build|build_pr|build_merge|slack|linear] [--wait]
1977
+ One PR adding Proofs to your product: Letter's script on signed-in
1978
+ pages (identification off) and the identify call
1979
+ (pick the repo where users sign in; --host: where they do)
1975
1980
  repo install-visitors [--site <id> | --host <domain>] [--repo <owner/name> [--gitlab]] [--branch <base>] [--action build|build_pr|build_merge|slack|linear] [--wait]
1976
1981
  One PR adding the Visitors script tag and server snippet to the repo that
1977
1982
  builds the site (--repo: another repo)
@@ -6270,8 +6270,10 @@ const LAGO_USAGE = `Usage: admin billing desk [--json] the Billing desk: s
6270
6270
  signups end <org-id> --why "…" end an org's signup in flight (not yet provisioned), so one on other terms can open
6271
6271
  cap <org-id> <dollars|off> [--why "…"] set an account's monthly spend cap on overage (off: no cap)
6272
6272
  cancel <org-id> --why "…" --yes end an account's Lago plan now (its plan fee refunded in its first month, once per org)
6273
- move <org-id> --plan starter [--ratio 4] [--why "…" above 4x] [--reason "…"] [--complimentary 20000] [--review 2027-05-01] [--stripe-subscription sub_…] [--now] [--dry]
6274
- move an existing customer from Stripe to Lago at their renewal (--now: today, the first invoice credited)
6273
+ move <org-id> --plan starter [--ratio 4] [--why "…" above 4x] [--reason "…"] [--complimentary 20000] [--review 2027-05-01] [--stripe-subscription sub_…] [--now [--fee-on-stripe]] [--dry]
6274
+ move an existing customer from Stripe to Lago at their renewal (--now: today, the first invoice credited; --fee-on-stripe: Stripe keeps billing the fee)
6275
+ fee <org-id> (--stripe [--stripe-subscription sub_…] | --lago) --why "…"
6276
+ who bills a Lago plan's fee: Stripe (Lago's fee $0, its tokens kept) or Lago (Stripe ends at its period end)
6275
6277
  changes [--org <org-id>] term changes waiting to take effect (moves, cheaper plans, new ratios)
6276
6278
  changes cancel <org-id> take back an org's scheduled change before it takes effect`;
6277
6279
 
@@ -6934,6 +6936,7 @@ async function cmdAdminBilling(ctx) {
6934
6936
  reviewAt: flagStr(flags.review),
6935
6937
  stripeSubscriptionId: flagStr(flags["stripe-subscription"]),
6936
6938
  startNow: flags.now ? true : undefined,
6939
+ feeOnStripe: flags["fee-on-stripe"] ? true : undefined,
6937
6940
  dryRun: flags.dry ? true : undefined,
6938
6941
  })
6939
6942
  );
@@ -6941,9 +6944,36 @@ async function cmdAdminBilling(ctx) {
6941
6944
  const credit = p.to.firstInvoiceCreditCents ?? 0;
6942
6945
  ok(
6943
6946
  ctx,
6944
- p.to.startsAt && p.to.startsAt !== p.from.renewsAt
6945
- ? `${result.dryRun ? "Would move" : "Moving"} ${p.orgId} from Stripe ${p.from.stripeSubscriptionId} (${p.from.product ?? "subscription"}) to Lago ${p.to.plan} now: ${p.to.includedTokens} tokens from today, the first invoice $${((p.to.amountCents - credit) / 100).toFixed(2)} after $${(credit / 100).toFixed(2)} Stripe already took. Stripe stops at ${p.from.renewsAt}, when Lago charges $${(p.to.amountCents / 100).toFixed(2)} next.`
6946
- : `${result.dryRun ? "Would move" : "Moving"} ${p.orgId} from Stripe ${p.from.stripeSubscriptionId} (${p.from.product ?? "subscription"}) to Lago ${p.to.plan} at its renewal ${p.from.renewsAt}: Stripe stops then, Lago charges $${(p.to.amountCents / 100).toFixed(2)} then (${p.to.includedTokens} tokens included, overage $${p.to.overageUsdPerToken} a token). Bonus when it takes effect: ${(p.to.bonusTokens ?? 0).toLocaleString("en-US")} tokens (signup × ${p.to.ratio}x), once.`
6947
+ p.to.feeOnStripe
6948
+ ? `${result.dryRun ? "Would put" : "Putting"} ${p.orgId} on Lago ${p.to.plan} now: ${p.to.includedTokens} tokens from today. Stripe ${p.from.stripeSubscriptionId} keeps billing the fee; Lago's is $0 and charges only overage.`
6949
+ : p.to.startsAt && p.to.startsAt !== p.from.renewsAt
6950
+ ? `${result.dryRun ? "Would move" : "Moving"} ${p.orgId} from Stripe ${p.from.stripeSubscriptionId} (${p.from.product ?? "subscription"}) to Lago ${p.to.plan} now: ${p.to.includedTokens} tokens from today, the first invoice $${((p.to.amountCents - credit) / 100).toFixed(2)} after $${(credit / 100).toFixed(2)} Stripe already took. Stripe stops at ${p.from.renewsAt}, when Lago charges $${(p.to.amountCents / 100).toFixed(2)} next.`
6951
+ : `${result.dryRun ? "Would move" : "Moving"} ${p.orgId} from Stripe ${p.from.stripeSubscriptionId} (${p.from.product ?? "subscription"}) to Lago ${p.to.plan} at its renewal ${p.from.renewsAt}: Stripe stops then, Lago charges $${(p.to.amountCents / 100).toFixed(2)} then (${p.to.includedTokens} tokens included, overage $${p.to.overageUsdPerToken} a token). Bonus when it takes effect: ${(p.to.bonusTokens ?? 0).toLocaleString("en-US")} tokens (signup × ${p.to.ratio}x), once.`
6952
+ );
6953
+ printResult(io, flags, result);
6954
+ return 0;
6955
+ }
6956
+ case "fee": {
6957
+ const orgId = requirePositional(positionals, 2, "org-id");
6958
+ const by = flags.stripe ? "stripe" : flags.lago ? "lago" : null;
6959
+ if (!by || !flagStr(flags.why)) throw new CliError(LAGO_USAGE);
6960
+ const result = await staffPost(
6961
+ ctx,
6962
+ `${LAGO}/fee`,
6963
+ compact({
6964
+ orgId,
6965
+ by,
6966
+ stripeSubscriptionId: flagStr(flags["stripe-subscription"]),
6967
+ why: flagStr(flags.why),
6968
+ })
6969
+ );
6970
+ ok(
6971
+ ctx,
6972
+ result.unchanged
6973
+ ? `Stripe ${result.stripeSubscriptionId} already bills ${orgId}'s fee.`
6974
+ : result.by === "stripe"
6975
+ ? `Stripe ${result.stripeSubscriptionId} bills ${orgId}'s fee; Lago's is $0 and the plan's tokens stay.`
6976
+ : `Lago bills ${orgId}'s fee from its next renewal; Stripe ${result.stripeSubscriptionId} ends${result.stripeEndsAt ? ` at ${result.stripeEndsAt}` : ""}.`
6947
6977
  );
6948
6978
  printResult(io, flags, result);
6949
6979
  return 0;
@@ -181,6 +181,7 @@ const ARGS = {
181
181
  },
182
182
  letterprove_open_install_pr: {
183
183
  provider,
184
+ host: "host",
184
185
  repo_owner: { value: (flags) => splitRepo(flags).owner },
185
186
  repo_name: { value: (flags) => splitRepo(flags).name },
186
187
  base_branch: "branch",
@@ -579,10 +580,10 @@ async function repoFixAudit(ctx) {
579
580
  return followRun(ctx, result.run);
580
581
  }
581
582
 
582
- /** `repo install-letterprove --repo owner/name [--branch b] [--wait]`: Letterprove's script + identify calls → one PR. */
583
+ /** `repo install-letterprove --repo owner/name [--host h] [--branch b] [--wait]`: the Visitors script on the product + identify → one PR. */
583
584
  async function repoInstallLetterprove(ctx) {
584
585
  const { client, flags, io } = ctx;
585
- refuseUnknownFlags(ctx, {}, ["repo", "owner", "name", "gitlab", "branch", "action", "wait"]);
586
+ refuseUnknownFlags(ctx, {}, ["repo", "owner", "name", "gitlab", "host", "branch", "action", "wait"]);
586
587
  const result = await client.callTool(
587
588
  "letterprove_open_install_pr",
588
589
  argsFromFlags(ARGS.letterprove_open_install_pr, flags, ctx.positionals)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.177.44",
3
+ "version": "0.177.46",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",