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

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,38 @@
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.16 (2026-11-17)
6
+
7
+ ### Changed
8
+
9
+ - The package page (README, on GitHub, npm and PyPI) opens with a short animation of a $2 AI budget refusing a call, linked to the 45-second demo.
10
+
11
+ ## 1.0.0-rc.15 (2026-11-14)
12
+
13
+ ### Added
14
+
15
+ - The workspace's audit log (`GET /v1/workspace/audit-events`) records
16
+ `billing.cancellation_undone` when a plan set to cancel is kept after all.
17
+ - The workspace's audit log (`GET /v1/workspace/audit-events`) records more
18
+ events. It now includes the workspace's creation and deletion, a declined
19
+ invitation, and plan changes: `workspace.created`, `workspace.deleted`,
20
+ `workspace.invitation_rejected` and `billing.subscribed`,
21
+ `billing.plan_changed`, `billing.cancellation_scheduled` and
22
+ `billing.subscription_ended`.
23
+ - `GET /v1/workspace/usage` now says where each count stands. Each count
24
+ gains `label`, `state` and `stopsAt`, and `unit` when the plan names
25
+ one. The response gains a `state` for the whole workspace.
26
+ `client.workspace.usage.get()` and the Python client return them. The
27
+ CLI's `workspace usage` prints each count as a sentence that says where
28
+ it stands. Use `--json` for the response as it is.
29
+
30
+ ### Fixed
31
+
32
+ - `usage.overview()` (`GET /v1/usage/overview`) now totals each limit's whole
33
+ current window on every plan. On Free, a monthly limit's `total` covered
34
+ only the last 7 days; it now covers the whole month, as each subject's
35
+ amounts already did.
36
+
5
37
  ## 1.0.0-rc.14 (2026-11-09)
6
38
 
7
39
  ### Added
package/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  The Limitry CLI sets up your limits and checks them from a terminal, a script or an agent: create a limit, try a check, and see who is using what, in test before live.
4
4
 
5
+ [![A $2 AI budget for one of your users: three calls are charged, and the next is refused before the AI runs.](https://media.limitry.com/launch/readme-20261117-1555.gif)](https://limitry.com/#demo)
6
+
7
+ [▶ Watch the 45-second demo](https://limitry.com/#demo)
8
+
5
9
  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.
6
10
 
7
11
  ## Install
@@ -28,12 +32,12 @@ Commands act in **test** unless you say otherwise, so trying things
28
32
  never touches the limits your customers depend on.
29
33
 
30
34
  ```bash
31
- # 100 AI replies a day for each user ("100 replies per user per day for ai-call")
35
+ # A $2 AI budget a month for each of your users ("200 cents per user per month for ai-call")
32
36
  limitry limits create --subject '{"kind":"user"}' --action ai-call \
33
- --amount 100 --unit replies --window day
37
+ --amount 200 --unit cents --window month
34
38
 
35
- # Check a user, as your code would
36
- limitry check user:usr_123 ai-call
39
+ # Check a user, as your code would, for a reply that costs 5 cents
40
+ limitry check user:usr_123 ai-call --cost 5
37
41
 
38
42
  # Where a user stands, without counting anything
39
43
  limitry usage standing --subject user:usr_123
package/dist/limitry.mjs CHANGED
@@ -17,20 +17,13 @@ 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"],
24
+ statusPage: true,
33
25
  discordInvite: "https://discord.gg/Nb6QFd6ER4",
26
+ profiles: { x: "limitryhq", github: "limitry" },
34
27
  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
28
  expectedAssets: [
36
29
  "logo.svg",
@@ -148,12 +141,37 @@ var brand = {
148
141
  * when the product has no Discord.
149
142
  */
150
143
  discord: optional.discordInvite ? `https://${brand_default.domain}/discord` : null,
144
+ /**
145
+ * The product's accounts, for the site footer's icons, the docs
146
+ * header's and the app's help menu (owner, 2026-11-09): GitHub (the
147
+ * organisation, which lists the public SDKs), Discord (the /discord
148
+ * redirect) and X, each only when brand.json has it.
149
+ */
150
+ socialLinks: [
151
+ optional.profiles?.github && {
152
+ network: "github",
153
+ label: "GitHub",
154
+ href: `https://github.com/${optional.profiles.github}`
155
+ },
156
+ optional.discordInvite && {
157
+ network: "discord",
158
+ label: "Discord",
159
+ href: `https://${brand_default.domain}/discord`
160
+ },
161
+ optional.profiles?.x && {
162
+ network: "x",
163
+ label: "X",
164
+ href: `https://x.com/${optional.profiles.x}`
165
+ }
166
+ ].filter(Boolean),
151
167
  /** One sentence: what the product is — llms.txt and the agent skill lead with it. */
152
168
  summary: optional.summary ?? `${brand_default.productName} documentation and API.`,
153
169
  /** Where vulnerability reports go — /.well-known/security.txt and /security publish it. Defaults to security@<domain>. */
154
170
  securityContact: optional.securityContact ?? `security@${brand_default.domain}`,
155
- /** The support address the /contact page shows. Defaults to support@<domain>. */
171
+ /** Where the Contact form's help topics go (Question, Bug, Billing). Never shown on a page. Defaults to support@<domain>. */
156
172
  supportContact: optional.supportContact ?? `support@${brand_default.domain}`,
173
+ /** Where the Contact form's other topics go (Sales and enterprise, Something else; owner, 2026-11-15). Never shown on a page. Defaults to contact@<domain>. */
174
+ contactContact: optional.contactContact ?? `contact@${brand_default.domain}`,
157
175
  /**
158
176
  * Where operational alerts go (dead letters, failed crons, unhandled
159
177
  * API errors, failed uptime probes — the worker's `sendOpsAlert`).
@@ -169,6 +187,10 @@ var brand = {
169
187
  * (docs/deployment.md "Resetting product data"). False when absent.
170
188
  */
171
189
  launched: optional.launched === true,
190
+ /** The launch date (brand.json `launchedAt`, YYYY-MM-DD): the public changelog starts here. */
191
+ launchedAt: optional.launchedAt ?? null,
192
+ /** The public status page's address, once brand.json `statusPage` says it is live; else null. */
193
+ statusPageUrl: optional.statusPage === true ? `https://status.${brand_default.domain}` : null,
172
194
  /** True once the product has its own brand (brand.json `status: "ready"`), not the platform's placeholders. */
173
195
  ready: brand_default.status === "ready"
174
196
  };
@@ -1835,11 +1857,11 @@ var Help = class {
1835
1857
  visibleOptions.push(helpOption);
1836
1858
  } else if (helpOption.long && !removeLong) {
1837
1859
  visibleOptions.push(
1838
- cmd.createOption(helpOption.long, helpOption.description)
1860
+ cmd.createOption(helpOption.long, helpOption.description).helpGroup(helpOption.helpGroupHeading)
1839
1861
  );
1840
1862
  } else if (helpOption.short && !removeShort) {
1841
1863
  visibleOptions.push(
1842
- cmd.createOption(helpOption.short, helpOption.description)
1864
+ cmd.createOption(helpOption.short, helpOption.description).helpGroup(helpOption.helpGroupHeading)
1843
1865
  );
1844
1866
  }
1845
1867
  }
@@ -2371,7 +2393,7 @@ var Option = class {
2371
2393
  this.description = description || "";
2372
2394
  this.required = flags.includes("<");
2373
2395
  this.optional = flags.includes("[");
2374
- this.variadic = /\w\.\.\.[>\]]$/.test(flags);
2396
+ this.variadic = new RegExp("\\p{ID_Continue}\\.\\.\\.[>\\]]$", "u").test(flags);
2375
2397
  this.mandatory = false;
2376
2398
  const optionFlags = splitOptionFlags(flags);
2377
2399
  this.short = optionFlags.shortFlag;
@@ -3554,7 +3576,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3554
3576
  getOptionValueSourceWithGlobals(key) {
3555
3577
  let source;
3556
3578
  this._getCommandAndAncestors().forEach((cmd) => {
3557
- if (cmd.getOptionValueSource(key) !== void 0) {
3579
+ if (Object.hasOwn(cmd._optionValueSources, key)) {
3558
3580
  source = cmd.getOptionValueSource(key);
3559
3581
  }
3560
3582
  });
@@ -4197,7 +4219,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
4197
4219
  return arg.length > 1 && arg[0] === "-";
4198
4220
  }
4199
4221
  const negativeNumberArg = (arg) => {
4200
- if (!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg)) return false;
4222
+ if (!/^-(\d+|\d*\.\d+)([eE][+-]?\d+)?$/.test(arg)) return false;
4201
4223
  return !this._getCommandAndAncestors().some(
4202
4224
  (cmd) => cmd.options.map((opt) => opt.short).some((short) => /^-\d$/.test(short))
4203
4225
  );
@@ -4645,7 +4667,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
4645
4667
  * (This does not override a group set directly on the subcommand using .helpGroup().)
4646
4668
  *
4647
4669
  * @example
4648
- * program.commandsGroup('Development Commands:);
4670
+ * program.commandsGroup('Development Commands:');
4649
4671
  * program.command('watch')...
4650
4672
  * program.command('lint')...
4651
4673
  * ...
@@ -4816,7 +4838,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
4816
4838
  * Pass in false to disable the built-in help option.
4817
4839
  *
4818
4840
  * @example
4819
- * program.helpOption('-?, --help' 'show help'); // customise
4841
+ * program.helpOption('-?, --help', 'show help'); // customise
4820
4842
  * program.helpOption(false); // disable
4821
4843
  *
4822
4844
  * @param {(string | boolean)} flags
@@ -4945,16 +4967,20 @@ function incrementNodeInspectorPort(args) {
4945
4967
  let debugHost = "127.0.0.1";
4946
4968
  let debugPort = "9229";
4947
4969
  let match;
4948
- if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {
4970
+ if ((match = arg.match(/^(--inspect(-brk|-wait)?)$/)) !== null) {
4949
4971
  debugOption = match[1];
4950
- } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
4972
+ } else if ((match = arg.match(
4973
+ /^(--inspect(-brk|-port|-wait)?)=(\[[^\]]+\]|[^:]+)$/
4974
+ )) !== null) {
4951
4975
  debugOption = match[1];
4952
4976
  if (/^\d+$/.test(match[3])) {
4953
4977
  debugPort = match[3];
4954
4978
  } else {
4955
4979
  debugHost = match[3];
4956
4980
  }
4957
- } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {
4981
+ } else if ((match = arg.match(
4982
+ /^(--inspect(-brk|-port|-wait)?)=(\[[^\]]+\]|[^:]+):(\d+)$/
4983
+ )) !== null) {
4958
4984
  debugOption = match[1];
4959
4985
  debugHost = match[3];
4960
4986
  debugPort = match[4];
@@ -5244,6 +5270,39 @@ var approvals = (program2, ctx) => {
5244
5270
  );
5245
5271
  };
5246
5272
 
5273
+ // src/usage.ts
5274
+ var usage = (program2, ctx) => {
5275
+ const workspace2 = program2.commands.find((c) => c.name() === "workspace") ?? program2.command("workspace");
5276
+ 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) => {
5277
+ const result = unwrap(
5278
+ await ctx.client({ workspace: options.workspace }).GET("/workspace/usage")
5279
+ );
5280
+ if (options.json) {
5281
+ ctx.io.stdout(json(result));
5282
+ return;
5283
+ }
5284
+ for (const line of usageLines(result)) ctx.io.stdout(line);
5285
+ });
5286
+ };
5287
+ var number = (n) => n.toLocaleString("en-US");
5288
+ function usageLines(usage2) {
5289
+ const resets = new Date(usage2.periodEnd).toLocaleDateString("en-US", {
5290
+ month: "short",
5291
+ day: "numeric",
5292
+ year: "numeric",
5293
+ timeZone: "UTC"
5294
+ });
5295
+ const lines = [`Usage this period. Counters reset on ${resets}.`];
5296
+ if (usage2.counts.length === 0) lines.push("Your plan counts nothing.");
5297
+ for (const count of usage2.counts) {
5298
+ const figures = count.limit === null ? `${number(count.used)} (no limit)` : `${number(count.used)} of ${number(count.limit)}`;
5299
+ 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." : "";
5300
+ lines.push(`${count.label}: ${figures}.${state}`);
5301
+ }
5302
+ for (const notice of usage2.notices ?? []) lines.push(notice);
5303
+ return lines;
5304
+ }
5305
+
5247
5306
  // src/commands.ts
5248
5307
  async function me(ctx) {
5249
5308
  return unwrap(await ctx.client({ workspace: false }).GET("/user/me"));
@@ -5467,7 +5526,8 @@ var platformCommands = [
5467
5526
  environment,
5468
5527
  api,
5469
5528
  config,
5470
- approvals
5529
+ approvals,
5530
+ usage
5471
5531
  ];
5472
5532
 
5473
5533
  // src/generated.ts
@@ -5917,7 +5977,7 @@ var OPERATIONS = [
5917
5977
  "exposed": false,
5918
5978
  "reason": "Adding credits gives value away; an agent asks a person (limit.credit approval)"
5919
5979
  },
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.",
5980
+ "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
5981
  "fields": [
5922
5982
  {
5923
5983
  "name": "limitId",
@@ -6937,7 +6997,7 @@ var OPERATIONS = [
6937
6997
  "idempotentHint": true
6938
6998
  }
6939
6999
  },
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.",
7000
+ "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
7001
  "fields": [
6942
7002
  {
6943
7003
  "name": "period",
@@ -7222,7 +7282,7 @@ var OPERATIONS = [
7222
7282
  "idempotentHint": true
7223
7283
  }
7224
7284
  },
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.",
7285
+ "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
7286
  "fields": [
7227
7287
  {
7228
7288
  "name": "limitId",
@@ -7866,7 +7926,7 @@ var OPERATIONS = [
7866
7926
  "idempotentHint": true
7867
7927
  }
7868
7928
  },
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.",
7929
+ "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
7930
  "fields": [],
7871
7931
  "hasBody": false,
7872
7932
  "workspace": true,
@@ -8506,6 +8566,8 @@ async function call2(ctx, op, args, options, flags) {
8506
8566
  `missing ${missing.map((f) => `--${flag(f.name)}`).join(", ")}`
8507
8567
  );
8508
8568
  }
8569
+ const problem = variantProblem(op, input, whole);
8570
+ if (problem) throw new Error(problem);
8509
8571
  const request = operationRequest(op, input, whole);
8510
8572
  const headers = {
8511
8573
  authorization: `Bearer ${token}`
@@ -8577,6 +8639,19 @@ function print(ctx, data, asJson) {
8577
8639
  }
8578
8640
  ctx.io.stdout(String(data));
8579
8641
  }
8642
+ function variantProblem(op, input, whole) {
8643
+ if (!op.variants) return void 0;
8644
+ const key = op.variants.field;
8645
+ const chosen = String(input[key] ?? whole[key]);
8646
+ const needs = op.variants.required[chosen];
8647
+ if (!needs) {
8648
+ return `--${flag(key)} must be one of ${Object.keys(op.variants.required).join(", ")}`;
8649
+ }
8650
+ const absent = needs.filter(
8651
+ (name) => input[name] === void 0 && whole[name] === void 0
8652
+ );
8653
+ return absent.length > 0 ? `missing ${absent.map((name) => `--${flag(name)}`).join(", ")} (needed with --${flag(key)} ${chosen})` : void 0;
8654
+ }
8580
8655
 
8581
8656
  // src/product/check.ts
8582
8657
  var checkCommand = (program2, ctx) => {
@@ -8774,7 +8849,7 @@ function tokenEnvVar() {
8774
8849
  function build(io) {
8775
8850
  let actedIn = null;
8776
8851
  let sending;
8777
- const program2 = new Command().name(brand.name).description(`The ${brand.productName} CLI`).version("1.0.0-rc.14").addHelpText(
8852
+ const program2 = new Command().name(brand.name).description(`The ${brand.productName} CLI`).version("1.0.0-rc.16").addHelpText(
8778
8853
  "after",
8779
8854
  `
8780
8855
  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.16",
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.16",
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"