@letterstory/cli 0.146.1 → 0.147.0
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 +3 -3
- package/lib/commands/admin.mjs +19 -1
- package/lib/commands/org.mjs +15 -0
- package/package.json +1 -1
package/lib/cli.mjs
CHANGED
|
@@ -65,7 +65,7 @@ import {
|
|
|
65
65
|
|
|
66
66
|
// Matches cli/package.json; publish-cli.yml rewrites both to the published version.
|
|
67
67
|
// Matches cli/package.json; publish-cli.yml rewrites both to the published version.
|
|
68
|
-
export const VERSION = "0.
|
|
68
|
+
export const VERSION = "0.147.0";
|
|
69
69
|
|
|
70
70
|
// Flags that never take a value. Listing them explicitly means `deploy get --json <id>`
|
|
71
71
|
// can't accidentally swallow the id as --json's value. Every `type: "bool"` flag (and its
|
|
@@ -945,7 +945,7 @@ Admin (STAFF key — --staff-key / LETTERSTORY_STAFF_API_KEY; acts before an org
|
|
|
945
945
|
| reconcile [--org <org-id>] | forward
|
|
946
946
|
| payments [--org <org-id>] [--open] | payments retry <lago-invoice-id> | payments run [--dry]
|
|
947
947
|
| signups [--status open|card_saved|provisioned|paid|abandoned]
|
|
948
|
-
| cap <org-id> <dollars|off> [--why "…"]
|
|
948
|
+
| cap <org-id> <dollars|off> [--why "…"] | cancel <org-id> --why "…" --yes
|
|
949
949
|
Usage billing on Lago: the plan catalog, an org's
|
|
950
950
|
plan and gifted ratio, Lago's tokens against ours,
|
|
951
951
|
forwarding usage now, failed payments and the
|
|
@@ -1103,7 +1103,7 @@ Seers (event-driven signals -> drafts):
|
|
|
1103
1103
|
org export --split <dir> …as one file per record (for keeping config in git)
|
|
1104
1104
|
org join <dir> [--file <path>] Rebuild the bundle from a --split directory
|
|
1105
1105
|
org integrations Every integration and whether it's connected
|
|
1106
|
-
org billing [cap <dollars|off> [--why "…"] | request [--note "…"]]
|
|
1106
|
+
org billing [cap <dollars|off> [--why "…"] | request [--note "…"] | cancel [--why "…"] --yes]
|
|
1107
1107
|
Usage billing: plan, this period against the
|
|
1108
1108
|
allowance and spend cap, failed payments; set
|
|
1109
1109
|
the cap (admins) or ask the admins for more
|
package/lib/commands/admin.mjs
CHANGED
|
@@ -5213,7 +5213,8 @@ const LAGO_USAGE = `Usage: admin billing lago <command>
|
|
|
5213
5213
|
payments retry <lago-invoice-id> charge one failed invoice again now
|
|
5214
5214
|
payments run [--dry] one pass of the failed-payment loop now (--dry: report only)
|
|
5215
5215
|
signups [--status open|card_saved|provisioned|paid|abandoned] new paying orgs on their way onto Lago
|
|
5216
|
-
cap <org-id> <dollars|off> [--why "…"] set an account's monthly spend cap on overage (off: no cap)
|
|
5216
|
+
cap <org-id> <dollars|off> [--why "…"] set an account's monthly spend cap on overage (off: no cap)
|
|
5217
|
+
cancel <org-id> --why "…" --yes end an account's Lago plan now and refund its first invoice`;
|
|
5217
5218
|
|
|
5218
5219
|
/** admin billing lago … — staff operations on Lago (docs/billing/lago-integration.md). */
|
|
5219
5220
|
async function cmdAdminBilling(ctx) {
|
|
@@ -5336,6 +5337,23 @@ async function cmdAdminBilling(ctx) {
|
|
|
5336
5337
|
);
|
|
5337
5338
|
return 0;
|
|
5338
5339
|
}
|
|
5340
|
+
case "cancel": {
|
|
5341
|
+
const orgId = positionals[2];
|
|
5342
|
+
if (!orgId || !flagStr(flags.why)) throw new CliError(LAGO_USAGE);
|
|
5343
|
+
if (!flagBool(flags.yes))
|
|
5344
|
+
throw new CliError(
|
|
5345
|
+
"This ends the plan now and refunds its first invoice. Run again with --yes to do it."
|
|
5346
|
+
);
|
|
5347
|
+
const result = await staffRequest(ctx, "POST", `${LAGO}/cancel`, { orgId, reason: flagStr(flags.why) });
|
|
5348
|
+
printResult(
|
|
5349
|
+
io,
|
|
5350
|
+
flags,
|
|
5351
|
+
result,
|
|
5352
|
+
(r) =>
|
|
5353
|
+
`Cancelled ${orgId}: first invoice ${r.firstInvoice}${r.refundedCents ? `, $${(r.refundedCents / 100).toFixed(2)} refunded` : ""}.`
|
|
5354
|
+
);
|
|
5355
|
+
return 0;
|
|
5356
|
+
}
|
|
5339
5357
|
case "cap": {
|
|
5340
5358
|
const orgId = positionals[2];
|
|
5341
5359
|
const value = positionals[3];
|
package/lib/commands/org.mjs
CHANGED
|
@@ -33,6 +33,7 @@ export const ARGS = {
|
|
|
33
33
|
reason: { flag: "why" },
|
|
34
34
|
},
|
|
35
35
|
request_billing_tokens: { note: { flag: "note" } },
|
|
36
|
+
cancel_billing_plan: { reason: { flag: "why" } },
|
|
36
37
|
list_integrations: {},
|
|
37
38
|
get_linear_connection: {},
|
|
38
39
|
list_linear_targets: { team_id: { flag: "team" } },
|
|
@@ -125,6 +126,20 @@ async function orgBilling(ctx) {
|
|
|
125
126
|
);
|
|
126
127
|
return 0;
|
|
127
128
|
}
|
|
129
|
+
if (positionals[0] === "cancel") {
|
|
130
|
+
refuseUnknownFlags(ctx, ARGS.cancel_billing_plan, ["yes"]);
|
|
131
|
+
if (!flagBool(flags.yes))
|
|
132
|
+
throw new CliError("This ends the plan now and refunds its first invoice. Run again with --yes to do it.");
|
|
133
|
+
const result = await client.callTool("cancel_billing_plan", argsFromFlags(ARGS.cancel_billing_plan, flags, []));
|
|
134
|
+
printResult(io, flags, result, (r) =>
|
|
135
|
+
r.firstInvoice === "refunded"
|
|
136
|
+
? `Plan cancelled; $${(r.refundedCents / 100).toFixed(2)} refunded to the card.`
|
|
137
|
+
: r.firstInvoice === "voided"
|
|
138
|
+
? "Plan cancelled; its unpaid first invoice is voided."
|
|
139
|
+
: "Plan cancelled."
|
|
140
|
+
);
|
|
141
|
+
return 0;
|
|
142
|
+
}
|
|
128
143
|
if (positionals[0] === "request") {
|
|
129
144
|
refuseUnknownFlags(ctx, ARGS.request_billing_tokens, []);
|
|
130
145
|
const result = await client.callTool(
|