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

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