@limitry/cli 1.0.0-rc.14 → 1.0.0-rc.15

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/CHANGELOG.md CHANGED
@@ -2,6 +2,32 @@
2
2
 
3
3
  What changed in the Limitry CLI (`@limitry/cli`). Generated from the source on each release; newest first.
4
4
 
5
+ ## 1.0.0-rc.15 (2026-11-14)
6
+
7
+ ### Added
8
+
9
+ - The workspace's audit log (`GET /v1/workspace/audit-events`) records
10
+ `billing.cancellation_undone` when a plan set to cancel is kept after all.
11
+ - The workspace's audit log (`GET /v1/workspace/audit-events`) records more
12
+ events. It now includes the workspace's creation and deletion, a declined
13
+ invitation, and plan changes: `workspace.created`, `workspace.deleted`,
14
+ `workspace.invitation_rejected` and `billing.subscribed`,
15
+ `billing.plan_changed`, `billing.cancellation_scheduled` and
16
+ `billing.subscription_ended`.
17
+ - `GET /v1/workspace/usage` now says where each count stands. Each count
18
+ gains `label`, `state` and `stopsAt`, and `unit` when the plan names
19
+ one. The response gains a `state` for the whole workspace.
20
+ `client.workspace.usage.get()` and the Python client return them. The
21
+ CLI's `workspace usage` prints each count as a sentence that says where
22
+ it stands. Use `--json` for the response as it is.
23
+
24
+ ### Fixed
25
+
26
+ - `usage.overview()` (`GET /v1/usage/overview`) now totals each limit's whole
27
+ current window on every plan. On Free, a monthly limit's `total` covered
28
+ only the last 7 days; it now covers the whole month, as each subject's
29
+ amounts already did.
30
+
5
31
  ## 1.0.0-rc.14 (2026-11-09)
6
32
 
7
33
  ### Added
package/README.md CHANGED
@@ -28,12 +28,12 @@ Commands act in **test** unless you say otherwise, so trying things
28
28
  never touches the limits your customers depend on.
29
29
 
30
30
  ```bash
31
- # 100 AI replies a day for each user ("100 replies per user per day for ai-call")
31
+ # A $2 AI budget a month for each of your users ("200 cents per user per month for ai-call")
32
32
  limitry limits create --subject '{"kind":"user"}' --action ai-call \
33
- --amount 100 --unit replies --window day
33
+ --amount 200 --unit cents --window month
34
34
 
35
- # Check a user, as your code would
36
- limitry check user:usr_123 ai-call
35
+ # Check a user, as your code would, for a reply that costs 5 cents
36
+ limitry check user:usr_123 ai-call --cost 5
37
37
 
38
38
  # Where a user stands, without counting anything
39
39
  limitry usage standing --subject user:usr_123
package/dist/limitry.mjs CHANGED
@@ -17,20 +17,12 @@ var brand_default = {
17
17
  productName: "Limitry",
18
18
  legalName: "Omsome L.L.C-FZ",
19
19
  releaseMirrors: true,
20
- mirrorProfile: {
21
- topics: [
22
- "rate-limiting",
23
- "usage-limits",
24
- "credits",
25
- "budgets",
26
- "api-client",
27
- "sdk"
28
- ]
29
- },
20
+ keywords: ["usage-limits", "rate-limiting", "credits", "budgets", "quotas"],
30
21
  domain: "limitry.com",
31
22
  devDomain: "limitry.dev",
32
23
  labs: ["lab"],
33
24
  discordInvite: "https://discord.gg/Nb6QFd6ER4",
25
+ profiles: { x: "limitryhq", github: "limitry" },
34
26
  summary: "Limitry is the limits, credits and budgets layer for the software you build: give each of your users, teams, tenants, API keys or agents an allowance, and before any costly request one call tells your code whether it may happen.",
35
27
  expectedAssets: [
36
28
  "logo.svg",
@@ -148,6 +140,29 @@ var brand = {
148
140
  * when the product has no Discord.
149
141
  */
150
142
  discord: optional.discordInvite ? `https://${brand_default.domain}/discord` : null,
143
+ /**
144
+ * The product's accounts, for the site footer's icons, the docs
145
+ * header's and the app's help menu (owner, 2026-11-09): GitHub (the
146
+ * organisation, which lists the public SDKs), Discord (the /discord
147
+ * redirect) and X, each only when brand.json has it.
148
+ */
149
+ socialLinks: [
150
+ optional.profiles?.github && {
151
+ network: "github",
152
+ label: "GitHub",
153
+ href: `https://github.com/${optional.profiles.github}`
154
+ },
155
+ optional.discordInvite && {
156
+ network: "discord",
157
+ label: "Discord",
158
+ href: `https://${brand_default.domain}/discord`
159
+ },
160
+ optional.profiles?.x && {
161
+ network: "x",
162
+ label: "X",
163
+ href: `https://x.com/${optional.profiles.x}`
164
+ }
165
+ ].filter(Boolean),
151
166
  /** One sentence: what the product is — llms.txt and the agent skill lead with it. */
152
167
  summary: optional.summary ?? `${brand_default.productName} documentation and API.`,
153
168
  /** Where vulnerability reports go — /.well-known/security.txt and /security publish it. Defaults to security@<domain>. */
@@ -1835,11 +1850,11 @@ var Help = class {
1835
1850
  visibleOptions.push(helpOption);
1836
1851
  } else if (helpOption.long && !removeLong) {
1837
1852
  visibleOptions.push(
1838
- cmd.createOption(helpOption.long, helpOption.description)
1853
+ cmd.createOption(helpOption.long, helpOption.description).helpGroup(helpOption.helpGroupHeading)
1839
1854
  );
1840
1855
  } else if (helpOption.short && !removeShort) {
1841
1856
  visibleOptions.push(
1842
- cmd.createOption(helpOption.short, helpOption.description)
1857
+ cmd.createOption(helpOption.short, helpOption.description).helpGroup(helpOption.helpGroupHeading)
1843
1858
  );
1844
1859
  }
1845
1860
  }
@@ -2371,7 +2386,7 @@ var Option = class {
2371
2386
  this.description = description || "";
2372
2387
  this.required = flags.includes("<");
2373
2388
  this.optional = flags.includes("[");
2374
- this.variadic = /\w\.\.\.[>\]]$/.test(flags);
2389
+ this.variadic = new RegExp("\\p{ID_Continue}\\.\\.\\.[>\\]]$", "u").test(flags);
2375
2390
  this.mandatory = false;
2376
2391
  const optionFlags = splitOptionFlags(flags);
2377
2392
  this.short = optionFlags.shortFlag;
@@ -3554,7 +3569,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3554
3569
  getOptionValueSourceWithGlobals(key) {
3555
3570
  let source;
3556
3571
  this._getCommandAndAncestors().forEach((cmd) => {
3557
- if (cmd.getOptionValueSource(key) !== void 0) {
3572
+ if (Object.hasOwn(cmd._optionValueSources, key)) {
3558
3573
  source = cmd.getOptionValueSource(key);
3559
3574
  }
3560
3575
  });
@@ -4197,7 +4212,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
4197
4212
  return arg.length > 1 && arg[0] === "-";
4198
4213
  }
4199
4214
  const negativeNumberArg = (arg) => {
4200
- if (!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg)) return false;
4215
+ if (!/^-(\d+|\d*\.\d+)([eE][+-]?\d+)?$/.test(arg)) return false;
4201
4216
  return !this._getCommandAndAncestors().some(
4202
4217
  (cmd) => cmd.options.map((opt) => opt.short).some((short) => /^-\d$/.test(short))
4203
4218
  );
@@ -4645,7 +4660,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
4645
4660
  * (This does not override a group set directly on the subcommand using .helpGroup().)
4646
4661
  *
4647
4662
  * @example
4648
- * program.commandsGroup('Development Commands:);
4663
+ * program.commandsGroup('Development Commands:');
4649
4664
  * program.command('watch')...
4650
4665
  * program.command('lint')...
4651
4666
  * ...
@@ -4816,7 +4831,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
4816
4831
  * Pass in false to disable the built-in help option.
4817
4832
  *
4818
4833
  * @example
4819
- * program.helpOption('-?, --help' 'show help'); // customise
4834
+ * program.helpOption('-?, --help', 'show help'); // customise
4820
4835
  * program.helpOption(false); // disable
4821
4836
  *
4822
4837
  * @param {(string | boolean)} flags
@@ -4945,16 +4960,20 @@ function incrementNodeInspectorPort(args) {
4945
4960
  let debugHost = "127.0.0.1";
4946
4961
  let debugPort = "9229";
4947
4962
  let match;
4948
- if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {
4963
+ if ((match = arg.match(/^(--inspect(-brk|-wait)?)$/)) !== null) {
4949
4964
  debugOption = match[1];
4950
- } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
4965
+ } else if ((match = arg.match(
4966
+ /^(--inspect(-brk|-port|-wait)?)=(\[[^\]]+\]|[^:]+)$/
4967
+ )) !== null) {
4951
4968
  debugOption = match[1];
4952
4969
  if (/^\d+$/.test(match[3])) {
4953
4970
  debugPort = match[3];
4954
4971
  } else {
4955
4972
  debugHost = match[3];
4956
4973
  }
4957
- } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {
4974
+ } else if ((match = arg.match(
4975
+ /^(--inspect(-brk|-port|-wait)?)=(\[[^\]]+\]|[^:]+):(\d+)$/
4976
+ )) !== null) {
4958
4977
  debugOption = match[1];
4959
4978
  debugHost = match[3];
4960
4979
  debugPort = match[4];
@@ -5244,6 +5263,39 @@ var approvals = (program2, ctx) => {
5244
5263
  );
5245
5264
  };
5246
5265
 
5266
+ // src/usage.ts
5267
+ var usage = (program2, ctx) => {
5268
+ const workspace2 = program2.commands.find((c) => c.name() === "workspace") ?? program2.command("workspace");
5269
+ workspace2.command("usage").description("Show your plan's usage this period").option("--workspace <slug>", "act in this workspace for one call").option("--json", "machine-readable output").action(async (options) => {
5270
+ const result = unwrap(
5271
+ await ctx.client({ workspace: options.workspace }).GET("/workspace/usage")
5272
+ );
5273
+ if (options.json) {
5274
+ ctx.io.stdout(json(result));
5275
+ return;
5276
+ }
5277
+ for (const line of usageLines(result)) ctx.io.stdout(line);
5278
+ });
5279
+ };
5280
+ var number = (n) => n.toLocaleString("en-US");
5281
+ function usageLines(usage2) {
5282
+ const resets = new Date(usage2.periodEnd).toLocaleDateString("en-US", {
5283
+ month: "short",
5284
+ day: "numeric",
5285
+ year: "numeric",
5286
+ timeZone: "UTC"
5287
+ });
5288
+ const lines = [`Usage this period. Counters reset on ${resets}.`];
5289
+ if (usage2.counts.length === 0) lines.push("Your plan counts nothing.");
5290
+ for (const count of usage2.counts) {
5291
+ const figures = count.limit === null ? `${number(count.used)} (no limit)` : `${number(count.used)} of ${number(count.limit)}`;
5292
+ const state = count.state === "grace" ? count.stopsAt === null ? " Over your plan." : ` Over your plan. Past ${number(count.stopsAt)}, ${brand.productName} refuses new use.` : count.state === "stopped" ? ` ${brand.productName} refuses new use until ${resets}.` : count.state === "over" ? " Over your plan." : count.limit === 0 ? " Not in your plan." : "";
5293
+ lines.push(`${count.label}: ${figures}.${state}`);
5294
+ }
5295
+ for (const notice of usage2.notices ?? []) lines.push(notice);
5296
+ return lines;
5297
+ }
5298
+
5247
5299
  // src/commands.ts
5248
5300
  async function me(ctx) {
5249
5301
  return unwrap(await ctx.client({ workspace: false }).GET("/user/me"));
@@ -5467,7 +5519,8 @@ var platformCommands = [
5467
5519
  environment,
5468
5520
  api,
5469
5521
  config,
5470
- approvals
5522
+ approvals,
5523
+ usage
5471
5524
  ];
5472
5525
 
5473
5526
  // src/generated.ts
@@ -5917,7 +5970,7 @@ var OPERATIONS = [
5917
5970
  "exposed": false,
5918
5971
  "reason": "Adding credits gives value away; an agent asks a person (limit.credit approval)"
5919
5972
  },
5920
- "description": "Adds `amount` credits to one subject's balance, on a limit whose window is `total`. A negative `amount` takes credits back, such as after a refund or a chargeback, and needs a `note` saying why. The balance can go below zero, and Limitry then refuses checks until you add more credits. Owners, admins and workspace API keys can add credits. An agent asks a person instead, through the `limit.credit` approval. Limitry keeps a credit's `Idempotency-Key` forever, so never reuse one for a new credit.",
5973
+ "description": "Adds `amount` credits to one subject's balance, on a limit whose window is `total`. A negative `amount` takes credits back, such as after a refund or a chargeback, and needs a `note` saying why. The balance can go below zero, and Limitry then refuses checks until you add more credits. Owners, admins and workspace API keys can add credits. An agent connected through MCP asks a person instead, through the `limit.credit` approval. Limitry keeps a credit's `Idempotency-Key` forever, so never reuse one for a new credit.",
5921
5974
  "fields": [
5922
5975
  {
5923
5976
  "name": "limitId",
@@ -6937,7 +6990,7 @@ var OPERATIONS = [
6937
6990
  "idempotentHint": true
6938
6991
  }
6939
6992
  },
6940
- "description": "Returns every active limit's usage in one answer, for a question that names no limit. Each limit comes with its name, unit, amount and window, its `total` (units used, checks allowed and refused) and its top subjects. By default, it covers each limit's current window, with exact amounts. For a past range, send `period`, such as `last_month`, or `from` and `to`. The totals and subjects then come from history, and each subject's `remaining` is null. Set `sort` to `refused` to list only the subjects each limit refused, the most refused first. A balance also lists the credits added to it in the range. Usage older than your plan's history isn't returned.",
6993
+ "description": "Returns every active limit's usage in one answer, for a question that names no limit. Each limit comes with its name, unit, amount and window, its `total` (units used, checks allowed and refused) and its top subjects. By default, it covers each limit's current window, with exact amounts. For a past range, send `period`, such as `last_month`, or `from` and `to`. The totals and subjects then come from history, and each subject's `remaining` is null. Set `sort` to `refused` to list only the subjects each limit refused, the most refused first. A balance also lists the credits added to it in the range. The current window is whole on every plan. A past range reaches no further back than your plan's history.",
6941
6994
  "fields": [
6942
6995
  {
6943
6996
  "name": "period",
@@ -7222,7 +7275,7 @@ var OPERATIONS = [
7222
7275
  "idempotentHint": true
7223
7276
  }
7224
7277
  },
7225
- "description": "Lists a limit's subjects in its current window, most used first. Each one shows the units used, what's left and how many checks the limit refused. The amounts are exact, but a subject first checked in the last minute may not appear yet. For a `concurrent` limit, it lists the slots each subject holds now, among the subjects checked in the last hour. Name the limit by `limitId` or `limitName`. For a past range, send `period`, such as `last_month`, or `from` and `to`. The subjects are then ranked by their use in that range, from history. Each one's `remaining` is then null. Set `sort` to `refused` to list the most refused first. Usage older than your plan's history isn't returned.",
7278
+ "description": "Lists a limit's subjects in its current window, most used first. Each one shows the units used, what's left and how many checks the limit refused. The amounts are exact, but a subject first checked in the last minute may not appear yet. For a `concurrent` limit, it lists the slots each subject holds now, among the subjects checked in the last hour. Name the limit by `limitId` or `limitName`. For a past range, send `period`, such as `last_month`, or `from` and `to`. The subjects are then ranked by their use in that range, from history. Each one's `remaining` is then null. Set `sort` to `refused` to list the most refused first. The current window is whole on every plan. A past range reaches no further back than your plan's history.",
7226
7279
  "fields": [
7227
7280
  {
7228
7281
  "name": "limitId",
@@ -7866,7 +7919,7 @@ var OPERATIONS = [
7866
7919
  "idempotentHint": true
7867
7920
  }
7868
7921
  },
7869
- "description": "Returns what the workspace used this period, with one entry for each thing its plan counts. Each entry has the plan's limit, or null when there is no limit. A period is one month from the workspace's billing date. That date comes from its subscription or, without one, from the day you created the workspace. On an annual plan, the counts still reset every month from the subscription's start.",
7922
+ "description": "Returns what the workspace used this period, with one entry for each thing its plan counts. Each entry has the plan's limit, or null when there is no limit. Each entry also says where it stands and where we start refusing new use. A period is one month from the workspace's billing date. That date comes from its subscription or, without one, from the day you created the workspace. On an annual plan, the counts still reset every month from the subscription's start.",
7870
7923
  "fields": [],
7871
7924
  "hasBody": false,
7872
7925
  "workspace": true,
@@ -8506,6 +8559,8 @@ async function call2(ctx, op, args, options, flags) {
8506
8559
  `missing ${missing.map((f) => `--${flag(f.name)}`).join(", ")}`
8507
8560
  );
8508
8561
  }
8562
+ const problem = variantProblem(op, input, whole);
8563
+ if (problem) throw new Error(problem);
8509
8564
  const request = operationRequest(op, input, whole);
8510
8565
  const headers = {
8511
8566
  authorization: `Bearer ${token}`
@@ -8577,6 +8632,19 @@ function print(ctx, data, asJson) {
8577
8632
  }
8578
8633
  ctx.io.stdout(String(data));
8579
8634
  }
8635
+ function variantProblem(op, input, whole) {
8636
+ if (!op.variants) return void 0;
8637
+ const key = op.variants.field;
8638
+ const chosen = String(input[key] ?? whole[key]);
8639
+ const needs = op.variants.required[chosen];
8640
+ if (!needs) {
8641
+ return `--${flag(key)} must be one of ${Object.keys(op.variants.required).join(", ")}`;
8642
+ }
8643
+ const absent = needs.filter(
8644
+ (name) => input[name] === void 0 && whole[name] === void 0
8645
+ );
8646
+ return absent.length > 0 ? `missing ${absent.map((name) => `--${flag(name)}`).join(", ")} (needed with --${flag(key)} ${chosen})` : void 0;
8647
+ }
8580
8648
 
8581
8649
  // src/product/check.ts
8582
8650
  var checkCommand = (program2, ctx) => {
@@ -8774,7 +8842,7 @@ function tokenEnvVar() {
8774
8842
  function build(io) {
8775
8843
  let actedIn = null;
8776
8844
  let sending;
8777
- const program2 = new Command().name(brand.name).description(`The ${brand.productName} CLI`).version("1.0.0-rc.14").addHelpText(
8845
+ const program2 = new Command().name(brand.name).description(`The ${brand.productName} CLI`).version("1.0.0-rc.15").addHelpText(
8778
8846
  "after",
8779
8847
  `
8780
8848
  Token: \`${brand.name} login\` stores it in ~/.config/${brand.name}/; ${tokenEnvVar()} overrides.
package/package.json CHANGED
@@ -1,7 +1,16 @@
1
1
  {
2
2
  "name": "@limitry/cli",
3
- "version": "1.0.0-rc.14",
3
+ "version": "1.0.0-rc.15",
4
4
  "description": "Limitry command line",
5
+ "keywords": [
6
+ "usage-limits",
7
+ "rate-limiting",
8
+ "credits",
9
+ "budgets",
10
+ "quotas",
11
+ "cli",
12
+ "command-line-tool"
13
+ ],
5
14
  "type": "module",
6
15
  "bin": {
7
16
  "limitry": "./dist/limitry.mjs"
@@ -17,9 +26,9 @@
17
26
  "typecheck": "tsc --noEmit"
18
27
  },
19
28
  "devDependencies": {
20
- "@limitry/sdk": "1.0.0-rc.14",
29
+ "@limitry/sdk": "1.0.0-rc.15",
21
30
  "@types/node": "26.6.6",
22
- "commander": "15.0.0",
31
+ "commander": "15.1.0",
23
32
  "esbuild": "0.28.2",
24
33
  "typescript": "6.0.3",
25
34
  "vitest": "4.1.12"