@limitry/cli 0.0.0-stage → 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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,2 @@
1
+ Limitry CLI
2
+ Copyright 2026 Omsome L.L.C-FZ
package/README.md CHANGED
@@ -1,3 +1,68 @@
1
- # Temporary Holding Version
1
+ # @limitry/cli
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
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
8
+
9
+ ```bash
10
+ npm install -g @limitry/cli
11
+ ```
12
+
13
+ Or run it without installing: `npx @limitry/cli --help`.
14
+
15
+ ## Sign in
16
+
17
+ ```bash
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
40
+ ```
41
+
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.