loadam 0.2.2 → 0.2.4

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 CHANGED
@@ -8,17 +8,20 @@
8
8
 
9
9
  ```bash
10
10
  npm i -g loadam # or: npx loadam ...
11
- loadam mcp ./openapi.yaml
12
- # 8 files written → cd loadam-out/mcp && npm install && node bin.js
11
+ loadam test ./openapi.yaml --target https://api.example.com
12
+ # Interactive: prompts for missing creds, runs k6 smoke, archives the session.
13
+ loadam report --open # Single-file HTML report with charts.
13
14
  ```
14
15
 
15
- That's it. One spec → three production-grade rigs. **One engine, two surfaces:**
16
+ That's it. One spec → three production-grade rigs **plus** a session archive and an HTML report. **One engine, two surfaces:**
16
17
 
17
18
  - **Test surface** — adversarial. Break the API: load, perf, contract drift.
18
19
  - **Agent surface** — cooperative. Let LLM agents use the API safely via MCP (stdio + HTTP).
19
20
 
20
21
  Both are compiled from the same **Intermediate Representation (IR)** built from your spec.
21
22
 
23
+ > **What's new in 0.2.4** — branded HTML report with a per-endpoint sidebar (live p95 + status-code distribution), filter chips (All / Failed / Flaky / Passed), three-tier overall status (`passed` ≥ 99% · `flaky` ≥ 95% · `failed` < 95%), and per-op latency/status sub-metrics emitted by generated k6 scripts. See the [CHANGELOG](CHANGELOG.md#024---2026-05-02) for the full list.
24
+
22
25
  ---
23
26
 
24
27
  ## Install
@@ -43,41 +46,59 @@ Requires Node.js 20+. The generated rigs have their own runtime requirements: **
43
46
  # 1. Inspect what loadam sees in your spec.
44
47
  loadam init ./openapi.yaml
45
48
 
46
- # 2. Generate a runnable k6 smoke + load test.
49
+ # 2. Generate + run a k6 smoke test in one shot (interactive: prompts for creds).
47
50
  loadam test ./openapi.yaml --target https://api.example.com
48
- cd loadam-out/k6 && cp .env.example .env && k6 run smoke.js
49
51
 
50
- # 3. Generate a property-based Schemathesis contract suite.
52
+ # 3. Browse archived runs and open the HTML report.
53
+ loadam history
54
+ loadam show latest
55
+ loadam report latest --open
56
+
57
+ # 4. Generate a property-based Schemathesis contract suite.
51
58
  loadam contract ./openapi.yaml --target https://api.example.com
52
59
  cd loadam-out/contract && pip install -e . && pytest
53
60
 
54
- # 4. Generate an MCP server. Read-only by default.
61
+ # 5. Generate an MCP server. Read-only by default.
55
62
  loadam mcp ./openapi.yaml
56
63
  cd loadam-out/mcp && npm install && node bin.js # stdio (Claude Desktop)
57
64
  node bin.js --http # streamable HTTP
58
65
 
59
- # 5. Detect drift between spec and live API.
66
+ # 6. Detect drift between spec and live API.
60
67
  loadam diff ./openapi.yaml --target https://api.example.com -o drift.md
61
68
  ```
62
69
 
63
- Every command supports `--json` for CI:
70
+ Every command supports `--json` for CI, and `--no-interactive` to skip prompts:
64
71
 
65
72
  ```bash
66
- loadam mcp ./openapi.yaml --json | jq .toolNames
73
+ loadam test ./openapi.yaml --target $LOADAM_TARGET --no-interactive --json | jq .sessionId
67
74
  ```
68
75
 
76
+ Set `LOADAM_TARGET` once per shell to drop the `--target` flag from every invocation.
77
+
78
+ <p align="center">
79
+ <img src="https://raw.githubusercontent.com/DesmondSanctity/loadam/main/.github/assets/report-screenshot.png" alt="loadam HTML report" width="720">
80
+ <br>
81
+ <sub><i>The single-file HTML report — branded header, per-endpoint sidebar, filter chips, threshold panel.</i></sub>
82
+ </p>
83
+
69
84
  ## Commands
70
85
 
71
- | Command | What it does | Output |
72
- | ------------------------ | ----------------------------------------------------------- | ---------------------- |
73
- | `loadam init <spec>` | Parse spec → IR with inferred resource graph | `loadam.ir.json` |
74
- | `loadam test <spec>` | Compile to k6 smoke + load scripts (stateful, ID-threading) | `loadam-out/k6/` |
75
- | `loadam contract <spec>` | Compile to a Schemathesis pytest project | `loadam-out/contract/` |
76
- | `loadam mcp <spec>` | Compile to a runnable MCP server (stdio + HTTP) | `loadam-out/mcp/` |
77
- | `loadam diff <spec>` | Probe a live API and report spec-vs-reality drift | Markdown |
78
- | `loadam auth import` | Infer an auth profile from a `curl` command | JSON / pretty |
79
- | `loadam update` | Check npm for a newer version of `loadam` | text or `--json` |
80
- | `loadam completion` | Print bash/zsh/fish completion script | stdout |
86
+ | Command | What it does | Output |
87
+ | ----------------------------- | --------------------------------------------------------------------- | --------------------------------- |
88
+ | `loadam init <spec>` | Parse spec → IR with inferred resource graph | `loadam.ir.json` |
89
+ | `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 | `loadam-out/contract/` + session |
91
+ | `loadam mcp <spec>` | Compile to a runnable MCP server (stdio + HTTP) | `loadam-out/mcp/` |
92
+ | `loadam diff <spec>` | Probe a live API and report spec-vs-reality drift | Markdown + session |
93
+ | `loadam history` | List archived sessions (newest first) | table or `--json` |
94
+ | `loadam show <id\|latest>` | Show a session's metadata + inline k6/drift summary | text or `--json` |
95
+ | `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`, `--dry-run` by default) | text or `--json` |
97
+ | `loadam auth import` | Infer an auth profile from a `curl` command | JSON / pretty |
98
+ | `loadam update` | Check npm for a newer version of `loadam` | text or `--json` |
99
+ | `loadam completion` | Print bash/zsh/fish completion script | stdout |
100
+
101
+ Use `--no-interactive` on `test` to skip prompts (CI-safe), and set `LOADAM_TARGET` to avoid repeating `--target`.
81
102
 
82
103
  ## What you get from `loadam mcp`
83
104
 
@@ -100,6 +121,19 @@ loadam mcp ./openapi.yaml --json | jq .toolNames
100
121
  }
101
122
  ```
102
123
 
124
+ ## Session archive & HTML reports
125
+
126
+ Every `loadam test`, `loadam contract`, and `loadam diff` invocation is archived to `./loadam-out/sessions/<id>/` with the parsed IR, the exact spec source, command flags, exit code, and any artefacts the run produced (k6 summary JSON, drift markdown, contract findings). The archive is local-only — it never leaves disk.
127
+
128
+ ```bash
129
+ loadam history # newest 20 sessions
130
+ loadam show latest # inline k6 p95 / threshold pass-fail
131
+ loadam report latest --open # one-file HTML report (charts, dark mode)
132
+ loadam clean --older-than 7d --apply # prune old runs
133
+ ```
134
+
135
+ 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
+
103
137
  ## Why loadam
104
138
 
105
139
  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.
@@ -128,6 +162,7 @@ packages/
128
162
  test-contract/ Schemathesis compiler — emits pytest project
129
163
  test-drift/ Live probe + Markdown diff report
130
164
  mcp/ MCP compiler — emits stdio + HTTP server
165
+ report/ Pure-function HTML report renderer (no DOM dependency)
131
166
  cli/ commander-based CLI tying it all together
132
167
  ```
133
168
 
@@ -150,6 +185,7 @@ V1 (this) targets **petstore-class specs** end-to-end. Stripe-class specs (polym
150
185
 
151
186
  - [examples/basic-openapi](examples/basic-openapi/) — petstore, no auth required to generate
152
187
  - [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
153
189
 
154
190
  ## Development
155
191