@withgauge/cli 0.19.0 → 0.20.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.
Files changed (2) hide show
  1. package/dist/index.js +27 -14
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -577,6 +577,8 @@ var billingStatusSchema = z6.object({
577
577
  holdsPerRun: workloadCreditStateSchema(z6.number()),
578
578
  /** Can the org fund at least one more run of each workload right now. */
579
579
  canRunByWorkload: workloadCreditStateSchema(z6.boolean()),
580
+ /** How the subscription is collected; null = no paid subscription. */
581
+ paymentType: z6.enum(["invoice", "card"]).nullable().optional(),
580
582
  /** Invoiced subscriptions only: how far below zero the org may spend. */
581
583
  creditLine: z6.object({ limitUsd: z6.number(), usedUsd: z6.number() }).nullable().optional(),
582
584
  // --- Deprecated. Retained for v1 compatibility; removal needs an API-version
@@ -6063,15 +6065,23 @@ function register4(program2) {
6063
6065
  // src/commands/billing.ts
6064
6066
  var billing_exports2 = {};
6065
6067
  __export(billing_exports2, {
6068
+ fmtOverage: () => fmtOverage,
6066
6069
  register: () => register5
6067
6070
  });
6068
6071
  function fmtDate(iso) {
6069
6072
  return iso ? iso.slice(0, 10) : "\u2014";
6070
6073
  }
6074
+ function fmtOverage(s) {
6075
+ const line = s.creditLine;
6076
+ if (!line) return s.paymentType === "card" ? "n/a (card)" : "\u2014";
6077
+ if (line.limitUsd <= 0) return "off (credit line limit $0)";
6078
+ return `$${line.usedUsd.toFixed(2)} of $${line.limitUsd.toFixed(2)} credit line`;
6079
+ }
6071
6080
  function statusLines(s) {
6072
6081
  return [
6073
6082
  ["Plan", s.plan ?? "free"],
6074
6083
  ["Subscription", s.subscriptionStatus ?? "\u2014"],
6084
+ ["Payment", s.paymentType ?? "\u2014"],
6075
6085
  ["Balance", `${s.balance} credits`],
6076
6086
  [
6077
6087
  "Allowance / cycle",
@@ -6083,10 +6093,7 @@ function statusLines(s) {
6083
6093
  ],
6084
6094
  ["Used this period", `${s.creditsUsedThisPeriod} credits`],
6085
6095
  ["Runs this period", String(s.runsThisPeriod)],
6086
- [
6087
- "Overage",
6088
- s.overageEnabled ? `enabled (${s.overageThisPeriod} used${s.overageCapCredits === null ? ", uncapped" : `, cap ${s.overageCapCredits}`})` : "disabled"
6089
- ],
6096
+ ["Overage", fmtOverage(s)],
6090
6097
  ["Can run eval", s.canRunByWorkload.eval ? "yes" : "no"],
6091
6098
  ["Can run visibility", s.canRunByWorkload.visibility ? "yes" : "no"],
6092
6099
  ["Can run generic", s.canRunByWorkload.generic ? "yes" : "no"],
@@ -6095,7 +6102,7 @@ function statusLines(s) {
6095
6102
  }
6096
6103
  function register5(program2) {
6097
6104
  const group = program2.command("billing").description("Billing & credits");
6098
- group.command("status").description("Show credit balance, plan, and overage").action(async (_opts, cmd) => {
6105
+ group.command("status").description("Show credit balance, plan, payment, and overage").action(async (_opts, cmd) => {
6099
6106
  const org = resolveOrg(cmd);
6100
6107
  const status = await createClient().get(
6101
6108
  `/api/v1/orgs/${encodeURIComponent(org)}/billing`
@@ -9836,16 +9843,14 @@ var org_exports = {};
9836
9843
  __export(org_exports, {
9837
9844
  register: () => register20
9838
9845
  });
9839
- function printSettings(s) {
9846
+ function printSettings(s, billingStatus) {
9840
9847
  console.log(`slug: ${s.slug}`);
9841
9848
  console.log(`name: ${s.name}`);
9842
9849
  console.log(`website: ${s.website ?? "(none)"}`);
9843
9850
  console.log(
9844
9851
  `max spend/run: ${s.maxSpendUsd == null ? "(server default)" : `$${s.maxSpendUsd}`}`
9845
9852
  );
9846
- console.log(
9847
- `overage: ${s.overageEnabled ? "on" : "off"}${s.overageEnabled ? ` (cap: ${s.overageCapCredits == null ? "uncapped" : `${s.overageCapCredits} credits`})` : ""}`
9848
- );
9853
+ console.log(`overage: ${fmtOverage(billingStatus)}`);
9849
9854
  console.log(`auto-join: ${s.autoJoinDomain ?? "off"}`);
9850
9855
  }
9851
9856
  function register20(program2) {
@@ -9854,11 +9859,19 @@ function register20(program2) {
9854
9859
  );
9855
9860
  group.command("get").description("Show the org's settings (edit them in the web app)").action(async (_opts, cmd) => {
9856
9861
  const org = resolveOrg(cmd);
9857
- const settings = await createClient().get(
9858
- `/api/v1/orgs/${encodeURIComponent(org)}`
9859
- );
9860
- if (resolveOutput(cmd) === "json") printJson(settings);
9861
- else printSettings(settings);
9862
+ const client = createClient();
9863
+ const base = `/api/v1/orgs/${encodeURIComponent(org)}`;
9864
+ const [settings, billingStatus] = await Promise.all([
9865
+ client.get(base),
9866
+ client.get(`${base}/billing`)
9867
+ ]);
9868
+ if (resolveOutput(cmd) === "json")
9869
+ printJson({
9870
+ ...settings,
9871
+ paymentType: billingStatus.paymentType ?? null,
9872
+ creditLine: billingStatus.creditLine ?? null
9873
+ });
9874
+ else printSettings(settings, billingStatus);
9862
9875
  });
9863
9876
  }
9864
9877
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@withgauge/cli",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "description": "Gauge customer CLI — Agent Preference, evals, runs, and organization settings over the Gauge API",
5
5
  "private": false,
6
6
  "author": "Gauge <support@withgauge.com> (https://withgauge.com)",