loadam 0.2.4 → 0.3.0
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/README.md +52 -19
- package/dist/bin.d.ts +1 -1
- package/dist/bin.js +1666 -331
- package/dist/bin.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1666 -331
- package/dist/index.js.map +1 -1
- package/package.json +8 -5
package/README.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
# loadam
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/DesmondSanctity/loadam/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/loadam)
|
|
5
|
+
[](https://www.npmjs.com/package/loadam)
|
|
6
|
+
[](#install)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
|
|
9
|
+
> Point loadam at an OpenAPI spec. Get back a working **k6 load test**, a **Schemathesis contract suite**, a **drift check** against your live API, and an **MCP server** for agents. OSS, Apache 2.0.
|
|
4
10
|
|
|
5
11
|
<p align="center">
|
|
6
12
|
<img src="https://raw.githubusercontent.com/DesmondSanctity/loadam/main/.github/assets/demo.svg" alt="loadam in 30 seconds" width="720">
|
|
@@ -13,14 +19,14 @@ loadam test ./openapi.yaml --target https://api.example.com
|
|
|
13
19
|
loadam report --open # Single-file HTML report with charts.
|
|
14
20
|
```
|
|
15
21
|
|
|
16
|
-
That's it. One spec →
|
|
22
|
+
That's it. One spec → a load test, a contract suite, a drift check, and an MCP server, **plus** a session archive and an HTML report. **One engine, two surfaces:**
|
|
17
23
|
|
|
18
24
|
- **Test surface** — adversarial. Break the API: load, perf, contract drift.
|
|
19
25
|
- **Agent surface** — cooperative. Let LLM agents use the API safely via MCP (stdio + HTTP).
|
|
20
26
|
|
|
21
27
|
Both are compiled from the same **Intermediate Representation (IR)** built from your spec.
|
|
22
28
|
|
|
23
|
-
> **What's new in 0.
|
|
29
|
+
> **What's new in 0.3.0** — measured accuracy: smoke tests now reach 100% of operations with real IDs on the benchmark (up from 91.8%), and never send made-up IDs. The contract suite is rewritten for Schemathesis 4 with stateful tests that catch use-after-delete, and `loadam contract --run` puts the results in your HTML report. Correct anything loadam infers wrong with `loadam.config.json`. See the [CHANGELOG](CHANGELOG.md#030---2026-12-05) for the full list.
|
|
24
30
|
|
|
25
31
|
---
|
|
26
32
|
|
|
@@ -38,7 +44,7 @@ npm i -D loadam && npx loadam <command>
|
|
|
38
44
|
```
|
|
39
45
|
|
|
40
46
|
Once installed globally, all examples below work as `loadam <command>` (no `npx` prefix).
|
|
41
|
-
Requires Node.js 20
|
|
47
|
+
Requires Node.js 20.19+ (or 22.13+). The generated rigs have their own runtime requirements: **k6** for load tests, **Python 3.10+** for contract tests, **Node.js 20+** for the MCP server.
|
|
42
48
|
|
|
43
49
|
## 30-second quickstart
|
|
44
50
|
|
|
@@ -54,9 +60,9 @@ loadam history
|
|
|
54
60
|
loadam show latest
|
|
55
61
|
loadam report latest --open
|
|
56
62
|
|
|
57
|
-
# 4. Generate a
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
# 4. Generate and run a Schemathesis contract suite (sends writes: use staging).
|
|
64
|
+
pip install "schemathesis>=4,<5" pytest python-dotenv
|
|
65
|
+
loadam contract ./openapi.yaml --target https://staging.example.com --run
|
|
60
66
|
|
|
61
67
|
# 5. Generate an MCP server. Read-only by default.
|
|
62
68
|
loadam mcp ./openapi.yaml
|
|
@@ -87,13 +93,13 @@ Set `LOADAM_TARGET` once per shell to drop the `--target` flag from every invoca
|
|
|
87
93
|
| ----------------------------- | --------------------------------------------------------------------- | --------------------------------- |
|
|
88
94
|
| `loadam init <spec>` | Parse spec → IR with inferred resource graph | `loadam.ir.json` |
|
|
89
95
|
| `loadam test <spec>` | Compile + (optionally) run k6 smoke / load; archives the session | `loadam-out/k6/` + session |
|
|
90
|
-
| `loadam contract <spec>` | Compile to a Schemathesis pytest project
|
|
96
|
+
| `loadam contract <spec>` | Compile to a Schemathesis pytest project; `--run` runs it | `loadam-out/contract/` + session |
|
|
91
97
|
| `loadam mcp <spec>` | Compile to a runnable MCP server (stdio + HTTP) | `loadam-out/mcp/` |
|
|
92
98
|
| `loadam diff <spec>` | Probe a live API and report spec-vs-reality drift | Markdown + session |
|
|
93
99
|
| `loadam history` | List archived sessions (newest first) | table or `--json` |
|
|
94
|
-
| `loadam show <id\|latest>` | Show a session's metadata + inline k6/drift summary
|
|
100
|
+
| `loadam show <id\|latest>` | Show a session's metadata + inline k6/drift/contract summary | text or `--json` |
|
|
95
101
|
| `loadam report <id\|latest>` | Render a single-file HTML report (charts, threshold table) | `report.html` (`--open` to view) |
|
|
96
|
-
| `loadam clean` | Prune session archive (`--older-than 7d
|
|
102
|
+
| `loadam clean` | Prune session archive (`--older-than 7d`; dry run unless `--yes`) | text or `--json` |
|
|
97
103
|
| `loadam auth import` | Infer an auth profile from a `curl` command | JSON / pretty |
|
|
98
104
|
| `loadam update` | Check npm for a newer version of `loadam` | text or `--json` |
|
|
99
105
|
| `loadam completion` | Print bash/zsh/fish completion script | stdout |
|
|
@@ -129,18 +135,42 @@ Every `loadam test`, `loadam contract`, and `loadam diff` invocation is archived
|
|
|
129
135
|
loadam history # newest 20 sessions
|
|
130
136
|
loadam show latest # inline k6 p95 / threshold pass-fail
|
|
131
137
|
loadam report latest --open # one-file HTML report (charts, dark mode)
|
|
132
|
-
loadam clean --older-than 7d --
|
|
138
|
+
loadam clean --older-than 7d --yes # prune old runs (dry run without --yes)
|
|
133
139
|
```
|
|
134
140
|
|
|
135
141
|
The HTML report is a single self-contained file (no external CDNs, no JS dependencies) and is safe to drop into a CI artefact store, gh-pages, or Slack. It includes a per-endpoint sidebar with live p95 and status-code distribution, filter chips (All / Failed / Flaky / Passed), and a three-tier overall status (passed · flaky · failed) so you can tell at a glance whether a run is genuinely broken or just noisy.
|
|
136
142
|
|
|
143
|
+
## How accurate is it?
|
|
144
|
+
|
|
145
|
+
Measured, not assumed. The [`bench/`](bench/) suite runs loadam against reference APIs whose ground truth is known, and exits non-zero if any number gets worse than the saved baseline:
|
|
146
|
+
|
|
147
|
+
| Metric | Result |
|
|
148
|
+
| --- | --- |
|
|
149
|
+
| Smoke test: operations that get a 2xx | 100% |
|
|
150
|
+
| Requests using a made-up path ID / body reference | 0% / 0% |
|
|
151
|
+
| Drift check: planted mismatches found, false findings | 100%, 0 |
|
|
152
|
+
| Contract tests: planted bugs found, false alarms on correct APIs | 6/6, 0 |
|
|
153
|
+
| Real APIs (PokeAPI, FakeRESTApi, Petstore v3): failures caused by loadam | 0 (PokeAPI 102/102) |
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
pnpm build && pnpm bench # also: pnpm bench:contract, pnpm bench:real
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
When loadam can't tell from the spec which resource a field points at (say `Transfer.from` → `Account`), tell it once in `loadam.config.json`; every command picks it up:
|
|
160
|
+
|
|
161
|
+
```json
|
|
162
|
+
{ "refs": { "Transfer.from": "Account" }, "resources": { "Product": { "idField": "sku" } } }
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
See [bench/README.md](bench/README.md) for how each metric is scored.
|
|
166
|
+
|
|
137
167
|
## Why loadam
|
|
138
168
|
|
|
139
169
|
Most teams have an OpenAPI spec sitting in a repo and **none** of the rigs that should fall out of it. They wire each one by hand, badly, and then drift. Loadam treats the spec as the source of truth and emits everything once: load, contract, drift, agent. One shape of input, four shapes of output, zero hand-rolled boilerplate.
|
|
140
170
|
|
|
141
171
|
## Privacy & telemetry
|
|
142
172
|
|
|
143
|
-
**Zero telemetry.** No analytics, no crash reporting, no phone-home. The CLI only
|
|
173
|
+
**Zero telemetry.** No analytics, no crash reporting, no phone-home. The CLI only talks to the API you point it at (`loadam diff`, and the k6 or contract runs it starts for you), plus the npm registry when you run `loadam update`. Generated rigs talk only to whatever target you configure. See [SECURITY.md](SECURITY.md) for the full guarantee.
|
|
144
174
|
|
|
145
175
|
## Shell completion
|
|
146
176
|
|
|
@@ -168,9 +198,9 @@ packages/
|
|
|
168
198
|
|
|
169
199
|
## Status
|
|
170
200
|
|
|
171
|
-
|
|
201
|
+
loadam handles CRUD-style specs end-to-end, including nested resources, wrapped responses, and specs with 100+ operations (PokeAPI's 102 pass the smoke test). Heavy polymorphism (`oneOf`, discriminators) may still need hand edits to the generated files.
|
|
172
202
|
|
|
173
|
-
| |
|
|
203
|
+
| | Now (0.3) | Planned |
|
|
174
204
|
| ------------------------- | --------------------- | ---------------------------- |
|
|
175
205
|
| OpenAPI 3.x | ✅ | |
|
|
176
206
|
| Postman / HAR / curl | curl only | Postman + HAR |
|
|
@@ -178,14 +208,15 @@ V1 (this) targets **petstore-class specs** end-to-end. Stripe-class specs (polym
|
|
|
178
208
|
| Schemathesis contract | ✅ | |
|
|
179
209
|
| Drift report | ✅ | |
|
|
180
210
|
| MCP server (stdio + HTTP) | ✅ read-only default | per-op `--writes` opt-in |
|
|
181
|
-
| Auth | bearer, apiKey, basic | OAuth2 PKCE, AWS sigv4, mTLS |
|
|
182
|
-
| Spec scale |
|
|
211
|
+
| Auth | bearer, apiKey, basic, OAuth2 client credentials¹ | OAuth2 PKCE, AWS sigv4, mTLS |
|
|
212
|
+
| Spec scale | 100+ ops | ~600 ops + polymorphism |
|
|
213
|
+
|
|
214
|
+
¹ k6 test, contract suite, and `diff`. The generated MCP server leaves OAuth2 for you to wire up.
|
|
183
215
|
|
|
184
216
|
## Examples
|
|
185
217
|
|
|
186
218
|
- [examples/basic-openapi](examples/basic-openapi/) — petstore, no auth required to generate
|
|
187
219
|
- [examples/with-auth](examples/with-auth/) — bookstore with bearer auth + multi-server
|
|
188
|
-
- [examples/demo](examples/demo/) — a real `report.html` generated against live petstore
|
|
189
220
|
|
|
190
221
|
## Development
|
|
191
222
|
|
|
@@ -193,12 +224,14 @@ V1 (this) targets **petstore-class specs** end-to-end. Stripe-class specs (polym
|
|
|
193
224
|
pnpm install
|
|
194
225
|
pnpm -r build
|
|
195
226
|
pnpm -r test
|
|
227
|
+
pnpm lint && pnpm typecheck
|
|
228
|
+
pnpm bench # accuracy benchmark (needs k6)
|
|
196
229
|
```
|
|
197
230
|
|
|
198
231
|
Conventions:
|
|
199
232
|
|
|
200
|
-
- TypeScript strict + ESM; Node 20
|
|
201
|
-
- Biome for formatting (
|
|
233
|
+
- TypeScript strict + ESM; Node 20.19+ (the website needs Node 22.23.4+); pnpm 9.15+.
|
|
234
|
+
- Biome for formatting and linting (2-space indent, double quotes). Run `pnpm fix`.
|
|
202
235
|
- Vitest for tests. Every package ships with goldens against the petstore fixture.
|
|
203
236
|
|
|
204
237
|
## Documentation
|
package/dist/bin.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
export {
|
|
2
|
+
export { };
|