@limitry/cli 1.0.0-rc.1 → 1.0.0-rc.10

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 ADDED
@@ -0,0 +1,188 @@
1
+ # Changelog
2
+
3
+ What changed in the Limitry CLI (`@limitry/cli`). Generated from the source on each release; newest first.
4
+
5
+ ## 1.0.0-rc.10 (2026-10-27)
6
+
7
+ ### Added
8
+
9
+ - You can now change a webhook endpoint's URL, description or event types
10
+ without deleting it: `client.workspace.webhookEndpoints.update()`
11
+ (`PATCH /v1/workspace/webhook-endpoints/{endpointId}`). The endpoint
12
+ keeps its signing secret, so your verification code keeps working.
13
+
14
+ ### Changed
15
+
16
+ - `login` and `logout` now point to **Account → Personal access tokens**,
17
+ the page's new name in the app (it was "API tokens").
18
+
19
+ ### Fixed
20
+
21
+ - Usage history (`GET /v1/usage`) counts a reservation you commit for its
22
+ full amount as an allowed check. It used to count only commits for less
23
+ than the amount reserved, so the `allowed` totals were too low.
24
+
25
+ ## 1.0.0-rc.9 (2026-10-22)
26
+
27
+ ### Added
28
+
29
+ - `POST /v1/checks` can now answer `503` with the code `busy` when
30
+ Limitry is deciding too many checks for those subjects at once. Nothing
31
+ was charged. `guard` and `reserve` (TypeScript and Python) send the
32
+ check again with the same key, within the same 30 seconds they give
33
+ `moving`, before the limit's fail mode decides. Each retry of `busy` or
34
+ `moving` now waits the answer's `Retry-After` plus a random backoff that
35
+ grows with each try, so clients don't all come back at the same moment.
36
+ Older SDK versions treat `busy` as Limitry being unreachable after their
37
+ usual two quick retries, so the fail mode decides; upgrade to retry it.
38
+
39
+ ### Changed
40
+
41
+ - A very busy workspace's counts are now spread over more of Limitry's
42
+ servers as its traffic grows. While some of them move, which takes a few
43
+ seconds, checks, commits and releases on those subjects answer `503`
44
+ with the new error code `moving` and `Retry-After: 1`; nothing is
45
+ counted. `guard` and `reserve` (TypeScript and Python) and the CLI send
46
+ the same request again with the same Idempotency-Key for up to 30
47
+ seconds, each try with its own time budget, before a limit's fail mode
48
+ applies, so work is neither run uncounted nor left uncommitted.
49
+
50
+ ### Fixed
51
+
52
+ - A reservation (`mode: "reserve"`) now starts a subject's period, as a
53
+ plain check does: on a `billing_date` limit with no billing date set
54
+ yet, the first reservation's time becomes the subject's billing date,
55
+ and on a `first_use` limit it starts the period. Before, reservations
56
+ made before the subject's first commit could each count in a period of
57
+ their own, so a monthly limit could let more through than its amount.
58
+ A reservation you release still starts the period, with nothing used in
59
+ it.
60
+ - A `503 moving` answer with `Retry-After: 0` is now retried after at least
61
+ a second, not at once, and still for at most 30 seconds. A client made
62
+ with `maxRetries: 0` no longer sends the SDK's internal
63
+ `x-limitry-moving` header to the API.
64
+
65
+ ## 1.0.0-rc.8 (2026-10-21)
66
+
67
+ ### Added
68
+
69
+ - Limits have `counting`: `fast` answers the instant it decides, and
70
+ `guaranteed` stores every count safely before answering, so the limit
71
+ never goes over, even if a server fails. A `total` balance defaults to
72
+ `guaranteed`, every other window to `fast`. Set it when creating or
73
+ updating a limit (`counting`, `--counting`), or in `limitry.json`.
74
+
75
+ ### Changed
76
+
77
+ - - Creating a limit needs only who it is for, the amount and the window:
78
+ `limits.create({ subject: { kind: "user" }, amount: 100, window: "month" })`
79
+ (`limitry limits create --subject '{"kind":"user"}' --amount 100 --window month`).
80
+ `action` defaults to every action (`*`), `unit` to `units`, and `name`
81
+ to the sentence the limit reads as, such as "100 units per user per
82
+ month". If a limit already has that name, the API answers `409`: give
83
+ this one a `name`. `limitry.json` entries still need a `name`.
84
+ - A limit's input names who it is for as `subject: { kind, id }` (was
85
+ `subjectKind` and `subjectId`), the same shape the limit itself has.
86
+ - What a limit counts is fixed once it is created: its subject, action,
87
+ unit, window, `every`, `start` and `rolling`. Changing one answers
88
+ `400 invalid_request`: create a new limit and archive the old one (its
89
+ history stays). Name, amount, fail mode and enabled still change any
90
+ time. `limitry sync` refuses such a change until you rename the entry.
91
+ - A limit says when a check last reached it (`lastCheckedAt`), so you can
92
+ see a limit no check names.
93
+ - One name for each idea, everywhere: the API, both SDKs, the CLI, the MCP
94
+ tools, `limitry.json` and webhooks. Update your code when you upgrade:
95
+
96
+ - `hold()` is `reserve()`: it takes `cost` (was `estimate`), and the block
97
+ gets a `Reservation` (was `Held`; Python `Reservation` and
98
+ `AsyncReservation`), with the same `cost()` and `extend()`.
99
+ - A refusal throws `LimitReached` (was `LimitExceeded`), with `limitId`
100
+ (Python `limit_id`) and `reason` `limit_reached` or
101
+ `too_many_reservations`. When Limitry can't be reached and a limit fails
102
+ closed, you now get a separate `Unavailable` error. "Can't be reached"
103
+ also covers a `402 plan_limit_reached` and a `429` from Limitry's flood
104
+ guard, so each limit's fail mode decides instead of your code getting an
105
+ error.
106
+ - A check's answer lists its limits in `limits` (was `remaining`): read
107
+ `decision.limits[0].remaining`. Every answer that names a limit says
108
+ `limitId`: `reason.limitId`, `limits[].limitId`, `usage.standing`'s
109
+ `limits[].limitId`, and webhook payloads.
110
+ - The refusal code is `limit_reached` (was `limit_exceeded`), and the
111
+ webhook event is `limit.reached` (was `limit.exceeded`): subscribe your
112
+ endpoints to the new name.
113
+ - Usage says `refused` (was `denied`); `usage.subjects` no longer has
114
+ `over` (it is `refused > 0`).
115
+ - Credits: `limits.credits.create()` and `limits.credits.list()` at
116
+ `/v1/limits/{limitId}/credits` (were `limits.grants.*` at `…/grants`),
117
+ ids start `crd_` (were `grt_`), and the approval an agent asks for is
118
+ `limit.credit` (was `limit.grant`).
119
+ - A period that starts on the subject's billing date is
120
+ `start: "billing_date"` (was `"anchor"`), and `subjects.update()` takes
121
+ `billingDate` (was `anchor`); the subject says `billingDate` too.
122
+ - `usage.standing()` and `usage.query()` take one `subject`, written
123
+ `kind:id` (`user:usr_123`), instead of separate kind and id fields
124
+ (`limitry usage standing --subject user:usr_123`).
125
+ - A limit's id starts `lmt_` (was `lim_`); keys still start `lim_test_`
126
+ and `lim_live_`.
127
+ - `limitry sync --preview` (was `--dry-run`), and the API's `preview`
128
+ (was `dryRun`), in what you send and what comes back.
129
+
130
+ ### Removed
131
+
132
+ - Limits no longer have `counting` (Fast or Guaranteed), and the CLI no
133
+ longer has `--counting`: every count is now saved before Limitry answers,
134
+ for every limit. Remove `counting` from your code and from
135
+ `limitry.json`; Limitry ignores it.
136
+
137
+ ## 1.0.0-rc.7 (2026-10-19)
138
+
139
+ ### Added
140
+
141
+ - A refused check's `reason` has a `message`: the refusal in one sentence,
142
+ such as "Refused by AI budget: 3 cents left, resets
143
+ 2026-11-01T00:00:00.000Z. Try again in 3600 s." `LimitExceeded` and
144
+ `limitry check` show it as the API writes it, so every client says the
145
+ same. Branch on `allowed` and `reason.code`, never on the message.
146
+
147
+ ### Fixed
148
+
149
+ - - `held.cost()` refuses a cost the API can't commit (not a whole number
150
+ from 0 to 1,000,000,000): TypeScript throws `RangeError`, Python raises
151
+ `ValueError`, in your code. Before, the commit failed silently after
152
+ the work and its usage was never counted.
153
+ - TypeScript's `held.extend()` throws the API's error, such as for an
154
+ expired hold, as Python's already did. Both send the `ttlSeconds` you
155
+ give as it is, so `0` is refused rather than read as the default.
156
+ - Python checks, commits and releases now retry exactly as TypeScript's
157
+ do: a network error, `408`, `429` or `5xx`, at most twice, all within
158
+ the check's `timeout` (1.5 s) or 5 s for a settle. `standing()` retries
159
+ too, and reports an error answer that isn't JSON.
160
+ - `limitry check` and `limitry sync` refuse `--workspace` with an API key,
161
+ as every other command does, instead of ignoring it.
162
+
163
+ ## 1.0.0-rc.6 (2026-10-19)
164
+
165
+ ### Fixed
166
+
167
+ - `login` in the browser no longer shows Safari's "This is a non-secure
168
+ form" warning after **Allow**. The page now hands the new token back to
169
+ the waiting CLI encrypted to a key only that CLI holds, by a redirect
170
+ instead of a form. A CLI from before this change is asked to update.
171
+
172
+ ## 1.0.0-rc.5 (2026-10-16)
173
+
174
+ No user-facing changes.
175
+
176
+ ## 1.0.0-rc.4 (2026-10-16)
177
+
178
+ ### Added
179
+
180
+ - Each release comes with a `CHANGELOG.md` listing what changed, newest first.
181
+
182
+ ### Changed
183
+
184
+ - The package page (README, on GitHub, npm and PyPI) shows what the product does with a first real example, and links the guide, the API reference, the changelog and support.
185
+
186
+ ## 1.0.0-rc.3 (2026-10-16)
187
+
188
+ No user-facing changes.
package/README.md CHANGED
@@ -1,20 +1,68 @@
1
1
  # @limitry/cli
2
2
 
3
- The Limitry command line.
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
+
5
+ Limitry is the limits, credits and budgets layer for your software: give each of your users, teams, tenants, API keys or agents an allowance, and before any costly action one call tells your code whether it may happen.
6
+
7
+ ## Install
4
8
 
5
9
  ```bash
6
- npx @limitry/cli login
7
- # or
8
- npm install -g @limitry/cli && limitry login
10
+ npm install -g @limitry/cli
9
11
  ```
10
12
 
11
- - Guide: https://limitry.com/docs/cli/
13
+ Or run it without installing: `npx @limitry/cli --help`.
12
14
 
13
- ## Building from this repository
15
+ ## Sign in
14
16
 
15
17
  ```bash
16
- npm ci && npm test && npm run build
18
+ limitry login
19
+ ```
20
+
21
+ Your browser opens: sign in, choose the workspaces the CLI may use, and
22
+ click **Allow**. On a server or in CI, set `LIMITRY_TOKEN` to a personal
23
+ access token or a workspace API key instead.
24
+
25
+ ## Set up a limit and try it
26
+
27
+ Commands act in **test** unless you say otherwise, so trying things
28
+ never touches the limits your customers depend on.
29
+
30
+ ```bash
31
+ # 100 AI replies a day for each user ("100 replies per user per day for ai-call")
32
+ limitry limits create --subject '{"kind":"user"}' --action ai-call \
33
+ --amount 100 --unit replies --window day
34
+
35
+ # Check a user, as your code would
36
+ limitry check user:usr_123 ai-call
37
+
38
+ # Where a user stands, without counting anything
39
+ limitry usage standing --subject user:usr_123
17
40
  ```
18
41
 
19
- This repository is generated from Limitry's own repository on
20
- each release; see CONTRIBUTING.md. Licensed under the Apache License 2.0.
42
+ When a limit is right, copy it to live from the **Limits** page in the
43
+ app, or create it with `--environment live`.
44
+
45
+ ## Everything else
46
+
47
+ Every API operation is a command: `limitry --help` lists them, and any
48
+ command takes `--json` for the API's exact answer, for scripts and
49
+ agents.
50
+
51
+ ## Links
52
+
53
+ - [Website](https://limitry.com)
54
+ - [CLI guide](https://limitry.com/docs/cli/)
55
+ - [API reference](https://limitry.com/docs/reference/)
56
+ - [Changelog](https://github.com/limitry/limitry-cli/blob/main/CHANGELOG.md)
57
+ - [Discord](https://limitry.com/discord)
58
+ - [Report a security issue](https://limitry.com/security/)
59
+
60
+ ## Contributing
61
+
62
+ This repository is generated from Limitry's source on each
63
+ release, so pull requests are ported there and credited (see
64
+ [CONTRIBUTING.md](https://github.com/limitry/limitry-cli/blob/main/CONTRIBUTING.md)).
65
+
66
+ ## License
67
+
68
+ Licensed under the Apache License 2.0.