@letterstory/cli 0.149.0 → 0.149.1

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
@@ -66,7 +66,7 @@ import {
66
66
 
67
67
  // Matches cli/package.json; publish-cli.yml rewrites both to the published version.
68
68
  // Matches cli/package.json; publish-cli.yml rewrites both to the published version.
69
- export const VERSION = "0.149.0";
69
+ export const VERSION = "0.149.1";
70
70
 
71
71
  // Flags that never take a value. Listing them explicitly means `deploy get --json <id>`
72
72
  // can't accidentally swallow the id as --json's value. Every `type: "bool"` flag (and its
@@ -158,33 +158,40 @@ async function orgBilling(ctx) {
158
158
  }
159
159
  refuseUnknownFlags(ctx, {}, []);
160
160
  const result = await client.callTool("get_billing_payments", {});
161
- printResult(io, flags, result, (r) =>
162
- [
163
- r.plan
164
- ? `Plan: ${r.plan.name}${r.plan.ratio !== 1 ? ` (${r.plan.ratio}x)` : ""}`
165
- : "Not billed by usage yet.",
166
- ...(r.usage
167
- ? [
168
- `This period (${r.usage.periodFrom.slice(0, 10)} to ${r.usage.periodTo.slice(0, 10)}): ${r.usage.usedTokens} of ${r.usage.allowanceTokens} tokens included${r.usage.overageUsd > 0 ? `, ${usd(r.usage.overageUsd)} of overage` : ""}.`,
169
- ]
170
- : []),
171
- r.spendCap
172
- ? `Spend cap: ${usd(r.spendCap.usd)} of overage a month${r.usage?.availableTokens != null ? `, ${Math.max(0, r.usage.availableTokens)} tokens left under it` : ""}.`
161
+ printResult(io, flags, result, billingAccountText);
162
+ return 0;
163
+ }
164
+
165
+ /** `org billing` as text (MCP get_billing_payments): the plan, this period, the cap and failed payments. */
166
+ export function billingAccountText(r) {
167
+ const ended = r.status === "ended";
168
+ const u = r.usage;
169
+ return [
170
+ r.plan
171
+ ? `Plan: ${r.plan.name}${r.plan.ratio !== 1 ? ` (${r.plan.ratio}x)` : ""}${ended ? `, cancelled${r.canceledAt ? ` on ${r.canceledAt.slice(0, 10)}` : ""}.` : ""}`
172
+ : "Not billed by usage yet.",
173
+ ...(u
174
+ ? [
175
+ `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)` : ""}` : ""}.`,
176
+ ]
177
+ : []),
178
+ ended
179
+ ? null
180
+ : r.spendCap
181
+ ? `Spend cap: ${usd(r.spendCap.usd)} of overage a month${u?.availableTokens != null ? `, ${Math.max(0, u.availableTokens)} tokens left under it` : ""}.`
173
182
  : r.plan
174
183
  ? "No spend cap: overage is on."
175
184
  : null,
176
- ...(r.pastDueAt ? [`Past due since ${r.pastDueAt}.`] : []),
177
- ...(r.payments.length
178
- ? r.payments.map(
179
- (p) =>
180
- ` ${p.invoiceNumber ?? p.invoiceId} $${(p.amountCents / 100).toFixed(2)} ${p.status}${p.nextAttemptAt ? `, next try ${p.nextAttemptAt}` : ""}${p.payUrl ? ` pay: ${p.payUrl}` : ""}`
181
- )
182
- : ["No failed payments."]),
183
- ]
184
- .filter((line) => line !== null)
185
- .join("\n")
186
- );
187
- return 0;
185
+ ...(r.pastDueAt ? [`Past due since ${r.pastDueAt}.`] : []),
186
+ ...(r.payments.length
187
+ ? r.payments.map(
188
+ (p) =>
189
+ ` ${p.invoiceNumber ?? p.invoiceId} $${(p.amountCents / 100).toFixed(2)} ${p.status}${p.nextAttemptAt ? `, next try ${p.nextAttemptAt}` : ""}${p.payUrl ? ` pay: ${p.payUrl}` : ""}`
190
+ )
191
+ : ["No failed payments."]),
192
+ ]
193
+ .filter((line) => line !== null)
194
+ .join("\n");
188
195
  }
189
196
 
190
197
  const tokensOrQty = (p) => `${p.billableQuantity}${p.tokens === null ? "" : ` ${p.tokens} tokens`}`;
@@ -71,6 +71,8 @@ const ARGS = {
71
71
  with_preview: { flag: "with-preview", type: "bool" },
72
72
  // --harness claude-code|letterpress-1: the coding agent; omitted, the deployment's default.
73
73
  harness: { flag: "harness", enum: ["claude-code", "letterpress-1"] },
74
+ // --again: start it even when an open change already asks for the same thing.
75
+ again: { flag: "again", type: "bool" },
74
76
  // --verifier / --no-verifier: review the change before it goes out; omitted, the deployment's choice.
75
77
  verifier: { value: (flags) => (flags["no-verifier"] ? false : flags.verifier ? true : undefined) },
76
78
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.149.0",
3
+ "version": "0.149.1",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",