@letterstory/cli 0.176.1 → 0.176.2
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 +5 -4
- package/lib/commands/org.mjs +14 -3
- package/package.json +1 -1
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.
|
|
83
|
+
export const VERSION = "0.176.2";
|
|
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
|
|
1314
|
-
|
|
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
|
package/lib/commands/org.mjs
CHANGED
|
@@ -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
|
|
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, []));
|
|
@@ -294,7 +305,7 @@ function billingInvoicesText(r) {
|
|
|
294
305
|
const lines = [];
|
|
295
306
|
if (r.upcoming)
|
|
296
307
|
lines.push(
|
|
297
|
-
|
|
308
|
+
`${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
309
|
""
|
|
299
310
|
);
|
|
300
311
|
if (r.invoices.length === 0) return [...lines, "No invoices yet."].join("\n");
|