loadam 0.2.3 → 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 +60 -19
- package/dist/bin.d.ts +1 -1
- package/dist/bin.js +2449 -367
- package/dist/bin.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2449 -367
- 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,13 +19,15 @@ 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
|
|
|
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.
|
|
30
|
+
|
|
23
31
|
---
|
|
24
32
|
|
|
25
33
|
## Install
|
|
@@ -36,7 +44,7 @@ npm i -D loadam && npx loadam <command>
|
|
|
36
44
|
```
|
|
37
45
|
|
|
38
46
|
Once installed globally, all examples below work as `loadam <command>` (no `npx` prefix).
|
|
39
|
-
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.
|
|
40
48
|
|
|
41
49
|
## 30-second quickstart
|
|
42
50
|
|
|
@@ -52,9 +60,9 @@ loadam history
|
|
|
52
60
|
loadam show latest
|
|
53
61
|
loadam report latest --open
|
|
54
62
|
|
|
55
|
-
# 4. Generate a
|
|
56
|
-
|
|
57
|
-
|
|
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
|
|
58
66
|
|
|
59
67
|
# 5. Generate an MCP server. Read-only by default.
|
|
60
68
|
loadam mcp ./openapi.yaml
|
|
@@ -73,19 +81,25 @@ loadam test ./openapi.yaml --target $LOADAM_TARGET --no-interactive --json | jq
|
|
|
73
81
|
|
|
74
82
|
Set `LOADAM_TARGET` once per shell to drop the `--target` flag from every invocation.
|
|
75
83
|
|
|
84
|
+
<p align="center">
|
|
85
|
+
<img src="https://raw.githubusercontent.com/DesmondSanctity/loadam/main/.github/assets/report-screenshot.png" alt="loadam HTML report" width="720">
|
|
86
|
+
<br>
|
|
87
|
+
<sub><i>The single-file HTML report — branded header, per-endpoint sidebar, filter chips, threshold panel.</i></sub>
|
|
88
|
+
</p>
|
|
89
|
+
|
|
76
90
|
## Commands
|
|
77
91
|
|
|
78
92
|
| Command | What it does | Output |
|
|
79
93
|
| ----------------------------- | --------------------------------------------------------------------- | --------------------------------- |
|
|
80
94
|
| `loadam init <spec>` | Parse spec → IR with inferred resource graph | `loadam.ir.json` |
|
|
81
95
|
| `loadam test <spec>` | Compile + (optionally) run k6 smoke / load; archives the session | `loadam-out/k6/` + session |
|
|
82
|
-
| `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 |
|
|
83
97
|
| `loadam mcp <spec>` | Compile to a runnable MCP server (stdio + HTTP) | `loadam-out/mcp/` |
|
|
84
98
|
| `loadam diff <spec>` | Probe a live API and report spec-vs-reality drift | Markdown + session |
|
|
85
99
|
| `loadam history` | List archived sessions (newest first) | table or `--json` |
|
|
86
|
-
| `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` |
|
|
87
101
|
| `loadam report <id\|latest>` | Render a single-file HTML report (charts, threshold table) | `report.html` (`--open` to view) |
|
|
88
|
-
| `loadam clean` | Prune session archive (`--older-than 7d
|
|
102
|
+
| `loadam clean` | Prune session archive (`--older-than 7d`; dry run unless `--yes`) | text or `--json` |
|
|
89
103
|
| `loadam auth import` | Infer an auth profile from a `curl` command | JSON / pretty |
|
|
90
104
|
| `loadam update` | Check npm for a newer version of `loadam` | text or `--json` |
|
|
91
105
|
| `loadam completion` | Print bash/zsh/fish completion script | stdout |
|
|
@@ -121,10 +135,34 @@ Every `loadam test`, `loadam contract`, and `loadam diff` invocation is archived
|
|
|
121
135
|
loadam history # newest 20 sessions
|
|
122
136
|
loadam show latest # inline k6 p95 / threshold pass-fail
|
|
123
137
|
loadam report latest --open # one-file HTML report (charts, dark mode)
|
|
124
|
-
loadam clean --older-than 7d --
|
|
138
|
+
loadam clean --older-than 7d --yes # prune old runs (dry run without --yes)
|
|
139
|
+
```
|
|
140
|
+
|
|
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.
|
|
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
|
|
125
157
|
```
|
|
126
158
|
|
|
127
|
-
|
|
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.
|
|
128
166
|
|
|
129
167
|
## Why loadam
|
|
130
168
|
|
|
@@ -132,7 +170,7 @@ Most teams have an OpenAPI spec sitting in a repo and **none** of the rigs that
|
|
|
132
170
|
|
|
133
171
|
## Privacy & telemetry
|
|
134
172
|
|
|
135
|
-
**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.
|
|
136
174
|
|
|
137
175
|
## Shell completion
|
|
138
176
|
|
|
@@ -160,9 +198,9 @@ packages/
|
|
|
160
198
|
|
|
161
199
|
## Status
|
|
162
200
|
|
|
163
|
-
|
|
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.
|
|
164
202
|
|
|
165
|
-
| |
|
|
203
|
+
| | Now (0.3) | Planned |
|
|
166
204
|
| ------------------------- | --------------------- | ---------------------------- |
|
|
167
205
|
| OpenAPI 3.x | ✅ | |
|
|
168
206
|
| Postman / HAR / curl | curl only | Postman + HAR |
|
|
@@ -170,14 +208,15 @@ V1 (this) targets **petstore-class specs** end-to-end. Stripe-class specs (polym
|
|
|
170
208
|
| Schemathesis contract | ✅ | |
|
|
171
209
|
| Drift report | ✅ | |
|
|
172
210
|
| MCP server (stdio + HTTP) | ✅ read-only default | per-op `--writes` opt-in |
|
|
173
|
-
| Auth | bearer, apiKey, basic | OAuth2 PKCE, AWS sigv4, mTLS |
|
|
174
|
-
| 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.
|
|
175
215
|
|
|
176
216
|
## Examples
|
|
177
217
|
|
|
178
218
|
- [examples/basic-openapi](examples/basic-openapi/) — petstore, no auth required to generate
|
|
179
219
|
- [examples/with-auth](examples/with-auth/) — bookstore with bearer auth + multi-server
|
|
180
|
-
- [examples/demo](examples/demo/) — a real `report.html` generated against live petstore
|
|
181
220
|
|
|
182
221
|
## Development
|
|
183
222
|
|
|
@@ -185,12 +224,14 @@ V1 (this) targets **petstore-class specs** end-to-end. Stripe-class specs (polym
|
|
|
185
224
|
pnpm install
|
|
186
225
|
pnpm -r build
|
|
187
226
|
pnpm -r test
|
|
227
|
+
pnpm lint && pnpm typecheck
|
|
228
|
+
pnpm bench # accuracy benchmark (needs k6)
|
|
188
229
|
```
|
|
189
230
|
|
|
190
231
|
Conventions:
|
|
191
232
|
|
|
192
|
-
- TypeScript strict + ESM; Node 20
|
|
193
|
-
- 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`.
|
|
194
235
|
- Vitest for tests. Every package ships with goldens against the petstore fixture.
|
|
195
236
|
|
|
196
237
|
## Documentation
|
package/dist/bin.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
export {
|
|
2
|
+
export { };
|